--- /dev/null
+/*
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "AittUtil.h"
+
+#include <mosquitto.h>
+
+#include "AittException.h"
+#include "aitt_internal.h"
+
+bool aitt::AittUtil::CompareTopic(const std::string& left, const std::string& right)
+{
+ bool result = false;
+ int ret = mosquitto_topic_matches_sub(left.c_str(), right.c_str(), &result);
+ if (ret != MOSQ_ERR_SUCCESS) {
+ ERR("mosquitto_topic_matches_sub(%s, %s) Fail(%s)", left.c_str(), right.c_str(),
+ mosquitto_strerror(ret));
+ throw AittException(AittException::MQTT_ERR);
+ }
+ return result;
+}
--- /dev/null
+/*
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <string>
+
+namespace aitt {
+
+class AittUtil {
+ public:
+ AittUtil() = default;
+ ~AittUtil() = default;
+
+ static bool CompareTopic(const std::string &left, const std::string &right);
+};
+
+} // namespace aitt
*/
#include "Module.h"
-#include <MQ.h>
+#include <AittUtil.h>
#include <flatbuffers/flexbuffers.h>
#include <unistd.h>
for (PublishMap::iterator it = publishTable.begin(); it != publishTable.end(); ++it) {
// NOTE:
// Find entries that have matched with the given topic
- if (!aitt::MQ::CompareTopic(it->first, topic))
+ if (!aitt::AittUtil::CompareTopic(it->first, topic))
continue;
// NOTE: