#include "Helper.h"
#include <wzcpp/features/utils.h>
#include <iostream>
#include <memory>
using namespace wz::baos::ip;
namespace
{
{
std::cout.fill('0');
std::cout << std::hex << std::uppercase;
{
std::cout << std::setw(2) << static_cast<std::int32_t>(
item) <<
" ";
}
std::cout << std::nouppercase << std::dec;
}
}
{
try
{
std::cout << "******************************************" << std::endl;
std::cout << "GetDatapointValue sample" << std::endl;
std::cout << "******************************************" << std::endl;
std::cout << std::endl;
setBaosLogLevel(wz::baos::LogLevel::warn);
{
return 0;
}
std::cout <<
" Connection requested for " <<
ipAddress << std::endl;
std::cout << "Reading datapoint value id 2:" << std::endl;
{
std::cout << "Id: 2, value: ";
std::cout << std::endl;
}
std::cout << "Reading datapoint value id 4:" << std::endl;
{
std::cout << "Id 4, value: ";
std::cout << std::endl;
}
std::cout << "Reading datapoint value ids 1 - 100:" << std::endl;
{
std::cout <<
"Id: " <<
item.first;
std::cout << ", value: ";
std::cout << std::endl;
}
}
catch (
const std::exception&
e)
{
std::cerr <<
"Failed: " <<
e.what() << std::endl;
return -1;
}
return 0;
}
Specialization for a TCP IP v4 BAOSConnection.
Global BAOS protocol defines and types.
Global BAOS SDK function and options.
protocol::DatapointValueStates getDpValues(std::uint16_t startDpId, std::uint16_t numberOfValues, protocol::DatapointValueFilter filter=protocol::DatapointValueFilter::ALL)
Get a map with the datapoint id as key and the DatapointValueState as value.
std::optional< protocol::DatapointValueState > getDpValue(std::uint16_t dpId)
Get a single datapoint value with its associated state.
A specialization for (connection-less) connection to the BAOS device via a TCP connection.
Definition BaosTcpConnection.h:145
A specialization for (connection oriented) connection to the BAOS device via a TCP connection.
Definition BaosTcpConnection.h:182
void open(const std::string &ip4Address, std::uint16_t port=12004)
Open a connection to physical BAOS device.
Groups BAOS binary protocol specific types , defines and classes for Indications, Responses etc.
Definition Defines.h:33
std::map< std::uint16_t, DatapointValueState > DatapointValueStates
Definition Defines.h:607
wz::baos::Buffer DatapointValue
An type for the DatapointValues.
Definition Defines.h:34
Global BAOS sdk namespace.
Definition config.h:69
BAOSLIB_EXPORT void setBaosLogLevel(wz::baos::LogLevel level)
A combination of the status of a datapoint and its actual value.
Definition Defines.h:601
DatapointValue value
The actual value of the datapoint.
Definition Defines.h:602