1
1
import asyncio
2
+ import binascii
2
3
import enum
3
4
import logging
4
5
@@ -32,21 +33,21 @@ class ModemStatus(t.uint8_t, t.UndefinedEnum):
32
33
'queued_at' : (0x09 , (t .uint8_t , t .ATCommand , t .Bytes ), 0x88 ),
33
34
'remote_at' : (0x17 , (), None ),
34
35
'tx' : (0x10 , (), None ),
35
- 'tx_explicit' : (0x11 , (t .uint8_t , t .EUI64 , t .uint16_t , t .uint8_t , t .uint8_t , t .uint16_t , t .uint16_t , t .uint8_t , t .uint8_t , t .Bytes ), None ),
36
- 'create_source_route' : (0x21 , (), None ),
36
+ 'tx_explicit' : (0x11 , (t .uint8_t , t .EUI64 , t .NWK , t .uint8_t , t .uint8_t , t .uint16_t , t .uint16_t , t .uint8_t , t .uint8_t , t .Bytes ), None ),
37
+ 'create_source_route' : (0x21 , (t . uint8_t , t . EUI64 , t . NWK , t . uint8_t , LVList ( t . NWK ) ), None ),
37
38
'register_joining_device' : (0x24 , (), None ),
38
39
39
40
'at_response' : (0x88 , (t .uint8_t , t .ATCommand , t .uint8_t , t .Bytes ), None ),
40
41
'modem_status' : (0x8A , (ModemStatus , ), None ),
41
- 'tx_status' : (0x8B , (t .uint8_t , t .uint16_t , t .uint8_t , t .uint8_t , t .uint8_t ), None ),
42
+ 'tx_status' : (0x8B , (t .uint8_t , t .NWK , t .uint8_t , t .uint8_t , t .uint8_t ), None ),
42
43
'route_information' : (0x8D , (), None ),
43
44
'rx' : (0x90 , (), None ),
44
- 'explicit_rx_indicator' : (0x91 , (t .EUI64 , t .uint16_t , t .uint8_t , t .uint8_t , t .uint16_t , t .uint16_t , t .uint8_t , t .Bytes ), None ),
45
+ 'explicit_rx_indicator' : (0x91 , (t .EUI64 , t .NWK , t .uint8_t , t .uint8_t , t .uint16_t , t .uint16_t , t .uint8_t , t .Bytes ), None ),
45
46
'rx_io_data_long_addr' : (0x92 , (), None ),
46
47
'remote_at_response' : (0x97 , (), None ),
47
48
'extended_status' : (0x98 , (), None ),
48
- 'route_record_indicator' : (0xA1 , (t .EUI64 , t .uint16_t , t .uint8_t , LVList (t .uint16_t )), None ),
49
- 'many_to_one_rri' : (0xA3 , (), None ),
49
+ 'route_record_indicator' : (0xA1 , (t .EUI64 , t .NWK , t .uint8_t , LVList (t .NWK )), None ),
50
+ 'many_to_one_rri' : (0xA3 , (t . EUI64 , t . NWK , t . uint8_t ), None ),
50
51
'node_id_indicator' : (0x95 , (), None ),
51
52
52
53
}
@@ -261,7 +262,11 @@ def frame_received(self, data):
261
262
command = self ._commands_by_id [data [0 ]]
262
263
LOGGER .debug ("Frame received: %s" , command )
263
264
data , rest = t .deserialize (data [1 :], COMMANDS [command ][1 ])
264
- getattr (self , '_handle_%s' % (command , ))(data )
265
+ try :
266
+ getattr (self , '_handle_%s' % (command , ))(data )
267
+ except AttributeError :
268
+ LOGGER .error ("No '%s' handler. Data: %s" , command ,
269
+ binascii .hexlify (data ))
265
270
266
271
def _handle_at_response (self , data ):
267
272
fut , = self ._awaiting .pop (data [0 ])
@@ -283,6 +288,9 @@ def _handle_at_response(self, data):
283
288
response , remains = response_type .deserialize (data [3 ])
284
289
fut .set_result (response )
285
290
291
+ def _handle_many_to_one_rri (self , data ):
292
+ LOGGER .debug ("_handle_many_to_one_rri: %s" , data )
293
+
286
294
def _handle_modem_status (self , data ):
287
295
LOGGER .debug ("Handle modem status frame: %s" , data )
288
296
status = data [0 ]
0 commit comments