mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Support software controllable termination
This commit is contained in:
@@ -644,3 +644,31 @@ bool icsneo_setDigitalIO(const neodevice_t* device, neoio_t type, uint32_t numbe
|
||||
|
||||
return device->device->setDigitalIO(static_cast<icsneo::IO>(type), number, value);
|
||||
}
|
||||
|
||||
bool icsneo_isTerminationSupportedFor(const neodevice_t* device, uint16_t netid) {
|
||||
if(!icsneo_isValidNeoDevice(device))
|
||||
return false;
|
||||
|
||||
return device->device->settings->isTerminationSupportedFor(Network(netid));
|
||||
}
|
||||
|
||||
bool icsneo_canTerminationBeEnabledFor(const neodevice_t* device, uint16_t netid) {
|
||||
if(!icsneo_isValidNeoDevice(device))
|
||||
return false;
|
||||
|
||||
return device->device->settings->canTerminationBeEnabledFor(Network(netid));
|
||||
}
|
||||
|
||||
bool icsneo_isTerminationEnabledFor(const neodevice_t* device, uint16_t netid) {
|
||||
if(!icsneo_isValidNeoDevice(device))
|
||||
return false;
|
||||
|
||||
return device->device->settings->isTerminationEnabledFor(Network(netid)).value_or(false);
|
||||
}
|
||||
|
||||
bool icsneo_setTerminationFor(const neodevice_t* device, uint16_t netid, bool enabled) {
|
||||
if(!icsneo_isValidNeoDevice(device))
|
||||
return false;
|
||||
|
||||
return device->device->settings->setTerminationFor(Network(netid), enabled);
|
||||
}
|
||||
|
||||
@@ -96,6 +96,9 @@ static constexpr const char* CANFD_NOT_SUPPORTED = "This device does not support
|
||||
static constexpr const char* RTR_NOT_SUPPORTED = "RTR is not supported with CANFD.";
|
||||
static constexpr const char* DEVICE_DISCONNECTED = "The device was disconnected.";
|
||||
static constexpr const char* ONLINE_NOT_SUPPORTED = "This device does not support going online.";
|
||||
static constexpr const char* TERMINATION_NOT_SUPPORTED_DEVICE = "This device does not support software selectable termination.";
|
||||
static constexpr const char* TERMINATION_NOT_SUPPORTED_NETWORK = "This network does not support software selectable termination on this device.";
|
||||
static constexpr const char* ANOTHER_IN_TERMINATION_GROUP_ENABLED = "A mutually exclusive network already has termination enabled.";
|
||||
|
||||
// Transport Errors
|
||||
static constexpr const char* FAILED_TO_READ = "A read operation failed.";
|
||||
@@ -193,6 +196,12 @@ const char* APIEvent::DescriptionForType(Type type) {
|
||||
return DEVICE_DISCONNECTED;
|
||||
case Type::OnlineNotSupported:
|
||||
return ONLINE_NOT_SUPPORTED;
|
||||
case Type::TerminationNotSupportedDevice:
|
||||
return TERMINATION_NOT_SUPPORTED_DEVICE;
|
||||
case Type::TerminationNotSupportedNetwork:
|
||||
return TERMINATION_NOT_SUPPORTED_NETWORK;
|
||||
case Type::AnotherInTerminationGroupEnabled:
|
||||
return ANOTHER_IN_TERMINATION_GROUP_ENABLED;
|
||||
|
||||
// Transport Errors
|
||||
case Type::FailedToRead:
|
||||
|
||||
Reference in New Issue
Block a user