#include <sys/utsname.h>
#include <glib.h>
#include <tcore.h>
+#include <server.h>
#include <plugin.h>
#include <core_object.h>
#include <hal.h>
#include "s_phonebook.h"
#include "s_gps.h"
-
-static gboolean on_load()
-{
- dbg("i'm load!");
-
- return TRUE;
-}
-
static void on_confirmation_modem_message_send(TcorePending *p,
gboolean result,
void *user_data)
dbg("%s", result == FALSE ? "SEND FAIL" : "SEND OK");
}
-static void on_response_bootup_subscription(TcorePending *p, int data_len, const void *data, void *user_data)
+static void on_response_bootup_subscription(TcorePending *p,
+ int data_len, const void *data, void *user_data)
{
- TcorePlugin *plugin = user_data;
const TcoreATResponse *resp = data;
-
dbg("Entry");
if (resp->success > 0) {
- dbg("result OK");
+ dbg("RESULT - OK");
+ } else {
+ err("RESULT - ERROR");
+ }
+}
+
+static void on_response_last_bootup_subscription(TcorePending *p,
+ int data_len, const void *data, void *user_data)
+{
+ const TcoreATResponse *resp = data;
+ dbg("Last Subscription - COMPLETED");
+
+ if (resp->success) {
+ dbg("RESULT - OK");
} else {
- dbg("result ERROR");
+ err("RESULT - FAIL");
}
- if (plugin != NULL)
- modem_power_on(plugin);
+ dbg("Boot-up configration completed for IMC modem. %s",
+ "Bring CP to ONLINE state based on Flightmode status");
+ modem_power_on(tcore_pending_ref_plugin(p));
}
-static void modem_subscribe_events(TcorePlugin *plugin)
+static void _modem_subscribe_events(TcorePlugin *plugin)
{
CoreObject *co_call = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_CALL);
CoreObject *co_sim = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_SIM);
/* XBCSTAT subscription */
tcore_prepare_and_send_at_request(co_sap, "at+xbcstat=1", NULL, TCORE_AT_NO_RESULT, NULL,
- on_response_bootup_subscription, NULL,
+ on_response_bootup_subscription, NULL,
on_confirmation_modem_message_send, NULL);
/* AGPS- assist data and reset assist data subscription */
tcore_prepare_and_send_at_request(co_gps, "at+cposr=1", NULL, TCORE_AT_NO_RESULT, NULL,
/* text/pdu mode subscription*/
tcore_prepare_and_send_at_request(co_sms, "at+cmgf=0", NULL, TCORE_AT_NO_RESULT, NULL,
- on_response_bootup_subscription, plugin,
+ on_response_last_bootup_subscription, NULL,
on_confirmation_modem_message_send, NULL);
dbg("Exit");
}
+/* Initializer Table */
struct object_initializer init_table = {
.modem_init = s_modem_init,
.sim_init = s_sim_init,
.gps_init = s_gps_init,
};
+/* Deinitializer Table */
struct object_deinitializer deinit_table = {
.modem_deinit = s_modem_exit,
.sim_deinit = s_sim_exit,
.gps_deinit = s_gps_exit,
};
+static gboolean on_load()
+{
+ dbg("Load!!!");
+
+ return TRUE;
+}
+
static gboolean on_init(TcorePlugin *p)
{
- CoreObject *co_modem;
- if (!p)
+ dbg("Init!!!");
+ if (p == NULL)
return FALSE;
+ /* Initialize Modules (Core Objects) */
if (tcore_object_init_objects(p, &init_table)
!= TCORE_RETURN_SUCCESS) {
err("Failed to initialize Core Objects");
return FALSE;
}
- 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);
+ /* Notify addition of Plug-in to Upper Layers */
+ tcore_server_send_notification(tcore_plugin_ref_server(p), NULL,
+ TNOTI_SERVER_ADDED_PLUGIN, 0, p);
+
+ /* Subscribe for the Events from CP */
+ _modem_subscribe_events(p);
return TRUE;
}
static void on_unload(TcorePlugin *p)
{
- if (!p)
+ dbg("Unload!!!");
+
+ if (p == NULL)
return;
+ /* Deinitialize Modules (Core Objects) */
tcore_object_deinit_objects(p, &deinit_table);
-
- dbg("i'm unload");
}
+/* IMC - Modem Plug-in Descriptor */
struct tcore_plugin_define_desc plugin_define_desc = {
.name = "IMC",
.priority = TCORE_PLUGIN_PRIORITY_MID,
{
struct tnoti_sim_status noti_data = {0, };
- dbg("tcore_sim_set_status and send noti w/ [%d]", sim_status);
- tcore_sim_set_status(o, sim_status);
- noti_data.sim_status = sim_status;
- tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SIM_STATUS,
- sizeof(struct tnoti_sim_status), ¬i_data);
+ if (sim_status != tcore_sim_get_status(o)) {
+ dbg("tcore_sim_set_status and send noti w/ [%d]", sim_status);
+ tcore_sim_set_status(o, sim_status);
+ noti_data.sim_status = sim_status;
+ tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SIM_STATUS,
+ sizeof(struct tnoti_sim_status), ¬i_data);
+ }
}
static void _response_get_sim_type(TcorePending *p, int data_len, const void *data, void *user_data)
dbg(" Function entry ");
file_meta.file_id = ef;
- dbg("file_meta.file_id: %d", file_meta.file_id);
+ dbg("file_meta.file_id: [0x%02x]", file_meta.file_id);
hal = tcore_object_get_hal(o);
dbg("hal: %x", hal);
return TCORE_HOOK_RETURN_CONTINUE;
dbg("Get SIM status");
-
+
sim_prepare_and_send_pending_request(co_sim, "AT+XSIMSTATE?", "+XSIMSTATE:", TCORE_AT_SINGLELINE, on_response_get_sim_status);
return TCORE_HOOK_RETURN_CONTINUE;