FIU Serial Library 1.2.0
FIU Serial Library
Loading...
Searching...
No Matches
bci::fiu Namespace Reference

Contains FIU-related code. More...

Classes

struct  FirmwareVersion
 FIU firmware version. More...
class  FiuClient
 Serial client for communicating with the Bloomy Controls Fault Insertion Unit (FIU). More...

Typedefs

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

Enumerations

enum class  ChannelState : std::uint8_t {
  kDisconnected = 0 , kConnected = 1 , kVoltageMeasurement = 2 , kCurrentMeasurement = 3 ,
  kGroundFault = 4
}
 FIU channel states. More...
enum class  InterlockType : std::uint8_t { kNone = 0 , kHardware = 1 , kSoftware = 2 , kBoth = kHardware | kSoftware }
 FIU interlock types. More...
enum class  ErrorCode : int {
  kSuccess = 0 , kBoxIDOutOfRange = -1 , kChannelIndexOutOfRange = -2 , kInvalidArgument = -3 ,
  kInvalidResponse = -4 , kAlreadyConnected = -5 , kFailedToOpenPort = -6 , kFailedToConfigurePort = -7 ,
  kNotConnected = -8 , kSendFailed = -9 , kReadTimedOut = -10 , kReadFailed = -11 ,
  kChecksumMismatch = -12 , kSyntaxError = -13 , kSystemInterlocked = -14 , kResourceConflict = -15 ,
  kUnknownDeviceError = -16 , kInvalidObject = -17 , kBufferTooSmall = -18 , kAllocationFailed = -19 ,
  kUnexpectedException = -20
}
 Error codes returned by the driver. More...

Functions

FIU_API const char * ErrorMessage (ErrorCode ec) noexcept
 Get a string describing an error code.

Variables

constexpr unsigned int kChannelCount {24U}
 FIU channel count.

Detailed Description

Contains FIU-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.

Template Parameters
Ttype of the expected response

Enumeration Type Documentation

◆ ChannelState

enum class ChannelState : std::uint8_t
strong

FIU channel states.

Enumerator
kDisconnected 

Disconnected.

kConnected 

Connected.

kVoltageMeasurement 

Voltage measurement mode.

kCurrentMeasurement 

Current measurement mode.

kGroundFault 

Ground fault mode.

◆ ErrorCode

enum class ErrorCode : int
strong

Error codes returned by the driver.

Enumerator
kSuccess 

Success (no error).

kBoxIDOutOfRange 

Box ID out of range.

kChannelIndexOutOfRange 

Channel index out of range.

kInvalidArgument 

Invalid argument.

kInvalidResponse 

Invalid response received from FIU.

kAlreadyConnected 

Already connected.

kFailedToOpenPort 

Failed to open serial port.

kFailedToConfigurePort 

Failed to configure serial port.

kNotConnected 

Not connected.

kSendFailed 

Failed to send data through serial port.

kReadTimedOut 

Read timed out.

kReadFailed 

Read failed (serial port error).

kChecksumMismatch 

Checksum mismatch on received message.

kSyntaxError 

Syntax error (from device).

kSystemInterlocked 

System interlocked (from device).

kResourceConflict 

Resource conflict (from device).

kUnknownDeviceError 

Unknown error (from device).

kInvalidObject 

Invalid client object.

kBufferTooSmall 

Buffer too small.

kAllocationFailed 

Allocation failed (C only).

kUnexpectedException 

Unexpected exception (C only).

◆ InterlockType

enum class InterlockType : std::uint8_t
strong

FIU interlock types.

Note
Legacy FIU only supports hardware interlocks. Software interlocks are only supported by FIU1KV.
Enumerator
kNone 

No interlock.

kHardware 

Hardware interlock.

kSoftware 

Software interlock.

kBoth 

Both hardware and software interlocks.

Function Documentation

◆ ErrorMessage()

FIU_API const char * ErrorMessage ( ErrorCode ec)
noexcept

Get a string describing an error code.

Parameters
[in]ecerror code
Returns
Error message. This function never returns a null pointer.