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 MsgMaskSatellite(sbp)
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 MsgBootloaderHandshakeDepA(sbp)
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 MsgStmUniqueIdResp(sbp)
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'])
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 MsgM25FlashWriteStatus(sbp)
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 MsgFlashReadReq(sbp)
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)
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 MsgResetFilters(sbp)
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 MsgBaselineHeading(sbp)
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 MsgSettingsReadByIndexResp(sbp)
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 MsgEphemerisDepA(sbp)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgSbasRaw(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgTweet(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgAcqSvProfile(sbp, **d)
def pull_it(data): handler.framer.write(SBP.from_json(data).pack())
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgCwStart(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgInsStatus(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgInsUpdates(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgSettingsReadByIndexDone(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgSettingsReadResp(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgIarState(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgUartStateDepa(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgThreadState(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgInitBase(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgResetFilters(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgFileioRemove(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgSetTime(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgSettingsSave(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgBasePosECEF(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgSettingsRegister(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgFileioReadDirResp(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgCwResults(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgFileioWriteResp(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgBootloaderJumpToApp(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgAcqResultDepA(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgNapDeviceDnaResp(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgOdometry(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgBootloaderHandshakeReq(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgPrintDep(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgFileioConfigResp(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgDeviceMonitor(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgAlmanac(sbp, **d)
def test_udp_logger(): msg = SBP(1, 2, 3, 'abc', 4) handler = udp_handler(msg.pack()) ip, port = udp_server(handler) with UdpLogger(ip, port) as udp: udp(msg)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgMaskSatellite(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgMagRaw(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgStartup(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgTrackingStateDetailedDep(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgTrackingIq(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgSsrOrbitClockDepA(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgCsacTelemetryLabels(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgMeasurementState(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgSsrPhaseBiases(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgObs(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgExtEvent(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgEphemerisDepA(sbp, **d)
def from_json_dict(d): sbp = SBP.from_json_dict(d) return MsgHeartbeat(sbp, **d)