本文整理汇总了Python中sbp.SBP类的典型用法代码示例。如果您正苦于以下问题:Python SBP类的具体用法?Python SBP怎么用?Python SBP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SBP类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: from_json
def from_json(s):
"""Given a JSON-encoded string s, build a message object.
"""
d = json.loads(s)
sbp = SBP.from_json_dict(d)
return MsgEphemerisOld(sbp)
示例2: from_json
def from_json(s):
"""Given a JSON-encoded string s, build a message object.
"""
d = json.loads(s)
sbp = SBP.from_json_dict(d)
return MsgBaselineNED(sbp)
示例3: from_json
def from_json(data):
"""Given a JSON-encoded message, build an object.
"""
d = json.loads(data)
sbp = SBP.from_json_dict(d)
return MsgIarState(sbp)
示例4: from_json
def from_json(s):
"""Given a JSON-encoded string s, build a message object.
"""
d = json.loads(s)
sbp = SBP.from_json_dict(d)
return MsgFileioReadDir(sbp)
示例5: from_json
def from_json(s):
"""Given a JSON-encoded string s, build a message object.
"""
d = json.loads(s)
sbp = SBP.from_json_dict(d)
return MsgStmFlashUnlockSector(sbp)
示例6: from_json
def from_json(s):
"""Given a JSON-encoded string s, build a message object.
"""
d = json.loads(s)
sbp = SBP.from_json_dict(d)
return MsgSettingsReadByIndex(sbp)
示例7: assert_package
def assert_package(test_filename, pkg_name):
"""
Runs unit tests for message bindings by reading a YAML unit test
specification, parsing a raw packet for each test, and then
asserting that SBP messages and parsed payloads have their intended
values.
Parameters
----------
test_filename : str
Filepath to unit test specifications
pkg_name : str
Name of package to test
"""
with open(test_filename, 'r') as f:
pkg = yaml.load(f.read())
_assert_sane_package(pkg_name, pkg)
for test_case in pkg['tests']:
sbp = SBP.unpack(base64.standard_b64decode(test_case['raw_packet']))
_assert_sbp(sbp, test_case['sbp'])
_assert_msg(dispatch(sbp), test_case['msg'])
_assert_msg_roundtrip(dispatch(sbp), test_case['raw_packet'])
_assert_msg_roundtrip_json(dispatch(sbp), test_case['raw_json'])
_assert_materialization(test_case['msg'], sbp, test_case['raw_json'])
示例8: from_json
def from_json(data):
"""Given a JSON-encoded message, build an object.
"""
d = json.loads(data)
sbp = SBP.from_json_dict(d)
return MsgBootloaderHandshake(sbp)
示例9: from_json
def from_json(data):
"""Given a JSON-encoded message, build an object.
"""
d = json.loads(data)
sbp = SBP.from_json_dict(d)
return MsgM25FlashWriteStatus(sbp)
示例10: from_json
def from_json(data):
"""Given a JSON-encoded message, build an object.
"""
d = json.loads(data)
sbp = SBP.from_json_dict(d)
return MsgSettingsReadByIndex(sbp)
示例11: from_json
def from_json(s):
"""Given a JSON-encoded string s, build a message object.
"""
d = json.loads(s)
sbp = SBP.from_json_dict(d)
return MsgBootloaderHandshake(sbp)