icsneo compiles, I'm sure everything else is broke.
parent
ca10478752
commit
21a587db75
|
|
@ -142,13 +142,13 @@ ICSNEO_API icsneo_error_t icsneo_device_describe(icsneo_device_t* device, const
|
|||
return icsneo_error_success;
|
||||
}
|
||||
|
||||
ICSNEO_API icsneo_error_t icsneo_device_type(icsneo_device_t* device, uint64_t* value) {
|
||||
ICSNEO_API icsneo_error_t icsneo_device_type(icsneo_device_t* device, icsneo_devicetype_t* value) {
|
||||
if (!device || !device->device) {
|
||||
return icsneo_error_invalid_parameters;
|
||||
}
|
||||
auto dev = device->device;
|
||||
// TODO: We should expose these types
|
||||
*value = static_cast<uint64_t>(dev->getType());
|
||||
*value = dev->getType().getDeviceType();
|
||||
|
||||
return icsneo_error_success;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ bool icsneo_getProductNameForType(icsneo_devicetype_t type, char* str, size_t* m
|
|||
return false;
|
||||
}
|
||||
|
||||
std::string output = DeviceType(type).getGenericProductName();
|
||||
std::string output = DeviceType(type).getProductName();
|
||||
|
||||
if(str == nullptr) {
|
||||
*maxLength = output.length();
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/communication/message/flexray/flexraymessage.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
|
||||
using namespace icsneo;
|
||||
|
||||
FlexRay::Extension::Extension(Device& device, const std::vector<Network>& controllerNetworks) : DeviceExtension(device) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ int main() {
|
|||
|
||||
std::cout<< "Supported devices:" << std::endl;
|
||||
for(auto& dev : icsneo::GetSupportedDevices())
|
||||
std::cout << '\t' << dev.getGenericProductName() << std::endl;
|
||||
std::cout << '\t' << dev.getProductName() << std::endl;
|
||||
|
||||
std::cout << "\nFinding devices... " << std::flush;
|
||||
auto devices = icsneo::FindAllDevices(); // This is type std::vector<std::shared_ptr<icsneo::Device>>
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public:
|
|||
std::string getSerial() const { return data.serial; }
|
||||
uint32_t getSerialNumber() const { return Device::SerialStringToNum(getSerial()); }
|
||||
const neodevice_t& getNeoDevice() const { return data; }
|
||||
virtual std::string getProductName() const { return getType().getGenericProductName(); }
|
||||
virtual std::string getProductName() const { return getType().getProductName(); }
|
||||
std::string describe() const;
|
||||
friend std::ostream& operator<<(std::ostream& os, const Device& device) {
|
||||
os << device.describe();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <ostream>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <icsneo/icsneotypes.h>
|
||||
|
||||
|
||||
|
|
@ -21,9 +22,11 @@ public:
|
|||
* as the product name may change based on device-specific factors, such as serial
|
||||
* number.
|
||||
*/
|
||||
static const char* GetGenericProductName(_icsneo_devicetype_t t) {
|
||||
template<typename T>
|
||||
static std::string getGenericProductName(T deviceType) {
|
||||
icsneo_devicetype_t t = static_cast<icsneo_devicetype_t>(deviceType);
|
||||
// Adding something? Make sure you update DEVICE_TYPE_LONGEST_NAME at the top!
|
||||
switch(t) {
|
||||
switch((icsneo_devicetype_t)t) {
|
||||
case Unknown:
|
||||
return "Unknown";
|
||||
case BLUE:
|
||||
|
|
@ -134,18 +137,20 @@ public:
|
|||
case DONT_REUSE1:
|
||||
case DONT_REUSE2:
|
||||
case DONT_REUSE3:
|
||||
// Intentionally don't use default so that the compiler throws a warning when something is added
|
||||
return "Unknown neoVI";
|
||||
// Intentionally don't use default so that the compiler throws a warning when something is added
|
||||
}
|
||||
return "Unknown neoVI";
|
||||
}
|
||||
|
||||
DeviceType() { value = _icsneo_devicetype_t::Unknown; }
|
||||
DeviceType(icsneo_devicetype_t device_type) { value = device_type; }
|
||||
icsneo_devicetype_t getDeviceType() const { return value; }
|
||||
std::string getGenericProductName() const { return GetGenericProductName(getDeviceType()); }
|
||||
operator icsneo_devicetype_t() const { return getDeviceType(); }
|
||||
DeviceType(icsneo_devicetype_t device_type) { deviceType = device_type; }
|
||||
icsneo_devicetype_t getDeviceType() const { return deviceType; }
|
||||
|
||||
// Returns the generic name of the device - This doesn't include the serial.
|
||||
std::string getProductName() const { return DeviceType::getGenericProductName(getDeviceType()); }
|
||||
|
||||
private:
|
||||
icsneo_devicetype_t value;
|
||||
icsneo_devicetype_t deviceType;
|
||||
};
|
||||
|
||||
}; // namespace icsneo
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ ICSNEO_API icsneo_error_t icsneo_open(icsneo_device_t* device);
|
|||
ICSNEO_API icsneo_error_t icsneo_close(icsneo_device_t* device);
|
||||
|
||||
ICSNEO_API icsneo_error_t icsneo_device_describe(icsneo_device_t* device, const char* value, uint32_t* value_length);
|
||||
ICSNEO_API icsneo_error_t icsneo_device_type(icsneo_device_t* device, uint64_t* value);
|
||||
ICSNEO_API icsneo_error_t icsneo_device_type(icsneo_device_t* device, icsneo_devicetype_t* value);
|
||||
ICSNEO_API icsneo_error_t icsneo_device_serial(icsneo_device_t* device, const char* value, uint32_t* value_length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
Loading…
Reference in New Issue