From 5d5fdd6ae2396ed19a5ee365933d971dcd2a4057 Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Tue, 3 Dec 2019 09:16:11 -0800 Subject: [PATCH] no more python version of libdbc, everything through cython --- can/libdbc_py.py | 93 ------------------------------------------------ 1 file changed, 93 deletions(-) delete mode 100644 can/libdbc_py.py diff --git a/can/libdbc_py.py b/can/libdbc_py.py deleted file mode 100644 index 26fedf2..0000000 --- a/can/libdbc_py.py +++ /dev/null @@ -1,93 +0,0 @@ -import os - -from cffi import FFI - -can_dir = os.path.dirname(os.path.abspath(__file__)) -libdbc_fn = os.path.join(can_dir, "libdbc.so") - -ffi = FFI() -ffi.cdef(""" - -typedef struct { - const char* name; - double value; -} SignalPackValue; - -typedef struct { - uint32_t address; - const char* name; - double default_value; -} SignalParseOptions; - -typedef struct { - uint32_t address; - int check_frequency; -} MessageParseOptions; - -typedef struct { - uint32_t address; - uint16_t ts; - const char* name; - double value; -} SignalValue; - - -typedef enum { - DEFAULT, - HONDA_CHECKSUM, - HONDA_COUNTER, - TOYOTA_CHECKSUM, - PEDAL_CHECKSUM, - PEDAL_COUNTER, - VOLKSWAGEN_CHECKSUM, - VOLKSWAGEN_COUNTER, -} SignalType; - -typedef struct { - const char* name; - int b1, b2, bo; - bool is_signed; - double factor, offset; - SignalType type; -} Signal; - -typedef struct { - const char* name; - uint32_t address; - unsigned int size; - size_t num_sigs; - const Signal *sigs; -} Msg; - -typedef struct { - const char* name; - uint32_t address; - const char* def_val; - const Signal *sigs; -} Val; - -typedef struct { - const char* name; - size_t num_msgs; - const Msg *msgs; - const Val *vals; - size_t num_vals; -} DBC; - - -void* can_init(int bus, const char* dbc_name, - size_t num_message_options, const MessageParseOptions* message_options, - size_t num_signal_options, const SignalParseOptions* signal_options); - -void can_update_string(void *can, const char* dat, int len); - -size_t can_query_latest(void* can, bool *out_can_valid, size_t out_values_size, SignalValue* out_values); - -const DBC* dbc_lookup(const char* dbc_name); - -void* canpack_init(const char* dbc_name); - -uint64_t canpack_pack(void* inst, uint32_t address, size_t num_vals, const SignalPackValue *vals, int counter); -""") - -libdbc = ffi.dlopen(libdbc_fn)