From c6a24708048bdec6077d1283bdf966b9e46aca3a Mon Sep 17 00:00:00 2001
From: Dmitriy Borovikov <dmitry@borovikov.name>
Date: Mon, 22 Jan 2024 14:38:18 +0300
Subject: [PATCH] Add ignored API defs

---
 .../FastRTPSSwift/FastRTPSNotifications.swift    |  3 +++
 .../BridgedParticipantListener.cpp               | 16 ++++++++++++++++
 Sources/FastRTPSWrapper/FastRTPSDefs.h           | 12 ++++++++++++
 Sources/FastRTPSWrapper/include/FastRTPSDefs.h   |  3 +++
 4 files changed, 34 insertions(+)
 create mode 100644 Sources/FastRTPSWrapper/FastRTPSDefs.h

diff --git a/Sources/FastRTPSSwift/FastRTPSNotifications.swift b/Sources/FastRTPSSwift/FastRTPSNotifications.swift
index da07df7..2dc7bbf 100644
--- a/Sources/FastRTPSSwift/FastRTPSNotifications.swift
+++ b/Sources/FastRTPSSwift/FastRTPSNotifications.swift
@@ -28,6 +28,8 @@ extension RTPSReaderWriterNotification: CustomStringConvertible {
         case .discoveredWriter : return "discoveredWriter"
         case .changedQosWriter : return "changedQosWriter"
         case .removedWriter    : return "removedWriter"
+        case .ignoredReader    : return "ignoredReader"
+        case .ignoredWriter    : return "ignoredWriter"
         }
     }
 }
@@ -39,6 +41,7 @@ extension RTPSParticipantNotification: CustomStringConvertible {
         case .changedQosParticipant : return "changedQosParticipant"
         case .removedParticipant    : return "removedParticipant"
         case .droppedParticipant    : return "droppedParticipant"
+        case .ignoredParticipant    : return "ignoredParticipant"
         }
     }
 }
diff --git a/Sources/FastRTPSWrapper/BridgedParticipantListener.cpp b/Sources/FastRTPSWrapper/BridgedParticipantListener.cpp
index 56a3f35..a261912 100644
--- a/Sources/FastRTPSWrapper/BridgedParticipantListener.cpp
+++ b/Sources/FastRTPSWrapper/BridgedParticipantListener.cpp
@@ -9,6 +9,7 @@
 #include <fastrtps/rtps/common/Locator.h>
 #include <fastrtps/utils/IPLocator.h>
 #include <memory.h>
+#include "FastRTPSDefs.h"
 
 using namespace eprosima::fastrtps;
 using namespace eprosima::fastrtps::rtps;
@@ -31,6 +32,11 @@ void BridgedParticipantListener::onReaderDiscovery(RTPSParticipant *participant,
         case ReaderDiscoveryInfo::REMOVED_READER:
             container.discoveryReaderWriterCallback(container.listnerObject, RTPSReaderWriterNotificationRemovedReader, topicName, typeName, nullptr);
             break;
+#if FASTDDS_VERSION >= 21000
+        case ReaderDiscoveryInfo::IGNORED_READER:
+            container.discoveryReaderWriterCallback(container.listnerObject, RTPSReaderWriterNotificationIgnoredReader, topicName, typeName, nullptr);
+            break;
+#endif
     }
 }
 
@@ -52,6 +58,11 @@ void BridgedParticipantListener::onWriterDiscovery(RTPSParticipant *participant,
         case WriterDiscoveryInfo::REMOVED_WRITER:
             container.discoveryReaderWriterCallback(container.listnerObject, RTPSReaderWriterNotificationRemovedWriter, topicName, typeName, nullptr);
             break;
+#if FASTDDS_VERSION >= 21000
+        case WriterDiscoveryInfo::IGNORED_WRITER:
+            container.discoveryReaderWriterCallback(container.listnerObject, RTPSReaderWriterNotificationIgnoredWriter, topicName, typeName, nullptr);
+            break;
+#endif
     }
     
 }
@@ -91,6 +102,11 @@ void BridgedParticipantListener::onParticipantDiscovery(RTPSParticipant *partici
         case ParticipantDiscoveryInfo::CHANGED_QOS_PARTICIPANT:
             container.discoveryParticipantCallback(container.listnerObject, RTPSParticipantNotificationChangedQosParticipant, info.info.m_participantName, nullptr, nullptr);
             break;
+#if FASTDDS_VERSION >= 21000
+        case ParticipantDiscoveryInfo::IGNORED_PARTICIPANT:
+            container.discoveryParticipantCallback(container.listnerObject, RTPSParticipantNotificationIgnoredParticipant, info.info.m_participantName, nullptr, nullptr);
+            break;
+#endif
     }
 }
 
diff --git a/Sources/FastRTPSWrapper/FastRTPSDefs.h b/Sources/FastRTPSWrapper/FastRTPSDefs.h
new file mode 100644
index 0000000..278a809
--- /dev/null
+++ b/Sources/FastRTPSWrapper/FastRTPSDefs.h
@@ -0,0 +1,12 @@
+//
+//  FastRTPSDefs.h
+//
+//
+//  Created by Dmitriy Borovikov on 22.01.2024.
+//
+
+#pragma once
+
+#define FASTDDS_VERSION (FASTRTPS_VERSION_MAJOR * 10000 \
+                         + FASTRTPS_VERSION_MINOR * 100 \
+                         + FASTRTPS_VERSION_MICRO)
diff --git a/Sources/FastRTPSWrapper/include/FastRTPSDefs.h b/Sources/FastRTPSWrapper/include/FastRTPSDefs.h
index 495da66..1d15799 100644
--- a/Sources/FastRTPSWrapper/include/FastRTPSDefs.h
+++ b/Sources/FastRTPSWrapper/include/FastRTPSDefs.h
@@ -47,12 +47,15 @@ typedef NS_CLOSED_ENUM(uint32_t, RTPSReaderWriterNotification) {
     RTPSReaderWriterNotificationDiscoveredWriter,
     RTPSReaderWriterNotificationChangedQosWriter,
     RTPSReaderWriterNotificationRemovedWriter,
+    RTPSReaderWriterNotificationIgnoredReader,
+    RTPSReaderWriterNotificationIgnoredWriter,
 };
 typedef NS_CLOSED_ENUM(uint32_t, RTPSParticipantNotification) {
     RTPSParticipantNotificationDiscoveredParticipant = 0,
     RTPSParticipantNotificationChangedQosParticipant,
     RTPSParticipantNotificationRemovedParticipant,
     RTPSParticipantNotificationDroppedParticipant,
+    RTPSParticipantNotificationIgnoredParticipant,
 };
 
 typedef NS_CLOSED_ENUM(uint32_t, FastRTPSLogLevel) {