AdsLib
Loading...
Searching...
No Matches
AdsLib.h
1// SPDX-License-Identifier: MIT
6#pragma once
7
8#if defined(USE_TWINCAT_ROUTER)
9#include "TwinCAT/AdsLib.h"
10#else
11#include "standalone/AdsLib.h"
12#endif
13
14#include "Sockets.h"
15
27long AdsSyncReadReqEx2(long port,
28 const AmsAddr* pAddr,
29 uint32_t indexGroup,
30 uint32_t indexOffset,
31 uint32_t bufferLength,
32 void* buffer,
33 uint32_t* bytesRead);
34
43long AdsSyncReadDeviceInfoReqEx(long port, const AmsAddr* pAddr, char* devName, AdsVersion* version);
44
53long AdsSyncReadStateReqEx(long port, const AmsAddr* pAddr, uint16_t* adsState, uint16_t* devState);
54
68long AdsSyncReadWriteReqEx2(long port,
69 const AmsAddr* pAddr,
70 uint32_t indexGroup,
71 uint32_t indexOffset,
72 uint32_t readLength,
73 void* readData,
74 uint32_t writeLength,
75 const void* writeData,
76 uint32_t* bytesRead);
77
88long AdsSyncWriteReqEx(long port,
89 const AmsAddr* pAddr,
90 uint32_t indexGroup,
91 uint32_t indexOffset,
92 uint32_t bufferLength,
93 const void* buffer);
94
105long AdsSyncWriteControlReqEx(long port,
106 const AmsAddr* pAddr,
107 uint16_t adsState,
108 uint16_t devState,
109 uint32_t bufferLength,
110 const void* buffer);
111
126long AdsSyncAddDeviceNotificationReqEx(long port,
127 const AmsAddr* pAddr,
128 uint32_t indexGroup,
129 uint32_t indexOffset,
130 const AdsNotificationAttrib* pAttrib,
132 uint32_t hUser,
133 uint32_t* pNotification);
134
142long AdsSyncDelDeviceNotificationReqEx(long port, const AmsAddr* pAddr, uint32_t hNotification);
143
150long AdsSyncGetTimeoutEx(long port, uint32_t* timeout);
151
152namespace bhf
153{
154namespace ads
155{
162long AddLocalRoute(AmsNetId ams, const char* ip);
163
168void DelLocalRoute(AmsNetId ams);
169
174void SetLocalAddress(AmsNetId ams);
175
186long AddRemoteRoute(const std::string& remote,
187 AmsNetId destNetId,
188 const std::string& destAddr,
189 const std::string& routeName,
190 const std::string& remoteUsername,
191 const std::string& remotePassword);
192
199long GetRemoteAddress(const std::string& remote,
200 AmsNetId& netId);
201}
202}
203
204#define AdsAddRoute bhf::ads::AddLocalRoute
205#define AdsDelRoute bhf::ads::DelLocalRoute
206#define AdsSetLocalAddress bhf::ads::SetLocalAddress
Definition: AdsDef.h:21
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
This structure contains all the attributes for the definition of a notification.
Definition: AdsDef.h:323
The structure contains the version number, revision number and build number.
Definition: AdsDef.h:248
The complete address of an ADS device can be stored in this structure.
Definition: AdsDef.h:237
The NetId of and ADS device can be represented in this structure.
Definition: AdsDef.h:224