Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 1 addition & 27 deletions generator/sbpg/targets/pythonNG.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,31 +87,6 @@ def numba_type(f):
return '__' + f.identifier


def numba_size(f):
# the worst case 255 - 6 (header) - 2 (crc)
UNKNOWN_LEN = 255 - 6 - 2

if f.type_id in NUMBA_TY_BYTES:
return NUMBA_TY_BYTES[f.type_id]
elif f.type_id == 'string':
if f.options.get('size', None) is not None:
return f.options.get('size', None).value
return UNKNOWN_LEN
elif f.type_id == 'array':
# NOTE: arrays of arrays are not supported
t = f.options['fill'].value
count = f.options.get('size', None)
if count:
if t in NUMBA_TY_BYTES:
return "%d * %d" % (NUMBA_TY_BYTES[t], count.value)
else:
return t + "._payload_size() * %d" % (count.value)
else:
return UNKNOWN_LEN
else:
return f.type_id + '._payload_size()'


def numba_format(f):
if NUMBA_GET_FN.get(f.type_id, None):
return NUMBA_GET_FN.get(f.type_id)
Expand Down Expand Up @@ -164,7 +139,6 @@ def classnameify(s):

JENV.filters['numba_py'] = numba_format
JENV.filters['numba_type'] = numba_type
JENV.filters['numba_size'] = numba_size
JENV.filters['classnameify'] = classnameify
JENV.filters['pydoc'] = pydoc_format
JENV.filters['comment_links'] = comment_links
Expand All @@ -174,7 +148,7 @@ def render_source(output_dir, package_spec, jenv=JENV):
"""
Render and output
"""
path, name = package_spec.filepath
_path, name = package_spec.filepath
directory = output_dir
destination_filename = "%s/%s.py" % (directory, name)
py_template = jenv.get_template(TEMPLATE_NAME)
Expand Down
11 changes: 0 additions & 11 deletions generator/sbpg/targets/resources/sbp_numba.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,9 @@ class ((( m.identifier )))(object):
((*- endfor *))
return res, off, length

@classmethod
def _payload_size(self):
ret = 0
((*- for f in m.fields *))
# (((f.identifier))): (((f.type_id))) ((*- if f.options['fill'] *)) of (((f.options['fill'].value))) ((*- endif *))
ret += (((f | numba_size)))
((*- endfor *))
return ret
((* else *))
def _unpack_members(self, buf, offset, length):
return {}, offset, length

def _payload_size(self):
return 0
((* endif *))
((*- endif *))
((*- endfor *))
Expand Down
116 changes: 0 additions & 116 deletions python/sbp/jit/acquisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,6 @@ def _unpack_members(self, buf, offset, length):
self.sid = res['sid']
return res, off, length

@classmethod
def _payload_size(self):
ret = 0
# cn0: float
ret += 4
# cp: float
ret += 4
# cf: float
ret += 4
# sid: GnssSignal
ret += GnssSignal._payload_size()
return ret

SBP_MSG_ACQ_RESULT_DEP_C = 0x001F
class MsgAcqResultDepC(SBP):
Expand Down Expand Up @@ -126,18 +114,6 @@ def _unpack_members(self, buf, offset, length):
self.sid = res['sid']
return res, off, length

@classmethod
def _payload_size(self):
ret = 0
# cn0: float
ret += 4
# cp: float
ret += 4
# cf: float
ret += 4
# sid: GnssSignalDep
ret += GnssSignalDep._payload_size()
return ret

SBP_MSG_ACQ_RESULT_DEP_B = 0x0014
class MsgAcqResultDepB(SBP):
Expand Down Expand Up @@ -179,18 +155,6 @@ def _unpack_members(self, buf, offset, length):
self.sid = res['sid']
return res, off, length

@classmethod
def _payload_size(self):
ret = 0
# snr: float
ret += 4
# cp: float
ret += 4
# cf: float
ret += 4
# sid: GnssSignalDep
ret += GnssSignalDep._payload_size()
return ret

SBP_MSG_ACQ_RESULT_DEP_A = 0x0015
class MsgAcqResultDepA(SBP):
Expand Down Expand Up @@ -232,18 +196,6 @@ def _unpack_members(self, buf, offset, length):
self.prn = res['prn']
return res, off, length

@classmethod
def _payload_size(self):
ret = 0
# snr: float
ret += 4
# cp: float
ret += 4
# cf: float
ret += 4
# prn: u8
ret += 1
return ret

class AcqSvProfile(object):
"""SBP class for message AcqSvProfile
Expand Down Expand Up @@ -319,34 +271,6 @@ def _unpack_members(self, buf, offset, length):
self.cp = res['cp']
return res, off, length

@classmethod
def _payload_size(self):
ret = 0
# job_type: u8
ret += 1
# status: u8
ret += 1
# cn0: u16
ret += 2
# int_time: u8
ret += 1
# sid: GnssSignal
ret += GnssSignal._payload_size()
# bin_width: u16
ret += 2
# timestamp: u32
ret += 4
# time_spent: u32
ret += 4
# cf_min: s32
ret += 4
# cf_max: s32
ret += 4
# cf: s32
ret += 4
# cp: u32
ret += 4
return ret

class AcqSvProfileDep(object):
"""SBP class for message AcqSvProfileDep
Expand Down Expand Up @@ -419,34 +343,6 @@ def _unpack_members(self, buf, offset, length):
self.cp = res['cp']
return res, off, length

@classmethod
def _payload_size(self):
ret = 0
# job_type: u8
ret += 1
# status: u8
ret += 1
# cn0: u16
ret += 2
# int_time: u8
ret += 1
# sid: GnssSignalDep
ret += GnssSignalDep._payload_size()
# bin_width: u16
ret += 2
# timestamp: u32
ret += 4
# time_spent: u32
ret += 4
# cf_min: s32
ret += 4
# cf_max: s32
ret += 4
# cf: s32
ret += 4
# cp: u32
ret += 4
return ret

SBP_MSG_ACQ_SV_PROFILE = 0x002E
class MsgAcqSvProfile(SBP):
Expand Down Expand Up @@ -478,12 +374,6 @@ def _unpack_members(self, buf, offset, length):
self.acq_sv_profile = res['acq_sv_profile']
return res, off, length

@classmethod
def _payload_size(self):
ret = 0
# acq_sv_profile: array of AcqSvProfile
ret += 247
return ret

SBP_MSG_ACQ_SV_PROFILE_DEP = 0x001E
class MsgAcqSvProfileDep(SBP):
Expand Down Expand Up @@ -513,12 +403,6 @@ def _unpack_members(self, buf, offset, length):
self.acq_sv_profile = res['acq_sv_profile']
return res, off, length

@classmethod
def _payload_size(self):
ret = 0
# acq_sv_profile: array of AcqSvProfileDep
ret += 247
return ret


msg_classes = {
Expand Down
32 changes: 0 additions & 32 deletions python/sbp/jit/bootload.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ class MsgBootloaderHandshakeReq(SBP):
__slots__ = []
def _unpack_members(self, buf, offset, length):
return {}, offset, length

def _payload_size(self):
return 0

SBP_MSG_BOOTLOADER_HANDSHAKE_RESP = 0x00B4
class MsgBootloaderHandshakeResp(SBP):
Expand Down Expand Up @@ -91,14 +88,6 @@ def _unpack_members(self, buf, offset, length):
self.version = res['version']
return res, off, length

@classmethod
def _payload_size(self):
ret = 0
# flags: u32
ret += 4
# version: string
ret += 247
return ret

SBP_MSG_BOOTLOADER_JUMP_TO_APP = 0x00B1
class MsgBootloaderJumpToApp(SBP):
Expand Down Expand Up @@ -129,12 +118,6 @@ def _unpack_members(self, buf, offset, length):
self.jump = res['jump']
return res, off, length

@classmethod
def _payload_size(self):
ret = 0
# jump: u8
ret += 1
return ret

SBP_MSG_NAP_DEVICE_DNA_REQ = 0x00DE
class MsgNapDeviceDnaReq(SBP):
Expand All @@ -157,9 +140,6 @@ class MsgNapDeviceDnaReq(SBP):
__slots__ = []
def _unpack_members(self, buf, offset, length):
return {}, offset, length

def _payload_size(self):
return 0

SBP_MSG_NAP_DEVICE_DNA_RESP = 0x00DD
class MsgNapDeviceDnaResp(SBP):
Expand Down Expand Up @@ -195,12 +175,6 @@ def _unpack_members(self, buf, offset, length):
self.dna = res['dna']
return res, off, length

@classmethod
def _payload_size(self):
ret = 0
# dna: array of u8
ret += 1 * 8
return ret

SBP_MSG_BOOTLOADER_HANDSHAKE_DEP_A = 0x00B0
class MsgBootloaderHandshakeDepA(SBP):
Expand Down Expand Up @@ -230,12 +204,6 @@ def _unpack_members(self, buf, offset, length):
self.handshake = res['handshake']
return res, off, length

@classmethod
def _payload_size(self):
ret = 0
# handshake: array of u8
ret += 247
return ret


msg_classes = {
Expand Down
14 changes: 0 additions & 14 deletions python/sbp/jit/ext_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,6 @@ def _unpack_members(self, buf, offset, length):
self.pin = res['pin']
return res, off, length

@classmethod
def _payload_size(self):
ret = 0
# wn: u16
ret += 2
# tow: u32
ret += 4
# ns_residual: s32
ret += 4
# flags: u8
ret += 1
# pin: u8
ret += 1
return ret


msg_classes = {
Expand Down
Loading