Skip to content

Instantly share code, notes, and snippets.

@thijstriemstra
Created November 12, 2015 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thijstriemstra/25a078663fe031efc474 to your computer and use it in GitHub Desktop.
Save thijstriemstra/25a078663fe031efc474 to your computer and use it in GitHub Desktop.
sim800 tests
diff --git a/txgsm/protocol.py b/txgsm/protocol.py
index 6c1ac70..7071d36 100644
--- a/txgsm/protocol.py
+++ b/txgsm/protocol.py
@@ -111,8 +111,191 @@ class TxGSMProtocol(LineReceiver):
"""
d = Deferred()
d.addCallback(self.next('ATE0'))
- d.addCallback(self.next('AT+CIMI'))
+
+ # XXX: no response
+ #d.addCallback(self.next('AT+CIMI'))
+
+ # model identification
+ # {'command': ['AT+CGMM'], 'expect': 'OK', 'response': ['SIMCOM_SIM800', 'OK']}
d.addCallback(self.next('AT+CGMM'))
+
+ # model identification
+ # {'command': ['AT+GMM'], 'expect': 'OK', 'response': ['SIMCOM_SIM800', 'OK']}
+ d.addCallback(self.next('AT+GMM'))
+
+ # manufacturer identification
+ # {'command': ['AT+CGMI'], 'expect': 'OK', 'response': ['SIMCOM_Ltd', 'OK']}
+ # Manufacturer: SIMCOM_Ltd
+ # IMSI: SIMCOM_SIM800
+ d.addCallback(self.next('AT+CGMI'))
+
+ # manufacturer identification
+ # {'command': ['AT+GMI'], 'expect': 'OK', 'response': ['SIMCOM_Ltd', 'OK']}
+ d.addCallback(self.next('AT+GMI'))
+
+ # TA revision identification of software release
+ # {'command': ['AT+GMR'], 'expect': 'OK', 'response': ['Revision:1308B02SIM800M64_BT', 'OK']}
+ d.addCallback(self.next('AT+GMR'))
+
+ # TA revision identification of software release
+ # {'command': ['AT+CGMR'], 'expect': 'OK', 'response': ['Revision:1308B02SIM800M64_BT', 'OK']}
+ d.addCallback(self.next('AT+CGMR'))
+
+ # product serial number identification
+ # {'command': ['AT+CGSN'], 'expect': 'OK', 'response': ['862958021162114', 'OK\r']}
+ # "Unsollicited response: '\\n'"
+ d.addCallback(self.next('AT+CGSN'))
+
+ # TA serial number identification (IMEI)
+ # {'command': ['AT+GSN'], 'expect': 'OK', 'response': ['\n', '862958021162114', 'OK\r']}
+ d.addCallback(self.next('AT+GSN'))
+
+ # display product identification information
+ # {'command': ['ATI'], 'expect': 'OK', 'response': ['\n', 'SIM800 R13.08', 'OK']}
+ d.addCallback(self.next('ATI'))
+
+ # request complete TA capabilities list
+ # {'command': ['AT+GCAP'], 'expect': 'OK', 'response': ['+GCAP: +CGSM', 'OK']}
+ d.addCallback(self.next('AT+GCAP'))
+
+ # request global object identification
+ # {'command': ['AT+GOI'], 'expect': 'OK', 'response': ['SIM800', 'OK']}
+ d.addCallback(self.next('AT+GOI'))
+
+ # operator selection
+ # {'command': ['AT+COPS?'], 'expect': 'OK', 'response': ['+COPS: 0', 'OK']}
+ # "Unsollicited response: '\\r\\n'"
+ d.addCallback(self.next('AT+COPS?'))
+
+ # phone activity status
+ # {'command': ['AT+CPAS'], 'expect': 'OK', 'response': ['+CPAS: 2', 'OK']}
+ # "Unsollicited response: '\\r\\n'"
+ d.addCallback(self.next('AT+CPAS'))
+
+ # service reporting control
+ # {'command': ['AT+CR?'], 'expect': 'OK', 'response': ['+CR: 0', 'OK']}
+ d.addCallback(self.next('AT+CR?'))
+
+ # network registration
+ # {'command': ['AT+CREG?'], 'expect': 'OK', 'response': ['+CREG: 0,0', 'OK']}
+ d.addCallback(self.next('AT+CREG?'))
+
+ # signal quality report
+ # {'command': ['AT+CSQ'], 'expect': 'OK', 'response': ['+CSQ: 21,0', 'OK']}
+ d.addCallback(self.next('AT+CSQ'))
+
+ # tone duration
+ # {'command': ['AT+VTD?'], 'expect': 'OK', 'response': ['+VTD: 1', 'OK\r']}
+ d.addCallback(self.next('AT+VTD?'))
+
+ # clock
+ # {'command': ['AT+CCLK?'], 'expect': 'OK', 'response': ['\n', '+CCLK: "04/01/01,13:48:15+00"', 'OK']}
+ d.addCallback(self.next('AT+CCLK?'))
+
+ # alert sound mode
+ # {'command': ['AT+CALM?'], 'expect': 'OK', 'response': ['+CALM: 0', 'OK']}
+ d.addCallback(self.next('AT+CALM?'))
+
+ # alert sound select
+ # {'command': ['AT+CALS?'], 'expect': 'OK', 'response': ['+CALS: 1,0', 'OK']}
+ d.addCallback(self.next('AT+CALS?'))
+
+ # ringer sound level
+ # {'command': ['AT+CRSL?'], 'expect': 'OK', 'response': ['+CRSL: 24', 'OK']}
+ d.addCallback(self.next('AT+CRSL?'))
+
+ # loud speaker volume level
+ # {'command': ['AT+CLVL?'], 'expect': 'OK', 'response': ['+CLVL: 33', 'OK']}
+ d.addCallback(self.next('AT+CLVL?'))
+
+ # mute control
+ # {'command': ['AT+CMUT?'], 'expect': 'OK', 'response': ['+CMUT: 0', 'OK']}
+ d.addCallback(self.next('AT+CMUT?'))
+
+ # battery charge
+ # {'command': ['AT+CBC'], 'expect': 'OK', 'response': ['+CBC: 0,86,4096', 'OK\r']}
+ d.addCallback(self.next('AT+CBC'))
+
+ # change the side tone gain level
+ # {'command': ['AT+SIDET?'], 'expect': 'OK', 'response': ['\n', '+SIDET: (0,0),(2,0)', 'OK']}
+ d.addCallback(self.next('AT+SIDET?'))
+
+ # change the microphone gain level
+ # {'command': ['AT+CMIC?'], 'expect': 'OK', 'response': ['+CMIC: (0,10),(2,10)', 'OK']}
+ d.addCallback(self.next('AT+CMIC?'))
+
+ # set alarm time
+ # {'command': ['AT+CALA?'], 'expect': 'OK', 'response': ['OK']}
+ d.addCallback(self.next('AT+CALA?'))
+
+ # delete alarm
+ # {'command': ['AT+CALD=?'], 'expect': 'OK', 'response': ['+CALD: (1-5)', 'OK']}
+ d.addCallback(self.next('AT+CALD=?'))
+
+ # read ADC
+ # {'command': ['AT+CADC?'], 'expect': 'OK', 'response': ['+CADC: 1,348', 'OK']}
+ d.addCallback(self.next('AT+CADC?'))
+
+ # get local timestamp
+ # {'command': ['AT+CLTS=?'], 'expect': 'OK', 'response': ['+CLTS: "yy/MM/dd,hh:mm:ss+/-zz"', 'OK\r']}
+ d.addCallback(self.next('AT+CLTS=?'))
+
+ # get and set mobile operation band
+ # {'command': ['AT+CBAND=?'], 'expect': 'OK', 'response': ['\n', '+CBAND: (EGSM_MODE,DCS_MODE,GSM850_MODE,PCS_MODE,EGSM_DCS_MODE,GSM850_PCS_MODE,EGSM_PCS_MODE,ALL_BAND)', 'OK']}
+ d.addCallback(self.next('AT+CBAND=?'))
+
+ # switch on or off engineering mode
+ # {'command': ['AT+CENG?'], 'expect': 'OK', 'response': ['+CENG: 0,0', 'OK']}
+ d.addCallback(self.next('AT+CENG?'))
+
+ # echo cancellation control
+ # {'command': ['AT+ECHO?'], 'expect': 'OK', 'response': ['+ECHO: (0,96,253,16388,20488),(1,96,224,5256,20488)', 'OK']}
+ d.addCallback(self.next('AT+ECHO?'))
+
+ # reject incoming call
+ # {'command': ['AT+GSMBUSY?'], 'expect': 'OK', 'response': ['+GSMBUSY: 0', 'OK']}
+ d.addCallback(self.next('AT+GSMBUSY?'))
+
+ # set the list of emergency number
+ # {'command': ['AT+CEMNL?'], 'expect': 'OK', 'response': ['+CEMNL: 1,2,"112","119"', 'OK\r']}
+ d.addCallback(self.next('AT+CEMNL?'))
+
+ # close or open the microphone
+ # {'command': ['AT+CEXTERNTONE?'], 'expect': 'OK', 'response': ['\n', '+CEXTERNTONE: 0', 'OK\r']}
+ d.addCallback(self.next('AT+CEXTERNTONE?'))
+
+ # switch on or off detecting SIM card
+ # {'command': ['AT+CSDT?'], 'expect': 'OK', 'response': ['\n', '+CSDT: 0', 'OK']}
+ d.addCallback(self.next('AT+CSDT?'))
+
+ # SIM inserted status reporting
+ # {'command': ['AT+CSMINS?'], 'expect': 'OK', 'response': ['+CSMINS: 0,0', 'OK']}
+ d.addCallback(self.next('AT+CSMINS?'))
+
+ # set jamming detection funtion
+ # {'command': ['AT+SJDR?'], 'expect': 'OK', 'response': ['+SJDR: 0', 'OK']}
+ d.addCallback(self.next('AT+SJDR?'))
+
+ # antenna detecting
+ # {'command': ['AT+CANT?'], 'expect': 'OK', 'response': ['+CANT: 0,0,10', 'OK']}
+ d.addCallback(self.next('AT+CANT?'))
+
+ # roaming state
+ # {'command': ['AT+CROAMING'], 'expect': 'OK', 'response': ['+CROAMING: 0', 'OK']}
+ d.addCallback(self.next('AT+CROAMING'))
+
+ # perform a net survey to show all the cells' information
+ # {'command': ['AT+CNETSCAN?'], 'expect': 'OK', 'response': ['+CNETSCAN: 0', 'OK']}
+ d.addCallback(self.next('AT+CNETSCAN?'))
+
+ # GSM location and time
+ # {'command': ['AT+CIPGSMLOC=?'], 'expect': 'OK', 'response': ['+CIPGSMLOC: (1,2),(1-3)', 'OK\r']}
+ d.addCallback(self.next('AT+CIPGSMLOC=?'))
+
+ # TTS operation
+ # {'command': ['AT+CTTS?'], 'expect': 'OK', 'response': ['\n', '+CTTS: 0', 'OK']}
+ d.addCallback(self.next('AT+CTTS?'))
+
reactor.callLater(0, d.callback, [])
return d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment