desc: send a notification when modem is powered on
[platform/core/telephony/tel-plugin-imc.git] / src / desc.c
index dc21ee3..aacc67d 100644 (file)
@@ -28,6 +28,7 @@
 #include <core_object.h>
 #include <hal.h>
 #include <at.h>
+#include <server.h>
 
 #include "s_network.h"
 #include "s_modem.h"
@@ -41,6 +42,7 @@
 #include "s_phonebook.h"
 #include "s_gps.h"
 
+
 static gboolean on_load()
 {
        dbg("i'm load!");
@@ -52,7 +54,7 @@ static void on_confirmation_modem_message_send(TcorePending *p,
                                                gboolean result,
                                                void *user_data)
 {
-       dbg("on_confirmation_modem_message_send - msg out from queue.");
+       dbg("msg out from queue");
 
        dbg("%s", result == FALSE ? "SEND FAIL" : "SEND OK");
 }
@@ -62,12 +64,13 @@ static void on_response_bootup_subscription(TcorePending *p, int data_len, const
        TcorePlugin *plugin = user_data;
        const TcoreATResponse *resp = data;
 
-       dbg("entry of on_response_bootup_subscription() - response comes\n");
+       dbg("Entry");
 
-       if (resp->success)
+       if (resp->success > 0) {
                dbg("result OK");
-
-       dbg("result ERROR");
+       } else {
+               dbg("result ERROR");
+       }
 
        if (plugin != NULL)
                modem_power_on(plugin);
@@ -224,6 +227,7 @@ struct object_deinitializer deinit_table = {
 
 static gboolean on_init(TcorePlugin *p)
 {
+       CoreObject *co_modem;
        if (!p)
                return FALSE;
 
@@ -234,7 +238,8 @@ static gboolean on_init(TcorePlugin *p)
        }
 
        dbg("i'm init!");
-
+       co_modem = tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_MODEM);
+       tcore_server_send_notification(tcore_plugin_ref_server(p), co_modem, TNOTI_MODEM_ADDED, 0, NULL);
        modem_subscribe_events(p);
 
        return TRUE;