This demo shows how to read all ServerItems via the device API.
#include "Helper.h"
#include <iostream>
#include <memory>
int main(int argc, char* argv[])
{
try
{
std::cout << "******************************************" << std::endl;
std::cout << "12_BaosSecureDeviceInformation sample" << std::endl;
std::cout << "******************************************" << std::endl;
std::cout << std::endl;
setBaosLogLevel(wz::baos::LogLevel::warn);
CommandLineOptions options;
options.setSecureSampleOptionSupported(true);
options.parse(argc, argv);
if (options.wasHelpdisplayed())
{
return 0;
}
const std::string ipAddress = options.getIpAddress();
std::cout << " Connection requested for " << ipAddress << std::endl;
const std::string password = options.getPassword();
const auto passwordHash = ip::BaosSecureIp4Device::calculatePasswordHash(password);
auto devicePtr = std::make_unique<ip::BaosSecureIp4Device>(ipAddress, passwordHash, 12004);
devicePtr->getStaticInfo(true);
std::cout <<
"Serial number: " << staticInfo.
serialNumber.toString() << std::endl;
std::cout <<
"MAC address: " << staticInfo.
macAddress.toString() << std::endl;
std::cout <<
"Max datapoints: " << staticInfo.
maxDatapoints << std::endl;
std::cout <<
"Application ID: " << configInfo.
applicationId << std::endl;
std::cout <<
"Application version: " <<
static_cast<std::int32_t
>(configInfo.
applicationVersion) << std::endl;
std::cout <<
"KNX bus connected: " << std::boolalpha << runtimeInfo.
busConnected << std::endl;
std::cout << "Programming mode: " << std::boolalpha << runtimeInfo.programmingMode << std::endl;
}
catch (const wzcpp::error::WzBaseException& e)
{
std::cout << "Wz Exception in main: " << e.msg() << std::endl;
}
catch (const std::exception& e)
{
std::cerr << "Failed: " << e.what() << std::endl;
return -1;
}
return 0;
}
Specialization for a IP v4 BAOSDevice.
Specialization for a TCP IP v4 BAOSConnection.
Global BAOS SDK function and options.
DeviceStaticInfo getStaticInfo(bool reload=false)
Get the information about a connected BAOS device that is never changed. Like serial number.
DeviceConfigInfo getConfigInfo(bool reload=false)
Get the information about a connected BAOS device that is typically only changed during configuration...
DeviceRuntimeInfo getRuntimeInfo(bool reload=false)
Get the information about a connected BAOS device that may change during runtime.
Represents a BAOS IP4 device with an underlying TCP connection (with BAOS secure)
Definition BaosIpv4Device.h:166
Global BAOS sdk namespace.
Definition config.h:69
BAOSLIB_EXPORT void setBaosLogLevel(wz::baos::LogLevel level)
A collection of fields representing those serveritems which may change if the configuration of the de...
Definition BaosDeviceDataTypes.h:94
std::uint8_t applicationVersion
Definition BaosDeviceDataTypes.h:98
std::uint16_t applicationId
Definition BaosDeviceDataTypes.h:96
std::uint16_t manufactureCodeApp
The manufacturer code of the ETS application e.g. 0x00C5 for Weinzierl.
Definition BaosDeviceDataTypes.h:95
A collection of fields representing those serveritems which may change during "normal" operation of t...
Definition BaosDeviceDataTypes.h:174
bool busConnected
The TP KNX bus connection state.
Definition BaosDeviceDataTypes.h:176
A collection of fields representing those serveritems which won't ever change in a device.
Definition BaosDeviceDataTypes.h:49
std::uint16_t maxDatapoints
The maximum amount of datapoint supported by this firmware.
Definition BaosDeviceDataTypes.h:64
std::uint16_t maxParameterBytes
The maximum amount of parameter bytes supported by this firmware.
Definition BaosDeviceDataTypes.h:65
wzcpp::SixByteArray macAddress
The MAC address.
Definition BaosDeviceDataTypes.h:59
wzcpp::SixByteArray serialNumber
manufacturer specific serial number
Definition BaosDeviceDataTypes.h:54
std::uint16_t manufactureCodeDevice
The manufacturer code of the device.
Definition BaosDeviceDataTypes.h:53