Gateway C ABI
Loading...
Searching...
No Matches
abi.h
Go to the documentation of this file.
1
158#ifndef ABI_H
159#define ABI_H
160
161#include "datapoint_value.h"
162#include "json.h"
163#include <stdbool.h>
164#include <stdint.h>
165
166#ifdef __cplusplus
167extern "C"
168{
169#endif
170
174#define GC_INTERFACE_NAME_MAX 50
175
188
194{
196 const char* name;
197
199 const char* version;
200
202 const char* pluginIfcVersion;
203
205 uint64_t features;
206};
207typedef const struct sGCPluginInfo* GCPluginInfo;
208
222
226typedef enum
227{
231
241
252
279
286{
288 const char* name;
289
291 const char* description;
292
294 uint64_t id;
295
297 const char* unit;
298};
299typedef const struct sGCDatapoint GCDatapoint;
300
302
303typedef void* GCCoreCtx;
304
311typedef void* GCInstanceHandle;
312
316typedef void (*tSystemLog)(GCCoreCtx, GCLogLevel, const char*);
317typedef void (*tAuditLog)(GCCoreCtx, const char*);
319typedef bool (*tGetEthernetInterface)(GCCoreCtx, const char* name, GCEthernetInterface out);
320typedef bool (*tGetSerialInterface)(GCCoreCtx, const char* name, GCSerialInterface out);
321
350typedef const struct sPluginConfig GCPluginConfig;
351
461
463
477extern GCInstanceHandle
479
494extern void
496
505extern GCPluginInfo
507
521extern bool
523
525
536void
537gcSystemLog(GCPluginInterface interface, GCLogLevel level, const char* message, ...);
538
540
550void
551gcAuditLog(GCPluginInterface interface, const char* message, ...);
552
554
563void
565
567
576bool
578
580
590bool
592
594
604bool
606
608
616void
618
619#ifdef __cplusplus
620}
621#endif
622
623#endif // ABI_H
void gc_plugin_shutdown(GCInstanceHandle instance)
Safely shuts down the plugin instance.
bool(* tGetEthernetInterface)(GCCoreCtx, const char *name, GCEthernetInterface out)
Definition abi.h:319
struct sGCSerialInterface * GCSerialInterface
Definition abi.h:278
void gcAuditLog(GCPluginInterface interface, const char *message,...)
Logs a message to the audit log.
bool(* tReleaseDatapointValue)(GCDatapointValue)
Definition abi.h:318
#define GC_INTERFACE_NAME_MAX
Maximum length for interface names (including null terminator)
Definition abi.h:174
enum eGCLogLevel GCLogLevel
Definition abi.h:187
GCStopBits
Serial port stop bits configuration.
Definition abi.h:227
@ GC_STOP_BITS_TWO
1 stop bit
Definition abi.h:229
@ GC_STOP_BITS_ONE
Definition abi.h:228
bool gcPublishDatapointValue(GCPluginInterface interface, GCDatapointValue dataValue)
Publishes a datapoint value This function is a wrapper around the publishDatapointValueCallback callb...
void(* tAuditLog)(GCCoreCtx, const char *)
Definition abi.h:317
GCParity
Serial port parity configuration.
Definition abi.h:236
@ GC_PARITY_ODD
No parity.
Definition abi.h:238
@ GC_PARITY_NONE
Definition abi.h:237
@ GC_PARITY_EVEN
Odd parity.
Definition abi.h:239
const struct sGCPluginInterface * GCPluginInterface
Definition abi.h:460
bool gcGetSerialInterface(GCPluginInterface interface, const char *name, GCSerialInterface out)
Retrieves a serial interface configuration by name.
GCDataBits
Serial port data bits configuration.
Definition abi.h:246
@ GC_DATA_BITS_SEVEN
6 data bits
Definition abi.h:249
@ GC_DATA_BITS_EIGHT
7 data bits
Definition abi.h:250
@ GC_DATA_BITS_SIX
5 data bits
Definition abi.h:248
@ GC_DATA_BITS_FIVE
Definition abi.h:247
GCPluginInfo gc_plugin_get_info()
Retrieves the plugin information.
bool(* tPublishDatapointValue)(GCCoreCtx, GCDatapointValue)
Definition abi.h:313
GCDatapointValue(* tGetLastDatapointValue)(GCCoreCtx, GCDatapointIdentifier)
Definition abi.h:315
bool gc_plugin_receive_datapoint(GCInstanceHandle instance, const GCDatapointValue dataValue)
Receives a datapoint value.
void * GCCoreCtx
Definition abi.h:303
bool(* tGetSerialInterface)(GCCoreCtx, const char *name, GCSerialInterface out)
Definition abi.h:320
void(* tStoreDatapointValue)(GCCoreCtx, GCDatapointValue)
Definition abi.h:314
const struct sGCPluginInfo * GCPluginInfo
Definition abi.h:207
GCInstanceHandle gc_plugin_init(GCPluginInterface interface)
Initializes the plugin.
eGCLogLevel
The log levels available.
Definition abi.h:180
@ DEBUG
Definition abi.h:185
@ ERROR
Definition abi.h:182
@ INFO
Definition abi.h:184
@ WARNING
Definition abi.h:183
@ CRITICAL
Definition abi.h:181
void gcSystemLog(GCPluginInterface interface, GCLogLevel level, const char *message,...)
Logs a message to the system log.
void gcStoreDatapointValue(GCPluginInterface interface, GCDatapointValue dataValue)
Stores a datapoint value This function us a wrapper around the StoreDatapointValueCallback callback p...
struct sGCEthernetInterface * GCEthernetInterface
Definition abi.h:221
void(* tSystemLog)(GCCoreCtx, GCLogLevel, const char *)
Definition abi.h:316
void * GCInstanceHandle
The handle to the plugin instance.
Definition abi.h:311
bool gcGetEthernetInterface(GCPluginInterface interface, const char *name, GCEthernetInterface out)
Retrieves an Ethernet interface configuration by name.
void gcReleaseDatapointValue(GCPluginInterface interface, GCDatapointValue dataValue)
Releases a datapoint value This function is a wrapper around the releaseDatapointValueCallback callba...
uint64_t GCDatapointIdentifier
Definition datapoint_value.h:6
struct sGCDatapointValue * GCDatapointValue
Definition datapoint_value.h:103
The value of a datapoint.
Definition datapoint_value.h:57
Datapoint information The information about a datapoint, each DatapointValue will belong to a specifi...
Definition abi.h:286
const char * unit
The unit of the datapoint.
Definition abi.h:297
const char * name
The name of the datapoint.
Definition abi.h:288
const char * description
The description of the datapoint.
Definition abi.h:291
uint64_t id
The id of the datapoint.
Definition abi.h:294
Ethernet interface configuration.
Definition abi.h:217
char interface[GC_INTERFACE_NAME_MAX]
OS interface name (e.g., "eth0", "enp0s3")
Definition abi.h:219
The JSON configuration data and parsing callbacks.
Definition json.h:65
Plugin version information The information that the core uses to register a new plugin....
Definition abi.h:194
const char * version
The version of the plugin.
Definition abi.h:199
uint64_t features
Reserved for future use.
Definition abi.h:205
const char * name
The name of the plugin.
Definition abi.h:196
const char * pluginIfcVersion
The interface version of the plugin.
Definition abi.h:202
The plugin interface.
Definition abi.h:359
const GCCoreCtx ctx
Core Context.
Definition abi.h:451
tStoreDatapointValue storeDatapointValueCallback
Callback used to store datapoint values.
Definition abi.h:377
tPublishDatapointValue publishDatapointValueCallback
Callback used to publish datapoint values.
Definition abi.h:368
tGetEthernetInterface getEthernetInterfaceCallback
Callback used to get ethernet interface configuration by name.
Definition abi.h:424
tReleaseDatapointValue releaseDatapointValueCallback
Callback used to release a datapoint value.
Definition abi.h:397
tAuditLog logAuditCallback
Definition abi.h:387
const GCPluginConfig config
Configuration and related functions.
Definition abi.h:444
tSystemLog logSystemCallback
Definition abi.h:382
const GCLogLevel logLevel
The log level set for this plugin instance.
Definition abi.h:458
tGetLastDatapointValue getLastDatapointValueCallback
Callback used to get the last value of a datapoint.
Definition abi.h:410
tGetSerialInterface getSerialInterfaceCallback
Callback used to get serial interface configuration by name.
Definition abi.h:438
Serial interface configuration.
Definition abi.h:262
GCStopBits stop_bits
Number of stop bits.
Definition abi.h:273
uint32_t baud_rate
Baud rate (e.g., 9600, 115200)
Definition abi.h:267
GCDataBits data_bits
Number of data bits.
Definition abi.h:276
GCParity parity
Parity setting.
Definition abi.h:270
char interface[GC_INTERFACE_NAME_MAX]
OS interface path (e.g., "/dev/ttyS0", "/dev/ttyM0")
Definition abi.h:264
Holds the configuration and related functions.
Definition abi.h:328
const uint64_t subscribedDatapointsCount
Definition abi.h:348
const GCDatapoint * subscribedDatapoints
Definition abi.h:347
const uint64_t ownDatapointsCount
Definition abi.h:340
const GCDatapoint * ownDatapoints
Definition abi.h:339
const GCJsonCallbacks pluginJsonConfig
Definition abi.h:332