File tree Expand file tree Collapse file tree 3 files changed +6
-7
lines changed Expand file tree Collapse file tree 3 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 2626
2727from senml import *
2828import time
29- from cbor2 import decoder
29+ import cbor2
3030
3131pack = SenmlPack ("device_name" )
3232
3838 cbor_val = pack .to_cbor ()
3939 print (cbor_val )
4040 print (cbor_val .hex ())
41- print (decoder .loads (cbor_val )) # convert to string again so we can print it.
41+ print (cbor2 .loads (cbor_val )) # convert to string again so we can print it.
4242 time .sleep (1 )
Original file line number Diff line number Diff line change 11metadata (
22 description = "SenML serialisation for MicroPython." ,
3- version = "0.1.0 " ,
3+ version = "0.1.1 " ,
44 pypi_publish = "micropython-senml" ,
55)
66
Original file line number Diff line number Diff line change 2727from senml .senml_record import SenmlRecord
2828from senml .senml_base import SenmlBase
2929import json
30- from cbor2 import encoder
31- from cbor2 import decoder
30+ import cbor2
3231
3332
3433class SenmlPackIterator :
@@ -278,7 +277,7 @@ def from_cbor(self, data):
278277 :param data: a byte array.
279278 :return: None
280279 """
281- records = decoder .loads (data ) # load the raw senml data
280+ records = cbor2 .loads (data ) # load the raw senml data
282281 naming_map = {
283282 "bn" : - 2 ,
284283 "bt" : - 3 ,
@@ -320,7 +319,7 @@ def to_cbor(self):
320319 }
321320 converted = []
322321 self ._build_rec_dict (naming_map , converted )
323- return encoder .dumps (converted )
322+ return cbor2 .dumps (converted )
324323
325324 def add (self , item ):
326325 """
You can’t perform that action at this time.
0 commit comments