Skip to content

Commit d46771d

Browse files
committed
when secondary transmission is enabled, consider as success if even 1 of the two connections and data transmissions is successful. Also report connection and transmission status of secondary connection to the message transmitted via the primary connection
1 parent a8c8a70 commit d46771d

3 files changed

Lines changed: 24 additions & 13 deletions

File tree

insighioNode/apps/demo_console/cellular.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,17 @@ def connect(cfg):
146146
set_value(
147147
results,
148148
"status",
149-
status == cellular.MODEM_CONNECTED and tc_success and (not is_secondary_transfer_protocol_enabled or tc_secondary_success),
149+
status == cellular.MODEM_CONNECTED and tc_success,
150150
)
151151

152+
if is_secondary_transfer_protocol_enabled:
153+
logging.debug("tc_secondary_success: {}".format(tc_secondary_success))
154+
set_value(
155+
results,
156+
"secondary_conn_status",
157+
1 if tc_secondary_success else 0,
158+
)
159+
152160
return results
153161

154162

@@ -158,8 +166,10 @@ def is_connected():
158166
modem_instance
159167
and transfer_client
160168
and modem_instance.is_connected()
161-
and transfer_client.is_connected()
162-
and (not is_secondary_transfer_protocol_enabled or (transfer_secondary_client and transfer_secondary_client.is_connected()))
169+
and (
170+
transfer_client.is_connected()
171+
or (not is_secondary_transfer_protocol_enabled or (transfer_secondary_client and transfer_secondary_client.is_connected()))
172+
)
163173
)
164174

165175

insighioNode/apps/demo_console/message_buffer.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,18 +131,21 @@ def parse_stored_measurements_and_upload(network):
131131
data = json.loads(line)
132132
update_timestamp_based_on_diff_dt(data, True)
133133

134-
message = network.create_message(cfg.get("device_id"), data)
135-
message_send_status = network.send_message(cfg, message)
136-
137-
completed_without_errors &= message_send_status
138-
139-
logging.debug("Message send status: " + str(message_send_status))
140-
141134
if utils.get_var_from_module(network, "is_secondary_transfer_protocol_enabled"):
142135
message_sec = network.create_secondary_message(cfg.get("device_id"), data)
143136
message_sec_send_status = network.send_secondary_message(cfg, message_sec)
144137
logging.debug("Secondary message send status: " + str(message_sec_send_status))
145-
completed_without_errors &= message_sec_send_status
138+
data["secondary_message_send_status"] = {"value": 1 if message_sec_send_status else 0}
139+
# completed_without_errors &= message_sec_send_status
140+
else:
141+
message_sec_send_status = True
142+
143+
message = network.create_message(cfg.get("device_id"), data)
144+
message_send_status = network.send_message(cfg, message)
145+
146+
completed_without_errors &= message_send_status or message_sec_send_status
147+
148+
logging.debug("Message send status: {}, message_sec_send_status: {}".format(message_send_status, message_sec_send_status))
146149

147150
# this only works for BG600 modem since it supports correct message transmission status
148151
if message_send_status is not None and not message_send_status:

insighioNode/apps/demo_console/templ/common_templ.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@
5353
""" System configuration options """
5454
_WD_PERIOD = 120 # watchdog time for rebooting in seconds
5555

56-
_STORE_MEASUREMENT_IF_FAILED_CONNECTION=<store-meas-if-failed-conn>
57-
5856
_SYSTEM_SETTINGS = '<system-settings>'
5957

6058
_LOW_LATENCY_MODE_ON = <low-latency-mode-on>

0 commit comments

Comments
 (0)