continued hk parsing
This commit is contained in:
@ -18,8 +18,7 @@ class TmTcpServer:
|
||||
|
||||
_Instance = None
|
||||
|
||||
def __init__(
|
||||
self):
|
||||
def __init__(self):
|
||||
|
||||
self.server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
|
||||
@ -65,7 +64,7 @@ class TmTcpServer:
|
||||
|
||||
# dle encode the bytes
|
||||
# adding a newline because someone might want to look at it in a console
|
||||
data_json_bytes = self.dle_encoder.encode(data_json_bytes + b'\n')
|
||||
data_json_bytes = self.dle_encoder.encode(data_json_bytes + b"\n")
|
||||
|
||||
try:
|
||||
sent_length = self.client_connection.send(data_json_bytes)
|
||||
@ -76,27 +75,25 @@ class TmTcpServer:
|
||||
self.client_connection.close()
|
||||
self.client_connection = None
|
||||
|
||||
def report_raw_hk_data(self, object_id: ObjectId,
|
||||
set_id: int,
|
||||
hk_data: bytes):
|
||||
def report_raw_hk_data(self, object_id: ObjectId, set_id: int, hk_data: bytes):
|
||||
|
||||
data_dict = {}
|
||||
data_dict["type"] = "TM"
|
||||
data_dict["tmType"] = "Raw HK"
|
||||
data_dict["objectId"] = object_id.as_string
|
||||
data_dict["setId"] = set_id
|
||||
data_dict["rawData"] = base64.b64encode(hk_data).decode()
|
||||
data_dict = {
|
||||
"type": "TM",
|
||||
"tmType": "Raw HK",
|
||||
"objectId": object_id.as_string,
|
||||
"setId": set_id,
|
||||
"rawData": base64.b64encode(hk_data).decode(),
|
||||
}
|
||||
|
||||
self._send_dictionary_over_socket(data_dict)
|
||||
|
||||
def report_parsed_hk_data(self, object_id: ObjectId,
|
||||
set_id: int,
|
||||
data_dictionary):
|
||||
data_dict = {}
|
||||
data_dict["type"] = "TM"
|
||||
data_dict["tmType"] = "Parsed HK"
|
||||
data_dict["objectId"] = object_id.as_string
|
||||
data_dict["setId"] = set_id
|
||||
data_dict["content"] = data_dictionary
|
||||
def report_parsed_hk_data(self, object_id: ObjectId, set_id: int, data_dictionary):
|
||||
data_dict = {
|
||||
"type": "TM",
|
||||
"tmType": "Parsed HK",
|
||||
"objectId": object_id.as_string,
|
||||
"setId": set_id,
|
||||
"content": data_dictionary,
|
||||
}
|
||||
|
||||
self._send_dictionary_over_socket(data_dict)
|
||||
self._send_dictionary_over_socket(data_dict)
|
||||
|
Reference in New Issue
Block a user