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;
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);
ip::BaosSecureIp4Device baosDevice(ipAddress, passwordHash);
auto devicePtr = std::make_unique<ip::BaosSecureIp4Device>(ipAddress, passwordHash, 12004);
devicePtr->getStaticInfo(true);
const DeviceStaticInfo staticInfo = baosDevice.getStaticInfo(true);
std::cout << "Serial number: " << staticInfo.serialNumber.toString() << std::endl;
std::cout << "Manufacture code device: " << staticInfo.manufactureCodeDevice << std::endl;
std::cout << "MAC address: " << staticInfo.macAddress.toString() << std::endl;
std::cout << "Max datapoints: " << staticInfo.maxDatapoints << std::endl;
std::cout << "Max parameter bytes: " << staticInfo.maxParameterBytes << std::endl;
const DeviceConfigInfo configInfo = baosDevice.getConfigInfo();
std::cout << "Manufacture code app: " << configInfo.manufactureCodeApp << std::endl;
std::cout << "Application ID: " << configInfo.applicationId << std::endl;
std::cout << "Application version: " << static_cast<std::int32_t>(configInfo.applicationVersion) << std::endl;
const DeviceRuntimeInfo runtimeInfo = baosDevice.getRuntimeInfo();
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.
Global BAOS sdk namespace.
Definition: config.h:69
BAOSLIB_EXPORT void setBaosLogLevel(wz::baos::LogLevel level)