#ifndef __RADGALAXY_H_ #define __RADGALAXY_H_ #include "device/include/device.h" #include "device/include/devicetype.h" #include "platform/include/pcap.h" #include "communication/include/packetizer.h" #include "communication/include/decoder.h" namespace icsneo { class RADGalaxy : public Device { public: // Serial numbers start with RG static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::RADGalaxy; static constexpr const uint16_t PRODUCT_ID = 0x0003; RADGalaxy(neodevice_t neodevice) : Device(neodevice) { auto transport = std::make_shared(getWritableNeoDevice()); auto packetizer = std::make_shared(); packetizer->disableChecksum = true; packetizer->align16bit = false; auto decoder = std::make_shared(); com = std::make_shared(transport, packetizer, decoder); getWritableNeoDevice().type = DEVICE_TYPE; productId = PRODUCT_ID; } static std::vector> Find() { std::vector> found; for(auto neodevice : PCAP::FindByProduct(PRODUCT_ID)) { { strncpy(neodevice.serial, SERIAL_FIND_ON_OPEN, sizeof(neodevice.serial)); neodevice.serial[sizeof(neodevice.serial) - 1] = '\0'; auto device = std::make_shared(neodevice); if(!device->open()) // We will get the serial number on open continue; // If the open failed, we won't display the device as an option to connect to strncpy(neodevice.serial, device->getNeoDevice().serial, sizeof(neodevice.serial)); neodevice.serial[sizeof(neodevice.serial) - 1] = '\0'; } found.push_back(std::make_shared(neodevice)); } return found; } }; } #endif