FIU Serial Library 1.0.0
FIU Serial Library
Loading...
Searching...
No Matches
CInterface.h File Reference

C-style interfaced to the library. More...

Include dependency graph for CInterface.h:

Classes

struct  FiuFirmwareVersion
 FIU firmware version. More...

Macros

#define FIU_SUCCESS   (0)
 Success (no error).
#define FIU_ERR_BOX_ID_OUT_OF_RANGE   (-1)
 Box ID out of range.
#define FIU_ERR_CHANNEL_INDEX_OUT_OF_RANGE   (-2)
 Channel index out of range.
#define FIU_ERR_INVALID_ARGUMENT   (-3)
 Invalid argument.
#define FIU_ERR_INVALID_RESPONSE   (-4)
 Invalid response received from FIU.
#define FIU_ERR_ALREADY_CONNECTED   (-5)
 Already connected.
#define FIU_ERR_FAILED_TO_OPEN_PORT   (-6)
 Failed to open serial port.
#define FIU_ERR_FAILED_TO_CONFIGURE_PORT   (-7)
 Failed to configure serial port.
#define FIU_ERR_NOT_CONNECTED   (-8)
 Not connected.
#define FIU_ERR_SEND_FAILED   (-9)
 Failed to send data through serial port.
#define FIU_ERR_READ_TIMED_OUT   (-10)
 Read timed out.
#define FIU_ERR_READ_FAILED   (-11)
 Read failed (serial port error).
#define FIU_ERR_CHECKSUM_MISMATCH   (-12)
 Checksum mismatch on received message.
#define FIU_ERR_SYNTAX_ERROR   (-13)
 Syntax error (from device).
#define FIU_ERR_SYSTEM_INTERLOCKED   (-14)
 System interlocked (from device).
#define FIU_ERR_RESOURCE_CONFLICT   (-15)
 Resource conflict (from device).
#define FIU_ERR_UNKNOWN_DEVICE_ERROR   (-16)
 Unknown error (from device).
#define FIU_ERR_INVALID_OBJECT   (-17)
 Invalid client object.
#define FIU_ERR_BUFFER_TOO_SMALL   (-18)
 Buffer too small.
#define FIU_ERR_ALLOCATION_FAILED   (-19)
 Allocation failed (C only).
#define FIU_ERR_UNEXPECTED_EXCEPTION   (-20)
 Unexpected exception (C only).
#define FIU_CHAN_STATE_DISCONNECTED   (0)
 Channel disconnected.
#define FIU_CHAN_STATE_CONNECTED   (1)
 Channel connected.
#define FIU_CHAN_STATE_VMEAS   (2)
 Voltage measurement mode.
#define FIU_CHAN_STATE_IMEAS   (3)
 Current measurement mode.
#define FIU_CHAN_STATE_FAULT   (4)
 Ground fault mode.

Typedefs

typedef void * FiuClientHandle
 FIU client handle.

Functions

FIU_API unsigned int FiuClient_Version ()
 Get the version of the library as an unsigned base 10 integer.
FIU_API const char * FiuClient_ErrorMessage (int error)
 Get a message describing an error code returned by the library.
FIU_API int FiuClient_Init (FiuClientHandle *handle_out)
 Initialize an FIU client.
FIU_API void FiuClient_Destroy (FiuClientHandle *handle)
 Destroy an FIU client.
FIU_API int FiuClient_Open (FiuClientHandle handle, const char *port)
 Open a serial connection to the FIU.
FIU_API int FiuClient_Close (FiuClientHandle handle)
 Close the serial port.
FIU_API int FiuClient_SetBoxID (FiuClientHandle handle, uint8_t box_id)
 Set the target box ID.
FIU_API int FiuClient_GetBoxID (FiuClientHandle handle, uint8_t *box_id_out)
 Get the target box ID.
FIU_API int FiuClient_SetChannelState (FiuClientHandle handle, unsigned int channel, uint8_t state)
 Set the state of a channel.
FIU_API int FiuClient_SetAllChannelStates (FiuClientHandle handle, uint8_t state)
 Set the state of all channels.
FIU_API int FiuClient_GetChannelStates (FiuClientHandle handle, uint8_t states_out[], unsigned int states_len)
 Get the states of all 24 channels.
FIU_API int FiuClient_GetFirmwareVersion (FiuClientHandle handle, FiuFirmwareVersion *version_out)
 Get the firmware version loaded onto the FIU.
FIU_API int FiuClient_SetSoftwareInterlock (FiuClientHandle handle, bool en)
 Set the state of the software interlock.
FIU_API int FiuClient_GetInterlockState (FiuClientHandle handle, bool *interlock_out)
 Get the system interlock state.

Detailed Description

C-style interfaced to the library.