2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
20 #include <klay/dbus/signal.h>
21 #include <klay/dbus/introspection.h>
22 #include <klay/exception.h>
24 const std::string SIGNAL_OBJECT_PATH = "/org/tizen/OnDeviceEncryption";
25 const std::string SIGNAL_EVENT_INTERFACE = "org.tizen.OnDeviceEncryption.Event";
27 const std::string manifest =
29 " <interface name='" + SIGNAL_EVENT_INTERFACE + "'>"
30 " <signal name='" + SIGNAL_OBJECT_PATH + "'>"
31 " <arg type='s' name='argument'/>"
36 void EventNotifier::init(void) noexcept
39 dbus::Connection& conn = dbus::Connection::getSystem();
40 conn.registerObject(SIGNAL_OBJECT_PATH, manifest, nullptr, nullptr);
41 WARN(SINK, "Success to init event-notifier.");
42 } catch(runtime::Exception& e) {
43 ERROR(SINK, e.what());
47 void EventNotifier::emit(const std::string& name, const std::string& state) noexcept
50 dbus::signal::Sender sender(SIGNAL_OBJECT_PATH, SIGNAL_EVENT_INTERFACE);
51 sender.emit(name, "(s)", state.c_str());
52 WARN(SINK, "Event '" << name << "' has notified with state '" << state << "'");
53 } catch(runtime::Exception& e) {
54 ERROR(SINK, e.what() << ", name: " << name << ", state: " << state);