+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 "IPC.h"
-
-using namespace ctx;
-
-GDBusConnection* IPC::__dbusConnection = NULL;
-
-static void __async_ready_cb(GObject* obj, GAsyncResult* res, gpointer data)
-{
- GError *gerr = NULL;
- GDBusConnection* conn = static_cast<GDBusConnection*>(data);
- GVariant* param = g_dbus_connection_call_finish(conn, res, &gerr);
-
- if (param)
- g_variant_unref(param);
-
- HANDLE_GERROR(gerr);
-}
-
-IPC::IPC()
-{
-}
-
-bool IPC::dbusCall(const std::string& busName, const std::string& objectPath,
- const std::string& interface, const std::string& methodName, GVariant* param)
-{
- IF_FAIL_RETURN(__dbusConnection, false);
-
- g_dbus_connection_call(__dbusConnection, busName.c_str(),
- objectPath.c_str(), interface.c_str(), methodName.c_str(), param,
- NULL, G_DBUS_CALL_FLAGS_NONE, CTX_DBUS_TIMEOUT, NULL, __async_ready_cb, __dbusConnection);
-
- return true;
-}
-
-void IPC::setDBus(GDBusConnection* conn)
-{
- __dbusConnection = conn;
-}
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#ifndef __CONTEXT_JOB_SCHEDULER_IPC_H__
-#define __CONTEXT_JOB_SCHEDULER_IPC_H__
-
-#include <string>
-#include <ContextTypes.h>
-
-namespace ctx {
-
- class IPC {
- public:
- static bool dbusCall(const std::string& busName, const std::string& objectPath,
- const std::string& interface, const std::string& methodName,
- GVariant* param);
-
- static void setDBus(GDBusConnection* conn);
-
- //TODO: Socket
-
- private:
- IPC();
-
- static GDBusConnection* __dbusConnection;
- };
-
-}
-
-#endif /* __CONTEXT_JOB_SCHEDULER_IPC_H__ */
#include "MethodCallHandler.h"
#include "ContextManager.h"
#include "SchedTimer.h"
-#include "IPC.h"
#define SYSTEM_UID 0
{
ContextManager::init();
SchedTimer::init();
- IPC::setDBus(__serviceRunner->getConnection());
__jobManagers.emplace(SYSTEM_UID, new JobManager(SYSTEM_UID));
return true;
}
#include <notification.h>
#include <notification_internal.h>
#include <vconf.h>
+#include <DBusCaller.h>
#include <Conf.h>
#include <JobSchedulerTypesPrivate.h>
#include <JobAction.h>
-#include "../IPC.h"
#include "ActionState.h"
#include "ClosingState.h"
void ActionState::__callDBusMethod()
{
JobDBusCall* action = static_cast<JobDBusCall*>(getJobInfo()->getAction());
- bool success = false;
+ DBusCaller caller;
_D("Call %s.%s", action->getInterface().c_str(), action->getMethodName().c_str());
- success = IPC::dbusCall(action->getBusName(), action->getObjectPath(),
+
+ GVariant* result = caller.call(action->getBusName(), action->getObjectPath(),
action->getInterface(), action->getMethodName(), action->getParameters());
- IF_FAIL_VOID_TAG(success, _E, "DBus call failed");
+ if (!result) {
+ _E("DBus call failed");
+ return;
+ }
+
+ g_variant_unref(result);
}
static void __aul_svc_result_cb(bundle* b, int requestCode, aul_svc_result_val result, void* data)