ABS SCPI Driver 0.2.0
ABS SCPI driver library
Loading...
Searching...
No Matches
CInterface.h File Reference

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

+ Include dependency graph for CInterface.h:

Classes

struct  AbsDeviceInfo
 ABS device information structure. All strings are guaranteed to be null-terminated. More...
 
struct  AbsEthernetConfig
 ABS Ethernet address configuration. All strings are guaranteed to be null-terminated. More...
 
struct  AbsModelInfo
 Information about a model. Strings are null-terminated. More...
 
struct  AbsEthernetDiscoveryResult
 ABS Ethernet discovery result. All strings are guaranteed to be null-terminated. More...
 
struct  AbsSerialDiscoveryResult
 ABS serial discovery result. All strings are guaranteed to be null-terminated. More...
 

Macros

#define ABS_SCPI_ERR_SUCCESS   (0)
 Success (no error)
 
#define ABS_SCPI_ERR_CHANNEL_INDEX_OUT_OF_RANGE   (-1)
 Channel index out of range.
 
#define ABS_SCPI_ERR_INVALID_IP_ADDRESS   (-2)
 Invalid IP address.
 
#define ABS_SCPI_ERR_CONNECTION_TIMED_OUT   (-3)
 Connection timed out.
 
#define ABS_SCPI_ERR_CONNECTION_FAILED   (-4)
 Connection failed.
 
#define ABS_SCPI_ERR_SEND_FAILED   (-5)
 Failed to send message.
 
#define ABS_SCPI_ERR_SEND_TIMED_OUT   (-6)
 Send timed out.
 
#define ABS_SCPI_ERR_READ_FAILED   (-7)
 Failed to read message.
 
#define ABS_SCPI_ERR_READ_TIMED_OUT   (-8)
 Read timed out.
 
#define ABS_SCPI_ERR_NOT_CONNECTED   (-9)
 Not connected.
 
#define ABS_SCPI_ERR_INVALID_RESPONSE   (-10)
 Invalid response from the unit.
 
#define ABS_SCPI_ERR_INVALID_FAULT_TYPE   (-11)
 Invalid fault type.
 
#define ABS_SCPI_ERR_INVALID_SENSE_RANGE   (-12)
 Invalid sense range.
 
#define ABS_SCPI_ERR_INVALID_ARGUMENT   (-13)
 Invalid argument.
 
#define ABS_SCPI_ERR_INVALID_DRIVER_HANDLE   (-14)
 Invalid driver handle.
 
#define ABS_SCPI_ERR_RECEIVE_NOT_ALLOWED   (-15)
 Receive not allowed by driver.
 
#define ABS_SCPI_ERR_ALREADY_CONNECTED   (-16)
 Already connected.
 
#define ABS_SCPI_ERR_SOCKET_ERROR   (-17)
 Unexpected socket error.
 
#define ABS_SCPI_ERR_FAILED_TO_BIND_SOCKET   (-18)
 Failed to bind socket.
 
#define ABS_SCPI_ERR_OPENING_SERIAL_PORT_FAILED   (-19)
 Failed to open serial port.
 
#define ABS_SCPI_ERR_FAILED_TO_CONFIGURE_PORT   (-20)
 Failed to configure serial port.
 
#define ABS_SCPI_ERR_FAILED_TO_JOIN_GROUP   (-21)
 Failed to join multicast group.
 
#define ABS_SCPI_ERR_BUFFER_TOO_SMALL   (-22)
 Buffer too small.
 
#define ABS_SCPI_ERR_ALLOCATION_FAILED   (-23)
 Allocation failed.
 
#define ABS_SCPI_ERR_UNEXPECTED_EXCEPTION   (-24)
 Unexpected exception.
 
#define ABS_CELL_FAULT_NONE   0
 No fault.
 
#define ABS_CELL_FAULT_OPEN   1
 Open circuit fault.
 
#define ABS_CELL_FAULT_SHORT   2
 Short circuit fault.
 
#define ABS_CELL_FAULT_POLARITY   3
 Polarity fault.
 
#define ABS_CELL_SENSE_RANGE_AUTO   0
 Automatic based on current limits (default)
 
#define ABS_CELL_SENSE_RANGE_1A   1
 Low range (1A)
 
#define ABS_CELL_SENSE_RANGE_5A   2
 High range (5A)
 
#define ABS_CELL_MODE_CV   0
 Constant voltage (normal)
 
#define ABS_CELL_MODE_ILIM   1
 Current limited.
 
#define ABS_MODEL_STATUS_RUNNING   (0x01)
 Model is running.
 
#define ABS_MODEL_STATUS_LOADED   (0x02)
 Model is loaded.
 
#define ABS_MODEL_STATUS_ERRORED   (0x04)
 Model has errored.
 

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.
 
int AbsScpiClient_GetDeviceInfo (AbsScpiClientHandle handle, AbsDeviceInfo *info_out)
 Query basic information about the unit.
 
int AbsScpiClient_GetDeviceId (AbsScpiClientHandle handle, uint8_t *id_out)
 Query the ABS's device ID.
 
int AbsScpiClient_GetIPAddress (AbsScpiClientHandle handle, AbsEthernetConfig *addr_out)
 Query the device's IP address and subnet mask.
 
int AbsScpiClient_SetIPAddress (AbsScpiClientHandle handle, const AbsEthernetConfig *addr)
 Set the device's IP address and subnet mask.
 
int AbsScpiClient_GetCalibrationDate (AbsScpiClientHandle handle, char buf[], unsigned int len)
 Get the device's calibration date.
 
int AbsScpiClient_GetErrorCount (AbsScpiClientHandle handle, int *count_out)
 Query the number of error's in the device's error queue.
 
int AbsScpiClient_GetNextError (AbsScpiClientHandle handle, int16_t *err_code_out, char msg_buf[], unsigned int msg_buf_len)
 Query the next error from the device's error queue.
 
int AbsScpiClient_ClearErrors (AbsScpiClientHandle handle)
 Clear the device's error queue.
 
int AbsScpiClient_GetAlarms (AbsScpiClientHandle handle, uint32_t *alarms_out)
 Query the alarms raised on the device.
 
int AbsScpiClient_GetInterlockState (AbsScpiClientHandle handle, bool *interlock_out)
 Query the system interlock state.
 
int AbsScpiClient_AssertSoftwareInterlock (AbsScpiClientHandle handle)
 Assert the software interlock (a recoverable alarm).
 
int AbsScpiClient_ClearRecoverableAlarms (AbsScpiClientHandle handle)
 Clear recoverable alarms.
 
int AbsScpiClient_Reboot (AbsScpiClientHandle handle)
 Reboot the device, resetting it to its POR state.
 
int AbsScpiClient_EnableCell (AbsScpiClientHandle handle, unsigned int cell, bool en)
 Enable a single cell.
 
int AbsScpiClient_EnableCellsMasked (AbsScpiClientHandle handle, unsigned int cells, bool en)
 Enable or disable multiple cells at once.
 
int AbsScpiClient_GetCellEnabled (AbsScpiClientHandle handle, unsigned int cell, bool *en_out)
 Query whether a cell is enabled.
 
int AbsScpiClient_GetCellsEnabledMasked (AbsScpiClientHandle handle, unsigned int *cells_out)
 Query the enable state of all cells.
 
int AbsScpiClient_SetCellVoltage (AbsScpiClientHandle handle, unsigned int cell, float voltage)
 Set a single cell's target voltage.
 
int AbsScpiClient_SetAllCellVoltages (AbsScpiClientHandle handle, const float voltages[], unsigned int count)
 Set many cells' target voltages.
 
int AbsScpiClient_SetMultipleCellVoltages (AbsScpiClientHandle handle, unsigned int cells, float voltage)
 Set multiple cells to the same voltage.
 
int AbsScpiClient_GetCellVoltageTarget (AbsScpiClientHandle handle, unsigned int cell, float *voltage_out)
 Query a cell's target voltage.
 
int AbsScpiClient_GetAllCellVoltageTargets (AbsScpiClientHandle handle, float voltages_out[], unsigned int count)
 Query many cells' target voltages.
 
int AbsScpiClient_SetCellSourcing (AbsScpiClientHandle handle, unsigned int cell, float limit)
 Set a single cell's current sourcing limit.
 
int AbsScpiClient_SetAllCellSourcing (AbsScpiClientHandle handle, const float limits[], unsigned int count)
 Set many cells' sourcing limits.
 
int AbsScpiClient_SetMultipleCellSourcing (AbsScpiClientHandle handle, unsigned int cells, float limit)
 Set multiple cells to the same sourcing limit.
 
int AbsScpiClient_GetCellSourcingLimit (AbsScpiClientHandle handle, unsigned int cell, float *limit_out)
 Query a single cell's sourcing limit.
 
int AbsScpiClient_GetAllCellSourcingLimits (AbsScpiClientHandle handle, float limits_out[], unsigned int count)
 Query many cells' sourcing limits.
 
int AbsScpiClient_SetCellSinking (AbsScpiClientHandle handle, unsigned int cell, float limit)
 Set a single cell's current sinking limit.
 
int AbsScpiClient_SetAllCellSinking (AbsScpiClientHandle handle, const float limits[], unsigned int count)
 Set many cells' sinking limits.
 
int AbsScpiClient_SetMultipleCellSinking (AbsScpiClientHandle handle, unsigned int cells, float limit)
 Set multiple cells to the same sinking limit.
 
int AbsScpiClient_GetCellSinkingLimit (AbsScpiClientHandle handle, unsigned int cell, float *limit_out)
 Query a single cell's sinking limit.
 
int AbsScpiClient_GetAllCellSinkingLimits (AbsScpiClientHandle handle, float limits_out[], unsigned int count)
 Query many cells' sinking limits.
 
int AbsScpiClient_SetCellFault (AbsScpiClientHandle handle, unsigned int cell, int fault)
 Set a single cell's fault state.
 
int AbsScpiClient_SetAllCellFaults (AbsScpiClientHandle handle, const int faults[], unsigned int count)
 Set many cells' fault states.
 
int AbsScpiClient_SetMultipleCellFaults (AbsScpiClientHandle handle, unsigned int cells, int fault)
 Set multiple cells to the same fault state.
 
int AbsScpiClient_GetCellFault (AbsScpiClientHandle handle, unsigned int cell, int *fault_out)
 Query a single cell's fault state.
 
int AbsScpiClient_GetAllCellFaults (AbsScpiClientHandle handle, int faults_out[], unsigned int count)
 Query many cells' fault states.
 
int AbsScpiClient_SetCellSenseRange (AbsScpiClientHandle handle, unsigned int cell, int range)
 Set a single cell's current sense range.
 
int AbsScpiClient_SetAllCellSenseRanges (AbsScpiClientHandle handle, const int ranges[], unsigned int count)
 Set many cells' current sense ranges.
 
int AbsScpiClient_GetCellSenseRange (AbsScpiClientHandle handle, unsigned int cell, int *range_out)
 Query a single cell's current sense range.
 
int AbsScpiClient_GetAllCellSenseRanges (AbsScpiClientHandle handle, int ranges_out[], unsigned int count)
 Query many cells' current sense ranges.
 
int AbsScpiClient_EnableCellNoiseFilter (AbsScpiClientHandle handle, bool en)
 Enable or disable the cell 50/60Hz noise filter.
 
int AbsScpiClient_GetCellNoiseFilterEnabled (AbsScpiClientHandle handle, bool *en_out)
 Query the enable state of the cell 50/60Hz noise filter.
 
int AbsScpiClient_MeasureCellVoltage (AbsScpiClientHandle handle, unsigned int cell, float *voltage_out)
 Measure a cell's voltage.
 
int AbsScpiClient_MeasureAllCellVoltages (AbsScpiClientHandle handle, float voltages_out[], unsigned int count)
 Measure many cells' voltages.
 
int AbsScpiClient_MeasureCellCurrent (AbsScpiClientHandle handle, unsigned int cell, float *current_out)
 Measure a cell's current.
 
int AbsScpiClient_MeasureAllCellCurrents (AbsScpiClientHandle handle, float currents_out[], unsigned int count)
 Measure many cells' currents.
 
int AbsScpiClient_GetCellOperatingMode (AbsScpiClientHandle handle, unsigned int cell, int *mode_out)
 Query a cell's operating mode (constant voltage or current-limited).
 
int AbsScpiClient_GetAllCellOperatingModes (AbsScpiClientHandle handle, int modes_out[], unsigned int count)
 Query many cells' operating modes (constant voltage or current-limited).
 
int AbsScpiClient_SetAnalogOutput (AbsScpiClientHandle handle, unsigned int channel, float voltage)
 Set a single analog output's voltage.
 
int AbsScpiClient_SetAllAnalogOutputs (AbsScpiClientHandle handle, const float voltages[], unsigned int count)
 Set many analog outputs.
 
int AbsScpiClient_SetMultipleAnalogOutputs (AbsScpiClientHandle handle, unsigned int channels, float voltage)
 Set multiple analog outputs to the same value.
 
int AbsScpiClient_GetAnalogOutput (AbsScpiClientHandle handle, unsigned int channel, float *voltage_out)
 Query on analog output's set point.
 
int AbsScpiClient_GetAllAnalogOutputs (AbsScpiClientHandle handle, float voltages_out[], unsigned int count)
 Query many analog outputs' set points.
 
int AbsScpiClient_SetDigitalOutput (AbsScpiClientHandle handle, unsigned int channel, bool level)
 Set a single digital output.
 
int AbsScpiClient_SetAllDigitalOutputs (AbsScpiClientHandle handle, unsigned int levels_mask)
 Set all digital outputs.
 
int AbsScpiClient_GetDigitalOutput (AbsScpiClientHandle handle, unsigned int channel, bool *level_out)
 Query the state of a digital output.
 
int AbsScpiClient_GetAllDigitalOutputs (AbsScpiClientHandle handle, unsigned int *levels_out)
 Query the states of all digital outputs.
 
int AbsScpiClient_MeasureAnalogInput (AbsScpiClientHandle handle, unsigned int channel, float *voltage_out)
 Measure a single analog input.
 
int AbsScpiClient_MeasureAllAnalogInputs (AbsScpiClientHandle handle, float voltages_out[], unsigned int count)
 Measure many analog inputs.
 
int AbsScpiClient_MeasureDigitalInput (AbsScpiClientHandle handle, unsigned int channel, bool *level_out)
 Measure a single digital input.
 
int AbsScpiClient_MeasureAllDigitalInputs (AbsScpiClientHandle handle, unsigned int *levels_out)
 Measure all digital inputs.
 
int AbsScpiClient_GetModelStatus (AbsScpiClientHandle handle, uint8_t *status_out)
 Query the model status.
 
int AbsScpiClient_LoadModel (AbsScpiClientHandle handle)
 Load the model configuration on the device.
 
int AbsScpiClient_StartModel (AbsScpiClientHandle handle)
 Start modeling.
 
int AbsScpiClient_StopModel (AbsScpiClientHandle handle)
 Stop modeling.
 
int AbsScpiClient_UnloadModel (AbsScpiClientHandle handle)
 Unload the model configuration.
 
int AbsScpiClient_GetModelInfo (AbsScpiClientHandle handle, AbsModelInfo *model_info_out)
 Query information about the loaded model.
 
int AbsScpiClient_SetGlobalModelInput (AbsScpiClientHandle handle, unsigned int index, float value)
 Set a single global model input.
 
int AbsScpiClient_SetAllGlobalModelInputs (AbsScpiClientHandle handle, const float values[], unsigned int count)
 Set multiple global model inputs.
 
int AbsScpiClient_GetGlobalModelInput (AbsScpiClientHandle handle, unsigned int index, float *value_out)
 Query the value of a single global model input.
 
int AbsScpiClient_GetAllGlobalModelInputs (AbsScpiClientHandle handle, float values_out[], unsigned int count)
 Query the values of multiple global model inputs.
 
int AbsScpiClient_SetLocalModelInput (AbsScpiClientHandle handle, unsigned int index, float value)
 Set a single local model input.
 
int AbsScpiClient_SetAllLocalModelInputs (AbsScpiClientHandle handle, const float values[], unsigned int count)
 Set multiple local model inputs.
 
int AbsScpiClient_GetLocalModelInput (AbsScpiClientHandle handle, unsigned int index, float *value_out)
 Query the value of a single local model input.
 
int AbsScpiClient_GetAllLocalModelInputs (AbsScpiClientHandle handle, float values_out[], unsigned int count)
 Query the values of multiple local model inputs.
 
int AbsScpiClient_GetModelOutput (AbsScpiClientHandle handle, unsigned int index, float *value_out)
 Query a single model output.
 
int AbsScpiClient_GetAllModelOutputs (AbsScpiClientHandle handle, float values_out[], unsigned int count)
 Query multiple model outputs.
 
int AbsScpiClient_MulticastDiscovery (const char *interface_ip, AbsEthernetDiscoveryResult results_out[], unsigned int *count)
 Use UDP multicast to discover ABSes on the network.
 
int AbsScpiClient_SerialDiscovery (const char *port, uint8_t first_id, uint8_t last_id, AbsSerialDiscoveryResult results_out[], unsigned int *count)
 Use RS-485 to discover ABSes on the bus.
 

Detailed Description

C-style interface to the library.