M module-services/service-db/ServiceDBCommon.cpp => module-services/service-db/ServiceDBCommon.cpp +4 -5
@@ 43,10 43,7 @@ sys::MessagePointer ServiceDBCommon::DataReceivedHandler(sys::DataMessage *msgl,
LOG_WARN("There is no response associated with query: %s!", query ? query->debugInfo().c_str() : "");
}
responseMsg = std::make_shared<db::QueryResponse>(std::move(result));
-
- if (id) {
- sendUpdateNotification(msg->getInterface(), queryType, *id);
- }
+ sendUpdateNotification(msg->getInterface(), queryType, id);
} break;
default:
@@ 110,7 107,9 @@ sys::ReturnCodes ServiceDBCommon::SwitchPowerModeHandler(const sys::ServicePower
return sys::ReturnCodes::Success;
}
-void ServiceDBCommon::sendUpdateNotification(db::Interface::Name interface, db::Query::Type type, uint32_t recordId)
+void ServiceDBCommon::sendUpdateNotification(db::Interface::Name interface,
+ db::Query::Type type,
+ std::optional<uint32_t> recordId)
{
auto notificationMessage = std::make_shared<db::NotificationMessage>(interface, type, recordId);
bus.sendMulticast(notificationMessage, sys::BusChannel::ServiceDBNotifications);
M module-services/service-db/include/service-db/DBNotificationMessage.hpp => module-services/service-db/include/service-db/DBNotificationMessage.hpp +2 -2
@@ 15,10 15,10 @@ namespace db
class NotificationMessage : public sys::DataMessage
{
public:
- NotificationMessage(db::Interface::Name interface, Query::Type type, uint32_t recordId);
+ NotificationMessage(db::Interface::Name interface, Query::Type type, std::optional<uint32_t> recordId);
const db::Interface::Name interface;
const Query::Type type;
- const uint32_t recordId;
+ const std::optional<uint32_t> recordId;
bool dataModified();
};
M module-services/service-db/include/service-db/ServiceDBCommon.hpp => module-services/service-db/include/service-db/ServiceDBCommon.hpp +1 -1
@@ 31,5 31,5 @@ class ServiceDBCommon : public sys::Service
sys::ReturnCodes SwitchPowerModeHandler(const sys::ServicePowerMode mode) final;
- void sendUpdateNotification(db::Interface::Name interface, db::Query::Type type, uint32_t recordId);
+ void sendUpdateNotification(db::Interface::Name interface, db::Query::Type type, std::optional<uint32_t> recordId);
};
M module-services/service-db/messages/DBNotificationMessage.cpp => module-services/service-db/messages/DBNotificationMessage.cpp +3 -1
@@ 9,7 9,9 @@
namespace db
{
- NotificationMessage::NotificationMessage(db::Interface::Name interface, Query::Type type, uint32_t recordId)
+ NotificationMessage::NotificationMessage(db::Interface::Name interface,
+ Query::Type type,
+ std::optional<uint32_t> recordId)
: sys::DataMessage(MessageType::DBServiceNotification), interface(interface), type(type), recordId(recordId)
{}
M module-services/service-desktop/OutboxNotifications.cpp => module-services/service-desktop/OutboxNotifications.cpp +3 -3
@@ 58,9 58,9 @@ void OutboxNotifications::newNotificationHandler(db::NotificationMessage *notifi
}
if (entryType != Outbox::EntryType::INVALID && entryChange != Outbox::EntryChange::INVALID &&
- notificationMessage->recordId != 0) {
+ notificationMessage->recordId) {
Outbox::NotificationEntry newNotificationEntry = {
- notificationCurrentUid++, entryType, entryChange, notificationMessage->recordId};
+ notificationCurrentUid++, entryType, entryChange, *notificationMessage->recordId};
notificationEntries.emplace_back(newNotificationEntry);
}
-}>
\ No newline at end of file
+}