#include "s_common.h"
#include "s_modem.h"
+#include "nvm/nvm.h"
#define ID_RESERVED_AT 0x0229
static void prepare_and_send_pending_request(CoreObject *co, const char *at_cmd, const char *prefix, enum tcore_at_command_type at_cmd_type, TcorePendingResponseCallback callback);
-static void on_confirmation_modem_message_send(TcorePending *p, gboolean result, void *user_data); // from Kernel
+static void on_confirmation_modem_message_send(TcorePending *p, gboolean result, void *user_data);
static void on_response_network_registration(TcorePending *p, int data_len, const void *data, void *user_data);
static void on_response_enable_proactive_command(TcorePending *p, int data_len, const void *data, void *user_data);
+/* NVM */
+static gboolean on_event_nvm_update(CoreObject *o, const void *event_info, void *user_data);
+static void modem_unsuspend_nvm_updates(CoreObject *o);
+static void modem_send_nvm_update_ack(CoreObject *o);
+static void modem_send_nvm_update_request_ack(CoreObject *o);
+
static void on_confirmation_modem_message_send(TcorePending *p, gboolean result, void *user_data)
{
dbg("on_confirmation_modem_message_send - msg out from queue.\n");
}
ur = tcore_pending_ref_user_request(p);
- tcore_user_request_send_response(ur, TRESP_MODEM_GET_IMEI, sizeof(struct tresp_modem_get_imei), &res);
+ tcore_user_request_send_response(ur, TRESP_MODEM_GET_IMEI,
+ sizeof(struct tresp_modem_get_imei), &res);
OUT:
if (tokens != NULL)
if (resp->lines) {
line = (const char *) resp->lines->data;
tokens = tcore_at_tok_new(line);
- if (g_slist_length(tokens) != 5) {
+ if (g_slist_length(tokens) == 1) {
+ swver = g_slist_nth_data(tokens, 0);
+ dbg("version: sw=[%s]", swver);
+ } else if (g_slist_length(tokens) == 5) {
+ swver = g_slist_nth_data(tokens, 0);
+ hwver = g_slist_nth_data(tokens, 1);
+ caldate = g_slist_nth_data(tokens, 2);
+ pcode = g_slist_nth_data(tokens, 3);
+ id = g_slist_nth_data(tokens, 4);
+
+ dbg("version: sw=[%s], hw=[%s], rf_cal=[%s], product_code=[%s], model_id=[%s]",
+ swver, hwver, caldate, pcode, id);
+ } else {
msg("invalid message");
goto OUT;
}
}
- swver = g_slist_nth_data(tokens, 0);
- hwver = g_slist_nth_data(tokens, 1);
- caldate = g_slist_nth_data(tokens, 2);
- pcode = g_slist_nth_data(tokens, 3);
- id = g_slist_nth_data(tokens, 4);
-
- dbg("version: sw=[%s], hw=[%s], rf_cal=[%s], product_code=[%s], model_id=[%s]", swver, hwver, caldate, pcode, id);
-
- vi = calloc(sizeof(TelMiscVersionInformation), 1);
+ vi = g_try_new0(TelMiscVersionInformation, 1);
if (NULL != swver)
memcpy(vi->szSwVersion, swver, strlen(swver));
if (NULL != hwver)
memset(&res, 0, sizeof(struct tresp_modem_get_version));
- if (NULL != swver)
- snprintf(res.software, (AT_VER_LEN > strlen(swver) ? strlen(swver) : AT_VER_LEN), "%s", swver);
- if (NULL != hwver)
- snprintf(res.hardware, (AT_VER_LEN > strlen(hwver) ? strlen(hwver) : AT_VER_LEN), "%s", hwver);
+ if (NULL != swver) {
+ snprintf(res.software,
+ (AT_VER_LEN > strlen(swver) ? strlen(swver) : AT_VER_LEN),
+ "%s", swver);
+ }
+
+ if (NULL != hwver) {
+ snprintf(res.hardware,
+ (AT_VER_LEN > strlen(hwver) ? strlen(hwver) : AT_VER_LEN),
+ "%s", hwver);
+ }
plugin = tcore_pending_ref_plugin(p);
vi_property = tcore_plugin_ref_property(plugin, "VERSION");
memcpy(vi_property, vi, sizeof(TelMiscVersionInformation));
- free(vi);
+ g_free(vi);
} else {
dbg("RESPONSE NOK");
if (resp->lines) {
}
ur = tcore_pending_ref_user_request(p);
- tcore_user_request_send_response(ur, TRESP_MODEM_GET_VERSION, sizeof(struct tresp_modem_get_version), &res);
+ tcore_user_request_send_response(ur, TRESP_MODEM_GET_VERSION,
+ sizeof(struct tresp_modem_get_version), &res);
OUT:
if (tokens != NULL)
return;
}
-static gboolean on_event_bootup_sim_status(CoreObject *o, const void *event_info, void *user_data)
+static enum tcore_hook_return on_hook_sim_status(Server *s,
+ CoreObject *source, enum tcore_notification_command command,
+ unsigned int data_len, void *data, void *user_data)
{
- GSList *tok = NULL;
- GSList *lines = NULL;
- int value = -1;
- char *line = NULL;
-
- lines = (GSList *) event_info;
- if (1 != g_slist_length(lines)) {
- dbg("unsolicited msg but multiple line");
- goto OUT;
- }
- line = (char *) (lines->data);
- dbg("on_bootup_event_sim_status notification : %s", line);
-
- tok = tcore_at_tok_new(line);
- value = atoi(g_slist_nth_data(tok, 0));
-
- if (7 == value) {
- dbg("SIM ready. request COPS & remove callback");
- dbg("power on done set for proactive command receiving mode");
- prepare_and_send_pending_request(o, "AT+CFUN=6", NULL, TCORE_AT_NO_RESULT, on_response_enable_proactive_command);
- prepare_and_send_pending_request(o, "AT+COPS=0", NULL, TCORE_AT_NO_RESULT, on_response_network_registration);
- return FALSE;
+ TcorePlugin *plugin;
+ const struct tnoti_sim_status *noti_sim_status;
+ CoreObject *co_sat;
+ CoreObject *co_network;
+
+ plugin = tcore_object_ref_plugin(source);
+ co_sat = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_SAT);
+ if (co_sat == NULL)
+ return TCORE_HOOK_RETURN_CONTINUE;
+
+ co_network = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_NETWORK);
+ if (co_network == NULL)
+ return TCORE_HOOK_RETURN_CONTINUE;
+
+ dbg("Get SIM status");
+ noti_sim_status = data;
+ if (noti_sim_status == NULL)
+ return TCORE_HOOK_RETURN_CONTINUE;
+
+ /* If SIM is initialized, Enable STK and and attach to Network */
+ dbg("SIM Status: [%d]", noti_sim_status->sim_status);
+ if (noti_sim_status->sim_status == SIM_STATUS_INIT_COMPLETED) {
+ dbg("SIM ready for attach!!! Enable STK and attach to Network");
+
+ /* Sending AT+CFUN=6 */
+ prepare_and_send_pending_request(co_sat, "AT+CFUN=6", NULL,
+ TCORE_AT_NO_RESULT, on_response_enable_proactive_command);
+
+ /* Sending AT+COPS */
+ prepare_and_send_pending_request(co_network, "AT+COPS=0", NULL,
+ TCORE_AT_NO_RESULT, on_response_network_registration);
}
-OUT:
- if (tok != NULL)
- tcore_at_tok_free(tok);
-
- return TRUE;
+ return TCORE_HOOK_RETURN_CONTINUE;
}
-
-
-gboolean modem_power_on(TcorePlugin *p)
+gboolean modem_power_on(TcorePlugin *plugin)
{
CoreObject *co_modem = NULL;
struct treq_modem_set_flightmode flight_mode_set = {0};
struct tnoti_modem_power modem_power = {0};
- TcoreHal *h = NULL;
Storage *strg = NULL;
- co_modem = tcore_plugin_ref_core_object(p, CORE_OBJECT_TYPE_MODEM);
+ co_modem = tcore_plugin_ref_core_object(plugin, CORE_OBJECT_TYPE_MODEM);
+ if (co_modem == NULL) {
+ err("Modem Core object is NULL");
+ return FALSE;
+ }
+
+ /* Set Modem Power State to 'ON' */
+ tcore_modem_set_powered(co_modem, TRUE);
- strg = tcore_server_find_storage(tcore_plugin_ref_server(p), "vconf");
+ /* Get Flight mode from VCONFKEY */
+ strg = tcore_server_find_storage(tcore_plugin_ref_server(plugin), "vconf");
flight_mode_set.enable = tcore_storage_get_bool(strg, STORAGE_KEY_FLIGHT_MODE_BOOL);
- h = tcore_object_get_hal(co_modem);
- tcore_hal_set_power_state(h, TRUE);
-
/* Set Flight mode as per AP settings */
- if (flight_mode_set.enable) { /* Radio Off */
- prepare_and_send_pending_request(co_modem, "AT+CFUN=4", NULL, TCORE_AT_NO_RESULT, on_response_set_flight_mode);
+ if (flight_mode_set.enable) { /* Radio OFF */
+ prepare_and_send_pending_request(co_modem, "AT+CFUN=4", NULL,
+ TCORE_AT_NO_RESULT, on_response_set_flight_mode);
+
+ /* Set Flight mode TRUE */
tcore_modem_set_flight_mode_state(co_modem, TRUE);
- } else { /* Radio On */
- prepare_and_send_pending_request(co_modem, "AT+CFUN=1", NULL, TCORE_AT_NO_RESULT, on_response_set_flight_mode);
+ } else { /* Radio ON */
+ prepare_and_send_pending_request(co_modem, "AT+CFUN=1", NULL,
+ TCORE_AT_NO_RESULT, on_response_set_flight_mode);
+
+ /* Set Flight mode FALSE */
tcore_modem_set_flight_mode_state(co_modem, FALSE);
}
/* Get IMEI */
- prepare_and_send_pending_request(co_modem, "AT+CGSN", NULL, TCORE_AT_NUMERIC, on_response_imei);
+ prepare_and_send_pending_request(co_modem, "AT+CGSN", NULL,
+ TCORE_AT_NUMERIC, on_response_imei);
/* Get Version Number */
- prepare_and_send_pending_request(co_modem, "AT+CGMR", NULL, TCORE_AT_SINGLELINE, on_response_version);
-
- tcore_modem_set_powered(co_modem, TRUE);
+ prepare_and_send_pending_request(co_modem, "AT+CGMR", NULL,
+ TCORE_AT_SINGLELINE, on_response_version);
+ /* Send Notification to TAPI - MODEM_POWER */
modem_power.state = MODEM_STATE_ONLINE;
- tcore_server_send_notification(tcore_plugin_ref_server(p), co_modem, TNOTI_MODEM_POWER,
- sizeof(struct tnoti_modem_power), &modem_power);
+ dbg("Sending notification - Modem Power state: [ONLINE]");
+ tcore_server_send_notification(tcore_plugin_ref_server(plugin),
+ co_modem, TNOTI_MODEM_POWER, sizeof(modem_power), &modem_power);
return TRUE;
}
req = tcore_at_request_new("AT+CFUN=0", NULL, TCORE_AT_NO_RESULT);
- dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+ dbg("Command: [%s], Prefix(if any): [%s], Command Length: [%d]",
+ req->cmd, req->prefix, strlen(req->cmd));
tcore_pending_set_request_data(pending, 0, req);
tcore_pending_set_response_callback(pending, on_response_power_off, hal);
req = tcore_at_request_new("AT+CGSN", NULL, TCORE_AT_NUMERIC);
- dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+ dbg("Command: [%s], Prefix(if any): [%s], Command Length: [%d]",
+ req->cmd, req->prefix, strlen(req->cmd));
tcore_pending_set_request_data(pending, 0, req);
tcore_pending_set_response_callback(pending, on_response_imei, hal);
tcore_pending_link_user_request(pending, ur);
tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL);
- tcore_hal_send_request(hal, pending);
-
- return TCORE_RETURN_SUCCESS;
+ return tcore_hal_send_request(hal, pending);
}
req = tcore_at_request_new("AT+CGMR", NULL, TCORE_AT_SINGLELINE);
- dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+ dbg("Command: [%s], Prefix(if any): [%s], Command Length: [%d]",
+ req->cmd, req->prefix, strlen(req->cmd));
tcore_pending_set_request_data(pending, 0, req);
tcore_pending_set_response_callback(pending, on_response_version, hal);
tcore_pending_link_user_request(pending, ur);
tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL);
- tcore_hal_send_request(hal, pending);
-
- return TCORE_RETURN_SUCCESS;
+ return tcore_hal_send_request(hal, pending);
}
static TReturn set_flight_mode(CoreObject *o, UserRequest *ur)
cmd_str = g_strdup("AT+CFUN=1");
}
- req = tcore_at_request_new((const char *) cmd_str, NULL, TCORE_AT_NO_RESULT);
+ req = tcore_at_request_new((const char *)cmd_str, NULL, TCORE_AT_NO_RESULT);
+ g_free(cmd_str);
- dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+ dbg("Command: [%s], Prefix(if any): [%s], Command Length: [%d]",
+ req->cmd, req->prefix, strlen(req->cmd));
tcore_pending_set_request_data(pending, 0, req);
tcore_pending_set_response_callback(pending, on_response_set_flight_mode, hal);
tcore_pending_link_user_request(pending, ur);
tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL);
- tcore_hal_send_request(hal, pending);
-
- return TCORE_RETURN_SUCCESS;
+ return tcore_hal_send_request(hal, pending);
}
sn_property = g_try_new0(TelMiscSNInformation, 1);
tcore_plugin_link_property(cp, "SN", sn_property);
- dbg("Registering for +XSIM event");
- tcore_object_override_callback(co_modem, "+XSIM", on_event_bootup_sim_status, NULL);
+ tcore_server_add_notification_hook(tcore_plugin_ref_server(cp),
+ TNOTI_SIM_STATUS, on_hook_sim_status, NULL);
+ dbg("Registering for +XDRVI event");
+ tcore_object_add_callback(co_modem, "+XDRVI", on_event_nvm_update, NULL);
dbg("Exit");
-
return TRUE;
}
dbg("Exit");
}
+
+/*
+ * NV Manager - Support for Remote File System
+ */
+/* NVM Hook */
+static gboolean modem_rfs_hook(const char *data)
+{
+ if (data != NULL)
+ if (data[NVM_FUNCTION_ID_OFFSET] == XDRV_INDICATION)
+ return TRUE;
+
+ return FALSE;
+}
+
+/* NVM event Notification */
+static gboolean on_event_nvm_update(CoreObject *o, const void *event_info, void *user_data)
+{
+ GSList *tokens = NULL;
+ GSList *lines;
+ const char *line;
+ int function_id;
+
+ gboolean ret = TRUE;
+ dbg("Entered");
+
+ lines = (GSList *)event_info;
+ line = lines->data;
+ dbg("Line: [%s]", line);
+
+ function_id = nvm_sum_4_bytes(&line[NVM_FUNCTION_ID_OFFSET]);
+ dbg("Function ID: [%d]", function_id);
+ if (IUFP_UPDATE == function_id) {
+ dbg("Calling process nvm_update");
+
+ /*
+ * Process NV Update indication
+ *
+ * +XDRVI: IUFP_GROUP, IUFP_UPDATE, <xdrv_result>, <data>
+ */
+ if (NVM_NO_ERR == nvm_process_nv_update(line)) {
+ dbg("NV data processed successfully");
+
+ /* Acknowledge NV Update */
+ modem_send_nvm_update_ack(o);
+
+ return ret;
+ } else {
+ err("NV data processing failed");
+ ret = FALSE;
+ }
+ } else {
+ tokens = tcore_at_tok_new(line);
+ if (g_slist_length(tokens) < 3) {
+ err("XDRVI event with less number of tokens, Ignore!!!");
+ ret = FALSE;
+ }
+ else if (IUFP_GROUP_ID != atoi(g_slist_nth_data(tokens, 0))) {
+ err("Group ID mismatch, Ignore!!!");
+ ret = FALSE;
+ }
+ else {
+ switch (atoi(g_slist_nth_data(tokens, 1))) {
+ case IUFP_UPDATE_REQ:
+ dbg("NV Update Request");
+
+ /* Acknowledge the Update Request */
+ modem_send_nvm_update_request_ack(o);
+ break;
+
+ case IUFP_NO_PENDING_UPDATE:
+ dbg("NO pending NV Update(s)!!!");
+ /* Can send FLUSH request to get fresh updates */
+ break;
+
+ default:
+ err("Unspported Function ID [%d], Ignore", atoi(g_slist_nth_data(tokens, 1)));
+ ret = FALSE;
+ }
+ }
+
+ tcore_at_tok_free(tokens);
+ }
+
+ dbg("Exit");
+ return ret;
+}
+
+/* NVM Responses */
+static gboolean __modem_check_nvm_response(const void *data, int command)
+{
+ const TcoreATResponse *resp = data;
+ const char *line;
+ char *resp_str;
+ GSList *tokens = NULL;
+ gboolean ret = FALSE;
+ dbg("Entered");
+
+ /* +XDRV: <group_id>,<function_id>,<xdrv_result>[,<response_n>] */
+ if (NULL == resp) {
+ err("Input data is NULL");
+ return FALSE;
+ }
+
+ if (resp->success > 0) {
+ dbg("RESPONSE OK");
+ line = (const char *) (((GSList *) resp->lines)->data);
+ tokens = tcore_at_tok_new(line);
+
+ /* Group ID */
+ resp_str = g_slist_nth_data(tokens, 0);
+ if (NULL == resp_str) {
+ err("Group ID is missing ");
+ goto OUT;
+ }
+ else if (IUFP_GROUP_ID != atoi(resp_str)) {
+ err("Group ID mismatch");
+ goto OUT;
+ }
+
+ /* Function ID */
+ resp_str = g_slist_nth_data(tokens, 1);
+ if (NULL == resp_str) {
+ err("Function ID is missing ");
+ goto OUT;
+ }
+ else if (command != atoi(resp_str)) {
+ err("Function ID mismatch");
+ goto OUT;
+ }
+
+ /* XDRV Result */
+ resp_str = g_slist_nth_data(tokens, 2);
+ if (NULL == resp_str) {
+ err("XDRV result is missing ");
+ goto OUT;
+ }
+ else if (XDRV_RESULT_OK != atoi(resp_str)) {
+ err("XDRV result[%d] ", atoi(resp_str));
+ goto OUT;
+ }
+
+ /* Result code */
+ resp_str = g_slist_nth_data(tokens, 3);
+ if (NULL == resp_str) {
+ err("UTA result is missing ");
+ goto OUT;
+ }
+ else if (UTA_SUCCESS != atoi(resp_str)) {
+ err("uta result[%d] ", atoi(resp_str));
+ goto OUT;
+ }
+
+ ret = TRUE;
+ } else {
+ dbg("Response NOK");
+ }
+
+OUT:
+ tcore_at_tok_free(tokens);
+
+ dbg("Exit");
+ return ret;
+}
+
+static void _on_response_modem_unsuspend_nvm_updates(TcorePending *p,
+ int data_len, const void *data, void *user_data)
+{
+ /* Check NVM response */
+ if (TRUE == __modem_check_nvm_response(data, IUFP_SUSPEND)) {
+ dbg("Priority level is set to get all updates since Boot-up");
+
+ /* Create NV data file */
+ if (nvm_create_nvm_data() == FALSE) {
+ err("Failed to Create NV data file");
+ }
+
+ return;
+ }
+
+ err("Response NOT OK");
+}
+
+static void _on_response_modem_send_nvm_update_ack(TcorePending *p,
+ int data_len, const void *data, void *user_data)
+{
+ /* Check NVM response */
+ if (TRUE == __modem_check_nvm_response(data, IUFP_UPDATE_ACK)) {
+ dbg("[UPDATE ACK] OK");
+ return;
+ }
+
+ err("[UPDATE ACK] NOT OK");
+}
+
+static void _on_response_modem_send_nvm_update_request_ack(TcorePending *p,
+ int data_len, const void *data, void *user_data)
+{
+ /* Check NVM response */
+ if (TRUE == __modem_check_nvm_response(data, IUFP_UPDATE_REQ_ACK)) {
+ dbg("[REQUEST ACK] OK");
+ return;
+ }
+
+ err("[REQUEST ACK] NOT OK");
+}
+
+static void _on_response_modem_register_nvm(TcorePending *p,
+ int data_len, const void *data, void *user_data)
+{
+ /* Check NVM response */
+ if (TRUE == __modem_check_nvm_response(data, IUFP_REGISTER)) {
+ dbg("Registering successful");
+
+ /* Send SUSPEND_UPDATE for all UPDATES */
+ modem_unsuspend_nvm_updates(tcore_pending_ref_core_object(p));
+
+ dbg("Exit");
+ return;
+ }
+
+ err("Response NOT OK");
+}
+
+/* NVM Requests */
+static void modem_unsuspend_nvm_updates(CoreObject *o)
+{
+ TcorePending *pending = NULL;
+ char *cmd_str;
+ dbg("Entered");
+
+ /* Prepare AT-Command */
+ cmd_str = g_strdup_printf("AT+XDRV=%d, %d, %d, %d",
+ IUFP_GROUP_ID, IUFP_SUSPEND,
+ 0, UTA_FLASH_PLUGIN_PRIO_UNSUSPEND_ALL);
+
+ /* Prepare pending request */
+ pending = tcore_at_pending_new(o,
+ cmd_str,
+ "+XDRV:",
+ TCORE_AT_SINGLELINE,
+ _on_response_modem_unsuspend_nvm_updates,
+ NULL);
+ if (pending == NULL) {
+ err("Failed to form pending request");
+ }
+ else if (tcore_hal_send_request(tcore_object_get_hal(o), pending)
+ != TCORE_RETURN_SUCCESS) {
+ err("IUFP_SUSPEND - Unable to send AT-Command");
+ }
+ else {
+ dbg("IUFP_SUSPEND - Successfully sent AT-Command");
+ }
+
+ g_free(cmd_str);
+}
+
+static void modem_send_nvm_update_ack(CoreObject *o)
+{
+ TcorePending *pending = NULL;
+ char *cmd_str;
+ dbg("Entered");
+
+ /* Prepare AT-Command */
+ cmd_str = g_strdup_printf("AT+XDRV=%s, %s", IUFP_GROUP, IUFP_UPDATE_ACK_STR);
+
+ /* Prepare pending request */
+ pending = tcore_at_pending_new(o,
+ cmd_str,
+ "+XDRV:",
+ TCORE_AT_SINGLELINE,
+ _on_response_modem_send_nvm_update_ack,
+ NULL);
+ if (pending == NULL) {
+ err("Failed to form pending request");
+ }
+ else if (tcore_hal_send_request(tcore_object_get_hal(o), pending)
+ != TCORE_RETURN_SUCCESS) {
+ err("IUFP_UPDATE_ACK - Unable to send AT-Command");
+ }
+ else {
+ dbg("IUFP_UPDATE_ACK - Successfully sent AT-Command");
+ }
+
+ g_free(cmd_str);
+}
+
+static void modem_send_nvm_update_request_ack(CoreObject *o)
+{
+ TcorePending *pending = NULL;
+ char *cmd_str;
+ dbg("Entered");
+
+ /* Prepare AT-Command */
+ cmd_str = g_strdup_printf("AT+XDRV=%s, %s", IUFP_GROUP, IUFP_UPDATE_REQ_ACK_STR);
+
+ /* Prepare pending request */
+ pending = tcore_at_pending_new(o,
+ cmd_str,
+ "+XDRV:",
+ TCORE_AT_SINGLELINE,
+ _on_response_modem_send_nvm_update_request_ack,
+ NULL);
+
+
+ if (pending == NULL) {
+ err("Failed to form pending request");
+ }
+ else if (tcore_hal_send_request(tcore_object_get_hal(o), pending)
+ != TCORE_RETURN_SUCCESS) {
+ err("IUFP_UPDATE_REQ_ACK - Unable to send AT-Ccommand");
+ }
+ else {
+ dbg("IUFP_UPDATE_REQ_ACK - Successfully sent AT-Command");
+ }
+
+ g_free(cmd_str);
+}
+
+void modem_register_nvm(CoreObject *co_modem)
+{
+ TcorePending *pending = NULL;
+ char *cmd_str;
+ dbg("Entered");
+
+ /* Prepare AT-Command */
+ cmd_str = g_strdup_printf("AT+XDRV=%s, %s, %s",
+ IUFP_GROUP, IUFP_REGISTER_STR, XDRV_ENABLE);
+
+ /* Prepare pending request */
+ pending = tcore_at_pending_new(co_modem,
+ cmd_str,
+ "+XDRV:",
+ TCORE_AT_SINGLELINE,
+ _on_response_modem_register_nvm,
+ NULL);
+ if (pending == NULL) {
+ err("Failed to form pending request");
+ }
+ else if (tcore_hal_send_request(tcore_object_get_hal(co_modem), pending)
+ != TCORE_RETURN_SUCCESS) {
+ err("IUFP_REGISTER (Enable) -Unable to send AT-Command");
+ }
+ else {
+ dbg("IUFP_REGISTER (Enable) -Successfully sent AT-Command");
+
+ /* Add RFS hook */
+ tcore_at_add_hook(tcore_object_get_hal(co_modem), modem_rfs_hook);
+ }
+
+ g_free(cmd_str);
+}