ABS SCPI Driver 0.2.0
ABS SCPI driver 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 SCPI driver functions.
 
 System Control
 Functions for controlling the system, such as querying device info and updating the IP address.
 
 Cell Control
 Functions for controlling and measuring the cells.
 
 Aux IO Control
 Functions for controlling auxiliary analog and digital IO.
 
 Model Control
 Model control functionality.
 
 Device Discovery
 Functions for discovering ABSes on the network.
 

Typedefs

typedef void * AbsScpiClientHandle
 ABS SCPI client handle.
 

Functions

const char * AbsScpiClient_ErrorMessage (int error)
 Get an error message to describe an error code returned by the driver.
 
int AbsScpiClient_Init (AbsScpiClientHandle *handle_out)
 Initialize a SCPI client.
 
void AbsScpiClient_Destroy (AbsScpiClientHandle *handle)
 Destroy a SCPI client.
 
int AbsScpiClient_OpenUdp (AbsScpiClientHandle handle, const char *target_ip, const char *interface_ip)
 Open a UDP connection to the ABS.
 
int AbsScpiClient_OpenTcp (AbsScpiClientHandle handle, const char *target_ip)
 Open a TCP connection to the ABS.
 
int AbsScpiClient_OpenSerial (AbsScpiClientHandle handle, const char *com_port, unsigned int device_id)
 Open a serial connection to one or many ABSes.
 
int AbsScpiClient_OpenUdpMulticast (AbsScpiClientHandle handle, const char *interface_ip)
 Open a UDP multicast socket for broadcasting to many ABSes.
 
int AbsScpiClient_SetTargetDeviceId (AbsScpiClientHandle handle, unsigned int device_id)
 Set the target device ID for communication.
 
int AbsScpiClient_GetTargetDeviceId (AbsScpiClientHandle handle, unsigned int *device_id_out)
 Get the target device ID for communication.
 

Detailed Description

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

Function Documentation

◆ AbsScpiClient_Destroy()

void AbsScpiClient_Destroy ( AbsScpiClientHandle handle)

Destroy a SCPI client.

Parameters
[in,out]handlepointer to a handle to destroy

◆ AbsScpiClient_ErrorMessage()

const char * AbsScpiClient_ErrorMessage ( int  error)

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

Returns
Null-terminated error message string.

◆ AbsScpiClient_GetTargetDeviceId()

int AbsScpiClient_GetTargetDeviceId ( AbsScpiClientHandle  handle,
unsigned int *  device_id_out 
)

Get the target device ID for communication.

Only relevant for RS-485 connections.

Parameters
[in]handleSCPI client
[out]device_id_outtarget device ID
Returns
0 on success or a negative error code.

◆ AbsScpiClient_Init()

int AbsScpiClient_Init ( AbsScpiClientHandle handle_out)

Initialize a SCPI 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.

◆ AbsScpiClient_OpenSerial()

int AbsScpiClient_OpenSerial ( AbsScpiClientHandle  handle,
const char *  com_port,
unsigned int  device_id 
)

Open a serial connection to one or many ABSes.

Parameters
[in]handleSCPI client
[in]com_portthe serial port to open, such as COM1 or /dev/ttyS0
[in]device_idtarget device ID, 0-31, or 32+ to broadcast to all units on the bus
Returns
0 on success or a negative error code.

◆ AbsScpiClient_OpenTcp()

int AbsScpiClient_OpenTcp ( AbsScpiClientHandle  handle,
const char *  target_ip 
)

Open a TCP connection to the ABS.

Note
As a consequence of TCP's design, it is inherently less deterministic than UDP. Commanding the ABS over TCP can be slower and less deterministic than UDP, so for time-sensitive applications, it's recommended to avoid TCP in favor of UDP.
Parameters
[in]handleSCPI client
[in]target_ipABS's IP address
Returns
0 on success or a negative error code.

◆ AbsScpiClient_OpenUdp()

int AbsScpiClient_OpenUdp ( AbsScpiClientHandle  handle,
const char *  target_ip,
const char *  interface_ip 
)

Open a UDP connection to the ABS.

Parameters
[in]handleSCPI client
[in]target_ipABS's IP address
[in]interface_ipaddress of the local interface to bind the socket to (may be NULL or empty to use any local address)
Returns
0 on success or a negative error code.

◆ AbsScpiClient_OpenUdpMulticast()

int AbsScpiClient_OpenUdpMulticast ( AbsScpiClientHandle  handle,
const char *  interface_ip 
)

Open a UDP multicast socket for broadcasting to many ABSes.

Parameters
[in]handleSCPI client
[in]interface_ipIP address of the local NIC to bind to
Returns
0 on success or a negative error code.

◆ AbsScpiClient_SetTargetDeviceId()

int AbsScpiClient_SetTargetDeviceId ( AbsScpiClientHandle  handle,
unsigned int  device_id 
)

Set the target device ID for communication.

Only applies to RS-485 connections.

Parameters
[in]handleSCPI client
[in]device_idtarget device ID, 0-31, or 32+ to broadcast to all units on the bus
Returns
0 on success or a negative error code.