!************************************************************ ! I-O DATA PCMA-9664P2(PDC) ! 01-SEP-2000 masuda ! 27-SEP-2001 masuda ! ! Copyright (C) 2000-2001 I-O DATA DEVICE,INC. All rights reserved. ! ! 'mlts' resource info for this modem: ! byte 1 == 01 -> modem HAS built-in error correction protocols ! byte 2 == 01 -> modem HAS built-in data compression protocols ! byte 3 == 35 -> max number of chars in varstr 7 (53dec) ! byte 4 == 35 -> max number of chars in varstr 8 ! byte 5 == 35 -> max number of chars in varstr 9 ! !************************************************************ @ORIGINATE @ANSWER ! ! ---- Initial modem setup ---- ! ! Set serial port speed depending upon the compression flag ! A higher rate with compression on to handle expanded data from the modem ! A lower rate closer to the DCE when compression is off ! ifstr 5 1 "0" serreset 115200, 0, 8, 1 !serreset 57600, 0, 8, 1 !serreset 38400, 0, 8, 1 jump 2 ! @LABEL 1 !serreset 115200, 0, 8, 1 serreset 57600, 0, 8, 1 !serreset 38400, 0, 8, 1 @LABEL 2 hsreset 0 0 0 0 0 0 settries 0 ! ! Get the modem's attention ! matchclr matchstr 1 3 "OK\13\10" write "AT\13" matchread 30 ! @LABEL 3 ! ! Setup the modem for the following: ! Reset to factory settings ! Standard compression/reliablity ! Lock serial port speed ! Serial port hardware handshaking, turn off software handshaking ! Verbose responces and compresion/protocol results ! CONNECT returns DCE speed ! Turn off answering ! Reset or return to command mode on DTR toggle (optional) ! matchclr matchstr 1 4 "OK\13\10" matchstr 2 101 "ERROR\13\10" !write "AT&FE0W2\\W1%C0&D0\13" !PDC V1W2 write "AT&FE0W2&D0#CLS=0%C0\13" !PACKET !write "AT&FE0%C0&D0\13" !PHS64K !write "AT&FE0\\W1&D0#CLS=3\13" !PHS6432K !write "AT&FE0\\W1&D0S142=1#CLS=3\13" matchread 30 inctries iftries 3 101 ! ! Reset the Modem on setup failure ! DTRClear pause 5 DTRSet flush jump 3 ! ! @LABEL 4 ! Varstring 4 , reliable link protocol: ! = 0, handled by computer (ARAP) ! = 1, handled by modem (PPP) ! = 2, MNP10 protocol (Cellular protocol, no longer supported) ifstr 4 5 "1" ifstr 4 5 "2" ! ! Varstring 4 == 0, turn off reliable link protocol in modem (ARAP) matchclr matchstr 1 9 "OK\13\10" write "AT\13" matchread 30 jump 101 ! ! @LABEL 5 ! Varstring 5, compression protocol: ! = 0, handled by computer ! = 1, handled by modem ifstr 5 9 "0" ! ! Varstring 5 == 1, turn on compression protocol in modem. matchclr matchstr 1 9 "OK\13\10" write "AT%C3\13" matchread 30 jump 101 ! ! @LABEL 9 ! Varstring 2, modem speaker: ! = 0, speaker off ! = 1, speaker on ifstr 2 13 "1" pause 5 matchclr matchstr 1 13 "OK\13\10" write "AT\13" matchread 30 jump 101 ! ! Modem ready, wait for a call or originate a call ! @LABEL 13 ifANSWER 32 ! ! ! ---- Originating a call ---- ! ! Varstring 6, dialing mode: ! = 0, normal dialing ! = 1, blind dialing ! = 2, manual dialing ifstr 6 17 "1" ifstr 6 15 "2" jump 19 ! @LABEL 15 note "Manual dialing initiated" 3 ! Display ASK dialog with message. Goto label 107 if dialog canceled. ASK 0 "Pick up the phone & dial ^1. Hit OK when the phone rings, then hangup." 107 ! X1 to ignore dialtone & busy, D to dial, \^ generates data tone write "ATD\13" jump 32 ! @LABEL 17 note "Dialing without tone" 3 matchclr matchstr 1 19 "OK\13\10" ! X1 to ignore dialtone & busy write "AT\13" matchread 30 jump 101 ! ! @LABEL 19 ! Display the full dialstring contained in Varstring 1 note "Dialing ^1" 3 ! ! Varstrings 7, 8 and 9, contain dialstring fragments ! Long phone numbers may need to be split into smaller groups ! for the modem to use ! ! Varstring 3: "p" for pulse & "t" for tone dialing ! Varstring 8 == blank (dialstring in varstring 7) ! Varstring 9 == blank (dialstring in varstrings 7 & 8) ! Otherwise (dialstring in varstrings 7, 8 & 9) ! \^ is added to the dialstring to force the modem to generate a data tone ifstr 8 27 " " ifstr 9 24 " " ! ! Write dialstring in varstrings 7, 8 & 9 write "ATD^3^7^8^9\13" jump 32 ! ! @LABEL 24 ! Write dialstring in varstrings 7 & 8 write "ATD^3^7^8\13" jump 32 ! @LABEL 27 ! Write dialstring in varstring 7 write "ATD^3^7\13" ! ! ! ---- Connection responce ---- ! ! The following section will parse modem responces of two types: ! 1) PROTOCOL: xxx, COMPRESSION: xxx, CONNECT xxx ! 2) CONNECT xxx/ARQ/V42 ! @LABEL 32 matchclr matchstr 1 59 "CONNECT\13\10" matchstr 2 81 "RING\13\10" matchstr 3 103 "NO CARRIER" matchstr 4 103 "ERROR\13\10" matchstr 5 102 "NO DIALTONE\13\10" matchstr 6 104 "BUSY\13\10" matchstr 7 105 "NO ANSWER\13\10" matchstr 8 33 "CONNECT " matchstr 9 32 "CARRIER" matchstr 10 67 "COMPRESSION:CLASS5" matchstr 11 67 "COMPRESSION:V.42BIS" matchstr 12 67 "COMPRESSION:NONE" matchstr 13 62 "PROTOCOL:NONE" matchstr 14 62 "PROTOCOL:LAPM" matchstr 15 62 "PROTOCOL:ALT" matchstr 16 62 "PROTOCOL:PACKET" matchstr 17 62 "PROTOCOL:PIAFS" matchstr 18 109 "BREAKDOWN" matchstr 19 110 "OUTSIDE" matchstr 20 111 "REDIAL ERROR" matchstr 21 112 "RESTRICTED DIAL" matchstr 22 113 "PS LOW BATTERY" matchstr 23 114 "ADP LOW BATTERY" matchstr 24 115 "OUT SIDE SERVICE" matchstr 25 116 "IN SERVICE" matchstr 26 117 "PS NO RESPONSE" matchread 700 ifANSWER 32 jump 101 ! ! Parse the speed of connect result codes ! 2400 and 4800 have two entries each ! to distinguish them from 24000 and 48000 ! @LABEL 33 matchclr matchstr 1 40 "300" matchstr 2 41 "1200" matchstr 3 42 "2400" matchstr 4 43 "4800" matchstr 5 44 "7200" matchstr 6 45 "9600" matchstr 7 46 "12000" matchstr 8 47 "14400" matchstr 10 48 "19200" matchstr 11 49 "38400" matchstr 12 50 "57600" matchstr 13 51 "115200" matchstr 14 52 "32000" matchstr 15 53 "64000" matchstr 16 54 "28800" matchread 30 jump 59 ! ! -- Connection rates -- ! CommunicatingAt informs ARA of the raw modem to modem ! connection speed. ! @LABEL 40 note "Communicating at 300 bps." 2 CommunicatingAt 300 jump 60 ! @LABEL 41 note "Communicating at 1200 bps." 2 CommunicatingAt 1200 jump 60 ! @LABEL 42 note "Communicating at 2400 bps." 2 CommunicatingAt 2400 jump 60 ! @LABEL 43 note "Communicating at 4800 bps." 2 CommunicatingAt 4800 jump 60 ! @LABEL 44 note "Communicating at 7200 bps." 2 CommunicatingAt 7200 jump 60 ! @LABEL 45 note "Communicating at 9600 bps." 2 CommunicatingAt 9600 jump 60 ! @LABEL 46 note "Communicating at 12000 bps." 2 CommunicatingAt 12000 jump 60 ! @LABEL 47 note "Communicating at 14400 bps." 2 CommunicatingAt 14400 jump 60 ! @LABEL 48 note "Communicating at 19200 bps." 2 CommunicatingAt 19200 jump 60 ! @LABEL 49 note "Communicating at 38400 bps." 2 CommunicatingAt 38400 jump 60 ! @LABEL 50 note "Communicating at 57600 bps." 2 CommunicatingAt 57600 jump 60 ! @LABEL 51 note "Communicating at 115200 bps." 2 CommunicatingAt 115200 jump 60 ! @LABEL 52 note "Communicating at 32000 bps." 2 CommunicatingAt 32000 jump 60 ! @LABEL 53 note "Communicating at 64000 bps." 2 CommunicatingAt 64000 jump 60 ! @LABEL 54 note "Communicating at 28800 bps." 2 CommunicatingAt 28800 jump 60 ! @LABEL 59 note "Communicating at an unknown rate." 2 jump 60 ! ! Look for reliablilty and compression results ! at the end of the connect result. ! @LABEL 60 matchclr matchstr 1 63 "REL" matchstr 2 62 "PROTOCOL:PIAFS" matchstr 3 70 "\13\10" !matchstr 1 63 "LAPM" !matchstr 3 63 "ARQ" !matchstr 4 68 "COMP/" !matchstr 5 68 "COMP\13" !matchstr 6 63 "V42/" !matchstr 7 63 "V42\13" !matchstr 8 68 "V42BIS" !matchstr 9 68 "V42bis" !matchstr 10 63 "MNP\13" !matchstr 11 68 "MNP5" !matchstr 12 70 "\10" !matchstr 13 68 "V.42bis" !matchstr 1 68 ".42bis" !matchstr 2 68 "42bis" matchread 30 jump 70 ! -- Modem error correction link negotiation -- ! Userhook 2 informs ARA that a modem-to-modem error ! correcting protocol has been negotiated ! ! @LABEL 62 note "Modem Reliable Link Established." 2 userhook 2 jump 32 ! @LABEL 63 note "Modem Reliable Link Established." 2 userhook 2 jump 60 ! ! -- Compression negotiation -- ! Userhook 3 informs ARA that a modem-to-modem compression ! protocol has been negotiated ! @LABEL 67 note "Modem Compression Established." 2 userhook 3 jump 32 ! @LABEL 68 note "Modem Compression Established." 2 userhook 3 jump 60 ! ! ! -- Normal exit after "CONNECT" -- ! ! This modem has been setup to do CTS handshaking, ! and we assume that a CTS handshaking cable is being used. ! @LABEL 70 ! Turn on CTS handshaking. HSReset 0 1 0 0 0 0 ! ifANSWER 71 pause 30 @LABEL 71 exit 0 ! ! ! ---- Answer calls ---- ! ! A RING result from the modem and in ANSWERING mode ! claims the serial port and answering the phone ! @LABEL 81 ifORIGINATE 32 userhook 1 note "Answering phone..." 2 write "ATA\13" jump 32 ! ! ! ---- Hang up and reset modem ---- ! @HANGUP @LABEL 90 settries 0 HSReset 0 0 0 0 0 0 ! @LABEL 92 ! Escape from data to command mode matchclr matchstr 1 96 "OK\13\10" write "+++" matchread 20 ! @LABEL 94 ! Force a hangup matchclr matchstr 1 98 "NO CARRIER\13\10" matchstr 2 98 "OK\13\10" matchstr 3 98 "ERROR\13\10" matchstr 4 98 "0\13\10" write "ATH\13" matchread 30 ! ! Try to get control of the modem by toggling DTR DTRClear pause 5 DTRSet flush ! ! Try the hangup sequence three times otherwise declare and error inctries iftries 3 101 jump 92 ! @LABEL 96 ! Pause between data and command mode pause 50 jump 94 ! ! @LABEL 98 ! Recall the factory settings pause 15 matchclr matchstr 1 99 "OK\13\10" write "AT&FE0W2\\W1%C0\13" matchread 30 jump 101 ! @LABEL 99 exit 0 ! ! ---- Error messages ----- ! ! Modem Not Responding @LABEL 101 exit -6019 ! ! No Dial Tone @LABEL 102 exit -6020 ! ! No Carrier or Error @LABEL 103 exit -6021 ! ! Busy @LABEL 104 exit -6022 ! ! No Answer @LABEL 105 exit -6023 ! ! User Cancellation @LABEL 107 exit -6002 "User cancelled the connection attempt." ! ! DELAYED @LABEL 108 exit -6022 ! ! BREAKDOWN @LABEL 109 exit -6002 "BREAKDOWN." ! ! OUTSIDE @LABEL 110 exit -6002 "OUTSIDE." ! ! REDIAL ERROR @LABEL 111 exit -6002 "REDIAL ERROR." ! ! RESTRICTED DIAL @LABEL 112 exit -6002 "RESTRICTED DIAL." ! ! PS LOW BATTERY @LABEL 113 exit -6002 "PS LOW BATTERY." ! ! ADP LOW BATTERY @LABEL 114 exit -6002 "ADP LOW BATTERY." ! ! OUT SIDE SERVICE @LABEL 115 exit -6002 "OUT SIDE SERVICE." ! ! IN SERVICE @LABEL 116 exit -6002 "IN SERVICE." ! ! PS NO RESPONSE @LABEL 117 exit -6002 "PS NO RESPONSE." !