BS120x Ethernet Library 1.0.0
BS120x Ethernet Library
Loading...
Searching...
No Matches
Configuration

Functions for setting and reading unit configuration information. More...

+ Collaboration diagram for Configuration:

Classes

struct  Bs120xUnitConfig
 BS1201 unit configuration structure. Strings are null-terminated. More...
 

Functions

int Bs120xEnet_GetUnitConfig (Bs120xEnetHandle handle, struct Bs120xUnitConfig *unit_config_out)
 Gets the configuration values of a unit after a QueryConfig call.
 
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

Functions for setting and reading unit configuration information.

Function Documentation

◆ Bs120xEnet_EnableCellInhibit()

int Bs120xEnet_EnableCellInhibit ( Bs120xEnetHandle  handle,
bool  enable 
)

Enables or disables the cell inhibit lines.

Parameters
[in]handleEthernet client handle.
[in]enableThe enable state for the cell inhibit lines.
Returns
0 on success or a negative error code.

◆ Bs120xEnet_EnableUDPData()

int Bs120xEnet_EnableUDPData ( Bs120xEnetHandle  handle,
bool  enable 
)

Enables the UDP data broadcast for the unit.

Unit must be reset for changes to take effect.

Parameters
[in]handleEthernet client handle.
[in]enableA value of TRUE will enable the UDP data broadcast.
Returns
0 on success or a negative error code.

◆ Bs120xEnet_GetConfigValueBool()

int Bs120xEnet_GetConfigValueBool ( Bs120xEnetHandle  handle,
const char *  opt,
bool *  value_out 
)

Get a boolean configuration value.

Note
QueryConfig must be called prior to calling this method.
Parameters
[in]handleEthernet client handle.
[in]optThe configuration option to look up.
[out]value_outPointer to the returned configuration value.
Returns
0 on success or a negative error code.

◆ Bs120xEnet_GetConfigValueFloat()

int Bs120xEnet_GetConfigValueFloat ( Bs120xEnetHandle  handle,
const char *  opt,
float *  value_out 
)

Get a floating-point configuration value.

Note
QueryConfig must be called prior to calling this method.
Parameters
[in]handleEthernet client handle.
[in]optThe configuration option to look up.
[out]value_outPointer to the returned configuration value.
Returns
0 on success or a negative error code.

◆ Bs120xEnet_GetConfigValueInt()

int Bs120xEnet_GetConfigValueInt ( Bs120xEnetHandle  handle,
const char *  opt,
int *  value_out 
)

Get an integer configuration value.

Note
QueryConfig must be called prior to calling this method.
Parameters
[in]handleEthernet client handle.
[in]optThe configuration option to look up.
[out]value_outPointer to the returned configuration value.
Returns
0 on success or a negative error code.

◆ Bs120xEnet_GetConfigValueString()

int Bs120xEnet_GetConfigValueString ( Bs120xEnetHandle  handle,
const char *  opt,
char  buf[],
size_t  len 
)

Get a string configuration value.

Note
QueryConfig must be called prior to calling this method.
Parameters
[in]handleEthernet client handle.
[in]optThe configuration option to look up.
[out]bufBuffer to hold the returned configuration value.
[in]lenLength of the buffer.
Returns
0 on success or a negative error code.

◆ Bs120xEnet_GetUnitConfig()

int Bs120xEnet_GetUnitConfig ( Bs120xEnetHandle  handle,
struct Bs120xUnitConfig unit_config_out 
)

Gets the configuration values of a unit after a QueryConfig call.

Note
QueryConfig must be called prior to calling this method.
Parameters
[in]handleEthernet client handle.
[out]unit_config_outPointer to the returned configuration.
Returns
0 on success or a negative error code.

◆ Bs120xEnet_QueryConfig()

int Bs120xEnet_QueryConfig ( Bs120xEnetHandle  handle)

Sends a request to the unit for its configuration information.

Parameters
[in]handleEthernet client handle.
Returns
0 on success or a negative error code.

◆ Bs120xEnet_SetBoxId()

int Bs120xEnet_SetBoxId ( Bs120xEnetHandle  handle,
uint8_t  id 
)

Sets the unit's box ID.

Unit must be reset for changes to take effect.

Parameters
[in]handleEthernet client handle.
[in]idThe new box ID. Valid values are 0-15.
Returns
0 on success or a negative error code.

◆ Bs120xEnet_SetCANPeriod()

int Bs120xEnet_SetCANPeriod ( Bs120xEnetHandle  handle,
uint32_t  period 
)

Sets the period for the unit's CAN broadcast.

Unit must be reset for changes to take effect.

Parameters
[in]handleEthernet client handle.
[in]periodThe new period in milliseconds.
Returns
0 on success or a negative error code.

◆ Bs120xEnet_SetConfigOptionBool()

int Bs120xEnet_SetConfigOptionBool ( Bs120xEnetHandle  handle,
const char *  opt,
bool  value 
)

Sets a boolean configuration option.

Unit must be reset for changes to take effect.

Parameters
[in]handleEthernet client handle.
[in]optThe configuration option to set.
[in]valueThe value to set the configuration option to.
Returns
0 on success or a negative error code.

◆ Bs120xEnet_SetConfigOptionFloat()

int Bs120xEnet_SetConfigOptionFloat ( Bs120xEnetHandle  handle,
const char *  opt,
double  value 
)

Sets a floating-point configuration option.

Unit must be reset for changes to take effect.

Parameters
[in]handleEthernet client handle.
[in]optThe configuration option to set.
[in]valueThe value to set the configuration option to.
Returns
0 on success or a negative error code.

◆ Bs120xEnet_SetConfigOptionInt()

int Bs120xEnet_SetConfigOptionInt ( Bs120xEnetHandle  handle,
const char *  opt,
int  value 
)

Sets an integer configuration option.

Unit must be reset for changes to take effect.

Parameters
[in]handleEthernet client handle.
[in]optThe configuration option to set.
[in]valueThe value to set the configuration option to.
Returns
0 on success or a negative error code.

◆ Bs120xEnet_SetConfigOptionString()

int Bs120xEnet_SetConfigOptionString ( Bs120xEnetHandle  handle,
const char *  opt,
const char *  value 
)

Sets a string configuration option.

Unit must be reset for changes to take effect.

Parameters
[in]handleEthernet client handle.
[in]optThe configuration option to set.
[in]valueThe value to set the configuration option to.
Returns
0 on success or a negative error code.

◆ Bs120xEnet_SetIPAddress()

int Bs120xEnet_SetIPAddress ( Bs120xEnetHandle  handle,
const char *  ip 
)

Sets the unit IP address.

Unit must be reset for changes to take effect.

Parameters
[in]handleEthernet client handle.
[in]ipNew IP address for the unit. Last octet may not have a value of 1 or 255.
Returns
0 on success or a negative error code.

◆ Bs120xEnet_SetUDPDataPeriod()

int Bs120xEnet_SetUDPDataPeriod ( Bs120xEnetHandle  handle,
uint32_t  period 
)

Sets the period for the unit's UDP data broadcast.

Unit must be reset for changes to take effect.

Parameters
[in]handleEthernet client handle.
[in]periodThe new period in milliseconds.
Returns
0 on success or a negative error code.

◆ Bs120xEnet_SetUDPDataPort()

int Bs120xEnet_SetUDPDataPort ( Bs120xEnetHandle  handle,
uint16_t  port 
)

Sets the port for the unit's UDP data broadcast.

Unit must be reset for changes to take effect.

Parameters
[in]handleEthernet client handle.
[in]portThe new UDP port.
Returns
0 on success or a negative error code.