Skip to content

Commit

Permalink
reverting "bt" to "dt" to avoid breaking compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
ftylitak committed May 16, 2023
1 parent bb07048 commit 4a9009f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions insighioNode/apps/demo_console/cellular.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@ def get_gps_position(cfg, measurements, keep_open=False):
def create_message(device_id, measurements):
message = SenmlPackJson((device_id + '-') if device_id is not None else None)

if "bt" in measurements:
message.base_time = measurements["bt"]["value"]
if "dt" in measurements:
message.base_time = measurements["dt"]["value"]

for key in measurements:
if isinstance(measurements[key], dict):
if "unit" in measurements[key]:
message.add(SenmlRecord(key, unit=measurements[key]["unit"], value=measurements[key]["value"]))
elif key != "bt":
elif key != "dt":
message.add(SenmlRecord(key, value=measurements[key]["value"]))
elif measurements[key] is not None:
message.add(SenmlRecord(key, value=measurements[key]))
Expand Down
2 changes: 1 addition & 1 deletion insighioNode/apps/demo_console/message_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def timestamp_measurements(measurements):

# Friday, April 15, 2022
if epoch > 1650000000:
measurements["bt"] = {"value": epoch} # time offset 1970 -> 2000
measurements["dt"] = {"value": epoch} # time offset 1970 -> 2000


def store_measurement(measurements, force_store=False):
Expand Down
6 changes: 3 additions & 3 deletions insighioNode/apps/demo_console/wifi.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ def disconnect():
def create_message(device_id, measurements):
message = SenmlPackJson((device_id + '-') if device_id is not None else None)

if "bt" in measurements:
message.base_time = measurements["bt"]["value"]
if "dt" in measurements:
message.base_time = measurements["dt"]["value"]

for key in measurements:
if isinstance(measurements[key], dict):
if "unit" in measurements[key]:
message.add(SenmlRecord(key, unit=measurements[key]["unit"], value=measurements[key]["value"]))
elif key != "bt":
elif key != "dt":
message.add(SenmlRecord(key, value=measurements[key]["value"]))
elif measurements[key] is not None:
message.add(SenmlRecord(key, value=measurements[key]))
Expand Down

0 comments on commit 4a9009f

Please sign in to comment.