home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / mac / programm / 18323 < prev    next >
Encoding:
Text File  |  1992-11-12  |  1.8 KB  |  56 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!mcsun!news.funet.fi!funic!convex!asunta
  3. From: asunta@convex.csc.FI (Miika Asunta)
  4. Subject: Re: looking for telecomm app source
  5. Message-ID: <1992Nov12.160833.796@nic.funet.fi>
  6. Keywords: modem, communications, serial, driver, src
  7. Sender: usenet@nic.funet.fi
  8. Nntp-Posting-Host: convex.csc.fi
  9. Organization: Finnish Academic and Research Network Project - FUNET
  10. References: <1992Nov11.191302.29668@ircam.fr>
  11. Date: Thu, 12 Nov 92 16:08:33 GMT
  12. Lines: 42
  13.  
  14. In <1992Nov11.191302.29668@ircam.fr> tanaka@ircam.fr writes:
  15.  
  16. As a programming excercise, I am writing a small utility to 
  17. send data out the  Mac serial port to a modem. I am wondering 
  18. if there are any good public domain examples and source code
  19. examples that would help me get started.
  20.  
  21. Does this mean I have to write a serial driver? I need to 
  22. set up communicationswith a Hayes compatible modem, send dialing 
  23. commands, etc. Any pointers would  
  24. be greatly appreciated.
  25.  
  26. Read Inside Macitosh vol II, chapter Serial Drivers, and you find out
  27. it's a really easy job to do.
  28.  
  29. You open modem or pringer port, and configurate it and then send
  30. and read the data, and finally close it.
  31.  
  32. ie.
  33.  
  34. main()
  35. {
  36. InitMac(); // Macintosh Init routines - you write it yourself...
  37.  
  38. RAMSDOpen(sPortA); // modem port, sPortB is printer port
  39.  
  40. SerReset(-6,baud2400+stop1+data8); // -6=Modem port in; printer= -8
  41. SerReset(-7,baud2400+stop1+data8); // -7=modem out; printer= -9
  42.  
  43. FSWrite(-7,&count,dataptr); // Read data
  44. FSRead(-6,&count,dataptr); // Write data
  45.  
  46. RAMSDClose(sPortA); 
  47. }
  48.  
  49. That's it! For more complicated modem operations I suggest use of
  50. communications toolbox; the comm tools provide really sophisticated
  51. means of controlling communication devices.
  52. --
  53. Miika Asunta
  54. asunta@convex.csc.fi            Double Bass Player
  55. tel. +358-0-494 093            Macintosh Programmer
  56.