mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Ethernet (DoIP) Activation Line support
This commit is contained in:
+25
-1
@@ -608,7 +608,7 @@ bool icsneo_getSupportedDevices(devicetype_t* devices, size_t* count) {
|
||||
return true;
|
||||
}
|
||||
|
||||
extern bool DLLExport icsneo_getTimestampResolution(const neodevice_t* device, uint16_t* resolution) {
|
||||
bool icsneo_getTimestampResolution(const neodevice_t* device, uint16_t* resolution) {
|
||||
if(!icsneo_isValidNeoDevice(device))
|
||||
return false;
|
||||
|
||||
@@ -620,3 +620,27 @@ extern bool DLLExport icsneo_getTimestampResolution(const neodevice_t* device, u
|
||||
*resolution = device->device->getTimestampResolution();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool icsneo_getDigitalIO(const neodevice_t* device, neoio_t type, uint32_t number, uint8_t* value) {
|
||||
if(!icsneo_isValidNeoDevice(device))
|
||||
return false;
|
||||
|
||||
if(value == nullptr) {
|
||||
EventManager::GetInstance().add(APIEvent::Type::RequiredParameterNull, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
const optional<bool> val = device->device->getDigitalIO(static_cast<icsneo::IO>(type), number);
|
||||
if(!val.has_value())
|
||||
return false;
|
||||
|
||||
*value = uint8_t(*val);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool icsneo_setDigitalIO(const neodevice_t* device, neoio_t type, uint32_t number, uint8_t value) {
|
||||
if(!icsneo_isValidNeoDevice(device))
|
||||
return false;
|
||||
|
||||
return device->device->setDigitalIO(static_cast<icsneo::IO>(type), number, bool(value));
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ static constexpr const char* DEVICE_CURRENTLY_POLLING = "The device is currently
|
||||
static constexpr const char* DEVICE_NOT_CURRENTLY_POLLING = "The device is not currently polling for messages.";
|
||||
static constexpr const char* UNSUPPORTED_TX_NETWORK = "Message network is not a supported TX network.";
|
||||
static constexpr const char* MESSAGE_MAX_LENGTH_EXCEEDED = "The message was too long.";
|
||||
static constexpr const char* VALUE_NOT_YET_PRESENT = "The value is not yet present.";
|
||||
|
||||
// Device Errors
|
||||
static constexpr const char* POLLING_MESSAGE_OVERFLOW = "Too many messages have been recieved for the polling message buffer, some have been lost!";
|
||||
@@ -140,6 +141,8 @@ const char* APIEvent::DescriptionForType(Type type) {
|
||||
return UNSUPPORTED_TX_NETWORK;
|
||||
case Type::MessageMaxLengthExceeded:
|
||||
return MESSAGE_MAX_LENGTH_EXCEEDED;
|
||||
case Type::ValueNotYetPresent:
|
||||
return VALUE_NOT_YET_PRESENT;
|
||||
|
||||
// Device Errors
|
||||
case Type::PollingMessageOverflow:
|
||||
|
||||
@@ -45,6 +45,7 @@ SETVCAN412SETTINGS icsneoSetVCAN412Settings;
|
||||
SETBITRATE icsneoSetBitRate;
|
||||
GETDEVICEPARMS icsneoGetDeviceParameters;
|
||||
SETDEVICEPARMS icsneoSetDeviceParameters;
|
||||
ENABLEDOIPACTIVATIONLINE icsneoEnableDOIPLine;
|
||||
|
||||
//Error Functions
|
||||
GETLASTAPIERROR icsneoGetLastAPIError;
|
||||
@@ -201,7 +202,7 @@ bool LoadDLLAPI(HINSTANCE &hAPIDLL)
|
||||
icsneoScriptReadAppSignal = (SCRIPTREADAPPSIGNAL) GetProcAddress(hAPIDLL, "icsneoScriptReadAppSignal");
|
||||
icsneoScriptWriteAppSignal = (SCRIPTWRITEAPPSIGNAL) GetProcAddress(hAPIDLL, "icsneoScriptWriteAppSignal");
|
||||
|
||||
|
||||
icsneoEnableDOIPLine = (ENABLEDOIPACTIVATIONLINE)GetProcAddress(hAPIDLL, "icsneoEnableDOIPLine");
|
||||
|
||||
if(!icsneoFindNeoDevices || !icsneoOpenNeoDevice || !icsneoClosePort || !icsneoFreeObject ||
|
||||
!icsneoTxMessages || !icsneoGetMessages || !icsneoWaitForRxMessagesWithTimeOut ||
|
||||
@@ -216,7 +217,7 @@ bool LoadDLLAPI(HINSTANCE &hAPIDLL)
|
||||
!icsneoGetErrorInfo || !icsneoScriptLoad || !icsneoScriptStart || !icsneoScriptStop ||
|
||||
!icsneoScriptClear || !icsneoScriptStartFBlock || !icsneoScriptStopFBlock ||
|
||||
!icsneoScriptGetFBlockStatus || !icsneoScriptGetScriptStatus || !icsneoScriptReadAppSignal ||
|
||||
!icsneoScriptWriteAppSignal || !icsneoGetDLLVersion)
|
||||
!icsneoScriptWriteAppSignal || !icsneoGetDLLVersion || !icsneoEnableDOIPLine)
|
||||
{
|
||||
FreeLibrary(hAPIDLL);
|
||||
return false;
|
||||
|
||||
@@ -62,6 +62,7 @@ typedef int (__stdcall *SETRADSTAR2SETTINGS)(void * hObject, SRADStar2Settings *
|
||||
typedef int (__stdcall *SETBITRATE)(void * hObject, int BitRate, int NetworkID);
|
||||
typedef int (__stdcall *GETDEVICEPARMS)(void * hObject, char *pParameter, char *pValues, short ValuesLength);
|
||||
typedef int (__stdcall *SETDEVICEPARMS)(void * hObject, char *pParmValue, int *pErrorIndex, int bSaveToEEPROM);
|
||||
typedef int(__stdcall *ENABLEDOIPACTIVATIONLINE)(void * hObject, bool Val);
|
||||
|
||||
//Error Functions
|
||||
typedef int (__stdcall *GETLASTAPIERROR)(void * hObject, unsigned long *pErrorNumber);
|
||||
@@ -157,6 +158,7 @@ extern SETVCAN412SETTINGS icsneoSetVCAN412Settings;
|
||||
extern SETBITRATE icsneoSetBitRate;
|
||||
extern GETDEVICEPARMS icsneoGetDeviceParameters;
|
||||
extern SETDEVICEPARMS icsneoSetDeviceParameters;
|
||||
extern ENABLEDOIPACTIVATIONLINE icsneoEnableDOIPLine;
|
||||
|
||||
//Error Functions
|
||||
extern GETLASTAPIERROR icsneoGetLastAPIError;
|
||||
|
||||
@@ -493,6 +493,13 @@ int icsneoGetSerialNumber(void* hObject, unsigned int*iSerialNumber) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int icsneoEnableDOIPLine(void* hObject, bool enable) {
|
||||
if(!icsneoValidateHObject(hObject))
|
||||
return false;
|
||||
neodevice_t* device = (neodevice_t*)hObject;
|
||||
return icsneo_setDigitalIO(device, ICSNEO_IO_ETH_ACTIVATION, 1, uint8_t(enable));
|
||||
}
|
||||
|
||||
int icsneoStartSockServer(void* hObject, int iPort) {
|
||||
// TODO Implement
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user