• Support
  • Articles
  • Resources
  • Products

TCP socket to a remote destination - Cellular modem Wavecom

Moderator: boris

1 postPage 1 of 1

celder
Newbie

Posts:
4
Joined: Fri Jan 22, 2010 11:47 am
by celder » Fri Jan 22, 2010 12:09 pm

Code: Select all

  1.  
  2. ;;  ### Script for sending streaming Data to a TCP socket using the MTSMC-G-F4 / MTMMC-G-F4 / MTSMC-G2
  3. ;; UK o2 cellular SIM. Tested with Wipsoft 3.11
  4. ;---------------------------------------------------------------------------------------------
  5.  
  6.  
  7. ; Auto run using Com 1 - Edit as nesesary
  8. connect '/C=1'
  9. setsync 1
  10. timeout = 5
  11. ; Enable error code reporting
  12.  
  13.  
  14. ; ############################################
  15. ; Enable cellular parameters variables
  16.  
  17. apn ='"mobile.o2.co.uk"'
  18. apnun ='"mobileweb"'
  19. apnpw ='"web"'
  20. Dialnumber ='*99***1#'
  21.  
  22. ; Enable destination device variabes
  23. remoteip ='"xxx.xxx.xxx.xxx"'
  24. remoteport ='25'
  25.  
  26. ;############################################
  27. ; Sanity check the device state ( will show errors )
  28.  
  29. Pause 3
  30.  
  31. sendln 'at+cfun=1'
  32.  
  33. pause 3
  34.  
  35. sendln 'ath'
  36. waitln 'OK'
  37.  
  38.  
  39. sendln 'at+wipclose=2,1
  40. ;waitln 'OK'
  41. pause 5
  42.  
  43. sendln 'at+wipcfg=0'
  44. ; waitln 'OK'
  45. pause 3
  46.  
  47. sendln 'at+csq'
  48. waitln 'OK'
  49.  
  50. sendln 'at+creg?'
  51. waitln 'OK'
  52.  
  53. sendln 'at+wopen=0'
  54. ; waitln 'OK'
  55. pause 5
  56.  
  57. ;sendln 'at+cmee=1'
  58. ;waitln 'OK'
  59.  
  60. ; ###############################################
  61. ; Configure Device with given cellular variables
  62.  
  63. ; Open the IP stack-
  64. sendln 'at+wopen=1'
  65. ;waitln 'OK'
  66.  
  67. :RERUN
  68. sendln 'at+wipcfg=1'
  69. waitln 'ERROR' 'OK'
  70.  
  71. if result = 0 goto RERUN
  72. If result = 1 goto RERUN
  73. if result = 2 goto PROCEED
  74.  
  75. :PROCEED
  76.  
  77. ; Apply cellular parameters
  78. sendln 'at+wipbr=1,6
  79. waitln 'OK'
  80. sendln 'at+wipbr=2,6,11,'apn''
  81. waitln 'OK'
  82. SENDLN 'AT+WIPBR=2,6,0,'apnun''
  83. WAITLN 'OK'
  84. SENDLN 'AT+WIPBR=2,6,1,'apnpw'
  85. WAITLN 'OK'
  86.  
  87. ; Start the bearer  4,6,0 - GPRS with Username and password
  88.  
  89. :AGAIN
  90. pause 3
  91. sendln 'at+wipbr=4,6,0'
  92. wait 'OK' '+CME'
  93. if result = 0 goto AGAIN
  94. if result = 1 goto NEXT
  95. if result = 2 goto AGAIN
  96. :NEXT
  97.  
  98. ; #############################################################
  99. ; Open the connection
  100.  
  101. ;  Create the TCP socket - 2,1 - TCP client session 1
  102. sendln 'at+wipcreate=2,1,'remoteip','remoteport'
  103. waitln 'OK'
  104.  
  105. ; open the TCP port ( example - transparent to DLE and ETX characters )
  106. sendln 'wipdata=2,1,2'
  107.  
  108.  
  109. messagebox 'Use Sendfile to locate file and terminiate with CTRL C / +++ ' 'SendFile'
  110.  
  111. waitln 'OK'
  112.  
  113. end
  114.  
  115.  

1 postPage 1 of 1

Users browsing this forum: No registered users
cron