map/das-dn/third_party/AdsLib/AdsLib.h

61 lines
1.8 KiB
C
Raw Permalink Normal View History

2024-12-03 10:36:06 +08:00
// SPDX-License-Identifier: MIT
/**
Copyright (c) 2020 - 2022 Beckhoff Automation GmbH & Co. KG
*/
#pragma once
#if defined(USE_TWINCAT_ROUTER)
#include "TwinCAT/AdsLib.h"
#else
2024-12-05 11:28:59 +08:00
#include "Standalone/AdsLib.h"
2024-12-03 10:36:06 +08:00
#endif
#include "Sockets.h"
2024-12-09 09:41:04 +08:00
namespace Beckhoff
2024-12-03 10:36:06 +08:00
{
2024-12-09 09:41:04 +08:00
namespace Ads
2024-12-03 10:36:06 +08:00
{
2024-12-09 09:41:04 +08:00
enum UdpTag : uint16_t {
PASSWORD = 2,
COMPUTERNAME = 5,
NETID = 7,
ROUTENAME = 12,
USERNAME = 13,
};
2024-12-03 10:36:06 +08:00
2024-12-09 09:41:04 +08:00
enum UdpServiceId : uint32_t {
SERVERINFO = 1,
ADDROUTE = 6,
RESPONSE = 0x80000000,
};
2024-12-03 10:36:06 +08:00
/**
* Add an ADS route to a remote TwinCAT system
* @param[in] remote hostname or ip address of the remote TwinCAT system
* @param[in] destNetId AmsNetId of the routes destination
* @param[in] destAddr hostname or ip address of the routes destination
* @param[in] routeName name of the new route
* @param[in] remoteUsername username on the remote TwinCAT system
* @param[in] remotePassword password for the user on the remote TwinCAT system
* @return [ADS Return Code](https://infosys.beckhoff.com/content/1031/tcadscommon/html/ads_returncodes.htm?id=1666172286265530469)
*/
long AddRemoteRoute(const std::string& remote,
AmsNetId destNetId,
const std::string& destAddr,
const std::string& routeName,
const std::string& remoteUsername,
const std::string& remotePassword);
/**
* Read AmsNetId of some TwinCAT remote host
* @param[in] remote hostname or ip address of the remote TwinCAT system
* @param[out] netId on success the AmsNetId of the remote TwinCAT system is written here
* @return [ADS Return Code](https://infosys.beckhoff.com/content/1031/tcadscommon/html/ads_returncodes.htm?id=1666172286265530469)
*/
long GetRemoteAddress(const std::string& remote,
AmsNetId& netId);
}
}