File tree Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Original file line number Diff line number Diff line change 42
42
43
43
"""
44
44
45
- # imports
46
-
47
45
__version__ = "0.0.0-auto.0"
48
46
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_RockBlock.git"
47
+
48
+
49
+ class RockBlock :
50
+ """Driver for RockBLOCK Iridium satellite modem."""
51
+
52
+ def __init__ (self , uart , baudrate = 19200 ):
53
+ self ._uart = uart
54
+ self ._uart .baudrate = baudrate
55
+
56
+ def _uart_xfer (self , cmd ):
57
+ """Send AT command and return response."""
58
+ # response = ATCMD\r\nRESP\r\n\r\nOK\r\n
59
+ # or = ATCMD\r\nERROR\r\n
60
+
61
+ cmd = str .encode ("AT" + cmd )
62
+
63
+ self ._uart .reset_input_buffer ()
64
+ self ._uart .write (cmd + "\r " )
65
+
66
+ resp = None
67
+ if self ._uart .readline ().strip () == cmd :
68
+ resp = self ._uart .readline ().strip ().decode ()
69
+
70
+ self ._uart .reset_input_buffer ()
71
+ return resp
72
+
73
+ @property
74
+ def model (self ):
75
+ """Return phone model."""
76
+ return self ._uart_xfer ("+GMM" )
You can’t perform that action at this time.
0 commit comments