File tree 3 files changed +6
-7
lines changed
3 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 26
26
27
27
from senml import *
28
28
import time
29
- from cbor2 import decoder
29
+ import cbor2
30
30
31
31
pack = SenmlPack ("device_name" )
32
32
38
38
cbor_val = pack .to_cbor ()
39
39
print (cbor_val )
40
40
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.
42
42
time .sleep (1 )
Original file line number Diff line number Diff line change 1
1
metadata (
2
2
description = "SenML serialisation for MicroPython." ,
3
- version = "0.1.0 " ,
3
+ version = "0.1.1 " ,
4
4
pypi_publish = "micropython-senml" ,
5
5
)
6
6
Original file line number Diff line number Diff line change 27
27
from senml .senml_record import SenmlRecord
28
28
from senml .senml_base import SenmlBase
29
29
import json
30
- from cbor2 import encoder
31
- from cbor2 import decoder
30
+ import cbor2
32
31
33
32
34
33
class SenmlPackIterator :
@@ -278,7 +277,7 @@ def from_cbor(self, data):
278
277
:param data: a byte array.
279
278
:return: None
280
279
"""
281
- records = decoder .loads (data ) # load the raw senml data
280
+ records = cbor2 .loads (data ) # load the raw senml data
282
281
naming_map = {
283
282
"bn" : - 2 ,
284
283
"bt" : - 3 ,
@@ -320,7 +319,7 @@ def to_cbor(self):
320
319
}
321
320
converted = []
322
321
self ._build_rec_dict (naming_map , converted )
323
- return encoder .dumps (converted )
322
+ return cbor2 .dumps (converted )
324
323
325
324
def add (self , item ):
326
325
"""
You can’t perform that action at this time.
0 commit comments