#include "Helper.h"
#include <wzcpp/features/utils.h>
#include <iostream>
#include <memory>
using namespace wz::baos::ip;
{
try
{
std::cout << "******************************************" << std::endl;
std::cout << "SetDatapointValue 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 << "Set some datapoint values (single item per request)" << std::endl;
std::cout << "Set multiple datapoint values (multiple items per request)" << std::endl;
std::cout << std::endl;
std::cout << "Set some datapoint values (check if the datapoint is linked with group address)" << std::endl;
std::cout << " Read datapoint configuration" << std::endl;
{
std::cout << "Warning: Datapoint not exist" << std::endl;
return -1;
}
{
std::cout << " Datapoint is config with group address" << std::endl;
try
{
}
catch (
const std::exception&
e)
{
std::cerr <<
"Failed: " <<
e.what() << std::endl;
}
}
else
{
std::cout << " Datapoint is not config with group address" << 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.
void setDpValues(std::map< std::uint16_t, protocol::DatapointChangeValue > &&dpValues)
Send a SetDatapointValue request to the BAOS device with given datapoint values.
void setDpValue(std::uint16_t dpId, protocol::DatapointChangeValue &&dpValue)
Send a SetDatapointValue request to the BAOS device for one datapoint.
std::optional< protocol::DatapointDescription > getDpDescription(std::uint16_t dpId)
Get the datapoint description for one datapoint.
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, DatapointChangeValue > DatapointChangeValues
Definition Defines.h:617
Global BAOS sdk namespace.
Definition config.h:69
BAOSLIB_EXPORT void setBaosLogLevel(wz::baos::LogLevel level)
A pair of the DatapointSetCommand and the Datapoint value for changing datapoint values.
Definition Defines.h:611
std::uint8_t communication
Definition Defines.h:509
Represents the information about a datapoint in the BAOS device.
Definition Defines.h:621
DatapointConfigFlags flags
The communication flags.
Definition Defines.h:623