-
Notifications
You must be signed in to change notification settings - Fork 0
C Api
typedef void* ModuleHandle;
Opaque pointer used to access the API or a module.
ModuleHandle API_HANDLE = (ModuleHandle)-1;
Default handle to access api instead of modules. If the linker complains this has to defined in C examples.
int DeWeModulesLoad(void);
Load the dw_modules_api.dll. Depending on the architecture (32bit, 64bit) this automatically selects the correct dll to load.
void DeWeModulesUnload(void);
Unload the dw_modules_api.dll. After this call it is not allowed to call dll functions anymore.
int DeWeInit();
Initialize dw_modules_api.dll. This has to be done before any other API functions are allowed to be called.
int DeWeDeInit();
Unnitialize dw_modules_api.dll if the api is no longer used. Deletes all allocated memory.
ModuleHandle DeWeCreateModule(const char* name, const char* fw_revision, const char* port, uint8 address);
Manually create a module. This is used for offline setup, or if a module is not able to be scanned.
ModuleHandle DeWeGetModule(const char* port, uint8 address);
Get a handle for a module. If the handle is NULL, no module could be found.
int DeWeGetParamStrLen(ModuleHandle mh, const char* source, const char* path, uint32* buffer_len);
Request the needed buffer size for a DeWeGetParamStr call. This is the minimum buffer size needed for the call.
int DeWeGetParamStr(ModuleHandle mh, const char* source, const char* path, char* buffer, uint32 buffer_len);
Get the API or module parameter and return the value in the given buffer.
int DeWeSetParamStr(ModuleHandle mh, const char* source, const char* path, const char* buffer);
Set a API or module parameter.
int DeWeGetParamXMLLen(ModuleHandle mh, const char* source, const char* path, uint32* buffer_len);
Request the needed buffer size for a DeWeGetParamXML call. This is the minimum buffer size needed for the call.
int DeWeGetParamXml(ModuleHandle mh, const char* source, const char* path, char* buffer, uint32 buffer_len);
Get the API or module parameter and return the value in the given buffer in XML format.
int DeWeGetParam_i32(ModuleHandle mh, uint32 command, int* val);
Get the API or module parameter and return the integer value.
int DeWeSetParam_i32(ModuleHandle mh, uint32 command, int val);
Get the API or module integer parameter.
int DeWeGetParam_Ptr(ModuleHandle mh, uint32 command, void* val, uint32 size);
Get module parameter as pointer to a buffer.
int DeWeSetParam_Ptr(ModuleHandle mh, uint32 command, void* val, uint32 size);
Set module parameter as pointer to a buffer.
int DeWeScanAddress(ModuleHandle mh, const char* port, uint8 addr, int* status);
Scan the given address for a module. This can be DAQP, HSI, EPAD modules.
int DeWeSetAddress(ModuleHandle mh, const char* port, uint8 addr);
Programm the module to a new address
int DeWeSimAddSerialPort(const char* port);
Add a "faked" serial port for module simulation.
int DeWeSimAddModule(const char* name, const char* fw_revision, const char* port, uint8 address);
Add a simulated module.
int DeWeSimRemoveModule(const char* port, uint8 address);
Remove a simulated module.
This is used for _i32 and _Ptr API functions:
enum DwModulesCmd
{
// Standard API
DWCMD_SCAN = 100
, DWCMD_CLEAR_SERIALPORT
, DWCMD_ADD_SERIALPORT
, DWCMD_REMOVE_SERIALPORT
// Standard Module
, DWCMD_APPLY_PARAM = 200
, DWCMD_RESET
, DWCMD_READ_MODULE_CONFIGURATION
, DWCMD_LOCK_MODULE_BUTTONS // 1 -> lock, 0 -> unlock
// EPAD only
, DWCMD_SAMPLES = 400
// SIM
, DWCMD_ENABLE_SIMULATION = 1000
, DWCMD_SIM_COMMAND_DELAY
, DWCMD_CLEAR_SIMULATION
};