BS120x Ethernet Library 1.0.0
BS120x Ethernet Library
Loading...
Searching...
No Matches
C Interface

This interface provides a wrapper around the C++ library for use in C and other languages. More...

+ Collaboration diagram for C Interface:

Modules

 Error Codes
 Error codes returned by the Ethernet client functions.
 
 Auxiliary IO
 Functions for controlling and reading auxiliary IO.
 
 Cells
 Functions for controlling and reading back cells.
 
 System
 Functions related to system status and control.
 
 Configuration
 Functions for setting and reading unit configuration information.
 

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.
 

Detailed Description

This interface provides a wrapper around the C++ library for use in C and other languages.

Function Documentation

◆ Bs120xEnet_Connect()

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.

Parameters
[in]handleEthernet client handle.
[in]interface_ipIP address of the local NIC to connect from.
[in]device_ipIP address of the unit.
[in]udp_portUDP data port for the unit.
[in]udp_timeoutTimeout in milliseconds to receive UDP data broadcast. A negative value will wait indefinitely.
[in]tcp_portTCP port to send commands on. BS120x default is 12345.
Returns
0 on success or a negative error code.

◆ Bs120xEnet_Destroy()

void Bs120xEnet_Destroy ( Bs120xEnetHandle handle)

Destroy an Ethernet client.

Parameters
[in,out]handleHandle pointer to a handle to destroy.

◆ Bs120xEnet_Disconnect()

int Bs120xEnet_Disconnect ( Bs120xEnetHandle  handle)

Disconnect from the unit.

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

◆ Bs120xEnet_ErrorMessage()

const char * Bs120xEnet_ErrorMessage ( int  error)

Get an error message to describe an error code returned by the driver.

Parameters
[in]errorError code.
Returns
Null-terminated error message string.

◆ Bs120xEnet_Init()

int Bs120xEnet_Init ( Bs120xEnetHandle handle_out)

Initialize an Ethernet client.

Must be destroyed by the caller!

Parameters
[out]handle_outPointer to a handle to initialize. (Handle should be zeroed.)
Returns
0 on success or a negative error code.

◆ Bs120xEnet_Version()

unsigned int Bs120xEnet_Version ( )

Get the library version as an unsigned base 10 integer.

For example, version 1.2.3 would return 10203.

This is intended to be used to check for the existence of certain functionality based on library version, particularly in wrappers (such as Python).

Returns
The library version.