consistent naming
parent
a5c640a51b
commit
25d88009b6
|
@ -5,5 +5,5 @@
|
|||
can/*.so
|
||||
can/build/
|
||||
can/obj/
|
||||
can/packer_impl.cpp
|
||||
can/packer_pyx.cpp
|
||||
can/parser_pyx.cpp
|
||||
|
|
|
@ -17,12 +17,11 @@ for x in os.listdir('../'):
|
|||
libdbc = env.SharedLibrary('libdbc', ["dbc.cc", "parser.cc", "packer.cc", "common.cc"]+dbcs, LIBS=["capnp", "kj"])
|
||||
|
||||
# packer
|
||||
env.Command(['packer_impl.so'],
|
||||
['packer_impl.pyx', 'packer_setup.py'],
|
||||
"cd opendbc/can && python3 packer_setup.py build_ext --inplace")
|
||||
env.Command(['packer_pyx.so'],
|
||||
['packer_pyx.pyx', 'packer_pyx_setup.py'],
|
||||
"cd opendbc/can && python3 packer_pyx_setup.py build_ext --inplace")
|
||||
|
||||
# parser
|
||||
env.Command(['parser_pyx.so'],
|
||||
[libdbc, cereal, 'parser_pyx_setup.py', 'parser_pyx.pyx', 'common.pxd'],
|
||||
"cd opendbc/can && python3 parser_pyx_setup.py build_ext --inplace")
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# pylint: skip-file
|
||||
from opendbc.can.packer_impl import CANPacker
|
||||
from opendbc.can.packer_pyx import CANPacker
|
||||
assert CANPacker
|
||||
|
|
|
@ -6,4 +6,4 @@ from common.cython_hacks import BuildExtWithoutPlatformSuffix
|
|||
|
||||
setup(name='CAN Packer API Implementation',
|
||||
cmdclass={'build_ext': BuildExtWithoutPlatformSuffix},
|
||||
ext_modules=cythonize(Extension("packer_impl", ["packer_impl.pyx"], language="c++", extra_compile_args=["-std=c++11"])))
|
||||
ext_modules=cythonize(Extension("packer_pyx", ["packer_pyx.pyx"], language="c++", extra_compile_args=["-std=c++11"])))
|
|
@ -4,7 +4,27 @@ import unittest
|
|||
|
||||
from opendbc.can.parser import CANParser
|
||||
from opendbc.can.packer import CANPacker
|
||||
from opendbc.boardd.boardd import can_list_to_can_capnp
|
||||
import cereal.messaging as messaging
|
||||
|
||||
|
||||
# Python implementation so we don't have to depend on boardd
|
||||
def can_list_to_can_capnp(can_msgs, msgtype='can'):
|
||||
dat = messaging.new_message()
|
||||
dat.init(msgtype, len(can_msgs))
|
||||
|
||||
for i, can_msg in enumerate(can_msgs):
|
||||
if msgtype == 'sendcan':
|
||||
cc = dat.sendcan[i]
|
||||
else:
|
||||
cc = dat.can[i]
|
||||
|
||||
cc.address = can_msg[0]
|
||||
cc.busTime = can_msg[1]
|
||||
cc.dat = bytes(can_msg[2])
|
||||
cc.src = can_msg[3]
|
||||
|
||||
return dat.to_bytes()
|
||||
|
||||
|
||||
class TestCanParserPacker(unittest.TestCase):
|
||||
def test_civic(self):
|
||||
|
|
Loading…
Reference in New Issue