pyRockBlock Command Reference¶
RockBlock¶
- class pyRockBlock.RockBlock(port, timeout=5)¶
Represents a connected RockBLOCK serial device.
Properties¶
- pyRockBlock.RockBlock.signal_quality()¶
Checks the network signal quality.
- Returns:
integer 0-5 representing the number of ISU signal bars.
- Return type:
int
- pyRockBlock.RockBlock.imei()¶
Gets the IMEI of the RockBLOCK modem.
- Returns:
the IMEI.
- Return type:
str
- pyRockBlock.RockBlock.modem()¶
Establishing Serial Connection¶
- pyRockBlock.RockBlock.connect(self) bool¶
Attempts to connect to the RockBLOCK via the serial interface.
- Returns:
true if connection is successful
- Return type:
bool
- pyRockBlock.RockBlock.disconnect(self)¶
Disconnects the serial connection to the RockBLOCK.
- pyRockBlock.RockBlock.check_serial_connection(self) bool¶
Checks if the RockBLOCK is still responding to messages via the serial interface by sending ‘AT’ and checking for an echo.
- Returns:
true if the RockBLOCK is still connected to the serial interface.
- Return type:
bool
Manually Sending and Reading Serial Interface¶
- pyRockBlock.RockBlock.write(self, command: str)¶
Writes text to the serial interface.
- Parameters:
command (str) – The text to write.
- pyRockBlock.RockBlock.write_line(self, command: str)¶
Writes text to the serial interface followed by a return character to denote the end of a command.
- Parameters:
command (str) – The text to write.
- pyRockBlock.RockBlock.write_line_echo(self, command: str) bool¶
Writes text to the serial interface followed by a return character, then waits for an echo from the device.
- Parameters:
command (str) – The text to write.
- Returns:
true if an echo of the message is received.
- Return type:
bool
- pyRockBlock.RockBlock.read_next(self) str¶
Waits for and then returns the next non-empty line from the serial interface.
- Returns:
the next message received.
- Return type:
str
Send and Receive SBD Messages¶
- pyRockBlock.RockBlock.queue_text(self, message: str) bool¶
Write text to the RockBLOCK MO buffer.
- Parameters:
message (str) – Text to be written.
- Returns:
true if the text is successfully written.
- Return type:
bool
- pyRockBlock.RockBlock.queue_bytes(self, message: str) bool¶
Write utf8 bytes to the RockBLOCK MO buffer.
- Parameters:
message (str) – The message to be written as bytes.
- Returns:
true if the message is successfully written.
- Return type:
bool
- pyRockBlock.RockBlock.initiate_session(self) SessionResponse¶
Attempts to contact the GSS, sending anything in the MO buffer and receiving MT messages.
- Returns:
the response from the GSS.
- Return type:
- pyRockBlock.RockBlock.send_text(self, message: str) SessionResponse¶
Writes the message to the RockBLOCK MO buffer and then attempts to send to the GSS.
- Parameters:
message (str) – Text to be sent.
- Returns:
the response from the GSS. (This will contain any available MT messages also)
- Return type:
- pyRockBlock.RockBlock.read_bytes(self) bytes¶
Reads bytes from the RockBLOCK MT buffer.
- Returns:
all bytes in buffer
- Return type:
bytes
- pyRockBlock.RockBlock.read_text(self) str¶
Reads text from the RockBLOCK MT buffer.
- Returns:
all text in buffer
- Return type:
str
Utility Commands¶
- pyRockBlock.RockBlock.set_radio_activity(self, enabled: bool)¶
Disables or Enables radio activity to save power and reduce signature
- Parameters:
enabled – if radio should be active
- pyRockBlock.RockBlock.set_energy_used(self, energy: int)¶
Preset the energy accumulator value.
- Parameters:
energy (int) – energy value in microamp hours
- pyRockBlock.RockBlock.get_energy_used(self) int¶
Get accumulated energy used.
- Returns:
energy used in microamp hours
- Return type:
int
- pyRockBlock.RockBlock.clear_buffer(self, clear: BufferClear)¶
Clear messages from the MO or MT buffer
- Parameters:
clear (BufferClear) – MO, MT or MO_MT
- pyRockBlock.RockBlock.get_status(self) SbdStatus¶
Get the status of the SBD modem
- Returns:
The SBD status
- Return type:
SessionResponse¶
- class pyRockBlock.SessionResponse(response: str)¶
Stores the result of an attempted GSS session.
SbdStatus¶
- class pyRockBlock.SbdStatus(response: str)¶
Stores result from SBD status requests