@@ -77,9 +77,9 @@ def _uart_xfer(self, cmd):
77
77
78
78
def reset (self ):
79
79
"""Perform a software reset."""
80
- if self ._uart_xfer ("&F0" ) is None : # factory defaults
80
+ if self ._uart_xfer ("&F0" )[ 0 ] is None : # factory defaults
81
81
return False
82
- if self ._uart_xfer ("&K0" ) is None : # flow control off
82
+ if self ._uart_xfer ("&K0" )[ 0 ] is None : # flow control off
83
83
return False
84
84
return True
85
85
@@ -89,7 +89,7 @@ def _transfer_buffer(self):
89
89
90
90
@property
91
91
def data_out (self ):
92
- "The binary data in the outbound buffer."
92
+ """ The binary data in the outbound buffer."" "
93
93
return self ._buf_out
94
94
95
95
@data_out .setter
@@ -208,30 +208,43 @@ def model(self):
208
208
209
209
@property
210
210
def serial_number (self ):
211
- """Return modem imei/serial."""
211
+ """Modem's serial number, also known as the modem's IMEI.
212
+
213
+ Returns
214
+ string
215
+ """
212
216
resp = self ._uart_xfer ("+CGSN" )
213
217
if resp [- 1 ].strip ().decode () == "OK" :
214
218
return resp [1 ].strip ().decode ()
215
219
return None
216
220
217
221
@property
218
- def rssi (self ):
219
- """Return Received Signal Strength Indicator (RSSI)
220
- values returned are 0 to 5, where 0 is no signal (0 bars) and 5 is strong signal (5 bars).
221
- Important note: signal strength may not be fully accurate, so
222
- waiting for high signal strength prior to sending a message isn't always recommended.
222
+ def signal_quality (self ):
223
+ """Signal Quality also known as the Received Signal Strength Indicator (RSSI).
224
+
225
+ Values returned are 0 to 5, where 0 is no signal (0 bars) and 5 is strong signal (5 bars).
226
+
227
+ Important note: signal strength may not be fully accurate, so waiting for
228
+ high signal strength prior to sending a message isn't always recommended.
223
229
For details see https://docs.rockblock.rock7.com/docs/checking-the-signal-strength
230
+
231
+ Returns:
232
+ int
224
233
"""
225
234
resp = self ._uart_xfer ("+CSQ" )
226
235
if resp [- 1 ].strip ().decode () == "OK" :
227
- return resp [1 ].strip ().decode ().split (":" )[1 ]
236
+ return int ( resp [1 ].strip ().decode ().split (":" )[1 ])
228
237
return None
229
238
230
239
@property
231
240
def revision (self ):
232
- """Return the modem components' firmware versions.
241
+ """Modem's internal component firmware revisions.
242
+
233
243
For example: Call Processor Version, Modem DSP Version, DBB Version (ASIC),
234
244
RFA VersionSRFA2), NVM Version, Hardware Version, BOOT Version
245
+
246
+ Returns a tuple:
247
+ (string, string, string, string, string, string, string)
235
248
"""
236
249
resp = self ._uart_xfer ("+CGMR" )
237
250
if resp [- 1 ].strip ().decode () == "OK" :
@@ -240,38 +253,47 @@ def revision(self):
240
253
line = resp [x ]
241
254
if line != b"\r \n " :
242
255
lines .append (line .decode ().strip ())
243
- return lines
244
- return None
256
+ return tuple ( lines )
257
+ return ( None ,) * 7
245
258
246
259
@property
247
260
def ring_alert (self ):
248
- """Retrieve setting for SBD Ring Alerts."""
261
+ """The current ring indication mode.
262
+
263
+ False means Ring Alerts are disabled, and True means Ring Alerts are enabled.
264
+
265
+ When SBD ring indication is enabled, the ISU asserts the RI line and issues
266
+ the unsolicited result code SBDRING when an SBD ring alert is received.
267
+ (Note: the network can only send ring alerts to the ISU after it has registered).
268
+
269
+ Returns:
270
+ bool
271
+ """
249
272
resp = self ._uart_xfer ("+SBDMTA?" )
250
273
if resp [- 1 ].strip ().decode () == "OK" :
251
274
return bool (int (resp [1 ].strip ().decode ().split (":" )[1 ]))
252
275
return None
253
276
254
277
@ring_alert .setter
255
278
def ring_alert (self , value = 1 ):
256
- """Enable or disable ring alert feature."""
257
279
if value in [True , False ]:
258
280
resp = self ._uart_xfer ("+SBDMTA=" + str (int (value )))
259
281
if resp [- 1 ].strip ().decode () == "OK" :
260
282
return True
261
283
raise RuntimeError ("Error setting Ring Alert." )
262
284
raise ValueError (
263
- "Use 0 or False to disable Ring Alert or use 0 or True to enable Ring Alert."
285
+ "Use 0 or False to disable Ring Alert or use 1 or True to enable Ring Alert."
264
286
)
265
287
266
288
@property
267
289
def ring_indication (self ):
268
- """
269
- Query the ring indication status, returning the reason for the most recent assertion
270
- of the Ring Indicate signal.
290
+ """The ring indication status.
291
+
292
+ Returns the reason for the most recent assertion of the Ring Indicate signal.
271
293
272
294
The response contains separate indications for telephony and SBD ring indications.
273
295
The response is in the form:
274
- [ <tel_ri>,<sbd_ri>]
296
+ ( <tel_ri>,<sbd_ri>)
275
297
276
298
<tel_ri> indicates the telephony ring indication status:
277
299
0 No telephony ring alert received.
@@ -282,21 +304,24 @@ def ring_indication(self):
282
304
<sbd_ri> indicates the SBD ring indication status:
283
305
0 No SBD ring alert received.
284
306
1 SBD ring alert received.
307
+
308
+ Returns a tuple:
309
+ (string, string)
285
310
"""
286
311
resp = self ._uart_xfer ("+CRIS" )
287
312
if resp [- 1 ].strip ().decode () == "OK" :
288
- return resp [1 ].strip ().decode ().split (":" )[1 ].split ("," )
289
- return None
313
+ return tuple ( resp [1 ].strip ().decode ().split (":" )[1 ].split ("," ) )
314
+ return ( None ,) * 2
290
315
291
316
@property
292
317
def geolocation (self ):
293
- """
294
- Return the geolocation of the modem as measured by the Iridium constellation
295
- and the current time based on the Iridium network timestamp.
318
+ """Most recent geolocation of the modem as measured by the Iridium constellation
319
+ including a timestamp of when geolocation measurement was made.
320
+
296
321
The response is in the form:
297
- [ <x>,<y>,<z>,<timestamp>]
322
+ ( <x>, <y>, <z>, <timestamp>)
298
323
299
- <x>,<y>,<z> is a geolocation grid code from an earth centered Cartesian coordinate system,
324
+ <x>, <y>, <z> is a geolocation grid code from an earth centered Cartesian coordinate system,
300
325
using dimensions, x, y, and z, to specify location. The coordinate system is aligned
301
326
such that the z-axis is aligned with the north and south poles, leaving the x-axis
302
327
and y-axis to lie in the plane containing the equator. The axes are aligned such that
@@ -311,10 +336,17 @@ def geolocation(self):
311
336
<timestamp> is a time_struct
312
337
The timestamp is assigned by the modem when the geolocation grid code received from
313
338
the network is stored to the modem's internal memory.
339
+
314
340
The timestamp used by the modem is Iridium system time, which is a running count of
315
- 90 millisecond intervals, since Sunday May 11, 2014, at 14:23:55 UTC.
341
+ 90 millisecond intervals, since Sunday May 11, 2014, at 14:23:55 UTC (the most recent
342
+ Iridium epoch).
316
343
The timestamp returned by the modem is a 32-bit integer displayed in hexadecimal form.
317
344
We convert the modem's timestamp and return it as a time_struct.
345
+
346
+ The system time value is always expressed in UTC time.
347
+
348
+ Returns a tuple:
349
+ (int, int, int, time_struct)
318
350
"""
319
351
resp = self ._uart_xfer ("-MSGEO" )
320
352
if resp [- 1 ].strip ().decode () == "OK" :
@@ -347,18 +379,29 @@ def geolocation(self):
347
379
int (temp [2 ]),
348
380
time_now ,
349
381
]
350
- return values
351
- return None
382
+ return tuple ( values )
383
+ return ( None ,) * 4
352
384
353
385
@property
354
- def timestamp (self ):
355
- """
356
- Return the current date and time as given by the Iridium network
357
- The timestamp is assigned by the modem when the geolocation grid code received from
358
- the network is stored to the modem's internal memory.
386
+ def system_time (self ):
387
+ """Current date and time as given by the Iridium network.
388
+
389
+ The system time is available and valid only after the ISU has registered with
390
+ the network and has received the Iridium system time from the network.
391
+ Once the time is received, the ISU uses its internal clock to increment the counter.
392
+ In addition, at least every 8 hours, or on location update or other event that
393
+ requires re-registration, the ISU will obtain a new system time from the network.
394
+
359
395
The timestamp used by the modem is Iridium system time, which is a running count of
360
- 90 millisecond intervals, since Sunday May 11, 2014, at 14:23:55 UTC.
396
+ 90 millisecond intervals, since Sunday May 11, 2014, at 14:23:55 UTC (the most recent
397
+ Iridium epoch).
398
+ The timestamp returned by the modem is a 32-bit integer displayed in hexadecimal form.
361
399
We convert the modem's timestamp and return it as a time_struct.
400
+
401
+ The system time value is always expressed in UTC time.
402
+
403
+ Returns:
404
+ time_struct
362
405
"""
363
406
resp = self ._uart_xfer ("-MSSTM" )
364
407
if resp [- 1 ].strip ().decode () == "OK" :
0 commit comments