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

Method Notifications

AdsLibTestRef/main.cpp:872–898  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

870
871 private:
872 void Notifications(size_t numNotifications)
873 {
874 const long port = AdsPortOpenEx();
875 fructose_assert(0 != port);
876
877 const auto notification = std::unique_ptr<unsigned long[]>(
878 new unsigned long[numNotifications]);
879 AdsNotificationAttrib attrib = {
880 1, ADSTRANS_SERVERCYCLE, 0, { 1000000 }
881 };
882 unsigned long hUser = 0xDEADBEEF;
883
884 for (hUser = 0; hUser < numNotifications; ++hUser) {
885 fructose_assert_eq(0, AdsSyncAddDeviceNotificationReqEx(
886 port, &server, 0x4020, 4,
887 &attrib, &NotifyCallback,
888 hUser,
889 &notification[hUser]));
890 }
891 std::this_thread::sleep_for(std::chrono::seconds(5));
892 for (hUser = 0; hUser < numNotifications; ++hUser) {
893 fructose_assert_eq(0, AdsSyncDelDeviceNotificationReqEx(
894 port, &server,
895 notification[hUser]));
896 }
897 fructose_assert(0 == AdsPortCloseEx(port));
898 }
899
900 void Read(const size_t numLoops)
901 {

Callers

nothing calls this directly

Calls 4

AdsPortOpenExFunction · 0.85
AdsPortCloseExFunction · 0.85

Tested by

no test coverage detected