Refactor for a central include directory

This commit is contained in:
Paul Hollinsky
2018-10-22 11:52:34 -04:00
parent 12451def11
commit 8e6b0d0b0e
127 changed files with 263 additions and 265 deletions
+3 -3
View File
@@ -4,9 +4,9 @@
#define ICSNEOC_MAKEDLL
#include "include/icsneoc.h"
#include "api/icsneocpp/include/icsneocpp.h"
#include "platform/include/dynamiclib.h"
#include "icsneo/icsneoc.h"
#include "icsneo/icsneocpp.h"
#include "icsneo/platform/dynamiclib.h"
#include <string>
#include <vector>
#include <memory>
-194
View File
@@ -1,194 +0,0 @@
#ifndef __ICSNEOC_H_
#define __ICSNEOC_H_
#include <stddef.h>
#include "device/include/neodevice.h" // For neodevice_t
#include "communication/message/include/neomessage.h" // For neomessage_t and friends
#include "platform/include/dynamiclib.h" // Dynamic library loading and exporting
#ifndef ICSNEOC_DYNAMICLOAD
#ifdef __cplusplus
extern "C" {
#endif
extern void DLLExport icsneo_findAllDevices(neodevice_t* devices, size_t* count);
extern void DLLExport icsneo_freeUnconnectedDevices();
extern bool DLLExport icsneo_serialNumToString(uint32_t num, char* str, size_t* count);
extern uint32_t DLLExport icsneo_serialStringToNum(const char* str);
extern bool DLLExport icsneo_isValidNeoDevice(const neodevice_t* device);
extern bool DLLExport icsneo_openDevice(const neodevice_t* device);
extern bool DLLExport icsneo_closeDevice(const neodevice_t* device);
extern bool DLLExport icsneo_goOnline(const neodevice_t* device);
extern bool DLLExport icsneo_goOffline(const neodevice_t* device);
extern bool DLLExport icsneo_isOnline(const neodevice_t* device);
extern bool DLLExport icsneo_enableMessagePolling(const neodevice_t* device);
extern bool DLLExport icsneo_disableMessagePolling(const neodevice_t* device);
extern bool DLLExport icsneo_getMessages(const neodevice_t* device, neomessage_t* messages, size_t* items);
extern size_t DLLExport icsneo_getPollingMessageLimit(const neodevice_t* device);
extern bool DLLExport icsneo_setPollingMessageLimit(const neodevice_t* device, size_t newLimit);
extern bool DLLExport icsneo_getProductName(const neodevice_t* device, char* str, size_t* maxLength);
extern bool DLLExport icsneo_settingsRefresh(const neodevice_t* device);
extern bool DLLExport icsneo_settingsApply(const neodevice_t* device);
extern bool DLLExport icsneo_settingsApplyTemporary(const neodevice_t* device);
extern bool DLLExport icsneo_settingsApplyDefaults(const neodevice_t* device);
extern bool DLLExport icsneo_settingsApplyDefaultsTemporary(const neodevice_t* device);
extern bool DLLExport icsneo_setBaudrate(const neodevice_t* device, uint16_t netid, uint32_t newBaudrate);
extern bool DLLExport icsneo_transmit(const neodevice_t* device, const neomessage_t* message);
extern bool DLLExport icsneo_transmitMessages(const neodevice_t* device, const neomessage_t* messages, size_t count);
#ifdef __cplusplus
} // extern "C"
#endif
#else // ICSNEOC_DYNAMICLOAD
typedef void(*fn_icsneo_findAllDevices)(neodevice_t* devices, size_t* count);
fn_icsneo_findAllDevices icsneo_findAllDevices;
typedef void(*fn_icsneo_freeUnconnectedDevices)();
fn_icsneo_freeUnconnectedDevices icsneo_freeUnconnectedDevices;
typedef bool(*fn_icsneo_serialNumToString)(uint32_t num, char* str, size_t* count);
fn_icsneo_serialNumToString icsneo_serialNumToString;
typedef uint32_t(*fn_icsneo_serialStringToNum)(const char* str);
fn_icsneo_serialStringToNum icsneo_serialStringToNum;
typedef bool(*fn_icsneo_isValidNeoDevice)(const neodevice_t* device);
fn_icsneo_isValidNeoDevice icsneo_isValidNeoDevice;
typedef bool(*fn_icsneo_openDevice)(const neodevice_t* device);
fn_icsneo_openDevice icsneo_openDevice;
typedef bool(*fn_icsneo_closeDevice)(const neodevice_t* device);
fn_icsneo_closeDevice icsneo_closeDevice;
typedef bool(*fn_icsneo_goOnline)(const neodevice_t* device);
fn_icsneo_goOnline icsneo_goOnline;
typedef bool(*fn_icsneo_goOffline)(const neodevice_t* device);
fn_icsneo_goOffline icsneo_goOffline;
typedef bool(*fn_icsneo_isOnline)(const neodevice_t* device);
fn_icsneo_isOnline icsneo_isOnline;
typedef bool(*fn_icsneo_enableMessagePolling)(const neodevice_t* device);
fn_icsneo_enableMessagePolling icsneo_enableMessagePolling;
typedef bool(*fn_icsneo_disableMessagePolling)(const neodevice_t* device);
fn_icsneo_disableMessagePolling icsneo_disableMessagePolling;
typedef bool(*fn_icsneo_getMessages)(const neodevice_t* device, neomessage_t* messages, size_t* items);
fn_icsneo_getMessages icsneo_getMessages;
typedef size_t(*fn_icsneo_getPollingMessageLimit)(const neodevice_t* device);
fn_icsneo_getPollingMessageLimit icsneo_getPollingMessageLimit;
typedef bool(*fn_icsneo_setPollingMessageLimit)(const neodevice_t* device, size_t newLimit);
fn_icsneo_setPollingMessageLimit icsneo_setPollingMessageLimit;
typedef bool(*fn_icsneo_getProductName)(const neodevice_t* device, char* str, size_t* maxLength);
fn_icsneo_getProductName icsneo_getProductName;
typedef bool(*fn_icsneo_settingsRefresh)(const neodevice_t* device);
fn_icsneo_settingsRefresh icsneo_settingsRefresh;
typedef bool(*fn_icsneo_settingsApply)(const neodevice_t* device);
fn_icsneo_settingsApply icsneo_settingsApply;
typedef bool(*fn_icsneo_settingsApplyTemporary)(const neodevice_t* device);
fn_icsneo_settingsApplyTemporary icsneo_settingsApplyTemporary;
typedef bool(*fn_icsneo_settingsApplyDefaults)(const neodevice_t* device);
fn_icsneo_settingsApplyDefaults icsneo_settingsApplyDefaults;
typedef bool(*fn_icsneo_settingsApplyDefaultsTemporary)(const neodevice_t* device);
fn_icsneo_settingsApplyDefaultsTemporary icsneo_settingsApplyDefaultsTemporary;
typedef bool(*fn_icsneo_setBaudrate)(const neodevice_t* device, uint16_t netid, uint32_t newBaudrate);
fn_icsneo_setBaudrate icsneo_setBaudrate;
typedef bool(*fn_icsneo_transmit)(const neodevice_t* device, const neomessage_t* message);
fn_icsneo_transmit icsneo_transmit;
typedef bool(*fn_icsneo_transmitMessages)(const neodevice_t* device, const neomessage_t* messages, size_t count);
fn_icsneo_transmitMessages icsneo_transmitMessages;
#define ICSNEO_IMPORT(func) func = (fn_##func)icsneo_dynamicLibraryGetFunction(icsneo_libraryHandle, #func)
#define ICSNEO_IMPORTASSERT(func) if((ICSNEO_IMPORT(func)) == NULL) return 3
void* icsneo_libraryHandle = NULL;
bool icsneo_initialized = false;
bool icsneo_destroyed = false;
int icsneo_init() {
icsneo_destroyed = false;
if(icsneo_initialized)
return 1;
icsneo_libraryHandle = icsneo_dynamicLibraryLoad();
if(icsneo_libraryHandle == NULL)
return 2;
ICSNEO_IMPORTASSERT(icsneo_findAllDevices);
ICSNEO_IMPORTASSERT(icsneo_freeUnconnectedDevices);
ICSNEO_IMPORTASSERT(icsneo_serialNumToString);
ICSNEO_IMPORTASSERT(icsneo_serialStringToNum);
ICSNEO_IMPORTASSERT(icsneo_isValidNeoDevice);
ICSNEO_IMPORTASSERT(icsneo_openDevice);
ICSNEO_IMPORTASSERT(icsneo_closeDevice);
ICSNEO_IMPORTASSERT(icsneo_goOnline);
ICSNEO_IMPORTASSERT(icsneo_goOffline);
ICSNEO_IMPORTASSERT(icsneo_isOnline);
ICSNEO_IMPORTASSERT(icsneo_enableMessagePolling);
ICSNEO_IMPORTASSERT(icsneo_disableMessagePolling);
ICSNEO_IMPORTASSERT(icsneo_getMessages);
ICSNEO_IMPORTASSERT(icsneo_getPollingMessageLimit);
ICSNEO_IMPORTASSERT(icsneo_setPollingMessageLimit);
ICSNEO_IMPORTASSERT(icsneo_getProductName);
ICSNEO_IMPORTASSERT(icsneo_settingsRefresh);
ICSNEO_IMPORTASSERT(icsneo_settingsApply);
ICSNEO_IMPORTASSERT(icsneo_settingsApplyTemporary);
ICSNEO_IMPORTASSERT(icsneo_settingsApplyDefaults);
ICSNEO_IMPORTASSERT(icsneo_settingsApplyDefaultsTemporary);
ICSNEO_IMPORTASSERT(icsneo_setBaudrate);
ICSNEO_IMPORTASSERT(icsneo_transmit);
ICSNEO_IMPORTASSERT(icsneo_transmitMessages);
icsneo_initialized = true;
return 0;
}
bool icsneo_close() ICSNEO_DESTRUCTOR {
icsneo_initialized = false;
if(icsneo_destroyed)
return true;
return icsneo_destroyed = icsneo_dynamicLibraryClose(icsneo_libraryHandle);
}
#endif // ICSNEOC_DYNAMICLOAD
#endif // __ICSNEOC_H_
+2 -2
View File
@@ -1,8 +1,8 @@
#include <iterator>
#include <iostream>
#include "include/icsneocpp.h"
#include "device/include/devicefinder.h"
#include "icsneo/icsneocpp.h"
#include "icsneo/device/devicefinder.h"
using namespace icsneo;
-15
View File
@@ -1,15 +0,0 @@
#ifndef __ICSNEOCPP_H_
#define __ICSNEOCPP_H_
#include <vector>
#include <memory>
#include "device/include/device.h"
namespace icsneo {
std::vector<std::shared_ptr<Device>> FindAllDevices();
}
#endif
@@ -1,7 +1,7 @@
//FILE: icsneo40DLLAPI.H
#include <windows.h>
#include "icsnVC40.h"
#include "icsneo/icsnVC40.h"
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -3,12 +3,12 @@
#endif
#define ICSNEOC_MAKEDLL
#include "api/icsneolegacy/include/icsneolegacy.h"
#include "icsneo/icsneolegacy.h"
#undef ICSNEOC_MAKEDLL
#include "api/icsneoc/include/icsneoc.h"
#include "icsneo/icsneoc.h"
#include "communication/include/network.h"
#include "icsneo/communication/network.h"
#include <map>
#include <algorithm>
-101
View File
@@ -1,101 +0,0 @@
#ifndef __ICSNEOLEGACY_H_
#define __ICSNEOLEGACY_H_
#include "platform/include/dynamiclib.h" // Dynamic library loading and exporting
#include "platform/include/tchar.h"
#include <stdint.h>
typedef uint8_t byte; // Typedef helper for the following include
#include "api/icsneolegacy/dllhelper/include/icsnVC40.h" // Definitions for structs
#ifdef __cplusplus
extern "C" {
#endif
//Basic Functions
extern int DLLExport icsneoFindNeoDevices(unsigned long DeviceTypes, NeoDevice* pNeoDevice, int* pNumDevices);
extern int DLLExport icsneoOpenNeoDevice(NeoDevice* pNeoDevice, void** hObject, unsigned char* bNetworkIDs, int bConfigRead, int bSyncToPC);
extern int DLLExport icsneoClosePort(void* hObject, int* pNumberOfErrors);
extern void DLLExport icsneoFreeObject(void* hObject);
extern int DLLExport icsneoSerialNumberToString(unsigned long serial, char* data, unsigned long data_size);
//Message Functions
extern int DLLExport icsneoGetMessages(void* hObject, icsSpyMessage* pMsg, int* pNumberOfMessages, int* pNumberOfErrors);
extern int DLLExport icsneoTxMessages(void* hObject, icsSpyMessage* pMsg, int lNetworkID, int lNumMessages);
extern int DLLExport icsneoTxMessagesEx(void* hObject,icsSpyMessage* pMsg, unsigned int lNetworkID, unsigned int lNumMessages, unsigned int* NumTxed, unsigned int zero2);
extern int DLLExport icsneoWaitForRxMessagesWithTimeOut(void* hObject, unsigned int iTimeOut);
extern int DLLExport icsneoEnableNetworkRXQueue(void* hObject, int iEnable);
extern int DLLExport icsneoGetTimeStampForMsg(void* hObject, icsSpyMessage* pMsg, double* pTimeStamp);
extern void DLLExport icsneoGetISO15765Status(void* hObject, int lNetwork, int lClearTxStatus, int lClearRxStatus, int*lTxStatus, int*lRxStatus);
extern void DLLExport icsneoSetISO15765RxParameters(void* hObject, int lNetwork, int lEnable, spyFilterLong* pFF_CFMsgFilter, icsSpyMessage* pTxMsg,
int lCFTimeOutMs, int lFlowCBlockSize, int lUsesExtendedAddressing, int lUseHardwareIfPresent);
//Device Functions
extern int DLLExport icsneoGetConfiguration(void* hObject, unsigned char* pData, int* lNumBytes);
extern int DLLExport icsneoSendConfiguration(void* hObject, unsigned char* pData, int lNumBytes);
extern int DLLExport icsneoGetFireSettings(void* hObject, SFireSettings* pSettings, int iNumBytes);
extern int DLLExport icsneoSetFireSettings(void* hObject, SFireSettings* pSettings, int iNumBytes, int bSaveToEEPROM);
extern int DLLExport icsneoGetVCAN3Settings(void* hObject, SVCAN3Settings* pSettings, int iNumBytes);
extern int DLLExport icsneoSetVCAN3Settings(void* hObject, SVCAN3Settings* pSettings, int iNumBytes, int bSaveToEEPROM);
extern int DLLExport icsneoGetFire2Settings(void* hObject, SFire2Settings* pSettings, int iNumBytes);
extern int DLLExport icsneoSetFire2Settings(void* hObject, SFire2Settings* pSettings, int iNumBytes, int bSaveToEEPROM);
extern int DLLExport icsneoGetVCANRFSettings(void* hObject, SVCANRFSettings* pSettings, int iNumBytes);
extern int DLLExport icsneoSetVCANRFSettings(void* hObject, SVCANRFSettings* pSettings, int iNumBytes, int bSaveToEEPROM);
extern int DLLExport icsneoGetVCAN412Settings(void* hObject, SVCAN412Settings* pSettings, int iNumBytes);
extern int DLLExport icsneoSetVCAN412Settings(void* hObject, SVCAN412Settings* pSettings, int iNumBytes, int bSaveToEEPROM);
extern int DLLExport icsneoGetRADGalaxySettings(void* hObject, SRADGalaxySettings* pSettings, int iNumBytes);
extern int DLLExport icsneoSetRADGalaxySettings(void* hObject, SRADGalaxySettings* pSettings, int iNumBytes, int bSaveToEEPROM);
extern int DLLExport icsneoGetRADStar2Settings(void* hObject, SRADStar2Settings* pSettings, int iNumBytes);
extern int DLLExport icsneoSetRADStar2Settings(void* hObject, SRADStar2Settings* pSettings, int iNumBytes, int bSaveToEEPROM);
extern int DLLExport icsneoSetBitRate(void* hObject, int BitRate, int NetworkID);
extern int DLLExport icsneoGetDeviceParameters(void* hObject, char* pParameter, char* pValues, short ValuesLength);
extern int DLLExport icsneoSetDeviceParameters(void* hObject, char* pParmValue, int* pErrorIndex, int bSaveToEEPROM);
//Error Functions
extern int DLLExport icsneoGetLastAPIError(void* hObject, unsigned long* pErrorNumber);
extern int DLLExport icsneoGetErrorMessages(void* hObject, int* pErrorMsgs, int* pNumberOfErrors);
extern int DLLExport icsneoGetErrorInfo(int lErrorNumber, TCHAR*szErrorDescriptionShort, TCHAR*szErrorDescriptionLong, int* lMaxLengthShort, int* lMaxLengthLong,int* lErrorSeverity,int* lRestartNeeded);
//ISO15765-2 Functions
extern int DLLExport icsneoISO15765_EnableNetworks(void* hObject, unsigned long ulNetworks);
extern int DLLExport icsneoISO15765_DisableNetworks(void* hObject);
extern int DLLExport icsneoISO15765_TransmitMessage(void* hObject, unsigned long ulNetworkID, stCM_ISO157652_TxMessage* pMsg, unsigned long ulBlockingTimeout);
extern int DLLExport icsneoISO15765_ReceiveMessage(void* hObject,int ulNetworkID, stCM_ISO157652_RxMessage* pMsg);
//General Utility Functions
extern int DLLExport icsneoValidateHObject(void* hObject);
extern int DLLExport icsneoGetDLLVersion(void);
extern int DLLExport icsneoGetSerialNumber(void* hObject, unsigned int*iSerialNumber);
extern int DLLExport icsneoStartSockServer(void* hObject, int iPort);
extern int DLLExport icsneoStopSockServer(void* hObject);
//CoreMini Script functions
extern int DLLExport icsneoScriptStart(void* hObject, int iLocation);
extern int DLLExport icsneoScriptStop(void* hObject);
extern int DLLExport icsneoScriptLoad(void* hObject, const unsigned char* bin, unsigned long len_bytes, int iLocation);
extern int DLLExport icsneoScriptClear(void* hObject, int iLocation);
extern int DLLExport icsneoScriptStartFBlock(void* hObject,unsigned int fb_index);
extern int DLLExport icsneoScriptGetFBlockStatus(void* hObject, unsigned int fb_index, int* piRunStatus);
extern int DLLExport icsneoScriptStopFBlock(void* hObject,unsigned int fb_index);
extern int DLLExport icsneoScriptGetScriptStatus(void* hObject, int* piStatus);
extern int DLLExport icsneoScriptReadAppSignal(void* hObject, unsigned int iIndex, double*dValue);
extern int DLLExport icsneoScriptWriteAppSignal(void* hObject, unsigned int iIndex, double dValue);
//Deprecated (but still suppored in the DLL)
extern int DLLExport icsneoOpenPortEx(void* lPortNumber, int lPortType, int lDriverType, int lIPAddressMSB, int lIPAddressLSBOrBaudRate, int bConfigRead, unsigned char* bNetworkID, int* hObject);
extern int DLLExport icsneoOpenPort(int lPortNumber, int lPortType, int lDriverType, unsigned char* bNetworkID, unsigned char* bSCPIDs, int* hObject);
extern int DLLExport icsneoEnableNetworkCom(void* hObject, int Enable);
extern int DLLExport icsneoFindAllCOMDevices(int lDriverType, int lGetSerialNumbers, int lStopAtFirst, int lUSBCommOnly, int* p_lDeviceTypes, int* p_lComPorts, int* p_lSerialNumbers, int*lNumDevices);
#ifdef __cplusplus
} // extern "C"
#endif
#endif