GsmModem¶
-
class
sitchlib.
GsmModem
(ser_port)[source]¶ GSM Modem handler class. Interfaces with device over serial.
- Calling GsmModem.set_eng_mode() causes the module to go into
- engineering mode, which will cause it to return cell network information. It has an iterator (generator) built in that cranks out dicts.
-
eng_mode
(status)[source]¶ Set or unset engineering mode on the modem.
Parameters: status (bool) – True to enable engineering mode, False to disable.
-
classmethod
process_12
(parts)[source]¶ Process a 12-part CENG message.
Parameters: parts (list) – Parts parsed from original CENG message. Returns: Structured cell channel metadata. Return type: dict
-
classmethod
process_7
(parts)[source]¶ Process a 12-part CENG message.
- In a 7-item line, cellid is not provided. We set
- it to 0 to prevent barfing elsewhere.
Parameters: parts (list) – Parts parsed from original CENG message. Returns: Structured cell channel metadata. Return type: dict
-
classmethod
process_8
(parts)[source]¶ Process an 8-part CENG message.
Parameters: parts (list) – Parts parsed from original CENG message. Returns: Structured cell channel metadata. Return type: dict
-
classmethod
process_line
(line)[source]¶ Process line output from GSM modem.
- We expect to see only lines starting with +CENG:. Otherwise, it’s
- an empty dictionary getting returned.
Parameters: line (str) – Raw line output from GSM modem. Returns: Structured data parsed from line. Return type: dict
-
set_band
(band)[source]¶ Set the band the GSM modem should communicate on.
If the band does not set correctly, an error will print to stdout and the original setting will persist.
Parameters: band (str) – Pick one: EGSM_MODE, PGSM_MODE, DCS_MODE, GSM850_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, EGSM_PCS_MODE, or ALL_BAND.