- add message handler for over the air updates
This commit is contained in:
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
- add message handler for over the air updates
|
||||||
|
- add unit tests for ota messages
|
||||||
|
- add unit test for int64 data type
|
||||||
|
- cleanup msg_get_time_handler
|
||||||
- remove python packages setuptools, wheel, pip from final image to reduce the attack surface
|
- remove python packages setuptools, wheel, pip from final image to reduce the attack surface
|
||||||
|
|
||||||
## [0.5.3] - 2023-11-12
|
## [0.5.3] - 2023-11-12
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ class Control:
|
|||||||
def is_ind(self) -> bool:
|
def is_ind(self) -> bool:
|
||||||
return (self.ctrl == 0x91)
|
return (self.ctrl == 0x91)
|
||||||
|
|
||||||
# def is_req(self) -> bool:
|
def is_req(self) -> bool:
|
||||||
# return not (self.ctrl & 0x08)
|
return (self.ctrl == 0x70)
|
||||||
|
|
||||||
def is_resp(self) -> bool:
|
def is_resp(self) -> bool:
|
||||||
return (self.ctrl == 0x99)
|
return (self.ctrl == 0x99)
|
||||||
@@ -93,6 +93,7 @@ class Message(metaclass=IterRegistry):
|
|||||||
self.new_data = {}
|
self.new_data = {}
|
||||||
self.switch = {
|
self.switch = {
|
||||||
0x00: self.msg_contact_info,
|
0x00: self.msg_contact_info,
|
||||||
|
0x13: self.msg_ota_update,
|
||||||
0x22: self.msg_get_time,
|
0x22: self.msg_get_time,
|
||||||
0x71: self.msg_collector_data,
|
0x71: self.msg_collector_data,
|
||||||
0x04: self.msg_inverter_data,
|
0x04: self.msg_inverter_data,
|
||||||
@@ -391,6 +392,15 @@ class Message(metaclass=IterRegistry):
|
|||||||
if update:
|
if update:
|
||||||
self.new_data[key] = True
|
self.new_data[key] = True
|
||||||
|
|
||||||
|
def msg_ota_update(self):
|
||||||
|
if self.ctrl.is_req():
|
||||||
|
pass
|
||||||
|
elif self.ctrl.is_ind():
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
self.inc_counter('Unknown_Ctrl')
|
||||||
|
self.forward(self._recv_buffer, self.header_len+self.data_len)
|
||||||
|
|
||||||
def msg_unknown(self):
|
def msg_unknown(self):
|
||||||
logger.warning(f"Unknow Msg: ID:{self.msg_id}")
|
logger.warning(f"Unknow Msg: ID:{self.msg_id}")
|
||||||
self.inc_counter('Unknown_Msg')
|
self.inc_counter('Unknown_Msg')
|
||||||
|
|||||||
Reference in New Issue
Block a user