BS120x Ethernet Library 1.0.0
BS120x Ethernet Library
Loading...
Searching...
No Matches
bci::bs120x Namespace Reference

Contains BS120x-related code. More...

Classes

class  EthernetClient
 Ethernet client for communicating with the Bloomy Controls Battery Simulator (BS120x). More...
 
struct  OpModeConfig
 Operating mode configuration values. More...
 
struct  UnitConfig
 Information about the unit configuration. More...
 
struct  UnitStatus
 Information about unit health and status. More...
 

Typedefs

template<class T >
using Result = tl::expected< T, ErrorCode >
 Result type used to return values or error codes for driver functions.
 

Enumerations

enum class  ErrorCode : int {
  kSuccess = 0 , kChannelIndexOutOfRange = -100 , kInvalidIPAddress = -101 , kAlreadyConnected = -102 ,
  kTcpAlreadyConnected = -103 , kUdpAlreadyConnected = -104 , kUdpSocketOpenFailed = -105 , kTcpSocketConfigFailed = -106 ,
  kUdpSocketConfigFailed = -107 , kUdpSocketBindFailed = -108 , kTcpConnectFailed = -109 , kReadFailed = -110 ,
  kSendFailed = -111 , kNotConnected = -112 , kFrameIdMismatch = -113 , kInvalidFrameSize = -114 ,
  kAiIndexOutOfRange = -115 , kDioIndexOutOfRange = -116 , kBufferTooSmall = -117 , kVoltageOutOfRange = -118 ,
  kCurrentOutOfRange = -119 , kReadbackTimedOut = -120 , kInvalidBoxId = -121 , kNoConfigData = -122 ,
  kInvalidConfigOption = -123 , kWrongConfigOptionType = -124 , kInvalidArgument = -125 , kAllocationFailed = -126 ,
  kUnexpectedException = -127
}
 Error codes returned by driver functions. More...
 

Functions

const char * ErrorMessage (ErrorCode ec) noexcept
 Get an error message string for a given error code.
 

Variables

constexpr unsigned int kCellCount {12U}
 Total cell count.
 
constexpr unsigned int kAnalogInputCount {8U}
 Total analog input count.
 
constexpr unsigned int kAnalogOutputCount {2U}
 Total analog output count.
 
constexpr unsigned int kDioCount {8U}
 Total DIO count.
 
constexpr unsigned int kFanCount {4U}
 Total fan count.
 
constexpr unsigned int kTempCount {3U}
 Total temperature sensor count.
 

Detailed Description

Contains BS120x-related code.

Typedef Documentation

◆ Result

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

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

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

Parameters
TType of the 'expected' response.

Enumeration Type Documentation

◆ 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.

kAlreadyConnected 

Driver already connected.

kTcpAlreadyConnected 

TCP client already connected.

kUdpAlreadyConnected 

UDP listener already connected.

kUdpSocketOpenFailed 

Failed to open socket for UDP listener.

kTcpSocketConfigFailed 

Failed to configure TCP socket.

kUdpSocketConfigFailed 

Failed to configure UDP socket.

kUdpSocketBindFailed 

Failed to bind UDP socket.

kTcpConnectFailed 

Failed to connect TCP client.

kReadFailed 

Failed to read message.

kSendFailed 

Failed to send message.

kNotConnected 

Not connected.

kFrameIdMismatch 

Frame Arb ID doesn't match expected value.

kInvalidFrameSize 

Frame size does not match known messages.

kAiIndexOutOfRange 

Analog input index out of range.

kDioIndexOutOfRange 

DIO index out of range.

kBufferTooSmall 

Buffer too small.

kVoltageOutOfRange 

Voltage out of range.

kCurrentOutOfRange 

Current out of range.

kReadbackTimedOut 

UDP read timed out.

kInvalidBoxId 

Invalid box ID.

kNoConfigData 

Config data has not been queried.

kInvalidConfigOption 

Invalid configuration option.

kWrongConfigOptionType 

Incorrect configuration option type.

kInvalidArgument 

Invalid argument.

kAllocationFailed 

Allocation failed.

kUnexpectedException 

Unexpected exception.

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.