41 Server(unit), serial(
"0123456789")
49 <<
" serial number attribute read." <<
NL;
58 return HF::Core::DeviceInformation::Server::attribute(uid);
72 #if HF_BATCH_PROGRAM_SUPPORT 75 #if HF_EVENT_SCHEDULING_SUPPORT 78 #if HF_WEEKLY_SCHEDULING_SUPPORT 82 , HF::Core::GroupTable::DefaultServer
118 resp.unpack(payload, offset);
120 LOG(INFO) <<
"Got serial number " << attr->get() <<
" from " 142 int main(
int argc,
char **argv)
147 LOG(INFO) <<
"Use case : Device Information service." <<
NL;
154 LOG(INFO) <<
"Create the node instances ..." <<
NL;
162 LOG(INFO) <<
"Create the base instance ..." <<
NL;
165 LOG(INFO) <<
"Create transport instance" <<
NL;
174 LOG(INFO) <<
"Network setup ..." <<
NL;
176 loop.set_base(&base);
177 loop.add_node(&node1,
"node_1");
178 loop.add_node(&node2,
"node_2");
185 LOG(INFO) <<
"Registering node1 ... " <<
NL;
186 node1.unit0()->device_management()->register_device();
187 LOG(INFO) <<
"Node1 address ... " << node1.address() <<
NL;
190 assert(node1.address() == 1);
195 LOG(INFO) <<
"Registering node2 ... " <<
NL;
196 node2.unit0()->device_management()->register_device();
197 LOG(INFO) <<
"Node2 address ... " << node2.address() <<
NL;
200 assert(node2.address() == 2);
202 LOG(INFO) <<
"There should be two registered devices ... " 203 << base.
unit0()->device_management()->entries().size() <<
NL;
205 assert(base.
unit0()->device_management()->entries().size() == 2);
213 LOG(INFO) <<
"Read serial number attribute from node1 ... " <<
NL;
214 node1.unit0()->device_info()->serial =
"111";
216 base.
unit0()->send(addr, *message,
nullptr);
218 LOG(INFO) <<
"Read serial number attribute from node2 ... " <<
NL;
220 node2.unit0()->device_info()->serial =
"222";
222 base.
unit0()->send(addr, *message,
nullptr);
This class represents a HAN-FUN Concentrator.
Server DefaultServer
Helper typedef.
This represent the special unit with ID/UID = 0.
This is the top level include file for the HAN-FUN library.
This file contains the prototypes of the debug functionality in HAN-FUN.
Message message
Packet message payload;.
Units::IUnit * unit(uint8_t id) const
Return pointer to the unit with the given id.
Server< Entries< Interval > > DefaultServer
Event Scheduling Service : Server side with default persistence implementation.
constexpr uint16_t BROADCAST_ADDR
HAN-FUN Broadcast - device address.
uint16_t id
Identifier of the interface.
Device Management interface : Client side.
Attribute Reporting - Server Role.
Template to create Unit 0 for HAN-FUN node devices.
This class represents the interface common to all HAN-FUN devices.
Unit0< Core::DeviceInformation::Server, Core::DeviceManagement::Client, Core::AttributeReporting::Server > DefaultUnit0
Unit0 using default classes to provide the core services for node devices.
Common::Result handle(HF::Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset)
Handle incoming messages from the network.
virtual uint16_t address() const =0
Return the device address on the HAN-FUN network, when the device is registered, or HF_BROADCAST_ADDR...
This class represents the response sent when a Protocol::Message::GET_ATTR_REQ request.
Template for HAN-FUN concentrator devices.
This class represents a byte array.
#define NL
Helper define for new-line and stream clear.
CoreServices * unit0() const
Get the unit 0 used by this concentrator device.
Template to create Unit0 for HAN-FUN concentrator devices.
virtual IDevice & device() const =0
Reference to the device this unit belongs to.
Protocol::Message * get(HF::Attributes::UIDS &uids)
Create a message that can be used to retrieve the attributes with the given uids of the device inform...
uint8_t member
Interface destination member.
Address source
Source Address.
Interface itf
Interface Address.
Time Service : Server side implementation.
Interface/Service Attribute API.
This file contains an implementation of a HAN-FUN transport layer to be used in the example applicati...
uint16_t device
Device Address.
#define UNUSED(x)
Helper macro to remove warning about unused function/method argument.
Helper template class to declare an attribute with the given T type.
Device information interface UID.
#define LOG(X)
Log messages with the level given by X.
Result
Commands result codes.
Template for declaring HAN-FUN node devices.
Scheduling Service : Server side implementation.
Top-level namespace for the HAN-FUN library.