MCPcopy Create free account
hub / github.com/Beckhoff/ADS / NotifyCallback

Function NotifyCallback

example/example.cpp:17–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15using ExampleDatatype = uint8_t;
16
17static void NotifyCallback(const AmsAddr *pAddr,
18 const AdsNotificationHeader *pNotification,
19 uint32_t hUser)
20{
21 ExampleDatatype data{};
22 std::memcpy(&data, pNotification + 1,
23 std::min<size_t>(sizeof(data),
24 pNotification->cbSampleSize));
25 std::cout << std::setfill('0') << "NetId: " << pAddr->netId
26 << " hUser 0x" << std::hex << hUser
27 << " sample time: " << std::dec << pNotification->nTimeStamp
28 << " sample size: " << std::dec << pNotification->cbSampleSize
29 << " value:" << " 0x" << std::hex << +data << '\n';
30}
31
32static void notificationExample(std::ostream &out, const AdsDevice &route)
33{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected