@@ -96,7 +96,7 @@ def create_packet(raw, operating_mode):
9696 if raw [3 ] != ApiFrameType .AT_COMMAND .code :
9797 raise InvalidPacketException ("This packet is not an AT command packet." )
9898
99- return ATCommPacket (raw [4 ], str ( raw [5 :7 ]), raw [7 :- 1 ])
99+ return ATCommPacket (raw [4 ], raw [5 :7 ]. decode ( "utf8" ), raw [7 :- 1 ])
100100
101101 def needs_id (self ):
102102 """
@@ -115,8 +115,8 @@ def _get_api_packet_spec_data(self):
115115 | :meth:`.XBeeAPIPacket._get_api_packet_spec_data`
116116 """
117117 if self .__parameter is not None :
118- return bytearray (self .__command , ' utf8' ) + self .__parameter
119- return bytearray (self .__command , ' utf8' )
118+ return bytearray (self .__command , " utf8" ) + self .__parameter
119+ return bytearray (self .__command , " utf8" )
120120
121121 def _get_api_packet_spec_data_dict (self ):
122122 """
@@ -259,7 +259,7 @@ def create_packet(raw, operating_mode):
259259 if ATCommandStatus .get (raw [7 ]) is None :
260260 raise InvalidPacketException ("Invalid command status." )
261261
262- return ATCommResponsePacket (raw [4 ], raw [5 :7 ].decode (), ATCommandStatus .get (raw [7 ]), raw [8 :- 1 ])
262+ return ATCommResponsePacket (raw [4 ], raw [5 :7 ].decode ("utf8" ), ATCommandStatus .get (raw [7 ]), raw [8 :- 1 ])
263263
264264 def needs_id (self ):
265265 """
@@ -277,7 +277,7 @@ def _get_api_packet_spec_data(self):
277277 .. seealso::
278278 | :meth:`.XBeeAPIPacket._get_api_packet_spec_data`
279279 """
280- ret = bytearray (self .__command )
280+ ret = bytearray (self .__command , "utf8" )
281281 ret .append (self .__response_status .code )
282282 if self .__comm_value is not None :
283283 ret += self .__comm_value
@@ -680,10 +680,10 @@ def create_packet(raw, operating_mode):
680680
681681 return RemoteATCommandPacket (
682682 raw [4 ],
683- XBee64BitAddress (raw [5 :12 ]),
683+ XBee64BitAddress (raw [5 :13 ]),
684684 XBee16BitAddress (raw [13 :15 ]),
685685 raw [15 ],
686- str ( raw [16 :18 ]),
686+ raw [16 :18 ]. decode ( "utf8" ),
687687 raw [18 :- 1 ]
688688 )
689689
@@ -706,7 +706,7 @@ def _get_api_packet_spec_data(self):
706706 ret = self .__x64bit_addr .address
707707 ret += self .__x16bit_addr .address
708708 ret .append (self .__transmit_options )
709- ret += bytearray (self .__command , ' utf8' )
709+ ret += bytearray (self .__command , " utf8" )
710710 return ret if self .__parameter is None else ret + self .__parameter
711711
712712 def _get_api_packet_spec_data_dict (self ):
@@ -936,7 +936,7 @@ def create_packet(raw, operating_mode):
936936 raise InvalidPacketException ("This packet is not a remote AT command response packet." )
937937
938938 return RemoteATCommandResponsePacket (raw [4 ], XBee64BitAddress (raw [5 :13 ]),
939- XBee16BitAddress (raw [13 :15 ]), str ( raw [15 :17 ].decode () ),
939+ XBee16BitAddress (raw [13 :15 ]), raw [15 :17 ].decode ("utf8" ),
940940 ATCommandStatus .get (raw [17 ]), raw [18 :- 1 ])
941941
942942 def needs_id (self ):
@@ -957,7 +957,7 @@ def _get_api_packet_spec_data(self):
957957 """
958958 ret = self .__x64bit_addr .address
959959 ret += self .__x16bit_addr .address
960- ret += bytearray (self .__command )
960+ ret += bytearray (self .__command , "utf8" )
961961 ret .append (self .__response_status .code )
962962 if self .__comm_value is not None :
963963 ret += self .__comm_value
@@ -1810,7 +1810,7 @@ def _get_api_packet_spec_data(self):
18101810 """
18111811 ret = self .__x64bit_addr .address
18121812 ret += self .__x16bit_addr .address
1813- ret .append (self .__receive_options . code )
1813+ ret .append (self .__receive_options )
18141814 if self .__rf_data is not None :
18151815 ret += self .__rf_data
18161816 return ret
0 commit comments