int main(int argc, char *argv[]) { intercom::Receiver receiver; const char * dbc_filename = "../dbc/can01.dbc"; busAssignment_t * busAssignment = busAssignment_create(); signalFormat_t signalFormat = signalFormat_Name; int bus = -1; busAssignment_associate(busAssignment, bus, dbc_filename); busAssignment_parseDBC(busAssignment); canMessage_t can_msg_1 = { .t = { 0, 0 }, .bus = 1, .id = 0x100, .dlc = 6, .byte_arr = { 1, 2, 3, 4, 5, 6, 7, 8 } }; canMessage_t can_msg_2 = { .t = { 0, 0 }, .bus = 1, .id = 0x110, .dlc = 4, .byte_arr = { 1, 2, 3, 4, 5, 6, 7, 8 } }; processCanMessage(&can_msg_1, busAssignment, signalFormat); processCanMessage(&can_msg_2, busAssignment, signalFormat); // while (true) { // intercom::DataMessage msg; // receiver.receive(msg); // } busAssignment_free(busAssignment); return EXIT_SUCCESS; }
Parser::Parser(Can *onCan, QObject *parent) : QObject(parent), consoleKey1(), consoleKey2(), ipdState(), mcoLimits(), mcoMode(), mcoState(), mmCoord(), mmAltLong(), mpState(), mvdDd(), sysDiagnostics(), sysKey(), tskbmState(), uktolDd1(), vdsState() { QMetaEnum auxDescriptors = AuxResource::staticMetaObject.enumerator ( AuxResource::staticMetaObject.indexOfEnumerator ("Descriptor")); for (int i = 0; i < auxDescriptors.keyCount(); i ++) { AuxResource::Descriptor descriptor = AuxResource::Descriptor(auxDescriptors.value(i)); auxResources[descriptor] = new AuxResourceVersion (descriptor, this); auxResources[descriptor]->connect (onCan, SIGNAL(messageReceived(CanFrame)), SLOT(processCanMessage(CanFrame))); this->connect (auxResources[descriptor], SIGNAL(whateverChanged()), SLOT(getChildChagnedSignal())); } consoleKey1.connect (onCan, SIGNAL(messageReceived(CanFrame)), SLOT(processCanMessage(CanFrame))); consoleKey2.connect (onCan, SIGNAL(messageReceived(CanFrame)), SLOT(processCanMessage(CanFrame))); ipdState.connect (onCan, SIGNAL(messageReceived(CanFrame)),SLOT(processCanMessage(CanFrame))); mcoLimits.connect (onCan, SIGNAL(messageReceived(CanFrame)),SLOT(processCanMessage(CanFrame))); mcoMode.connect (onCan, SIGNAL(messageReceived(CanFrame)), SLOT(processCanMessage(CanFrame))); mcoState.connect (onCan, SIGNAL(messageReceived(CanFrame)),SLOT(processCanMessage(CanFrame))); mmAltLong.connect (onCan, SIGNAL(messageReceived(CanFrame)),SLOT(processCanMessage(CanFrame))); mmCoord.connect (onCan, SIGNAL(messageReceived(CanFrame)),SLOT(processCanMessage(CanFrame))); mpState.connect (onCan, SIGNAL(messageReceived(CanFrame)),SLOT(processCanMessage(CanFrame))); mvdDd.connect (onCan, SIGNAL(messageReceived(CanFrame)),SLOT(processCanMessage(CanFrame))); sysDiagnostics.connect (onCan, SIGNAL(messageReceived(CanFrame)), SLOT(processCanMessage(CanFrame))); sysKey.connect (onCan, SIGNAL(messageReceived(CanFrame)), SLOT(processCanMessage(CanFrame))); tskbmState.connect (onCan, SIGNAL(messageReceived(CanFrame)),SLOT(processCanMessage(CanFrame))); uktolDd1.connect (onCan, SIGNAL(messageReceived(CanFrame)),SLOT(processCanMessage(CanFrame))); vdsState.connect (onCan, SIGNAL(messageReceived(CanFrame)),SLOT(processCanMessage(CanFrame))); this->connect (&consoleKey1, SIGNAL(whateverChanged()), SLOT(getChildChagnedSignal())); this->connect (&consoleKey1, SIGNAL(whateverChanged()), SLOT(getChildChagnedSignal())); this->connect (&ipdState, SIGNAL(whateverChanged()), SLOT(getChildChagnedSignal())); this->connect (&mcoLimits, SIGNAL(whateverChanged()), SLOT(getChildChagnedSignal())); this->connect (&mcoMode, SIGNAL(whateverChanged()), SLOT(getChildChagnedSignal())); this->connect (&mcoState, SIGNAL(whateverChanged()), SLOT(getChildChagnedSignal())); this->connect (&mmAltLong, SIGNAL(whateverChanged()), SLOT(getChildChagnedSignal())); this->connect (&mmCoord, SIGNAL(whateverChanged()), SLOT(getChildChagnedSignal())); this->connect (&mpState, SIGNAL(whateverChanged()), SLOT(getChildChagnedSignal())); this->connect (&mvdDd, SIGNAL(whateverChanged()), SLOT(getChildChagnedSignal())); this->connect (&sysDiagnostics, SIGNAL(whateverChanged()), SLOT(getChildChagnedSignal())); this->connect (&sysKey, SIGNAL(whateverChanged()), SLOT(getChildChagnedSignal())); this->connect (&tskbmState, SIGNAL(whateverChanged()), SLOT(getChildChagnedSignal())); this->connect (&uktolDd1, SIGNAL(whateverChanged()), SLOT(getChildChagnedSignal())); this->connect (&vdsState, SIGNAL(whateverChanged()), SLOT(getChildChagnedSignal())); }