ABS SCPI Driver 0.2.0
ABS SCPI driver library
Loading...
Searching...
No Matches
bci::abs Namespace Reference

Contains ABS-related code. More...

Namespaces

namespace  alarms
 Bits and masks for interpreting alarms.
 
namespace  drivers
 Contains comm drivers for use with the SCPI client.
 
namespace  model_status
 Bits for interpreting the model status.
 

Classes

struct  DeviceInfo
 General device info. More...
 
struct  EthernetConfig
 Ethernet configuration structure. More...
 
struct  EthernetDevice
 Structure containing information about a discovered Ethernet device. More...
 
struct  ModelInfo
 Information about a model. More...
 
class  ScpiClient
 Generic SCPI client for communicating with the Bloomy Controls ABS. More...
 
struct  ScpiError
 SCPI error read from device error queue. More...
 
struct  SerialDevice
 Structure containing information about a discovered serial device. More...
 

Typedefs

template<class T >
using Result = tl::expected< T, ErrorCode >
 Result type used to return values or error codes from driver functions.
 
using EthernetDeviceList = std::vector< EthernetDevice >
 List of discovered Ethernet devices.
 
using SerialDeviceList = std::vector< SerialDevice >
 List of discovered serial devices.
 

Enumerations

enum class  CellFault : int { kNone , kOpenCircuit , kShortCircuit , kPolarity }
 Cell fault states. More...
 
enum class  CellSenseRange : int { kAuto , kLow , kHigh }
 Cell current sense ranges. Defaults to auto at power up. More...
 
enum class  CellMode : int { kConstantVoltage , kCurrentLimited }
 Cell operating modes. More...
 
enum class  ErrorCode : int {
  kSuccess = 0 , kChannelIndexOutOfRange = -1 , kInvalidIPAddress = -2 , kConnectionTimedOut = -3 ,
  kConnectionFailed = -4 , kSendFailed = -5 , kSendTimedOut = -6 , kReadFailed = -7 ,
  kReadTimedOut = -8 , kNotConnected = -9 , kInvalidResponse = -10 , kInvalidFaultType = -11 ,
  kInvalidSenseRange = -12 , kInvalidArgument = -13 , kInvalidDriverHandle = -14 , kReceiveNotAllowed = -15 ,
  kAlreadyConnected = -16 , kSocketError = -17 , kFailedToBindSocket = -18 , kOpeningSerialPortFailed = -19 ,
  kFailedToConfigurePort = -20 , kFailedToJoinGroup = -21 , kBufferTooSmall = -22 , kAllocationFailed = -23 ,
  kUnexpectedException = -24
}
 Error codes returned by driver functions. More...
 

Functions

const char * ErrorMessage (ErrorCode ec) noexcept
 Get an error message string for a given error code.
 
Result< EthernetDeviceListMulticastDiscovery (std::string_view interface_ip)
 Discover any units on the network over UDP multicast.
 
Result< SerialDeviceListSerialDiscovery (std::string_view port, std::uint8_t first_id, std::uint8_t last_id)
 Discover any units on a serial bus.
 

Variables

constexpr unsigned int kCellCount = 8U
 Total cell count.
 
constexpr unsigned int kAnalogInputCount = 8U
 Total analog input count.
 
constexpr unsigned int kAnalogOutputCount = 8U
 Total analog output count.
 
constexpr unsigned int kDigitalInputCount = 4U
 Total digital input count.
 
constexpr unsigned int kDigitalOutputCount = 4U
 Total digital output count.
 
constexpr unsigned int kGlobalModelInputCount = 8U
 Total global model input count.
 
constexpr unsigned int kLocalModelInputCount = 8U
 Total local model input count.
 
constexpr unsigned int kModelOutputCount = 36U
 Total model output count.
 

Detailed Description

Contains ABS-related code.

Typedef Documentation

◆ Result

template<class T >
using Result = tl::expected<T, ErrorCode>

Result type used to return values or error codes from driver functions.

tl::expected models C++23's std::expected and adds some other useful functions as well.

Template Parameters
Ttype of the "expected" response

Enumeration Type Documentation

◆ CellFault

enum class CellFault : int
strong

Cell fault states.

Enumerator
kNone 

No fault.

kOpenCircuit 

Open circuit.

kShortCircuit 

Short circuit.

kPolarity 

Polarity fault.

◆ CellMode

enum class CellMode : int
strong

Cell operating modes.

Enumerator
kConstantVoltage 

Constant voltage (normal)

kCurrentLimited 

Current limited.

◆ CellSenseRange

enum class CellSenseRange : int
strong

Cell current sense ranges. Defaults to auto at power up.

Enumerator
kAuto 

Automatic based on current limit (default)

kLow 

Low range (1A)

kHigh 

High range (5A)

◆ ErrorCode

enum class ErrorCode : int
strong

Error codes returned by driver functions.

Note
These values must match the macros in CInterface.h!
Enumerator
kSuccess 

Success (no error)

kChannelIndexOutOfRange 

Channel index out of range.

kInvalidIPAddress 

Invalid IP address.

kConnectionTimedOut 

Connection timed out.

kConnectionFailed 

Connection failed.

kSendFailed 

Failed to send message.

kSendTimedOut 

Send timed out.

kReadFailed 

Failed to read message.

kReadTimedOut 

Read timed out.

kNotConnected 

Not connected.

kInvalidResponse 

Invalid response from the unit.

kInvalidFaultType 

Invalid fault type.

kInvalidSenseRange 

Invalid sense range.

kInvalidArgument 

Invalid argument.

kInvalidDriverHandle 

Invalid driver handle.

kReceiveNotAllowed 

Receive not allowed by driver.

kAlreadyConnected 

Already connected.

kSocketError 

Unexpected socket error.

kFailedToBindSocket 

Failed to bind socket.

kOpeningSerialPortFailed 

Failed to open serial port.

kFailedToConfigurePort 

Failed to configure serial port.

kFailedToJoinGroup 

Failed to join multicast group.

kBufferTooSmall 

Buffer too small.

kAllocationFailed 

Allocation failed (C only)

kUnexpectedException 

Unexpected exception (C only)

Function Documentation

◆ ErrorMessage()

const char * ErrorMessage ( ErrorCode  ec)
noexcept

Get an error message string for a given error code.

Parameters
[in]ecerror code
Returns
Error message.

◆ MulticastDiscovery()

Result< EthernetDeviceList > MulticastDiscovery ( std::string_view  interface_ip)

Discover any units on the network over UDP multicast.

This function operates by sending an identification query to the multicast group and enumerating all devices that reply.

Parameters
[in]interface_ipIP address of the local NIC to use
Returns
Result containing a list of devices or an error code.

◆ SerialDiscovery()

Result< SerialDeviceList > SerialDiscovery ( std::string_view  port,
std::uint8_t  first_id,
std::uint8_t  last_id 
)

Discover any units on a serial bus.

This function operates by sending an identification query to each address in the specified range and enumerating all devices that reply.

Parameters
[in]portserial port
[in]first_idfirst serial ID to query, 0-31
[in]last_idlast serial ID to query, 0-31 (inclusive)
Returns
Result containing a list of devices or an error code.