Пример #1
0
  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)
Пример #2
0
  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)
Пример #3
0
  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)
Пример #4
0
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'])
Пример #5
0
  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)
Пример #6
0
  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)
Пример #7
0
  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)
Пример #8
0
  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)
Пример #9
0
    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)
Пример #10
0
  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)
Пример #11
0
    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)
Пример #12
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgSbasRaw(sbp, **d)
Пример #13
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgTweet(sbp, **d)
Пример #14
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgAcqSvProfile(sbp, **d)
Пример #15
0
 def pull_it(data):
   handler.framer.write(SBP.from_json(data).pack())
Пример #16
0
 def from_json_dict(d):
     sbp = SBP.from_json_dict(d)
     return MsgCwStart(sbp, **d)
Пример #17
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgInsStatus(sbp, **d)
Пример #18
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgInsUpdates(sbp, **d)
Пример #19
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgSettingsReadByIndexDone(sbp, **d)
Пример #20
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgSettingsReadResp(sbp, **d)
Пример #21
0
 def from_json_dict(d):
     sbp = SBP.from_json_dict(d)
     return MsgIarState(sbp, **d)
Пример #22
0
 def from_json_dict(d):
     sbp = SBP.from_json_dict(d)
     return MsgUartStateDepa(sbp, **d)
Пример #23
0
 def from_json_dict(d):
     sbp = SBP.from_json_dict(d)
     return MsgThreadState(sbp, **d)
Пример #24
0
 def from_json_dict(d):
     sbp = SBP.from_json_dict(d)
     return MsgInitBase(sbp, **d)
Пример #25
0
 def from_json_dict(d):
     sbp = SBP.from_json_dict(d)
     return MsgResetFilters(sbp, **d)
Пример #26
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgFileioRemove(sbp, **d)
Пример #27
0
 def from_json_dict(d):
     sbp = SBP.from_json_dict(d)
     return MsgSetTime(sbp, **d)
Пример #28
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgSettingsSave(sbp, **d)
Пример #29
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgBasePosECEF(sbp, **d)
Пример #30
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgSettingsRegister(sbp, **d)
Пример #31
0
 def from_json_dict(d):
     sbp = SBP.from_json_dict(d)
     return MsgFileioReadDirResp(sbp, **d)
Пример #32
0
 def from_json_dict(d):
     sbp = SBP.from_json_dict(d)
     return MsgCwResults(sbp, **d)
Пример #33
0
 def from_json_dict(d):
     sbp = SBP.from_json_dict(d)
     return MsgFileioRemove(sbp, **d)
Пример #34
0
 def from_json_dict(d):
     sbp = SBP.from_json_dict(d)
     return MsgFileioWriteResp(sbp, **d)
Пример #35
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgSettingsSave(sbp, **d)
Пример #36
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgBootloaderJumpToApp(sbp, **d)
Пример #37
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgAcqResultDepA(sbp, **d)
Пример #38
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgNapDeviceDnaResp(sbp, **d)
Пример #39
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgOdometry(sbp, **d)
Пример #40
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgBootloaderHandshakeReq(sbp, **d)
Пример #41
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgPrintDep(sbp, **d)
Пример #42
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgFileioConfigResp(sbp, **d)
Пример #43
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgFileioReadDirResp(sbp, **d)
Пример #44
0
 def from_json_dict(d):
     sbp = SBP.from_json_dict(d)
     return MsgDeviceMonitor(sbp, **d)
Пример #45
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgFileioWriteResp(sbp, **d)
Пример #46
0
 def from_json_dict(d):
     sbp = SBP.from_json_dict(d)
     return MsgAlmanac(sbp, **d)
Пример #47
0
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)
Пример #48
0
 def from_json_dict(d):
     sbp = SBP.from_json_dict(d)
     return MsgMaskSatellite(sbp, **d)
Пример #49
0
 def from_json_dict(d):
     sbp = SBP.from_json_dict(d)
     return MsgMagRaw(sbp, **d)
Пример #50
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgStartup(sbp, **d)
Пример #51
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgTrackingStateDetailedDep(sbp, **d)
Пример #52
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgTrackingIq(sbp, **d)
Пример #53
0
 def from_json_dict(d):
     sbp = SBP.from_json_dict(d)
     return MsgSsrOrbitClockDepA(sbp, **d)
Пример #54
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgCsacTelemetryLabels(sbp, **d)
Пример #55
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgMeasurementState(sbp, **d)
Пример #56
0
 def from_json_dict(d):
     sbp = SBP.from_json_dict(d)
     return MsgSsrPhaseBiases(sbp, **d)
Пример #57
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgObs(sbp, **d)
Пример #58
0
 def from_json_dict(d):
     sbp = SBP.from_json_dict(d)
     return MsgExtEvent(sbp, **d)
Пример #59
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgEphemerisDepA(sbp, **d)
Пример #60
0
 def from_json_dict(d):
   sbp = SBP.from_json_dict(d)
   return MsgHeartbeat(sbp, **d)