You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
1.4 KiB
72 lines
1.4 KiB
6 years ago
|
# distutils: language = c++
|
||
|
#cython: language_level=3
|
||
|
|
||
|
from libc.stdint cimport uint32_t, uint64_t, uint16_t
|
||
|
from libcpp.vector cimport vector
|
||
|
from libcpp.map cimport map
|
||
|
from libcpp.string cimport string
|
||
|
from libcpp.unordered_set cimport unordered_set
|
||
|
from libcpp cimport bool
|
||
|
|
||
|
|
||
|
cdef extern from "common.h":
|
||
|
|
||
|
ctypedef enum SignalType:
|
||
|
DEFAULT,
|
||
|
HONDA_CHECKSUM,
|
||
|
HONDA_COUNTER,
|
||
|
TOYOTA_CHECKSUM,
|
||
|
PEDAL_CHECKSUM,
|
||
|
PEDAL_COUNTER
|
||
|
|
||
|
cdef struct Signal:
|
||
|
const char* name
|
||
|
int b1, b2, bo
|
||
|
bool is_signed
|
||
|
double factor, offset
|
||
|
SignalType type
|
||
|
|
||
|
cdef struct Msg:
|
||
|
const char* name
|
||
|
uint32_t address
|
||
|
unsigned int size
|
||
|
size_t num_sigs
|
||
|
const Signal *sigs
|
||
|
|
||
|
cdef struct Val:
|
||
|
const char* name
|
||
|
uint32_t address
|
||
|
const char* def_val
|
||
|
const Signal *sigs
|
||
|
|
||
|
cdef struct DBC:
|
||
|
const char* name
|
||
|
size_t num_msgs
|
||
|
const Msg *msgs
|
||
|
const Val *vals
|
||
|
size_t num_vals
|
||
|
|
||
|
cdef struct SignalParseOptions:
|
||
|
uint32_t address
|
||
|
const char* name
|
||
|
double default_value
|
||
|
|
||
|
|
||
|
cdef struct MessageParseOptions:
|
||
|
uint32_t address
|
||
|
int check_frequency
|
||
|
|
||
|
cdef struct SignalValue:
|
||
|
uint32_t address
|
||
|
uint16_t ts
|
||
|
const char* name
|
||
|
double value
|
||
|
|
||
|
cdef const DBC* dbc_lookup(const string);
|
||
|
|
||
|
cdef cppclass CANParser:
|
||
|
bool can_valid
|
||
|
CANParser(int, string, vector[MessageParseOptions], vector[SignalParseOptions])
|
||
|
void update_string(string)
|
||
|
vector[SignalValue] query_latest()
|