57
57
from ustruct import pack_into , unpack
58
58
59
59
60
- class MsgType : #pylint: disable=too-few-public-methods
60
+ class MsgType : #pylint: disable=too-few-public-methods,bad-whitespace
61
61
"""An enum-like class representing the possible message types.
62
62
Possible values are:
63
63
- ``MsgType.COMMAND``
@@ -71,7 +71,7 @@ class MsgType: #pylint: disable=too-few-public-methods
71
71
ERROR = const (0x80 ) # Error message
72
72
73
73
74
- class SDEPCommand : #pylint: disable=too-few-public-methods
74
+ class SDEPCommand : #pylint: disable=too-few-public-methods,bad-whitespace
75
75
"""An enum-like class representing the possible SDEP commands.
76
76
Possible values are:
77
77
- ``SDEPCommand.INITIALIZE``
@@ -85,7 +85,7 @@ class SDEPCommand: #pylint: disable=too-few-public-methods
85
85
BLEUART_RX = const (0x0A02 ) # BLE UART read data
86
86
87
87
88
- class ArgType : #pylint: disable=too-few-public-methods
88
+ class ArgType : #pylint: disable=too-few-public-methods,bad-whitespace
89
89
"""An enum-like class representing the possible argument types.
90
90
Possible values are
91
91
- ``ArgType.STRING``
@@ -107,7 +107,7 @@ class ArgType: #pylint: disable=too-few-public-methods
107
107
UINT8 = const (0x0800 ) # Unsigned 8-bit integer data type
108
108
109
109
110
- class ErrorCode : #pylint: disable=too-few-public-methods
110
+ class ErrorCode : #pylint: disable=too-few-public-methods,bad-whitespace
111
111
"""An enum-like class representing possible error codes.
112
112
Possible values are
113
113
- ``ErrorCode.``
@@ -151,6 +151,9 @@ def __init__(self, spi, cs, irq, debug=False):
151
151
self ._spi .unlock ()
152
152
153
153
def cmd (self , cmd ):
154
+ """Executes the supplied AT command, which must be terminated with
155
+ a new-line (\n ) character.
156
+ """
154
157
# Make sure we stay within the 20 byte limit
155
158
if len (cmd ) > 16 :
156
159
# TODO: Split command into multiple packets
@@ -180,7 +183,7 @@ def cmd(self, cmd):
180
183
if timeout <= 0 :
181
184
if self ._debug :
182
185
print ("ERROR: Timed out waiting for a response." )
183
- raise Exception ('Timed out waiting for a response.' )
186
+ raise RuntimeError ('Timed out waiting for a response.' )
184
187
185
188
# Retrieve the response message
186
189
msgtype = 0
0 commit comments