ModbusSMA  v1.0.0
modbusSMA Namespace Reference

The main namespace of this library. More...

Namespaces

 enum2Str
 Connvert enums to strings.
 
 log
 Namespace for logging related functions.
 

Classes

class  DataBase
 Reads the modbusSMA register definitions from a sqlite3 database. More...
 
class  MBConnectionBase
 Base class for the modbus connection. More...
 
class  MBConnectionIP
 Class for an IP based modbus connection. More...
 
class  MBConnectionIP_PI
 Class for an IP based modbus connection. More...
 
class  MBConnectionRTU
 Class for an IP based modbus connection. More...
 
class  ModbusAPI
 Main ModbusSMA class. More...
 
class  Register
 Data and information of one SMA register. More...
 
class  RegisterContainer
 Container for all modbus registers. More...
 

Enumerations

enum  State { State::CONFIGURE = 0b000, State::CONNECTED = 0b001, State::INITIALIZED = 0b011, State::ERROR = 0b100 }
 The current state of the ModbusAPI. More...
 
enum  ErrorCode {
  ErrorCode::OK = 0, ErrorCode::INVALID_STATE, ErrorCode::INVALID_MODBUS_CONTEXT, ErrorCode::MODBUS_CONNECTION_FAILED,
  ErrorCode::INITIALIZATION_FAILED, ErrorCode::FILE_NOT_FOUND, ErrorCode::DATA_BASE_ERROR, ErrorCode::ERROR
}
 Error codes for functions used in modbusSMA. More...
 
enum  ConnectionType { ConnectionType::TCP_IP, ConnectionType::TCP_IP_PI, ConnectionType::RTU }
 The modbus connection type. More...
 
enum  DataType {
  DataType::S16, DataType::S32, DataType::S64, DataType::STR32,
  DataType::U16, DataType::U32, DataType::U64, DataType::__UNKNOWN__
}
 SMA modbus register data types. More...
 
enum  DataFormat {
  DataFormat::Duration, DataFormat::DT, DataFormat::ENUM, DataFormat::FIX0,
  DataFormat::FIX1, DataFormat::FIX2, DataFormat::FIX3, DataFormat::FIX4,
  DataFormat::FW, DataFormat::HW, DataFormat::IP4, DataFormat::RAW,
  DataFormat::TM, DataFormat::UTF8, DataFormat::REV, DataFormat::TEMP,
  DataFormat::FUNCTION_SEC, DataFormat::__UNKNOWN__
}
 SMA data format of a modbus register. More...
 
enum  DataAccess { DataAccess::RO = 0, DataAccess::RW = 1, DataAccess::WO = 2, DataAccess::__UNKNOWN__ }
 SMA modbus register access. More...
 

Functions

bool operator< (const Register &a, const Register &b)
 Compares Registers. More...
 
bool operator< (const Register &a, const uint16_t &b)
 Compares Registers. More...
 
bool operator< (const uint16_t &a, const Register &b)
 Compares Registers. More...
 
bool operator== (const Register &a, const Register &b)
 Compares Registers. More...
 
bool operator== (const Register &a, const uint16_t &b)
 Compares Registers. More...
 
bool operator== (const uint16_t &a, const Register &b)
 Compares Registers. More...
 

Detailed Description

The main namespace of this library.

Enumeration Type Documentation

◆ ConnectionType

The modbus connection type.

Enumerator
TCP_IP 

Normal TCP IP.

TCP_IP_PI 

TCP IP protocol independant.

RTU 

RTU connection.

Definition at line 45 of file Enums.hpp.

◆ DataAccess

enum modbusSMA::DataAccess
strong

SMA modbus register access.

Enumerator
RO 

Read only.

RW 

Read and write.

WO 

Write only.

__UNKNOWN__ 

Undefined.

Definition at line 101 of file Enums.hpp.

◆ DataFormat

enum modbusSMA::DataFormat
strong

SMA data format of a modbus register.

Enumerator
Duration 

Time in seconds, in minutes or in hours, depending on the Modbus register.

DT 

Date/time, in accordance with country setting.

Transmission in seconds since 1970-01-01.

ENUM 

Coded numerical values (enum).

FIX0 

Decimal number, commercially rounded, no decimal place.

FIX1 

Decimal number, commercially rounded, one decimal place.

FIX2 

Decimal number, commercially rounded, two decimal places.

FIX3 

Decimal number, commercially rounded, three decimal places.

FIX4 

Decimal number, commercially rounded, four decimal places.

FW 

Firmware version (see Section 3.8, "SMA Firmware Data Format (FW)", 15).

HW 

Hardware version e.g.

IP4 

4-byte IP address (IPv4) of the form XXX.XXX.XXX.XXX.

RAW 

Text or number.

A RAW number has no decimal places and no thousand or other separation indicators.

TM 

UTC time, in seconds.

UTF8 

Data in UTF8 format.

REV 

Outline Purchase Agreement.

TEMP 

Temperature values are stored in special Modbus registers in degrees Celsius (°C), in degrees Fahrenheit (°F), or in Kelvin K.

The values are commercially rounded, with one decimal place.

FUNCTION_SEC 

The date saved in the register will be transmitted in the event of a change to a function and starts this.

After execution of the function, no status value is set. A security question must be executed in the client software prior to execution of the function.

__UNKNOWN__ 

Undefined.

Definition at line 65 of file Enums.hpp.

◆ DataType

enum modbusSMA::DataType
strong

SMA modbus register data types.

Enumerator
S16 

A single word (16-bit).

S32 

A signed double word (32-bit).

S64 

A signed quadruple word (64-bit).

STR32 

32 byte data field, in UTF8 format.

U16 

A word (16-bit).

U32 

A double word (32-bit).

U64 

A quadruple word (64-bit).

__UNKNOWN__ 

Undefined.

Definition at line 52 of file Enums.hpp.

◆ ErrorCode

enum modbusSMA::ErrorCode
strong

Error codes for functions used in modbusSMA.

Enumerator
OK 

The function was successfull.

INVALID_STATE 

The function can not be executed with the current sate of the object.

INVALID_MODBUS_CONTEXT 

Creating the modbus context (IP, etc.) failed.

MODBUS_CONNECTION_FAILED 

Failed to establishe the modbus connection.

INITIALIZATION_FAILED 

Failed to initialize the API.

FILE_NOT_FOUND 

A specified file was not found.

DATA_BASE_ERROR 

An error generated when handling the database.

ERROR 

Generic error.

Definition at line 33 of file Enums.hpp.

◆ State

enum modbusSMA::State
strong

The current state of the ModbusAPI.

Enumerator
CONFIGURE 

(CFG) The ModbusAPI object is configured and ready to connect.

CONNECTED 

(CON) The Connecction to the SMA inverter is established and can be initialized.

INITIALIZED 

(INI) The ModbusAPI is initialized.

ERROR 

(ERR) An error occurred.

Definition at line 25 of file Enums.hpp.

Function Documentation

◆ operator<() [1/3]

bool modbusSMA::operator< ( const Register a,
const Register b 
)
inline

Compares Registers.

Definition at line 76 of file Register.hpp.

◆ operator<() [2/3]

bool modbusSMA::operator< ( const Register a,
const uint16_t &  b 
)
inline

Compares Registers.

Definition at line 77 of file Register.hpp.

◆ operator<() [3/3]

bool modbusSMA::operator< ( const uint16_t &  a,
const Register b 
)
inline

Compares Registers.

Definition at line 78 of file Register.hpp.

◆ operator==() [1/3]

bool modbusSMA::operator== ( const Register a,
const Register b 
)
inline

Compares Registers.

Definition at line 79 of file Register.hpp.

◆ operator==() [2/3]

bool modbusSMA::operator== ( const Register a,
const uint16_t &  b 
)
inline

Compares Registers.

Definition at line 80 of file Register.hpp.

◆ operator==() [3/3]

bool modbusSMA::operator== ( const uint16_t &  a,
const Register b 
)
inline

Compares Registers.

Definition at line 81 of file Register.hpp.