AdsLib
Loading...
Searching...
No Matches
AdsNotificationOOI.h
1// SPDX-License-Identifier: MIT
6#pragma once
7
8#include "AdsDevice.h"
9
10typedef void (* PAdsNotificationFuncExConst)(const AmsAddr* pAddr, const AdsNotificationHeader* pNotification,
11 uint32_t hUser);
12typedef void (* PAdsNotificationFuncExLegacy)(AmsAddr* pAddr, AdsNotificationHeader* pNotification, uint32_t hUser);
13
15 AdsNotification(const AdsDevice& route,
16 const std::string& symbolName,
17 const AdsNotificationAttrib& notificationAttributes,
18 PAdsNotificationFuncExConst callback,
19 uint32_t hUser)
20 : m_Symbol(route.GetHandle(symbolName)),
21 m_Notification(route.GetHandle(ADSIGRP_SYM_VALBYHND, *m_Symbol, notificationAttributes,
22 reinterpret_cast<PAdsNotificationFuncEx>(callback), hUser))
23 {}
24
25 AdsNotification(const AdsDevice& route,
26 const std::string& symbolName,
27 const AdsNotificationAttrib& notificationAttributes,
28 PAdsNotificationFuncExLegacy callback,
29 uint32_t hUser)
30 : m_Symbol(route.GetHandle(symbolName)),
31 m_Notification(route.GetHandle(ADSIGRP_SYM_VALBYHND, *m_Symbol, notificationAttributes,
32 reinterpret_cast<PAdsNotificationFuncEx>(callback), hUser))
33 {}
34
35 AdsNotification(const AdsDevice& route,
36 uint32_t indexGroup,
37 uint32_t indexOffset,
38 const AdsNotificationAttrib& notificationAttributes,
39 PAdsNotificationFuncExConst callback,
40 uint32_t hUser)
41 : m_Symbol{route.GetHandle(indexOffset)},
42 m_Notification(route.GetHandle(indexGroup, indexOffset, notificationAttributes,
43 reinterpret_cast<PAdsNotificationFuncEx>(callback), hUser))
44 {}
45
46 AdsNotification(const AdsDevice& route,
47 uint32_t indexGroup,
48 uint32_t indexOffset,
49 const AdsNotificationAttrib& notificationAttributes,
50 PAdsNotificationFuncExLegacy callback,
51 uint32_t hUser)
52 : m_Symbol{route.GetHandle(indexOffset)},
53 m_Notification(route.GetHandle(indexGroup, indexOffset, notificationAttributes,
54 reinterpret_cast<PAdsNotificationFuncEx>(callback), hUser))
55 {}
56
57private:
58 AdsHandle m_Symbol;
59 AdsHandle m_Notification;
60};
void(* PAdsNotificationFuncEx)(const AmsAddr *pAddr, const AdsNotificationHeader *pNotification, uint32_t hUser)
Type definition of the callback function required by the AdsSyncAddDeviceNotificationReqEx() function...
Definition: AdsDef.h:363
Definition: AdsDevice.h:55
AdsHandle GetHandle(uint32_t offset) const
Definition: AdsDevice.cpp:58
This structure contains all the attributes for the definition of a notification.
Definition: AdsDef.h:323
This structure is also passed to the callback function.
Definition: AdsDef.h:346
Definition: AdsNotificationOOI.h:14
The complete address of an ADS device can be stored in this structure.
Definition: AdsDef.h:237