moler.cmd.at package¶
Submodules¶
moler.cmd.at.at module¶
AT .
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.at.
At
(connection=None, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
Command to check if AT console is operable. Example output:
AT OK
-
build_command_string
()¶ Returns string with command constructed with parameters of object.
Returns: String with command.
-
moler.cmd.at.attach module¶
AT+CGATT=1 . Attach
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.attach.
Attach
(connection=None, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
Command to trigger attach. Example output:
AT+CGATT=1 OK
-
build_command_string
()¶ Returns string with command constructed with parameters of object.
Returns: String with command.
-
moler.cmd.at.cu module¶
Run cu -l /dev/ttyS{} -s 19200 command.
-
class
moler.cmd.at.cu.
Cu
(connection, serial_devname, prompt=None, newline_chars=None, target_newline='n', runner=None, options=None)¶ Bases:
moler.cmd.commandchangingprompt.CommandChangingPrompt
Command to connect COM port using cu. Example output:
$ cu -l /dev/ttyS21 -s 19200 -E - Connected.
-
build_command_string
()¶ Builds command string from parameters passed to object.
Returns: String representation of command to send over connection to device.
-
on_new_line
(line, is_full_line)¶ Parses the output of the command.
Parameters: - line – Line to process, can be only part of line. New line chars are removed from line.
- is_full_line – True if line had new line chars, False otherwise.
Returns: None.
-
moler.cmd.at.detach module¶
AT+CGATT=0 . Detach
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.detach.
Detach
(connection=None, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
Command to trigger detach. Example output:
AT+CGATT=0 OK
-
build_command_string
()¶ Returns string with command constructed with parameters of object.
Returns: String with command.
-
moler.cmd.at.enable_echo module¶
ATE1
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.enable_echo.
EnableEcho
(connection=None, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
Command to enable echo. Example output:
ATE1 OK
-
build_command_string
()¶ Builds command string from parameters passed to object. :return: String representation of command to send over connection to device.
-
moler.cmd.at.exit_serial_proxy module¶
Exit AtConsole<->stdio proxy
-
class
moler.cmd.at.exit_serial_proxy.
ExitSerialProxy
(connection, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.commandtextualgeneric.CommandTextualGeneric
-
build_command_string
()¶ command string to exit from moler_serial_proxy
-
on_new_line
(line, is_full_line)¶ Put your parsing code here.
Parameters: - line – Line to process, can be only part of line. New line chars are removed from line.
- is_full_line – True if line had new line chars, False otherwise
Returns: None
-
moler.cmd.at.genericat module¶
Common part for all commands.
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.genericat.
GenericAtCommand
(connection, operation='execute', prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.commandtextualgeneric.CommandTextualGeneric
-
on_new_line
(line, is_full_line)¶ Method to parse command output. Will be called after line with command echo. Write your own implementation but don’t forget to call on_new_line from base class
Parameters: - line – Line to parse, new lines are trimmed
- is_full_line – False for chunk of line; True on full line (NOTE: new line character removed)
Returns: None
-
moler.cmd.at.get_apns module¶
AT+CGDCONT
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.get_apns.
GetApns
(connection=None, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
Command to get APNs. Example output:
+CGDCONT: 1,”IPV4V6”,”apnscp1”,”0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0”,0,0,0,0 +CGDCONT: 2,”IPV4V6”,””,”0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0”,0,0,0,0 +CGDCONT: 3,”IPV4V6”,”ims”,”0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0”,0,0,0,0 +CGDCONT: 4,”IPV4V6”,”sos”,”0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0”,0,0,0,1 +CGDCONT: 5,”IPV4V6”,”xcap”,”0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0”,0,0,0,0
OK
-
build_command_string
()¶ Returns string with command constructed with parameters of object.
Returns: String with command.
-
on_new_line
(line, is_full_line)¶ Method to parse command output. Will be called after line with command echo.
+CGDCONT: 1,”IPV4V6”,”apnscp1”,”0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0”,0,0,0,0 +CGDCONT: 2,”IPV4V6”,””,”0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0”,0,0,0,0 +CGDCONT: 3,”IPV4V6”,”ims”,”0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0”,0,0,0,0 +CGDCONT: 4,”IPV4V6”,”sos”,”0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0”,0,0,0,1 +CGDCONT: 5,”IPV4V6”,”xcap”,”0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0”,0,0,0,0
OK
Write your own implementation but don’t forget to call on_new_line from base class
Parameters: - line – Line to parse, new lines are trimmed
- is_full_line – False for chunk of line; True on full line (NOTE: new line character removed)
Returns: None
-
moler.cmd.at.get_attach_state module¶
AT+CGATT? . Check attach state: attached/detached
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.get_attach_state.
GetAttachState
(connection=None, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
Command to check attach state. Example output:
AT+CGATT? +CGATT: 1 OK
-
build_command_string
()¶ Returns string with command constructed with parameters of object.
Returns: String with command.
-
on_new_line
(line, is_full_line)¶ Method to parse command output. Will be called after line with command echo.
+CGATT: 1 OK
Write your own implementation but don’t forget to call on_new_line from base class
Parameters: - line – Line to parse, new lines are trimmed
- is_full_line – False for chunk of line; True on full line (NOTE: new line character removed)
Returns: None
-
moler.cmd.at.get_cell_id module¶
AT+CREG?
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.get_cell_id.
GetCellId
(connection=None, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
-
build_command_string
()¶ Returns string with command constructed with parameters of object.
Returns: String with command.
-
on_new_line
(line, is_full_line)¶ Method to parse command output. Will be called after line with command echo. Example output:
+CREG: <n>,<stat>[,[<lac>],[<ci>],[<AcT>][,<cause_type>,<reject_cause>]]
OK
Write your own implementation but don’t forget to call on_new_line from base class
Parameters: - line – Line to parse, new lines are trimmed
- is_full_line – False for chunk of line; True on full line (NOTE: new line character removed)
Returns: None
-
moler.cmd.at.get_cell_id_gprs module¶
AT+CGREG?
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.get_cell_id_gprs.
GetCellIdGprs
(connection=None, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
-
build_command_string
()¶ Returns string with command constructed with parameters of object.
Returns: String with command.
-
on_new_line
(line, is_full_line)¶ Method to parse command output. Will be called after line with command echo. Example outputs:
+CGREG: <n>,<stat>[,[<lac>],[<ci>],[<AcT>],[<rac>][,<cause_type>,<reject_cause>]]
OK or +CGREG: <n>,<stat>[,[<lac>],[<ci>],[<AcT>],[<rac>][,[<cause_type>],[<reject_cause>]… …[,[<Active-Time>],[<Periodic-RAU>],[<GPRS-READY-timer>]]]]
OK
Write your own implementation but don’t forget to call on_new_line from base class
Parameters: - line – Line to parse, new lines are trimmed
- is_full_line – False for chunk of line; True on full line (NOTE: new line character removed)
Returns: None
-
moler.cmd.at.get_cell_id_lte module¶
AT+CEREG?
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.get_cell_id_lte.
GetCellIdLte
(connection=None, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
-
build_command_string
()¶ Returns string with command constructed with parameters of object.
Returns: String with command.
-
on_new_line
(line, is_full_line)¶ Method to parse command output. Will be called after line with command echo.
+CEREG: <n>,<stat>[,[<lac>],[<ci>],[<AcT>][,<cause_type>,<reject_cause>]]
OK or +CEREG: <n>,<stat>[,[<lac>],[<ci>],[<AcT>][,[<cause_type>],[<reject_cause>]… …[,[<Active-Time>],[<Periodic-RAU>],[<GPRS-READY-timer>]]]]
OK
Write your own implementation but don’t forget to call on_new_line from base class
Parameters: - line – Line to parse, new lines are trimmed
- is_full_line – False for chunk of line; True on full line (NOTE: new line character removed)
Returns: None
-
moler.cmd.at.get_cell_id_nr module¶
AT+C5GREG?
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.get_cell_id_nr.
GetCellIdNr
(connection=None, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
-
build_command_string
()¶ Returns string with command constructed with parameters of object.
Returns: String with command.
-
on_new_line
(line, is_full_line)¶ Method to parse command output. Will be called after line with command echo.
- +C5GREG: <n>,<stat>[,[<tac>],[<ci>],[<AcT>],[<Allowed_NSSAI_length>],[<Allowed_NSSAI>]…
- …[,<cause_type>,<reject_cause>]][,<cag_stat>][,<caginfo>]
OK
Write your own implementation but don’t forget to call on_new_line from base class
Parameters: - line – Line to parse, new lines are trimmed
- is_full_line – False for chunk of line; True on full line (NOTE: new line character removed)
Returns: None
-
moler.cmd.at.get_imei module¶
AT+CGSN .
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.get_imei.
GetImei
(connection=None, sn_type='default', prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
Command to get product serial number identification. Example output:
AT+CGSN 490154203237518
AT+CGSN=1 +CGSN: “490154203237518” OK
-
build_command_string
()¶ Returns string with command constructed with parameters of object.
Returns: String with command.
-
is_end_of_cmd_output
(line)¶ Checks if end of command is reached.
AT+CGSN and AT+CGSN=0 are not finished by OK, so such cmd is finished when it detects serial_number
Parameters: line – Line from device. Returns:
-
on_new_line
(line, is_full_line)¶ Method to parse command output. Will be called after line with command echo.
490154203237518
or
+CGSN: “490154203237518” OK
Write your own implementation but don’t forget to call on_new_line from base class
Parameters: - line – Line to parse, new lines are trimmed
- is_full_line – False for chunk of line; True on full line (NOTE: new line character removed)
Returns: None
-
moler.cmd.at.get_imsi module¶
AT+CIMI .
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.get_imsi.
GetImsi
(connection=None, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
Command to get IMSI. Example output:
AT+CIMI 49009123123123 OK
-
build_command_string
()¶ Returns string with command constructed with parameters of object.
Returns: String with command.
-
on_new_line
(line, is_full_line)¶ Method to parse command output. Will be called after line with command echo.
49009123123123 OK
Write your own implementation but don’t forget to call on_new_line from base class
Parameters: - line – Line to parse, new lines are trimmed
- is_full_line – False for chunk of line; True on full line (NOTE: new line character removed)
Returns: None
-
moler.cmd.at.get_ip module¶
AT+CGPADDR
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.get_ip.
GetIp
(context_identifier, connection=None, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
Command to get IP. Example output:
+CGPADDR: 1,0.0.0.0,0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
OK
-
build_command_string
()¶ Returns string with command constructed with parameters of object.
Returns: String with command.
-
on_new_line
(line, is_full_line)¶ Method to parse command output. Will be called after line with command echo.
+CGPADDR: 1,”40.1.1.105”
OK
Write your own implementation but don’t forget to call on_new_line from base class
Parameters: - line – Line to parse, new lines are trimmed
- is_full_line – False for chunk of line; True on full line (NOTE: new line character removed)
Returns: None
-
moler.cmd.at.get_manufacturer_id module¶
AT+CGMI .
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.get_manufacturer_id.
GetManufacturerId
(connection=None, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
Command to get manufacturer identification. Example output:
AT+CGMI QUALCOMM INCORPORATED
-
build_command_string
()¶ Returns string with command constructed with parameters of object.
Returns: String with command.
-
is_end_of_cmd_output
(line)¶ Checks if end of command is reached.
AT+CGMI is not finished by OK, so it is finished when it detects manufacturer
Parameters: line – Line from device. Returns:
-
on_new_line
(line, is_full_line)¶ Method to parse command output. Will be called after line with command echo.
QUALCOMM INCORPORATED
Write your own implementation but don’t forget to call on_new_line from base class
Parameters: - line – Line to parse, new lines are trimmed
- is_full_line – False for chunk of line; True on full line (NOTE: new line character removed)
Returns: None
-
moler.cmd.at.get_product_info module¶
ATI
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.get_product_info.
GetProductInfo
(connection=None, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
Command to get product information. Example output:
Manufacturer: QUALCOMM INCORPORATED Model: 334 Revision: OEM_VER: RTL6300_NOKIA_V0.0.3_201116.1_m OEM_BLD: master@dailybuild2, 11/16/2020 05:56:34 QC_VER: MPSS.HI.2.0.c3-00246-SDX55_CPEALL_PACK-1 IMEI: 352569090027192 +GCAP: +CGSM
OK
-
build_command_string
()¶ Returns string with command constructed with parameters of object.
Returns: String with command.
-
on_new_line
(line, is_full_line)¶ Method to parse command output. Will be called after line with command echo.
Manufacturer: QUALCOMM INCORPORATED Model: 334 Revision: OEM_VER: RTL6300_NOKIA_V0.0.3_201116.1_m OEM_BLD: master@dailybuild2, 11/16/2020 05:56:34 QC_VER: MPSS.HI.2.0.c3-00246-SDX55_CPEALL_PACK-1 IMEI: 352569090027192 +GCAP: +CGSM
OK
Write your own implementation but don’t forget to call on_new_line from base class
Parameters: - line – Line to parse, new lines are trimmed
- is_full_line – False for chunk of line; True on full line (NOTE: new line character removed)
Returns: None
-
moler.cmd.at.get_revision_id module¶
AT+CGMR .
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.get_revision_id.
GetRevisionId
(connection=None, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
Command to get revision identification. Example output:
AT+CGMR MPSS.HE.1.5.2-00368-SM8150_GENFUSION_PACK-1 1 [Aug 07 2019 21:00:00]
-
build_command_string
()¶ Returns string with command constructed with parameters of object.
Returns: String with command.
-
is_end_of_cmd_output
(line)¶ Checks if end of command is reached.
AT+CGMR is not finished by OK, so it is finished when it detects revision
Parameters: line – Line from device. Returns:
-
on_new_line
(line, is_full_line)¶ Method to parse command output. Will be called after line with command echo.
MPSS.HE.1.5.2-00368-SM8150_GENFUSION_PACK-1 1 [Aug 07 2019 21:00:00]
Write your own implementation but don’t forget to call on_new_line from base class
Parameters: - line – Line to parse, new lines are trimmed
- is_full_line – False for chunk of line; True on full line (NOTE: new line character removed)
Returns: None
-
moler.cmd.at.plink_serial module¶
Run plink -serial command
-
class
moler.cmd.at.plink_serial.
PlinkSerial
(connection, serial_devname, prompt=None, newline_chars=None, target_newline='n', runner=None)¶ Bases:
moler.cmd.commandchangingprompt.CommandChangingPrompt
-
build_command_string
()¶ Builds command string from parameters passed to object. :return: String representation of command to send over connection to device.
-
on_new_line
(line, is_full_line)¶ Parses the output of the command.
Parameters: - line – Line to process, can be only part of line. New line chars are removed from line.
- is_full_line – True if line had new line chars, False otherwise.
Returns: None.
-
moler.cmd.at.set_apn module¶
AT+CGDCONT
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.set_apn.
SetApn
(apn_name, context_identifier='1', pdp_type='IPV4V6', connection=None, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
Command to set apn.
-
build_command_string
()¶ Builds command string from parameters passed to object. :return: String representation of command to send over connection to device.
-
moler.cmd.at.set_mode module¶
AT+COPS
AT commands specification: google for: 3gpp specification 27.007 (always check against latest version of standard)
-
class
moler.cmd.at.set_mode.
SetMode
(selected_mode, connection=None, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
Command to set mode (automatic, lte, gsm, wcdma).
-
build_command_string
()¶ Returns string with command constructed with parameters of object.
Returns: String with command.
-
mode2cops_value
= {'automatic': '0', 'gsm': '0,0,0,3', 'lte': '0,0,0,7', 'wcdma': '0,0,0,6'}¶
-
moler.cmd.at.quectel_lock_nrearfcn module¶
AT+QNWCFG=”nr5g_earfcn_lock”,(0..32),earfcn1:scs1:…:earfcnN:scsN
AT commands specification: google for: Quectel RG50xQRM5xxQ (R11 release and later) This is internal Quectel AT command (always check against the latest vendor release notes)
-
class
moler.cmd.at.quectel_lock_nr_earfcn.
QuectelLockNrEarfcn
(earfcn, scs, connection=None, prompt=None, newline_chars=None, runner=None)¶ Bases:
moler.cmd.at.genericat.GenericAtCommand
Command to lock NR EARFCN. Example output:
AT+QNWCFG=”nr5g_earfcn_lock”,1,433970:15 OK
-
build_command_string
()¶ Returns string with command constructed with parameters of object.
Returns: String with command.
-
Module contents¶
Package for implementing AT commands.
AT commands specification: https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1515 (always check against latest version of standard)