Version info

This commit is contained in:
Paul Hollinsky
2018-10-29 16:35:14 -04:00
parent 37ef932e03
commit 4f91d0775f
8 changed files with 80 additions and 2 deletions
+24
View File
@@ -0,0 +1,24 @@
#ifndef __ICSNEO_API_VERSION_H_
#define __ICSNEO_API_VERSION_H_
#include <stdint.h>
typedef struct {
uint16_t major;
uint16_t minor;
uint16_t patch;
const char* metadata;
const char* buildBranch;
const char* buildTag;
char reserved[32];
} neoversion_t;
#ifdef __cplusplus
namespace icsneo {
neoversion_t GetVersion(void);
}
#endif
#endif
+7
View File
@@ -6,6 +6,7 @@
#include "icsneo/communication/message/neomessage.h" // For neomessage_t and friends
#include "icsneo/platform/dynamiclib.h" // Dynamic library loading and exporting
#include "icsneo/communication/network.h" // Network type and netID defines
#include "icsneo/api/version.h" // For version info
#ifndef ICSNEOC_DYNAMICLOAD
@@ -63,6 +64,8 @@ extern bool DLLExport icsneo_transmitMessages(const neodevice_t* device, const n
extern bool DLLExport icsneo_describeDevice(const neodevice_t* device, char* str, size_t* maxLength);
extern neoversion_t DLLExport icsneo_getVersion(void);
#ifdef __cplusplus
} // extern "C"
#endif
@@ -144,6 +147,9 @@ fn_icsneo_transmitMessages icsneo_transmitMessages;
typedef bool(*fn_icsneo_describeDevice)(const neodevice_t* device, char* str, size_t* maxLength);
fn_icsneo_describeDevice icsneo_describeDevice;
typedef neoversion_t(*fn_icsneo_getVersion)(void);
fn_icsneo_getVersion icsneo_getVersion;
#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;
@@ -183,6 +189,7 @@ int icsneo_init() {
ICSNEO_IMPORTASSERT(icsneo_transmit);
ICSNEO_IMPORTASSERT(icsneo_transmitMessages);
ICSNEO_IMPORTASSERT(icsneo_describeDevice);
ICSNEO_IMPORTASSERT(icsneo_getVersion);
icsneo_initialized = true;
return 0;
+1
View File
@@ -5,6 +5,7 @@
#include <memory>
#include "icsneo/device/device.h"
#include "icsneo/api/version.h"
namespace icsneo {