home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / irishset.zip / SetIrish.cmd < prev    next >
OS/2 REXX Batch file  |  1997-01-15  |  6KB  |  219 lines

  1. /* Program to use settings from Irish Setter to configure a Motorola BitSUFR Pro T/A */
  2. /* Just setting variables so it won't print to a file or copy the variable name instead of the information */
  3. SaveSet = ">w"
  4. ResetTA= ">z"
  5. port = ''
  6. portNum = ''
  7. IrishName = ''
  8. ATCommand = "AT"
  9. main:                   /* Now the program starts! */
  10. PARSE ARG IrishName
  11. /*  After getting the filename from the commandline, we open the file & copy what is in it. */
  12. rc = LineIn(IrishName,1,0)
  13. port = LineIn(IrishName)
  14. portNum = strip(port, 't', ':')
  15. FSpid = LineIn(IrishName)
  16. SSpid = LineIn(IrishName)
  17. DATASpid = LineIn(IrishName)
  18. FDirNum = LineIn(IrishName)
  19. SDirNum = LineIn(IrishName)
  20. DNDATANum = LineIn(IrishName)
  21. /*                              The following three variables aren't normally used.                     */
  22. /*                              They are included here in case you need them.                           */
  23. /*    Most often the TEI are set automatically after the T/A has been set with the other variables.  */
  24. TEIFNum = LineIn(IrishName)
  25. TEISNum = LineIn(IrishName)
  26. TEIDNum = LineIn(IrishName)
  27. SwitchType = LineIn(IrishName)
  28. SSwitchType = LineIn(IrishName)
  29. /* Here we have the variables converted to the 'AT' command that will be used. */
  30. NFSpid = "AT *1!C6=" || FSpid
  31. NSSpid = "AT *2!C6=" || SSpid
  32. NDATASpid = "AT !C6=" || DATASpid
  33. NFDirNum = "AT *1!N1=" || FDirNum
  34. NSDirNum = "AT *2!N1=" || SDirNum
  35. NDNDATANum = "AT !n1=" || DNDATANum
  36. /* * * * * * * * * * * * * * *  ONLY use these variables when necessary! * * * * * * * * */
  37. /*
  38. NTEIFNum = "AT *1!D3=" || TEIFNum
  39. NTEISNum = "AT *2!D3=" || TEISNum
  40. NTEIDNum = "AT !D3=" || TEIDNum
  41. p1.0 = "\"
  42. p1.1 = "-"
  43. p1.2 = "/"
  44. p1.3 = "-"
  45. p2 = 0
  46. */
  47. /*    Here is where the information is uploaded to the T/A(commonly known as a 'cable modem').  */
  48. NSwitchtype = "AT !C0=" || Switchtype
  49. NSSwitchType = "AT !C1=" || SSwitchType
  50. rc = stream(portNum, 'C', 'OPEN')
  51. CALL FirstPOTS
  52. CALL SecondPOTS
  53. CALL DATAPOTS
  54. CALL FirstSPID
  55. CALL SecondSPID
  56. CALL DATASPID
  57. CALL DOSwitch
  58. CALL DOSoft
  59. CALL SAVEset
  60. CALL RESet
  61. return
  62. FirstPOTS:
  63. CALL LineOut portNum, NFDirNum
  64. Info=''
  65. DO  While Chars(port)
  66.    Info= Info || CharIn(port)
  67.    CALL CharOut , "1B"x || '[s Reading ' || p1.p2 || "1B"x || "[u"
  68.    p2 = (p2+1) // 4
  69.    end  /* end DO */
  70. IF POS("OK", Info) <> 0 then
  71.         DO SAY "ERROR! on first Directory number"
  72.         exit
  73.         end  /* end DO */
  74. else
  75. SAY Info
  76. return
  77. SecondPOTS:
  78. CALL LineOut portNum, NSDirNum
  79. Info=''
  80. DO  While Chars(port)
  81.    Info= Info || CharIn(port)
  82.    CALL CharOut , "1B"x || '[s Reading ' || p1.p2 || "1B"x || "[u"
  83.    p2 = (p2+1) // 4
  84.    end  /* end DO */
  85. IF POS("OK", Info) <> 0 then
  86.         DO SAY "ERROR! on second Directory number"
  87.         exit
  88.         end
  89. else
  90. SAY Info
  91. return
  92. DATAPOTS:
  93. CALL LineOut portNum, NDATASpid
  94. Info=''
  95. DO  While Chars(port)
  96.    Info= Info || CharIn(port)
  97.    CALL CharOut , "1B"x || '[s Reading ' || p1.p2 || "1B"x || "[u"
  98.    p2 = (p2+1) // 4
  99.    end  /* end DO */
  100. IF POS("OK", Info) <> 0 then
  101.         DO SAY "ERROR! on  DATA Directory number"
  102.         exit
  103.         end
  104. else
  105. SAY Info
  106. return
  107. FirstSPID:
  108. CALL LineOut portNum, NFSpid
  109. Info=''
  110. DO  While Chars(port)
  111.    Info= Info || CharIn(port)
  112.    CALL CharOut , "1B"x || '[s Reading ' || p1.p2 || "1B"x || "[u"
  113.    p2 = (p2+1) // 4
  114.    end  /* end DO */
  115. IF POS("OK", Info) <> 0 then
  116.         DO SAY "ERROR! on first SPID number"
  117.         exit
  118.         end
  119. else
  120. SAY Info
  121. return
  122. SecondSPID:
  123. CALL LineOut portNum, NSSpid
  124. Info=''
  125. DO  While Chars(port)
  126.    Info= Info || CharIn(port)
  127.    CALL CharOut , "1B"x || '[s Reading ' || p1.p2 || "1B"x || "[u"
  128.    p2 = (p2+1) // 4
  129.    end  /* end DO */
  130. IF POS("OK", Info) <> 0 then
  131.         DO SAY "ERROR! on second SPID number"
  132.         exit
  133.         end
  134. else
  135. SAY Info
  136. return
  137. DATASPID:
  138. CALL LineOut portNum, NDNDATANum
  139. Info=''
  140. DO  While Chars(port)
  141.    Info= Info || CharIn(port)
  142.    CALL CharOut , "1B"x || '[s Reading ' || p1.p2 || "1B"x || "[u"
  143.    p2 = (p2+1) // 4
  144.    end  /* end DO */
  145. IF POS("OK", Info) <> 0 then
  146.         DO SAY "ERROR! on DATA SPID number"
  147.         exit
  148.         end
  149. else
  150. SAY Info
  151. return
  152. DOSwitch:
  153. CALL LineOut portNum, NSwitchType
  154. Info=''
  155. DO  While Chars(port)
  156.    Info= Info || CharIn(port)
  157.    CALL CharOut , "1B"x || '[s Reading ' || p1.p2 || "1B"x || "[u"
  158.    p2 = (p2+1) // 4
  159.    end  /* end DO */
  160. IF POS("OK", Info) <> 0 then
  161.         DO SAY "ERROR! on Central Office Switch type."
  162.         exit
  163.         end
  164. else
  165. SAY Info
  166. return
  167. DOSoft:
  168. CALL LineOut portNum, NSSwitchType
  169. Info=''
  170. DO  While Chars(port)
  171.    Info= Info || CharIn(port)
  172.    CALL CharOut , "1B"x || '[s Reading ' || p1.p2 || "1B"x || "[u"
  173.    p2 = (p2+1) // 4
  174.    end  /* end DO */
  175. IF POS("OK", Info) <> 0 then
  176.         DO SAY "ERROR! on Central Office Software version."
  177.         exit
  178.         end
  179. else
  180. SAY Info
  181. return
  182. /*  
  183. CALL LineOut portNum, NTEIDNum
  184. CALL LineOut portNum, NTEIFNum
  185. CALL LineOut portNum, NTEISNum
  186. */
  187. SAVEset:
  188. CALL LineOut portNum, "AT " || SaveSet
  189. Info=''
  190. DO  While Chars(port)
  191.    Info= Info || CharIn(port)
  192.    CALL CharOut , "1B"x || '[s Reading ' || p1.p2 || "1B"x || "[u"
  193.    p2 = (p2+1) // 4
  194.    end  /* end DO */
  195. IF POS("OK", Info) <> 0 then
  196.         DO SAY "ERROR! on saving settings to non-volatile memory!"
  197.         exit
  198.         end
  199. else
  200. SAY Info
  201. return
  202. RESet:
  203. CALL LineOut portNum, "AT " || ResetTA
  204. Info=''
  205. DO  While Chars(port)
  206.    Info= Info || CharIn(port)
  207.    CALL CharOut , "1B"x || '[s Reading ' || p1.p2 || "1B"x || "[u"
  208.    p2 = (p2+1) // 4
  209.    end  /* end DO */
  210. IF POS("OK", Info) <> 0 then
  211.         DO SAY "ERROR! on resetting T/A."
  212.         exit
  213.         end
  214. else
  215. SAY Info
  216. return
  217. exit
  218.  
  219.