diff --git a/bindings/python/icsneopy/communication/message/canmessage.cpp b/bindings/python/icsneopy/communication/message/canmessage.cpp index 68d36ed..1091a5a 100644 --- a/bindings/python/icsneopy/communication/message/canmessage.cpp +++ b/bindings/python/icsneopy/communication/message/canmessage.cpp @@ -7,7 +7,7 @@ namespace icsneo { void init_canmessage(pybind11::module_& m) { - pybind11::class_, Frame>(m, "CANMessage") + pybind11::class_, BusMessage>(m, "CANMessage") .def(pybind11::init()) .def_readwrite("arbid", &CANMessage::arbid) .def_readwrite("dlcOnWire", &CANMessage::dlcOnWire) diff --git a/bindings/python/icsneopy/communication/message/ethernetmessage.cpp b/bindings/python/icsneopy/communication/message/ethernetmessage.cpp index 87a9cc6..d689f0e 100644 --- a/bindings/python/icsneopy/communication/message/ethernetmessage.cpp +++ b/bindings/python/icsneopy/communication/message/ethernetmessage.cpp @@ -11,7 +11,7 @@ void init_ethernetmessage(pybind11::module_& m) { .def("to_string", &MACAddress::toString) .def("__repr__", &MACAddress::toString); - pybind11::class_, Frame>(m, "EthernetMessage") + pybind11::class_, BusMessage>(m, "EthernetMessage") .def(pybind11::init()) .def_readwrite("preemptionEnabled", &EthernetMessage::preemptionEnabled) .def_readwrite("preemptionFlags", &EthernetMessage::preemptionFlags) diff --git a/bindings/python/icsneopy/communication/message/mdiomessage.cpp b/bindings/python/icsneopy/communication/message/mdiomessage.cpp index 066ff5a..d8ac784 100644 --- a/bindings/python/icsneopy/communication/message/mdiomessage.cpp +++ b/bindings/python/icsneopy/communication/message/mdiomessage.cpp @@ -7,7 +7,7 @@ namespace icsneo { void init_mdiomessage(pybind11::module_& m) { - pybind11::class_, Frame> mdioMessage(m, "MDIOMessage"); + pybind11::class_, BusMessage> mdioMessage(m, "MDIOMessage"); pybind11::enum_(mdioMessage, "Clause") .value("Clause45", MDIOMessage::Clause::Clause45) .value("Clause22", MDIOMessage::Clause::Clause22); diff --git a/bindings/python/icsneopy/communication/message/message.cpp b/bindings/python/icsneopy/communication/message/message.cpp index 60ecabf..221815f 100644 --- a/bindings/python/icsneopy/communication/message/message.cpp +++ b/bindings/python/icsneopy/communication/message/message.cpp @@ -41,7 +41,7 @@ void init_message(pybind11::module_& m) { .def_readwrite("network", &InternalMessage::network) .def_readwrite("data", &InternalMessage::data); - pybind11::class_, InternalMessage>(m, "BusMessage") + pybind11::class_, InternalMessage>(m, "BusMessage") .def_readwrite("description", &BusMessage::description) .def_readwrite("transmitted", &BusMessage::transmitted) .def_readwrite("error", &BusMessage::error); diff --git a/bindings/python/icsneopy/device/device.cpp b/bindings/python/icsneopy/device/device.cpp index 7d45687..90051bc 100644 --- a/bindings/python/icsneopy/device/device.cpp +++ b/bindings/python/icsneopy/device/device.cpp @@ -26,7 +26,7 @@ void init_device(pybind11::module_& m) { .def("set_polling_message_limit", &Device::setPollingMessageLimit) .def("add_message_callback", &Device::addMessageCallback) .def("remove_message_callback", &Device::removeMessageCallback) - .def("transmit", pybind11::overload_cast>(&Device::transmit)) + .def("transmit", pybind11::overload_cast>(&Device::transmit)) .def("get_supported_rx_networks", &Device::getSupportedRXNetworks, pybind11::return_value_policy::reference) .def("get_supported_tx_networks", &Device::getSupportedTXNetworks, pybind11::return_value_policy::reference) .def("get_rtc", &Device::getRTC) diff --git a/bindings/python/icsneopy/device/devicetype.cpp b/bindings/python/icsneopy/device/devicetype.cpp index 659b3d4..593d1d3 100644 --- a/bindings/python/icsneopy/device/devicetype.cpp +++ b/bindings/python/icsneopy/device/devicetype.cpp @@ -3,72 +3,68 @@ #include #include +#include namespace icsneo { void init_devicetype(pybind11::module_& m) { pybind11::class_ deviceType(m, "DeviceType"); - pybind11::enum_(deviceType, "Enum") - .value("Unknown", _icsneo_devicetype_t::Unknown) - .value("BLUE", _icsneo_devicetype_t::BLUE) - .value("ECU_AVB", _icsneo_devicetype_t::ECU_AVB) - .value("RADSupermoon", _icsneo_devicetype_t::RADSupermoon) - .value("DW_VCAN", _icsneo_devicetype_t::DW_VCAN) - .value("RADMoon2", _icsneo_devicetype_t::RADMoon2) - .value("RADMars", _icsneo_devicetype_t::RADMars) - .value("VCAN4_1", _icsneo_devicetype_t::VCAN4_1) - .value("FIRE", _icsneo_devicetype_t::FIRE) - .value("RADPluto", _icsneo_devicetype_t::RADPluto) - .value("VCAN4_2EL", _icsneo_devicetype_t::VCAN4_2EL) - .value("RADIO_CANHUB", _icsneo_devicetype_t::RADIO_CANHUB) - .value("NEOECU12", _icsneo_devicetype_t::NEOECU12) - .value("OBD2_LCBADGE", _icsneo_devicetype_t::OBD2_LCBADGE) - .value("RADMoonDuo", _icsneo_devicetype_t::RADMoonDuo) - .value("FIRE3", _icsneo_devicetype_t::FIRE3) - .value("VCAN3", _icsneo_devicetype_t::VCAN3) - .value("RADJupiter", _icsneo_devicetype_t::RADJupiter) - .value("VCAN4_IND", _icsneo_devicetype_t::VCAN4_IND) - .value("RADGigastar", _icsneo_devicetype_t::RADGigastar) - .value("RED2", _icsneo_devicetype_t::RED2) - .value("EtherBADGE", _icsneo_devicetype_t::EtherBADGE) - .value("RAD_A2B", _icsneo_devicetype_t::RAD_A2B) - .value("RADEpsilon", _icsneo_devicetype_t::RADEpsilon) - .value("RADMoon3", _icsneo_devicetype_t::RADMoon3) - .value("RADComet", _icsneo_devicetype_t::RADComet) - .value("FIRE3_FlexRay", _icsneo_devicetype_t::FIRE3_FlexRay) - .value("Connect", _icsneo_devicetype_t::Connect) - .value("RADComet3", _icsneo_devicetype_t::RADComet3) - .value("RADMoonT1S", _icsneo_devicetype_t::RADMoonT1S) - .value("RADGigastar2", _icsneo_devicetype_t::RADGigastar2) - .value("RED", _icsneo_devicetype_t::RED) - .value("ECU", _icsneo_devicetype_t::ECU) - .value("IEVB", _icsneo_devicetype_t::IEVB) - .value("Pendant", _icsneo_devicetype_t::Pendant) - .value("OBD2_PRO", _icsneo_devicetype_t::OBD2_PRO) - .value("ECUChip_UART", _icsneo_devicetype_t::ECUChip_UART) - .value("PLASMA", _icsneo_devicetype_t::PLASMA) - .value("DONT_REUSE0", _icsneo_devicetype_t::DONT_REUSE0) - .value("NEOAnalog", _icsneo_devicetype_t::NEOAnalog) - .value("CT_OBD", _icsneo_devicetype_t::CT_OBD) - .value("DONT_REUSE1", _icsneo_devicetype_t::DONT_REUSE1) - .value("DONT_REUSE2", _icsneo_devicetype_t::DONT_REUSE2) - .value("ION", _icsneo_devicetype_t::ION) - .value("RADStar", _icsneo_devicetype_t::RADStar) - .value("DONT_REUSE3", _icsneo_devicetype_t::DONT_REUSE3) - .value("VCAN4_4", _icsneo_devicetype_t::VCAN4_4) - .value("VCAN4_2", _icsneo_devicetype_t::VCAN4_2) - .value("CMProbe", _icsneo_devicetype_t::CMProbe) - .value("EEVB", _icsneo_devicetype_t::EEVB) - .value("VCANrf", _icsneo_devicetype_t::VCANrf) - .value("FIRE2", _icsneo_devicetype_t::FIRE2) - .value("Flex", _icsneo_devicetype_t::Flex) - .value("RADGalaxy", _icsneo_devicetype_t::RADGalaxy) - .value("RADStar2", _icsneo_devicetype_t::RADStar2) - .value("VividCAN", _icsneo_devicetype_t::VividCAN) - .value("OBD2_SIM", _icsneo_devicetype_t::OBD2_SIM); - deviceType.def(pybind11::init()); - deviceType.def("get_device_type", &_icsneo_devicetype_t::getDeviceType); - deviceType.def("get_generic_product_name", &_icsneo_devicetype_t::getGenericProductName); + // deviceType.def("get_device_type", &DeviceType::getDeviceType); + // deviceType.def("get_generic_product_name", &DeviceType::getGenericProductName); + + pybind11::enum_<_icsneo_devicetype_t>(m, "icsneo_devicetype_t") + .value("Unknown", icsneo_devicetype_unknown) + .value("BLUE", icsneo_devicetype_blue) + .value("ECU_AVB", icsneo_devicetype_ecu_avb) + .value("RADSupermoon", icsneo_devicetype_rad_supermoon) + .value("DW_VCAN", icsneo_devicetype_dw_vcan) + .value("RADMoon2", icsneo_devicetype_rad_moon2) + .value("RADMars", icsneo_devicetype_rad_mars) + .value("VCAN4_1", icsneo_devicetype_vcan41) + .value("FIRE", icsneo_devicetype_fire) + .value("RADPluto", icsneo_devicetype_rad_pluto) + .value("VCAN4_2EL", icsneo_devicetype_vcan42_el) + .value("RADIO_CANHUB", icsneo_devicetype_radio_canhub) + .value("NEOECU12", icsneo_devicetype_neo_ecu12) + .value("OBD2_LCBADGE", icsneo_devicetype_obd2_lc_badge) + .value("RADMoonDuo", icsneo_devicetype_rad_moon_duo) + .value("FIRE3", icsneo_devicetype_fire3) + .value("VCAN3", icsneo_devicetype_vcan3) + .value("RADJupiter", icsneo_devicetype_rad_jupiter) + .value("VCAN4_IND", icsneo_devicetype_vcan4_industrial) + .value("RADGigastar", icsneo_devicetype_rad_gigastar) + .value("RED2", icsneo_devicetype_red2) + .value("EtherBADGE", icsneo_devicetype_etherbadge) + .value("RAD_A2B", icsneo_devicetype_rad_a2b) + .value("RADEpsilon", icsneo_devicetype_rad_epsilon) + .value("RADMoon3", icsneo_devicetype_rad_moon3) + .value("RADComet", icsneo_devicetype_rad_comet) + .value("FIRE3_FlexRay", icsneo_devicetype_fire3_flexray) + .value("Connect", icsneo_devicetype_connect) + .value("RADComet3", icsneo_devicetype_rad_comet3) + .value("RADMoonT1S", icsneo_devicetype_rad_moon_t1s) + .value("RADGigastar2", icsneo_devicetype_rad_gigastar2) + .value("RED", icsneo_devicetype_red) + .value("ECU", icsneo_devicetype_ecu) + .value("IEVB", icsneo_devicetype_ievb) + .value("Pendant", icsneo_devicetype_pendant) + .value("OBD2_PRO", icsneo_devicetype_obd2_pro) + .value("ECUChip_UART", icsneo_devicetype_ecuchip_uart) + .value("PLASMA", icsneo_devicetype_plasma) + .value("NEOAnalog", icsneo_devicetype_neo_analog) + .value("CT_OBD", icsneo_devicetype_ct_obd) + .value("ION", icsneo_devicetype_ion) + .value("RADStar", icsneo_devicetype_rad_star) + .value("VCAN4_4", icsneo_devicetype_vcan44) + .value("VCAN4_2", icsneo_devicetype_vcan42) + .value("CMProbe", icsneo_devicetype_cm_probe) + .value("EEVB", icsneo_devicetype_eevb) + .value("FIRE2", icsneo_devicetype_fire2) + .value("Flex", icsneo_devicetype_flex) + .value("RADGalaxy", icsneo_devicetype_rad_galaxy) + .value("RADStar2", icsneo_devicetype_rad_star2) + .value("VividCAN", icsneo_devicetype_vividcan) + .value("OBD2_SIM", icsneo_devicetype_obd2_sim); } } // namespace icsneo diff --git a/examples/cpp/simple/src/SimpleExample.cpp b/examples/cpp/simple/src/SimpleExample.cpp index 1858154..132330a 100644 --- a/examples/cpp/simple/src/SimpleExample.cpp +++ b/examples/cpp/simple/src/SimpleExample.cpp @@ -170,7 +170,7 @@ int main() { auto handler = device->addMessageCallback(std::make_shared([](std::shared_ptr message) { switch(message->type) { case icsneo::Message::Type::BusMessage: { - // A message of type Frame is guaranteed to be a Frame, so we can static cast safely + // A message of type BusMessage is guaranteed to be a BusMessage, so we can static cast safely auto frame = std::static_pointer_cast(message); switch(frame->network.getType()) { case icsneo_msg_bus_type_can: { @@ -202,7 +202,7 @@ int main() { case icsneo_msg_bus_type_ethernet: { auto ethMessage = std::static_pointer_cast(message); - std::cout << "\t\t" << ethMessage->network << " Frame - " << std::dec + std::cout << "\t\t" << ethMessage->network << " BusMessage - " << std::dec << ethMessage->data.size() << " bytes on wire\n"; std::cout << "\t\t Timestamped:\t"<< ethMessage->timestamp << " ns since 1/1/2007\n"; @@ -249,7 +249,7 @@ int main() { break; } break; - } // end of icsneo::Message::Type::Frame + } // end of icsneo::Message::Type::BusMessage case icsneo::Message::Type::CANErrorCount: { // A message of type CANErrorCount is guaranteed to be a CANErrorCount, so we can static cast safely auto cec = std::static_pointer_cast(message);