{
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;
{
const TcoreATResponse *resp = data;
UserRequest *ur = NULL;
- CoreObject *co_sim = NULL;
- struct s_sim_property *sp = NULL;
GSList *tokens = NULL;
- struct tresp_sim_get_facility_status res;
+ struct tresp_sim_get_facility_status *res = user_data;
const char *line;
dbg(" Function entry ");
- co_sim = tcore_pending_ref_core_object(p);
- sp = tcore_sim_ref_userdata(co_sim);
ur = tcore_pending_ref_user_request(p);
- memset(&res, 0, sizeof(struct tresp_sim_get_facility_status));
-
- res.result = SIM_INCOMPATIBLE_PIN_OPERATION;
- res.type = _sim_get_current_pin_facility(sp->current_sec_op);
+ res->result = SIM_PIN_OPERATION_SUCCESS;
if (resp->success > 0) {
dbg("RESPONSE OK");
tokens = tcore_at_tok_new(line);
if (g_slist_length(tokens) != 1) {
msg("invalid message");
- goto OUT;
+ tcore_at_tok_free(tokens);
+ return;
}
}
- res.b_enable = atoi(g_slist_nth_data(tokens, 0));
+ res->b_enable = atoi(g_slist_nth_data(tokens, 0));
} else {
dbg("RESPONSE NOK");
+ res->result = SIM_INCOMPATIBLE_PIN_OPERATION;
}
-OUT:
+
if (ur) {
tcore_user_request_send_response(ur, _find_resp_command(ur),
- sizeof(struct tresp_sim_get_facility_status), &res);
+ sizeof(struct tresp_sim_get_facility_status), res);
}
tcore_at_tok_free(tokens);
+ g_free(res);
dbg(" Function exit");
}
TcorePending *pending = NULL;
char *cmd_str = NULL;
const struct treq_sim_get_facility_status *req_data;
+ struct tresp_sim_get_facility_status *res;
char *fac = "SC";
int mode = 2; /* 0:unlock, 1:lock, 2:query*/
TReturn ret = TCORE_RETURN_FAILURE;
pending = tcore_pending_new(o, 0);
req_data = tcore_user_request_ref_data(ur, NULL);
+ res = g_try_new0(struct tresp_sim_get_facility_status, 1);
+ if (!res)
+ return TCORE_RETURN_ENOMEM;
+
+ res->type = req_data->type;
+
if (req_data->type == SIM_FACILITY_PS) {
fac = "PS"; /*PH-SIM, Lock PHone to SIM/UICC card*/
} else if (req_data->type == SIM_FACILITY_SC) {
dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
tcore_pending_set_request_data(pending, 0, req);
- tcore_pending_set_response_callback(pending, on_response_get_facility_status, hal);
+ tcore_pending_set_response_callback(pending, on_response_get_facility_status, res);
tcore_pending_link_user_request(pending, ur);
ret = tcore_hal_send_request(hal, pending);
return ret;
}
-static TReturn s_get_lock_info(CoreObject *o, UserRequest *ur)
+static TReturn s_get_lock_info_n(CoreObject *o, UserRequest *ur)
+{
+ TcoreHal *hal = NULL;
+ TcoreATRequest *req = NULL;
+ TcorePending *pending = NULL;
+ char *cmd_str = NULL;
+ int lock_type = 0;
+ const struct treq_sim_get_lock_info *req_data;
+ struct s_sim_property *sp = NULL;
+
+ dbg(" Function entry ");
+
+ hal = tcore_object_get_hal(o);
+
+ sp = tcore_sim_ref_userdata(o);
+ pending = tcore_pending_new(o, 0);
+ req_data = tcore_user_request_ref_data(ur, NULL);
+
+ if (!o || !ur)
+ return TCORE_RETURN_EINVAL;
+
+ switch (req_data->type) {
+ case SIM_FACILITY_PS:
+ lock_type = 9; // IMSI lock
+ break;
+
+ case SIM_FACILITY_SC:
+ lock_type = 1;
+ break;
+
+ case SIM_FACILITY_FD:
+ lock_type = 2;
+ break;
+
+ case SIM_FACILITY_PN:
+ lock_type = 5;
+ break;
+
+ case SIM_FACILITY_PU:
+ lock_type = 6;
+ break;
+
+ case SIM_FACILITY_PP:
+ lock_type = 7;
+ break;
+
+ case SIM_FACILITY_PC:
+ lock_type = 8;
+ break;
+
+ default:
+ break;
+ }
+ cmd_str = g_strdup_printf("AT+XPINCNT =%d", lock_type);
+ req = tcore_at_request_new(cmd_str, "+XPINCNT:", TCORE_AT_SINGLELINE);
+
+ dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+ tcore_pending_set_request_data(pending, 0, req);
+ tcore_pending_set_response_callback(pending, on_response_get_lock_info, hal);
+ tcore_pending_link_user_request(pending, ur);
+ tcore_hal_send_request(hal, pending);
+
+ free(cmd_str);
+ dbg(" Function exit");
+ return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_get_lock_info_str(CoreObject *o, UserRequest *ur)
{
TcoreHal *hal = NULL;
TcoreATRequest *req = NULL;
return TCORE_RETURN_EINVAL;
hal = tcore_object_get_hal(o);
- if(FALSE == tcore_hal_get_power_state(hal)){
- dbg("cp not ready/n");
- return TCORE_RETURN_ENOSYS;
- }
+
pending = tcore_pending_new(o, 0);
req_data = tcore_user_request_ref_data(ur, NULL);
return ret;
}
+static TReturn s_get_lock_info(CoreObject *o, UserRequest *ur)
+{
+ TcorePlugin *plugin = tcore_object_ref_plugin(o);
+ const char *cpname = tcore_server_get_cp_name_by_plugin(plugin);
+
+ if (g_str_has_prefix(cpname, "mfld_blackbay") == TRUE)
+ return s_get_lock_info_n(o, ur);
+ else
+ return s_get_lock_info_str(o, ur);
+}
+
static TReturn s_read_file(CoreObject *o, UserRequest *ur)
{
TReturn api_ret = TCORE_RETURN_SUCCESS;