BS120x Ethernet Library 1.0.0
BS120x Ethernet Library
Loading...
Searching...
No Matches
CInterface.h File Reference

C-style interface for the library. More...

+ Include dependency graph for CInterface.h:

Classes

struct  Bs120xOpModeConfig
 BS1201 operational mode configuration structure. More...
 
struct  Bs120xStatus
 BS1201 status structure. More...
 
struct  Bs120xUnitConfig
 BS1201 unit configuration structure. Strings are null-terminated. More...
 

Macros

#define BCI_ENET_ERR_SUCCESS   (0)
 Success (no error)
 
#define BCI_ENET_ERR_CHANNEL_INDEX_OUT_OF_RANGE   (-100)
 Channel index out of range.
 
#define BCI_ENET_ERR_INVALID_IP_ADDRESS   (-101)
 Invalid IP address.
 
#define BCI_ENET_ERR_ALREADY_CONNECTED   (-102)
 Driver already connected.
 
#define BCI_ENET_ERR_TCP_ALREADY_CONNECTED   (-103)
 TCP client already connected.
 
#define BCI_ENET_ERR_UDP_ALREADY_CONNECTED   (-104)
 UDP listener already connected.
 
#define BCI_ENET_ERR_UDP_SOCKET_OPEN_FAILED   (-105)
 Failed to open socket for UDP listener.
 
#define BCI_ENET_ERR_TCP_SOCKET_CONFIG_FAILED   (-106)
 Failed to configure TCP socket.
 
#define BCI_ENET_ERR_UDP_SOCKET_CONFIG_FAILED   (-107)
 Failed to configure UDP socket.
 
#define BCI_ENET_ERR_UDP_SOCKET_BIND_FAILED   (-108)
 Failed to bind UDP socket.
 
#define BCI_ENET_ERR_TCP_CONNECT_FAILED   (-109)
 Failed to connect TCP client.
 
#define BCI_ENET_ERR_READ_FAILED   (-110)
 Failed to read message.
 
#define BCI_ENET_ERR_SEND_FAILED   (-111)
 Failed to send message.
 
#define BCI_ENET_ERR_NOT_CONNECTED   (-112)
 Not connected.
 
#define BCI_ENET_ERR_FRAME_ID_MISMATCH   (-113)
 Frame Arb ID doesn't match expected value.
 
#define BCI_ENET_ERR_INVALID_FRAME_SIZE   (-114)
 Frame size does not match known messages.
 
#define BCI_ENET_ERR_AI_INDEX_OUT_OF_RANGE   (-115)
 Analog input index out of range.
 
#define BCI_ENET_ERR_DIO_INDEX_OUT_OF_RANGE   (-116)
 DIO index out of range.
 
#define BCI_ENET_ERR_BUFFER_TOO_SMALL   (-117)
 Buffer too small.
 
#define BCI_ENET_ERR_VOLTAGE_OUT_OF_RANGE   (-118)
 Voltage out of range.
 
#define BCI_ENET_ERR_CURRENT_OUT_OF_RANGE   (-119)
 Current out of range.
 
#define BCI_ENET_ERR_READBACK_TIMED_OUT   (-120)
 UDP read timed out.
 
#define BCI_ENET_ERR_INVALID_BOX_ID   (-121)
 Invalid box ID.
 
#define BCI_ENET_ERR_NO_CONFIG_DATA   (-122)
 Config data has not been queried.
 
#define BCI_ENET_ERR_INVALID_CONFIG_OPTION   (-123)
 Invalid configuration option.
 
#define BCI_ENET_ERR_WRONG_CONFIG_OPTION_TYPE   (-124)
 Invalid configuration option type.
 
#define BCI_ENET_ERR_INVALID_ARGUMENT   (-125)
 Invalid argument.
 
#define BCI_ENET_ERR_ALLOCATION_FAILED   (-126)
 Allocation failed.
 
#define BCI_ENET_ERR_UNEXPECTED_EXCEPTION   (-127)
 Unexpected exception.
 

Typedefs

typedef void * Bs120xEnetHandle
 Ethernet client handle.
 

Functions

unsigned int Bs120xEnet_Version ()
 Get the library version as an unsigned base 10 integer.
 
const char * Bs120xEnet_ErrorMessage (int error)
 Get an error message to describe an error code returned by the driver.
 
int Bs120xEnet_Init (Bs120xEnetHandle *handle_out)
 Initialize an Ethernet client.
 
void Bs120xEnet_Destroy (Bs120xEnetHandle *handle)
 Destroy an Ethernet client.
 
int Bs120xEnet_Connect (Bs120xEnetHandle handle, const char *interface_ip, const char *device_ip, uint16_t udp_port, uint32_t udp_timeout, uint16_t tcp_port)
 Connect to a unit.
 
int Bs120xEnet_Disconnect (Bs120xEnetHandle handle)
 Disconnect from the unit.
 
int Bs120xEnet_SetDIOStates (Bs120xEnetHandle handle, const bool output[], size_t output_len, const bool direction[], size_t direction_len)
 Set the output states and directions for all DIO.
 
int Bs120xEnet_SetAnalogOutputs (Bs120xEnetHandle handle, const float voltages[], size_t voltages_len)
 Set the voltages for all analog outputs.
 
int Bs120xEnet_SetOpModeConfig (Bs120xEnetHandle handle, struct Bs120xOpModeConfig config)
 Configures the operating mode of the unit.
 
int Bs120xEnet_SetAllCellCurrents (Bs120xEnetHandle handle, float isrc, float isnk)
 Sets the sinking and sourcing current limits for all cells.
 
int Bs120xEnet_SetCellSinkCurrent (Bs120xEnetHandle handle, unsigned int cell, float isnk)
 Sets the sinking current limit for a single cell.
 
int Bs120xEnet_SetCellSourceCurrent (Bs120xEnetHandle handle, unsigned int cell, float isrc)
 Sets teh sourcing current limit for a single cell.
 
int Bs120xEnet_SetAllCellVoltage (Bs120xEnetHandle handle, float voltage)
 Sets the voltage for all cells.
 
int Bs120xEnet_SetCellVoltage (Bs120xEnetHandle handle, unsigned int cell, float voltage)
 Sets the voltage for a single cell.
 
int Bs120xEnet_EnableAllCells (Bs120xEnetHandle handle, bool enable)
 Enables or disables all cells.
 
int Bs120xEnet_EnableCell (Bs120xEnetHandle handle, unsigned int cell, bool enable)
 Enables or disables a single cell.
 
int Bs120xEnet_GetCellVoltage (Bs120xEnetHandle handle, unsigned int cell, float *voltage_out)
 Gets the voltage of a cell.
 
int Bs120xEnet_GetAllCellVoltage (Bs120xEnetHandle handle, float voltage_out[], size_t voltage_out_len)
 Gets the voltages of all cells.
 
int Bs120xEnet_GetCellCurrent (Bs120xEnetHandle handle, unsigned int cell, float *current_out)
 Gets the current of a cell in Amps.
 
int Bs120xEnet_GetAllCellCurrent (Bs120xEnetHandle handle, float current_out[], size_t current_out_len)
 Get the currents of all cells in Amps.
 
int Bs120xEnet_GetAnalogInput (Bs120xEnetHandle handle, unsigned int analog_input, float *voltage_out)
 Gets the voltage of an analog input.
 
int Bs120xEnet_GetAllAnalogInput (Bs120xEnetHandle handle, float voltage_out[], size_t voltage_out_len)
 Gets the voltages of all analog inputs.
 
int Bs120xEnet_GetDIOState (Bs120xEnetHandle handle, unsigned int dio, bool *state_out)
 Gets the output state of a DIO.
 
int Bs120xEnet_GetAllDIOState (Bs120xEnetHandle handle, bool state_out[], size_t state_out_len)
 Gets the output states of all DIO.
 
int Bs120xEnet_GetStatus (Bs120xEnetHandle handle, struct Bs120xStatus *status_out)
 Gets the status of the unit.
 
int Bs120xEnet_GetUnitConfig (Bs120xEnetHandle handle, struct Bs120xUnitConfig *unit_config_out)
 Gets the configuration values of a unit after a QueryConfig call.
 
int Bs120xEnet_Reset (Bs120xEnetHandle handle)
 Commands the unit to reset.
 
int Bs120xEnet_SetIPAddress (Bs120xEnetHandle handle, const char *ip)
 Sets the unit IP address.
 
int Bs120xEnet_QueryConfig (Bs120xEnetHandle handle)
 Sends a request to the unit for its configuration information.
 
int Bs120xEnet_SetConfigOptionInt (Bs120xEnetHandle handle, const char *opt, int value)
 Sets an integer configuration option.
 
int Bs120xEnet_SetConfigOptionBool (Bs120xEnetHandle handle, const char *opt, bool value)
 Sets a boolean configuration option.
 
int Bs120xEnet_SetConfigOptionString (Bs120xEnetHandle handle, const char *opt, const char *value)
 Sets a string configuration option.
 
int Bs120xEnet_SetConfigOptionFloat (Bs120xEnetHandle handle, const char *opt, double value)
 Sets a floating-point configuration option.
 
int Bs120xEnet_EnableUDPData (Bs120xEnetHandle handle, bool enable)
 Enables the UDP data broadcast for the unit.
 
int Bs120xEnet_SetUDPDataPort (Bs120xEnetHandle handle, uint16_t port)
 Sets the port for the unit's UDP data broadcast.
 
int Bs120xEnet_SetUDPDataPeriod (Bs120xEnetHandle handle, uint32_t period)
 Sets the period for the unit's UDP data broadcast.
 
int Bs120xEnet_SetBoxId (Bs120xEnetHandle handle, uint8_t id)
 Sets the unit's box ID.
 
int Bs120xEnet_SetCANPeriod (Bs120xEnetHandle handle, uint32_t period)
 Sets the period for the unit's CAN broadcast.
 
int Bs120xEnet_EnableCellInhibit (Bs120xEnetHandle handle, bool enable)
 Enables or disables the cell inhibit lines.
 
int Bs120xEnet_GetConfigValueBool (Bs120xEnetHandle handle, const char *opt, bool *value_out)
 Get a boolean configuration value.
 
int Bs120xEnet_GetConfigValueInt (Bs120xEnetHandle handle, const char *opt, int *value_out)
 Get an integer configuration value.
 
int Bs120xEnet_GetConfigValueFloat (Bs120xEnetHandle handle, const char *opt, float *value_out)
 Get a floating-point configuration value.
 
int Bs120xEnet_GetConfigValueString (Bs120xEnetHandle handle, const char *opt, char buf[], size_t len)
 Get a string configuration value.
 

Detailed Description

C-style interface for the library.