From 48d37d2773a2c43be1bfc291c981d7614bc80353 Mon Sep 17 00:00:00 2001 From: Suresh Kumar N Date: Mon, 28 Nov 2016 16:19:54 +0530 Subject: [PATCH] Add new features - Introduce subscription - Fix memory leak in database API - Added IMS related features Change-Id: Icb728fb4609cba47ed6972364a3d3ed61395d442 Signed-off-by: Suresh Kumar N --- CMakeLists.txt | 1 + include/co_call.h | 23 +- include/co_context.h | 14 + include/co_modem.h | 4 + include/co_network.h | 15 +- include/co_ps.h | 15 +- include/co_sim.h | 21 +- include/core_object.h | 8 +- include/hal.h | 7 + include/server.h | 2 + include/storage.h | 4 +- include/tcore.h | 7 + include/type/call.h | 235 ++++++++++++--- include/type/common.h | 2 + include/type/modem.h | 17 ++ include/type/network.h | 54 +++- include/type/notification.h | 8 +- include/type/ps.h | 57 ++-- include/type/request.h | 16 +- include/type/response.h | 14 +- include/type/sat.h | 19 +- include/type/sim.h | 95 +++--- include/type/sms.h | 15 + include/type/subscription.h | 42 +++ include/util.h | 4 + src/core_object/co_call.c | 151 ++++++++-- src/core_object/co_context.c | 364 ++++++++++++++++++----- src/core_object/co_modem.c | 52 +++- src/core_object/co_network.c | 246 ++++++++++++---- src/core_object/co_phonebook.c | 34 ++- src/core_object/co_ps.c | 495 ++++++++++++++++++++++++++----- src/core_object/co_sat.c | 48 ++- src/core_object/co_sim.c | 652 ++++++++++++++++++++++++----------------- src/core_object/co_ss.c | 36 ++- src/core_object/core_object.c | 26 +- src/hal.c | 28 ++ src/plugin.c | 2 +- src/server.c | 111 ++++--- src/storage.c | 2 +- src/subscription.c | 41 +++ src/util.c | 132 ++++++++- 41 files changed, 2420 insertions(+), 699 deletions(-) create mode 100644 include/type/subscription.h create mode 100644 src/subscription.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 6af461e..a13d8a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,7 @@ SET(SRCS src/communicator.c src/storage.c src/queue.c + src/subscription.c src/user_request.c src/util.c src/core_object/core_object.c diff --git a/include/co_call.h b/include/co_call.h index fdd0126..0b2d7d7 100644 --- a/include/co_call.h +++ b/include/co_call.h @@ -134,8 +134,12 @@ struct tcore_call_operations { TReturn (*get_preferred_voice_subscription)(CoreObject *o, UserRequest *ur); TReturn (*set_privacy_mode)(CoreObject *o, UserRequest *ur); TReturn (*get_privacy_mode)(CoreObject *o, UserRequest *ur); - TReturn (*modify)(CoreObject *o, UserRequest *ur); /* IMS specific */ - TReturn (*confirm_modify)(CoreObject *o, UserRequest *ur); /* IMS specific */ + TReturn (*upgrade)(CoreObject *o, UserRequest *ur); /* IMS specific */ + TReturn (*downgrade)(CoreObject *o, UserRequest *ur); /* IMS specific */ + TReturn (*confirm_upgrade)(CoreObject *o, UserRequest *ur); /* IMS specific */ + TReturn (*start_conference)(CoreObject *o, UserRequest *ur); + TReturn (*modify_participants_in_conference)(CoreObject *o, UserRequest *ur); + TReturn (*set_ecc_status)(CoreObject* o, UserRequest* ur); }; struct tcore_call_information_operations { @@ -229,6 +233,9 @@ int tcore_call_object_get_name(CallObject *co, char *name); gboolean tcore_call_object_set_multiparty_state (CallObject *co, gboolean is); gboolean tcore_call_object_get_multiparty_state (CallObject *co); +gboolean tcore_call_object_set_conference_state (CallObject *co, gboolean is); +gboolean tcore_call_object_get_conference_state (CallObject *co); + gboolean tcore_call_object_set_active_line(CallObject *co, unsigned int line); int tcore_call_object_get_active_line(CallObject *co); gboolean tcore_call_object_set_is_volte_call(CallObject *co, gboolean flag); @@ -250,6 +257,18 @@ gboolean tcore_call_object_get_is_release_pending(CallObject *co); gboolean tcore_call_object_set_silent_redial_reason(CallObject *co, enum tcore_call_silent_redial_reason reason); enum tcore_call_silent_redial_reason tcore_call_object_get_silent_redial_reason(CallObject *co); +gboolean tcore_call_object_set_hd_icon(CallObject *co, gboolean is_hd_icon); +gboolean tcore_call_object_get_hd_icon(CallObject *co); + +gboolean tcore_call_object_set_modifiable(CallObject *co, gboolean is_modifiable); +gboolean tcore_call_object_get_modifiable(CallObject* co); + +gboolean tcore_call_object_set_added_to_conference(CallObject *co, gboolean added_to_conference); +gboolean tcore_call_object_get_added_to_conference(CallObject *co); + +gboolean tcore_call_object_set_audio_codec(CallObject *co, gchar *audio_codec); +gchar *tcore_call_object_get_audio_codec(CallObject* co); + /* Call Control APIs */ gboolean tcore_call_control_new(CoreObject *o, struct tcore_call_control_operations *ops); void tcore_call_control_free(CoreObject *o); diff --git a/include/co_context.h b/include/co_context.h index 0f5ee4d..0d4f552 100644 --- a/include/co_context.h +++ b/include/co_context.h @@ -51,6 +51,14 @@ enum co_context_role { CONTEXT_ROLE_PREPAID_MMS, CONTEXT_ROLE_TETHERING, CONTEXT_ROLE_IMS_EMERGENCY, + CONTEXT_ROLE_IMS_UT, + CONTEXT_ROLE_FOTA, + CONTEXT_ROLE_CBS, + CONTEXT_ROLE_SUPL, + CONTEXT_ROLE_E911, + CONTEXT_ROLE_EMBMS, + CONTEXT_ROLE_BIP, + CONTEXT_ROLE_CAS, CONTEXT_ROLE_USER_DEFINED, }; @@ -130,6 +138,8 @@ TReturn tcore_context_set_profile_name(CoreObject *o, const char *profile_name); char *tcore_context_get_profile_name(CoreObject *o); TReturn tcore_context_set_default_profile(CoreObject *o, gboolean default_conn); gboolean tcore_context_get_default_profile(CoreObject *o); +TReturn tcore_context_set_default_pdn(CoreObject *o, gboolean default_pdn); +gboolean tcore_context_get_default_pdn(CoreObject *o); TReturn tcore_context_set_devinfo(CoreObject *o, struct tnoti_ps_pdp_ipconfiguration *devinfo); TReturn tcore_context_reset_devinfo(CoreObject *o); @@ -138,12 +148,14 @@ TReturn tcore_context_get_bearer_info(CoreObject *o, struct dedicated_bearer_inf TReturn tcore_context_reset_bearer_info(CoreObject *o); void tcore_context_cp_service_info(CoreObject *dest, CoreObject *src); +TReturn tcore_context_set_ipv4_addr(CoreObject *o, unsigned char *ipv4_address); char *tcore_context_get_ipv4_addr(CoreObject *o); char *tcore_context_get_ipv4_dns1(CoreObject *o); char *tcore_context_get_ipv4_dns2(CoreObject *o); char *tcore_context_get_ipv4_gw(CoreObject *o); char *tcore_context_get_ipv4_devname(CoreObject *o); +TReturn tcore_context_set_ipv6_addr(CoreObject *o, char *ipv6_address); char *tcore_context_get_ipv6_addr(CoreObject *o); char *tcore_context_get_ipv6_dns1(CoreObject *o); char *tcore_context_get_ipv6_dns2(CoreObject *o); @@ -155,6 +167,8 @@ TReturn tcore_context_set_attach_apn(CoreObject *o, gboolean flag); gboolean tcore_context_get_attach_apn(CoreObject *o); TReturn tcore_context_set_roaming_apn(CoreObject *o, gboolean flag); gboolean tcore_context_get_roaming_apn(CoreObject *o); +TReturn tcore_context_set_disable_apn(CoreObject *o, gboolean flag); +gboolean tcore_context_get_disable_apn(CoreObject *o); __END_DECLS diff --git a/include/co_modem.h b/include/co_modem.h index c089d2d..2dc288b 100644 --- a/include/co_modem.h +++ b/include/co_modem.h @@ -38,6 +38,7 @@ struct tcore_modem_operations { TReturn (*dun_pin_ctrl)(CoreObject *o, UserRequest *ur); TReturn (*get_flight_mode)(CoreObject *o, UserRequest *ur); TReturn (*get_device_info)(CoreObject *o, UserRequest *ur); + TReturn (*set_always_on)(CoreObject *o, UserRequest *ur); }; @@ -51,6 +52,9 @@ gboolean tcore_modem_get_flight_mode_state(CoreObject *o); TReturn tcore_modem_set_powered(CoreObject *o, gboolean pwr); gboolean tcore_modem_get_powered(CoreObject *o); +TReturn tcore_modem_set_modem_power_state(CoreObject *o, enum modem_state modem_power_state); +TReturn tcore_modem_get_modem_power_state(CoreObject *o, enum modem_state *modem_power_state); + __END_DECLS #endif /* __TCORE_CO_MODEM_H__ */ diff --git a/include/co_network.h b/include/co_network.h index 36ad3b8..868b221 100644 --- a/include/co_network.h +++ b/include/co_network.h @@ -117,10 +117,11 @@ struct tcore_network_operations { TReturn (*get_default_data_subscription)(CoreObject *o, UserRequest *ur); TReturn (*set_default_subscription)(CoreObject *o, UserRequest *ur); TReturn (*get_default_subscription)(CoreObject *o, UserRequest *ur); - TReturn (*set_emergency_callback_mode)(CoreObject *o, UserRequest *ur); /* 3GPP2 spcefic */ - TReturn (*set_roaming_preference)(CoreObject *o, UserRequest *ur); /* 3GPP2 spcefic */ - TReturn (*get_roaming_preference)(CoreObject *o, UserRequest *ur); /* 3GPP2 spcefic */ - TReturn (*get_subscription_info)(CoreObject *o, UserRequest *ur); /* 3GPP2 spcefic */ + TReturn (*set_emergency_callback_mode)(CoreObject *o, UserRequest *ur); /* 3GPP2 specfic */ + TReturn (*set_roaming_preference)(CoreObject *o, UserRequest *ur); /* 3GPP2 specfic */ + TReturn (*get_roaming_preference)(CoreObject *o, UserRequest *ur); /* 3GPP2 specfic */ + TReturn (*get_subscription_info)(CoreObject *o, UserRequest *ur); /* 3GPP2 specfic */ + TReturn (*get_subscription_source)(CoreObject *o, UserRequest *ur); /* 3GPP2 specfic */ TReturn (*search_ecc_rat)(CoreObject *o, UserRequest *ur); TReturn (*ims_deregister)(CoreObject *o, UserRequest *ur); }; @@ -173,6 +174,12 @@ TReturn tcore_network_get_rac(CoreObject *co, unsigned int *result); TReturn tcore_network_set_cell_id(CoreObject *co, unsigned int cell_id); TReturn tcore_network_get_cell_id(CoreObject *co, unsigned int *result); +TReturn tcore_network_set_physical_cell_id(CoreObject *co, unsigned int physical_cell_id); +TReturn tcore_network_get_physical_cell_id(CoreObject *co, unsigned int *result); + +TReturn tcore_network_set_reject_reason(CoreObject *co, int reject_reason); +TReturn tcore_network_get_reject_reason(CoreObject *co, int *result); + TReturn tcore_network_set_gsm_dtm_support(CoreObject *co, gboolean state); gboolean tcore_network_get_gsm_dtm_support(CoreObject *co); diff --git a/include/co_ps.h b/include/co_ps.h index abc514d..be9de43 100644 --- a/include/co_ps.h +++ b/include/co_ps.h @@ -29,11 +29,20 @@ __BEGIN_DECLS #define PS_MAX_CID 4 +/* + * DNET connection status property + * + * Value: 'connected' / 'disconnected' / Empty(Unknown state) + */ +#define PROP_DNET_CONNECTION_STATUS "dnet_connection_status" + struct tcore_ps_operations { + TReturn (*set_data_profile)(CoreObject *co_ps, CoreObject *context, void *user_data); TReturn (*define_context)(CoreObject *co_ps, CoreObject *context, void *user_data); TReturn (*activate_context)(CoreObject *co_ps, CoreObject *context, void *user_data); TReturn (*deactivate_context)(CoreObject *co_ps, CoreObject *context, void *user_data); TReturn (*send_dormant_request)(CoreObject *co_ps, void *user_data); + TReturn (*set_attach_request)(CoreObject *co_ps, gint attach_req_info); }; CoreObject *tcore_ps_new(TcorePlugin *p, const char *name, struct tcore_ps_operations *ops, TcoreHal *hal); @@ -45,8 +54,10 @@ TReturn tcore_ps_add_context(CoreObject *o, CoreObject *ctx_o); TReturn tcore_ps_remove_context(CoreObject *o, CoreObject *ctx_o); CoreObject *tcore_ps_ref_context_by_role(CoreObject *o, enum co_context_role role); GSList *tcore_ps_ref_context_by_id(CoreObject *o, unsigned int id); +gboolean tcore_ps_any_internet_mms_tethering_context_activating_activated(CoreObject *o, int * state); gboolean tcore_ps_any_context_activating_activated(CoreObject *o, int *state); +TReturn tcore_ps_set_activation(CoreObject *o, enum telephony_ps_activation activation); TReturn tcore_ps_set_online(CoreObject *o, gboolean state); TReturn tcore_ps_set_num_of_pdn(CoreObject *o, gint numbers); unsigned int tcore_ps_get_num_of_pdn(CoreObject *o); @@ -60,12 +71,14 @@ unsigned int tcore_ps_is_active_apn(CoreObject *o, const char* apn); TReturn tcore_ps_assign_context_id(CoreObject *o, CoreObject *context, unsigned char cid); TReturn tcore_ps_clear_context_id(CoreObject *o, CoreObject *context); -TReturn tcore_ps_send_dormant_request(CoreObject *o, void *user_data); +TReturn tcore_ps_send_dormant_request(CoreObject *o, void *user_data); +TReturn tcore_ps_set_data_profile(CoreObject *o, CoreObject *context, void *user_data); TReturn tcore_ps_define_context(CoreObject *o, CoreObject *context, void *user_data); TReturn tcore_ps_activate_context(CoreObject *o, CoreObject *context, void *user_data); TReturn tcore_ps_deactivate_context(CoreObject *o, CoreObject *context, void *user_data); TReturn tcore_ps_deactivate_contexts(CoreObject *o); TReturn tcore_ps_deactivate_cid(CoreObject *o, unsigned int cid); +TReturn tcore_ps_set_attach_request(CoreObject *o, gint attach_req_info); __END_DECLS diff --git a/include/co_sim.h b/include/co_sim.h index 00ac9c8..aebfbac 100644 --- a/include/co_sim.h +++ b/include/co_sim.h @@ -69,6 +69,9 @@ gboolean tcore_sim_set_type(CoreObject *o, enum tel_sim_type type); struct tel_sim_imsi *tcore_sim_get_imsi(CoreObject *o); gboolean tcore_sim_set_imsi(CoreObject *o, const struct tel_sim_imsi *imsi); +struct tel_sim_imsi *tcore_sim_get_imsi_m(CoreObject *o); +gboolean tcore_sim_set_imsi_m(CoreObject *o, const struct tel_sim_imsi *imsi_m); + enum tel_sim_status tcore_sim_get_status(CoreObject *o); gboolean tcore_sim_set_status(CoreObject *o, enum tel_sim_status status); @@ -106,15 +109,23 @@ enum tcore_return tcore_sim_delete_iccid(CoreObject *o); gboolean tcore_sim_get_cphs_status(CoreObject *o); gboolean tcore_sim_set_cphs_status(CoreObject *o, gboolean b_support); -unsigned char tcore_sim_get_app_list(CoreObject *o); -gboolean tcore_sim_set_app_list(CoreObject *o, unsigned char app_list); + +enum tel_sim_app_type tcore_sim_get_app_list(CoreObject *o); +gboolean tcore_sim_set_app_list(CoreObject *o, enum tel_sim_app_type app_list); + struct tel_sim_ist *tcore_sim_get_isim_service_table(CoreObject *o); -gboolean tcore_sim_set_isim_service_table(CoreObject *o, struct tel_sim_ist *ist); +gboolean tcore_sim_set_isim_service_table(CoreObject *o, const struct tel_sim_ist *ist); enum tcore_return tcore_sim_delete_isim_service_table(CoreObject *o); +char *tcore_sim_get_isim_impi(CoreObject *o); +gboolean tcore_sim_set_isim_impi(CoreObject *o, const char *impi); +enum tcore_return tcore_sim_delete_isim_impi(CoreObject *o); +gboolean tcore_sim_is_jio_sim(CoreObject *co_sim); + gboolean tcore_sim_link_userdata(CoreObject *o, void *userdata); void *tcore_sim_ref_userdata(CoreObject *o); +enum tel_sim_access_result tcore_sim_decode_status_word(unsigned short status_word1, unsigned short status_word2); gboolean tcore_sim_decode_iccid(struct tel_sim_iccid *p_out, unsigned char *p_in, int in_length); gboolean tcore_sim_decode_lp(struct tel_sim_language *p_out, unsigned char *p_in, int in_length); char *tcore_sim_encode_lp(int *out_length, struct tel_sim_language *p_in); @@ -123,7 +134,7 @@ char *tcore_sim_encode_li(int *out_length, struct tel_sim_language *p_in); gboolean tcore_sim_decode_imsi(struct tel_sim_imsi *p_out, unsigned char *p_in, int in_length); gboolean tcore_sim_decode_cdma_imsi(struct tel_sim_imsi *p_out, unsigned char *p_in, int in_length); gboolean tcore_sim_decode_sst(struct tel_sim_sst *p_sst, unsigned char *p_in, int in_length); -gboolean tcore_sim_decode_cdma_st(struct tel_sim_cst *p_cdma_st, unsigned char *p_in, int in_length); +gboolean tcore_sim_decode_cdma_st(struct tel_sim_ruimst *p_cdma_st, unsigned char *p_in, int in_length); gboolean tcore_sim_decode_csim_st(struct tel_sim_cst *p_csim_st, unsigned char *p_in, int in_length); gboolean tcore_sim_decode_spn(struct tel_sim_spn *p_spn, unsigned char *p_in, int in_length); gboolean tcore_sim_decode_cdma_spn(struct tel_sim_spn *p_spn, unsigned char *p_in, int in_length); @@ -149,7 +160,9 @@ char *tcore_sim_encode_cfis(int *out_length, const struct tel_sim_cfis *p_cfis); gboolean tcore_sim_decode_cff(struct tel_sim_cphs_cf *cfis, unsigned char *p_in, int in_length); char *tcore_sim_encode_cff(const struct tel_sim_cphs_cf *cff, int in_length); gboolean tcore_sim_decode_csp(struct tel_sim_cphs_csp *p_csp, unsigned char *p_in, int in_length); +#if 0 gboolean tcore_sim_encode_csp(unsigned char *p_out, int out_length, struct tel_sim_cphs_csp *p_csp); +#endif gboolean tcore_sim_decode_dynamic_flag(struct tel_sim_cphs_dflag *p_df, unsigned char *p_in, int in_length); gboolean tcore_sim_encode_dynamic_flag(char *p_out, int out_length, struct tel_sim_cphs_dflag *p_df); gboolean tcore_sim_decode_dynamic2_flag(struct tel_sim_cphs_dflag2 *p_d2f, unsigned char *p_in, int in_length); diff --git a/include/core_object.h b/include/core_object.h index ec03728..8078bcd 100644 --- a/include/core_object.h +++ b/include/core_object.h @@ -46,12 +46,6 @@ __BEGIN_DECLS if (!o) { warn("core_object is NULL"); return r; } \ if (tcore_object_get_type(o) != t) { warn("type(0x%x != 0x%x) mismatch", tcore_object_get_type(o), t); return r; } -enum tcore_ops_type { - TCORE_OPS_TYPE_CP = 0, - TCORE_OPS_TYPE_IMS, - TCORE_OPS_TYPE_MAX -}; - #define CORE_OBJECT_VALIDATE_OPS_RETURN(ops_type) \ do { \ switch (ops_type) { \ @@ -128,6 +122,8 @@ struct object_deinitializer { CoreObject *tcore_object_new(TcorePlugin *plugin, const char *name, TcoreHal *hal); void tcore_object_free(CoreObject *co); +enum telephony_subscription_type tcore_object_ref_subscription_type(CoreObject *co); + TReturn tcore_object_set_free_hook(CoreObject *co, CoreObjectFreeHook free_hook); TReturn tcore_object_set_name(CoreObject *co, const char *name); diff --git a/include/hal.h b/include/hal.h index 323c7c4..99bcf85 100644 --- a/include/hal.h +++ b/include/hal.h @@ -47,6 +47,8 @@ struct tcore_hal_operations { TReturn (*setup_netif)(CoreObject *co, TcoreHalSetupNetifCallback func, void *user_data, unsigned int cid, gboolean enable); + TReturn (*control_nvdata)(TcoreHal *hal, int option); + TReturn (*reset)(TcoreHal *hal, int option); }; TcoreHal *tcore_hal_new(TcorePlugin *plugin, const char *name, @@ -55,6 +57,7 @@ void tcore_hal_free(TcoreHal *hal); TReturn tcore_hal_set_name(TcoreHal *hal, const char *name); char *tcore_hal_get_name(TcoreHal *hal); +char *tcore_hal_ref_name(TcoreHal *hal); TcoreAT *tcore_hal_get_at(TcoreHal *hal); enum tcore_hal_mode tcore_hal_get_mode(TcoreHal *hal); @@ -95,6 +98,10 @@ TReturn tcore_hal_setup_netif(TcoreHal *hal, CoreObject *co, TcoreHalSetupNetifCallback func, void *user_data, unsigned int cid, gboolean enable); +TReturn tcore_hal_control_nvdata(TcoreHal *hal, int option); + +TReturn tcore_hal_reset(TcoreHal *hal, int option); + __END_DECLS #endif /* __TCORE_HAL_H__ */ diff --git a/include/server.h b/include/server.h index a1efe94..2643331 100644 --- a/include/server.h +++ b/include/server.h @@ -41,6 +41,7 @@ Manager *tcore_server_ref_manager(Server *s); TReturn tcore_server_add_plugin(Server *s, TcorePlugin *plugin); GSList *tcore_server_ref_plugins(Server *s); TcorePlugin *tcore_server_find_plugin(Server *s, const char *name); +TcorePlugin *tcore_server_search_plugin_list(Server *s, const char *desc_name); TReturn tcore_server_add_communicator(Server *s, Communicator *comm); TReturn tcore_server_remove_communicator(Server *s, Communicator *comm); @@ -57,6 +58,7 @@ GSList *tcore_server_ref_hals(Server *s); TcoreHal *tcore_server_find_hal(Server *s, const char *name); TReturn tcore_server_dispatch_request(Server *s, UserRequest *ur); +TReturn tcore_server_dispatch_request_ex(Server *s, UserRequest *ur, enum tcore_ops_type ops_type); TReturn tcore_server_send_notification(Server *s, CoreObject *source, enum tcore_notification_command command, unsigned int data_len, void *data); diff --git a/include/storage.h b/include/storage.h index 81799c3..f487583 100644 --- a/include/storage.h +++ b/include/storage.h @@ -146,7 +146,7 @@ struct storage_operations { const char *query, GHashTable *in_param); gboolean (*read_query_database)(Storage *strg, void *handle, const char *query, GHashTable *in_param, - GHashTable *out_param, int out_param_cnt); + GHashTable **out_param, int out_param_cnt); gboolean (*read_query_database_in_order)(Storage *strg, void *handle, const char *query, GHashTable *in_param, GSList **out_param, int out_param_cnt); @@ -187,7 +187,7 @@ gboolean tcore_storage_update_query_database(Storage *strg, void *handle, const char *query, GHashTable *in_param); gboolean tcore_storage_read_query_database(Storage *strg, void *handle, const char *query, GHashTable *in_param, - GHashTable *out_param, int out_param_cnt); + GHashTable **out_param, int out_param_cnt); gboolean tcore_storage_read_query_database_in_order(Storage *strg, void *handle, const char *query, GHashTable *in_param, GSList **out_param, int out_param_cnt); diff --git a/include/tcore.h b/include/tcore.h index efeb7f5..b9dd8be 100644 --- a/include/tcore.h +++ b/include/tcore.h @@ -43,6 +43,7 @@ #include #include #include +#include #include typedef struct tcore_server_type Server; @@ -72,4 +73,10 @@ enum tcore_manager_return { TCORE_MANAGER_RETURN_CONTINUE_IMS }; +enum tcore_ops_type { + TCORE_OPS_TYPE_CP = 0, + TCORE_OPS_TYPE_IMS, + TCORE_OPS_TYPE_MAX +}; + #endif /* __TCORE_H__ */ diff --git a/include/type/call.h b/include/type/call.h index 9a2e841..34fe44a 100644 --- a/include/type/call.h +++ b/include/type/call.h @@ -36,7 +36,7 @@ enum telephony_call_error { CALL_ERROR_BUSY, /**< (Network/Server) busy */ CALL_ERROR_CALLMETER_EXPIRED, /**< Call meter expired */ CALL_ERROR_CALLNO_ERROR, /**< Call number error */ - CALL_ERROR_CKTUNAVAIL, /**< Circuit channel unavailable */ //10 + CALL_ERROR_CKTUNAVAIL, /**< Circuit channel unavailable */ //10 CALL_ERROR_CONGESTION, /**< Congestion happened */ CALL_ERROR_NO_CIRCUIT_AVAIL, /**< Circuit not available */ CALL_ERROR_DESTIN_INCOMPAT, /**< Destination incompatibility */ @@ -46,7 +46,7 @@ enum telephony_call_error { CALL_ERROR_FACILITY_NOTSUBSCRIBED, /**< Facility not subscribed */ CALL_ERROR_INCOMINGCUGCALLS_BARRED, /**< Incoming CUG Calls barred */ CALL_ERROR_INVALNUM, /**< Invalid number */ - CALL_ERROR_MPTY_ERROR, /**< Multiparty error */ //20 + CALL_ERROR_MPTY_ERROR, /**< Multiparty error */ //20 CALL_ERROR_NOANSWER, /**< No answer */ CALL_ERROR_NONCUGMEMBER, /**< Non CUG member */ CALL_ERROR_NUMBERCHANGED, /**< Number changed */ @@ -56,7 +56,7 @@ enum telephony_call_error { CALL_ERROR_OUTOFORDER, /**< Out of order */ CALL_ERROR_PROTOCOL_ERROR, /**< Protocol error */ CALL_ERROR_QOSUNAVAIL, /**< QOS unavailable */ - CALL_ERROR_REJECT, /**< Rejected */ //30 + CALL_ERROR_REJECT, /**< Rejected */ //30 CALL_ERROR_REJ_FAIL, /**< Rejection failed */ CALL_ERROR_REJ_SRVC_NOT_AVL, /**< Rejection service not available */ CALL_ERROR_REJ_SAT_CALL_CTRL, /**< Rejection by SAT call control */ @@ -66,8 +66,8 @@ enum telephony_call_error { CALL_ERROR_SERVICE_NOTIMPL, /**< Service not implemented */ CALL_ERROR_SERVICE_UNAVAIL, /**< Service not available */ CALL_ERROR_MODIFY_SAME_BEARER, /**< Modify same bearer */ - CALL_ERROR_MODIFY_NOT_PERMITTED, /**< Modification not permitted */ - CALL_ERROR_HOLD_FAIL, /**< Call hold fail */ //40 + CALL_ERROR_MODIFY_NOT_PERMITTED, /**< Modification not permitted */ //40 + CALL_ERROR_HOLD_FAIL, /**< Call hold fail */ CALL_ERROR_TEMPFAILURE, /**< Temporary failure */ CALL_ERROR_WRONGNUM, /**< Wrong number */ CALL_ERROR_NORMAL_UNSPECIFIED, /**< Normal but unspecified */ @@ -76,8 +76,8 @@ enum telephony_call_error { CALL_ERROR_SSINCOMPATIBLESTATE, /**< SS incompatible state */ CALL_ERROR_SSERRSYNTAXERROR, /**< SS syntax error */ CALL_ERROR_SSPROTOCOLERROR, /**< Protocol error */ - CALL_ERROR_SSNEGATIVEPASSWORDCHECK, /**< Negative password check */ - CALL_ERROR_SSSENTASPHASE1, /**< SS sent as phase1 message */ //50 + CALL_ERROR_SSNEGATIVEPASSWORDCHECK, /**< Negative password check */ //50 + CALL_ERROR_SSSENTASPHASE1, /**< SS sent as phase1 message */ CALL_ERROR_SSERROR, /**< Supplementary service error */ CALL_ERROR_SS_USSD_BUSY, /**< Second USSD request will be rejected when already USSD transaction is ongoing. */ CALL_ERROR_IDLE, /**< Idle */ @@ -86,8 +86,8 @@ enum telephony_call_error { CALL_ERROR_UNKNOWN, /**< unknown no details available */ CALL_ERROR_INCOM_CALL, /**< terminated by incoming call */ CALL_ERROR_ALERT_STOP, /**< terminated by alert stop */ - CALL_ERROR_INTERCEPT, /**< voice call was dropped by interception */ - CALL_ERROR_REORDER, /**< voice call was dropped by reordering */ //60 + CALL_ERROR_INTERCEPT, /**< voice call was dropped by interception */ //60 + CALL_ERROR_REORDER, /**< voice call was dropped by reordering */ CALL_ERROR_CLIENT_END, /**< client ended the call */ CALL_ERROR_ACCESS_CLASS_BLOCKED, /**< access class blocked */ CALL_ERROR_MEMCAPEXCEEDED, /**< Memory capacity exceeded */ @@ -96,8 +96,8 @@ enum telephony_call_error { CALL_ERROR_PROTOCOLID_ERROR, /**< Protocol id error */ CALL_ERROR_CLASSNOTSUPPORTED, /**< Class not supported */ CALL_ERROR_DATACODING_ERROR, /**< Data coding error */ - CALL_ERROR_INVAL_MSG, /**< Invalid message */ - CALL_ERROR_CALL_BARRED, /**< Call barred */ //70 + CALL_ERROR_INVAL_MSG, /**< Invalid message */ //70 + CALL_ERROR_CALL_BARRED, /**< Call barred */ CALL_ERROR_SIM_CALL_CONTROL_CHANGED_TO_SS, /**< Sim call control changed to SS */ CALL_ERROR_SIM_CALL_CONTROL_CHANGED_TO_CALL, /**< SIM Call control changed to call */ CALL_ERROR_SIM_ERROR, /**< SIM error */ @@ -106,8 +106,8 @@ enum telephony_call_error { CALL_ERROR_LOWER_LAYER_FAILURE, /**< Lower layer error */ CALL_ERROR_ACCESS_REJECTED, /**< Access rejected */ CALL_ERROR_RESET_NOT_ALLOWED, /**< Reset not allowed */ - CALL_ERROR_EMERGENCY_CALL_NOT_ALLOWED, /**< Emergency call not allowed */ - CALL_ERROR_ACCESS_NOT_ALLOWED, /**< Access not allowed */ //80 + CALL_ERROR_EMERGENCY_CALL_NOT_ALLOWED, /**< Emergency call not allowed */ //80 + CALL_ERROR_ACCESS_NOT_ALLOWED, /**< Access not allowed */ CALL_ERROR_RADIO_LINK_FAILURE, /**< Radio link failure */ CALL_ERROR_INVALID_IDENTITY, /**< Invalid identity */ CALL_ERROR_UNKNOWN_IDENTITY, /**< Unknown identity */ @@ -116,13 +116,14 @@ enum telephony_call_error { CALL_ERROR_SERVICE_NOT_ALLOWED, /**< Service not allowed */ CALL_ERROR_SERVICE_NOT_AVAIL, /**< Service not available */ CALL_ERROR_SERVICE_NOT_WORKING, /**< Service not working */ - CALL_ERROR_CANNOT_IDENTIFY_CALL, /**< Cannot identify the call */ - CALL_ERROR_DEACTIVATION, /**< Deactivation */ //90 + CALL_ERROR_CANNOT_IDENTIFY_CALL, /**< Cannot identify the call */ //90 + CALL_ERROR_DEACTIVATION, /**< Deactivation */ CALL_ERROR_FATAL_ERROR, /**< Fatal error */ CALL_ERROR_SEND_DTMF_SUCCESS, /**< Sending DTMF Success */ CALL_ERROR_SEND_DTMF_FAIL, /**< Sending DTMF Failed */ CALL_ERROR_FIXED_DIALING_NUMBER_ONLY,/**< Fixed Dialing Number Only */ CALL_ERROR_TIMER_EXPIRED, /**< Call Timer Expired */ + CALL_ERROR_MAX_CONFERENCE_PARTICIPANTS_REACHED, /**< Max Conference Partcipants Reached(VoLTE specific)*/ }; enum telephony_call_answer_type { @@ -138,6 +139,12 @@ enum telephony_call_type { CALL_TYPE_E911 }; +enum telephony_call_answer_call_type { + CALL_ANSWER_CALL_UNKNWON = -1, + CALL_ANSWER_CALL_TYPE_VOICE, + CALL_ANSWER_CALL_TYPE_VIDEO, +}; + enum telephony_call_emergency_category { CALL_EMERGENCY_CATEGORY_DEFAULT = 0x00, CALL_EMERGENCY_CATEGORY_POLICE = 0x01, @@ -168,6 +175,7 @@ enum telephony_call_end_type { enum telephony_call_rec_type { CALL_REC_NAME_INFO, CALL_REC_NUMBER_INFO, + CALL_REC_LINE_CTRL_INFO }; @@ -330,17 +338,36 @@ enum telephony_call_cna_mode { }; enum telephony_call_sound_path { - CALL_SOUND_PATH_HANDSET = 0x01, - CALL_SOUND_PATH_HEADSET, - CALL_SOUND_PATH_HANDFREE, - CALL_SOUND_PATH_BLUETOOTH, - CALL_SOUND_PATH_STEREO_BLUETOOTH, - CALL_SOUND_PATH_SPEAKER, - CALL_SOUND_PATH_HEADSET_3_5PI, - CALL_SOUND_PATH_BT_NSEC_OFF, - CALL_SOUND_PATH_MIC1, - CALL_SOUND_PATH_MIC2, - CALL_SOUND_PATH_HEADSET_HAC, + CALL_SOUND_PATH_HANDSET = 0x01, + CALL_SOUND_PATH_HEADSET = 0x02, + CALL_SOUND_PATH_HANDFREE = 0x03, + CALL_SOUND_PATH_BLUETOOTH = 0x04, + CALL_SOUND_PATH_STEREO_BLUETOOTH = 0x05, + CALL_SOUND_PATH_SPEAKER = 0x06, + CALL_SOUND_PATH_HEADSET_3_5PI = 0x07, + CALL_SOUND_PATH_BT_NSEC_OFF = 0x08, + CALL_SOUND_PATH_MIC1 = 0x09, + CALL_SOUND_PATH_MIC2 = 0x0A, + CALL_SOUND_PATH_BLUETOOTH_WB = 0x0B, + CALL_SOUND_PATH_BLUETOOTH_WB_NO_NR = 0x0C, + CALL_SOUND_PATH_HEADSET_HAC = 0x0D, + CALL_SOUND_PATH_BIKEMODE_NEAR = 0x17, + CALL_SOUND_PATH_BIKEMODE_FAR = 0x18, + CALL_SOUND_PATH_VOLTE_HANDSET = 0x1F, + CALL_SOUND_PATH_VOLTE_HEADSET = 0x20, + CALL_SOUND_PATH_VOLTE_SPEAKER = 0x21, + CALL_SOUND_PATH_VOLTE_BLUETOOTH = 0x22, + CALL_SOUND_PATH_VOLTE_STEREO_BT = 0x23, + CALL_SOUND_PATH_VOLTE_HEADPHONE = 0x24, + CALL_SOUND_PATH_VOLTE_HEADSET_3_5PI = 0x25, + CALL_SOUND_PATH_VOLTE_BT_NSEC_OFF = 0x26, + CALL_SOUND_PATH_VOLTE_BLUETOOTH_WB = 0x27, + CALL_SOUND_PATH_VOLTE_BLUETOOTH_WB_NO_NR = 0x28, + CALL_SOUND_PATH_VOLTE_HANDSET_HAC = 0x29, + CALL_SOUND_PATH_CALL_FWD = 0x32, + CALL_SOUND_PATH_HEADSET_MIC1 = 0x33, + CALL_SOUND_PATH_HEADSET_MIC2 = 0x34, + CALL_SOUND_PATH_HEADSET_MIC3 = 0x35, }; enum telephony_call_sound_device { @@ -520,16 +547,76 @@ enum telephony_call_srvcc_ho_state { CALL_SRVCC_HANDOVER_STATE_CANCEL_OR_FAIL }; -enum telephony_call_confirm_type { - CALL_CONFIRM_TYPE_ACCEPT, - CALL_CONFIRM_TYPE_REJECT, -}; - enum telephony_call_fallback_type{ CALL_FALLBACK_TO_IMS, CALL_FALLBACK_TO_CS }; +/* IMS Specific */ +enum telephony_call_config_type { + CALL_CONFIG_TYPE_INVALID = -1, /**< Call type is Invalid */ + + /** AUDIO */ + CALL_CONFIG_TYPE_AUDIO = 2, /**< Call type is Audio */ + + /** VIDEO */ + CALL_CONFIG_TYPE_VIDEO_SHARE_TX = 3, /**< Call type is Video Share TX */ + CALL_CONFIG_TYPE_VIDEO_SHARE_RX = 4, /**< Call type is Video Share RX */ + CALL_CONFIG_TYPE_INBOUND_ONLY_VIDEO_CALL = 5, /**< Call type is Inbound Video Call */ + CALL_CONFIG_TYPE_HDVIDEO = 6, /**< Call type is HD Video */ + CALL_CONFIG_TYPE_VIDEO_CONFERENCE = 7, /**< Call type is Video Conference */ + CALL_CONFIG_TYPE_QCIFVIDEO_CONFERENCE = 8, /**< Call type is QCIF Video Conference */ + CALL_CONFIG_TYPE_QVGAVIDEO = 9, /**< Call type is QVGA */ + CALL_CONFIG_TYPE_QCIFVIDEO = 10, /**< Call type is QCIF Video */ + + /** TTY */ + CALL_CONFIG_TYPE_TTY_FULL = 11, /**< Call type is tty Full */ + CALL_CONFIG_TYPE_TTY_HCO = 12, /**< Call type is tty HCO */ + CALL_CONFIG_TYPE_TTY_VCO = 13, /**< Call type is tty VCO */ + CALL_CONFIG_TYPE_USSD = 14, /**< Call type USSD */ + + /** for Korea Market */ + CALL_CONFIG_TYPE_HDVIDEO_LAND = 15, /**< Call type is HDVideo Land */ + + /** E911 */ + CALL_CONFIG_TYPE_E911 = 20, /**< Call type is E911 - Emergency Call */ + + /* AUDIO conference */ + CALL_CONFIG_TYPE_AUDIO_CONFERENCE = 21, /**< Call type is Audio conference */ + + /** E911 Video */ + CALL_CONFIG_TYPE_E911_VIDEO = 22, /**< Call type is E911 Emergency video call */ + CALL_CONFIG_TYPE_E911_VIDEO_HD = 23, /**< Call type is E911 Emergency video call HD */ + CALL_CONFIG_TYPE_E911_VIDEO_HD_LAND = 24, /**< Call type is E911 Emergency video call HD Land */ + CALL_CONFIG_TYPE_E911_VIDEO_LAND = 25, /**< Call type is E911 Emergency video call Land */ + CALL_CONFIG_TYPE_E911_VIDEO_HD_QVGA_LAND = 26, /**< Call type is E911 Emergency video call HD QVGA Land */ + + /** VIDEO */ + CALL_CONFIG_TYPE_CIFVIDEO = 27, /**< Call type is CIF Video Call */ + CALL_CONFIG_TYPE_HD720VIDEO = 28, /**< Call type is HD 720 video call */ + CALL_CONFIG_TYPE_VIDEO_HOLD = 29, /**< Call type is E911 video hold call */ + CALL_CONFIG_TYPE_SWITCH_VOIP_TO_VT_INPROGRESS = 30 /**< Call type is switch VOIP to VT call */ +}; + +enum telephony_call_confirm_upgrade_type { + CALL_CONFIRM_UPGRADE_TYPE_ACCEPT, + CALL_CONFIRM_UPGRADE_TYPE_REJECT, +}; + +enum telephony_call_modify_conference_type { + CALL_MODIFY_CONFERENCE_TYPE_INVITE, + CALL_MODIFY_CONFERENCE_TYPE_REMOVE +}; + +enum telephony_call_ecc_status { + CALL_ECC_STATUS_NONE = 0, + CALL_ECC_STATUS_STARTED = 1, + CALL_ECC_STATUS_ENDED = 2, + CALL_ECC_STATUS_CANCELED = 3, + CALL_ECC_STATUS_FAILED =4, +}; + + /********** Struct **********/ @@ -547,6 +634,16 @@ enum telephony_call_fallback_type{ #define MAX_CALL_DISPLAY_INFORMATION 182 +/*IMS specific*/ +#define MAX_CALL_CONFERENCE_PARTICIPANT_NUM_LEN 6 + +struct telephony_call_line_ctrl_info { + unsigned char polarity_included; + unsigned char toggle_mode; + unsigned char reverse_polarity; + unsigned char power_denial_time; +}; + struct telephony_call_cli_info { enum telephony_call_cli_mode mode; enum telephony_call_no_cli_cause no_cli_cause; @@ -564,6 +661,7 @@ struct telephony_call_rec_info { union { char name[ MAX_ALPHA_INFO_LEN ]; char number[ MAX_CALL_NUMBER_LEN ]; + struct telephony_call_line_ctrl_info line_ctrl; } data; }; @@ -577,6 +675,7 @@ struct treq_call_dial { struct treq_call_answer { unsigned int handle; enum telephony_call_answer_type type; + enum telephony_call_answer_call_type answer_call_type; /* Specifically for IMS, incoming video call can be accepted as audio as well */ }; struct treq_call_end { @@ -675,15 +774,42 @@ struct treq_call_get_preferred_voice_subscription { }; /* IMS specific */ -struct treq_call_modify { +struct treq_call_upgrade { unsigned int handle; - enum telephony_call_type call_type; + enum telephony_call_config_type config_type; }; -/* IMS specific */ -struct treq_call_confirm_modify { +struct treq_call_downgrade { + unsigned int handle; + enum telephony_call_config_type config_type; +}; + + +struct treq_call_confirm_upgrade { + unsigned int handle; + enum telephony_call_confirm_upgrade_type confirm_type; +}; + +struct telephony_call_paricipant_number_info { + char szNumber[MAX_CALL_NUMBER_LEN]; +}; + +struct treq_call_start_conference { + enum telephony_call_type type; + unsigned int num_participants; + GSList* participants_list; +}; + +struct treq_call_modify_participans_in_conference { unsigned int handle; - enum telephony_call_confirm_type confirm_type; + enum telephony_call_modify_conference_type type; + unsigned int num_participants; + GSList* participants_list; +}; +/* end of IMS specific */ + +struct treq_call_set_ecc_status{ + enum telephony_call_ecc_status status; }; // Response @@ -804,15 +930,32 @@ struct tresp_call_get_voice_privacy_mode { }; /* IMS specific */ -struct tresp_call_modify { +struct tresp_call_upgrade { enum telephony_call_error err; }; -/* IMS specific */ -struct tresp_call_confirm_modify { +struct tresp_call_downgrade { + enum telephony_call_error err; +}; + +struct tresp_call_confirm_upgrade { + enum telephony_call_error err; +}; + +struct tresp_call_start_conference { + enum telephony_call_error err; +}; + +struct tresp_call_modify_participans_in_conference { + unsigned int handle; + enum telephony_call_error err; +}; + +struct tresp_call_set_ecc_status { enum telephony_call_error err; }; + // Notification struct tnoti_call_status_idle { @@ -930,9 +1073,14 @@ struct tnoti_call_info_rec { }; /* IMS specific */ -struct tnoti_call_modify_request { +struct tnoti_call_upgrade_requested { + unsigned int handle; + enum telephony_call_config_type config_type; +}; + +struct tnoti_call_downgraded { unsigned int handle; - enum telephony_call_type call_type; + enum telephony_call_config_type config_type; }; struct tnoti_call_fallback{ @@ -940,6 +1088,11 @@ struct tnoti_call_fallback{ enum telephony_call_fallback_type fallback_to; }; +struct tnoti_call_info_modifiable{ + unsigned int handle; + gboolean modifiable; +}; + __END_DECLS #endif diff --git a/include/type/common.h b/include/type/common.h index 092ec89..163bde6 100644 --- a/include/type/common.h +++ b/include/type/common.h @@ -73,10 +73,12 @@ enum tcore_return { TCORE_RETURN_PENDING_WRONG_ID = TCORE_RETURN | TCORE_TYPE_PENDING, TCORE_RETURN_PS_NETWORK_NOT_READY = TCORE_RETURN | TCORE_TYPE_PS, + TCORE_RETURN_PS_ACTIVATION_ON_HOLD, TCORE_RETURN_PS_CID_ERROR, TCORE_RETURN_PS_ACTIVATING, TCORE_RETURN_PS_ALREADY_ACTIVATED, TCORE_RETURN_PS_DEACTIVATING, + TCORE_RETURN_PS_DEACTIVATED, TCORE_RETURN_HOOK_STOP = TCORE_RETURN | TCORE_TYPE_HOOK, diff --git a/include/type/modem.h b/include/type/modem.h index 3bbbd7b..93fa454 100644 --- a/include/type/modem.h +++ b/include/type/modem.h @@ -57,6 +57,12 @@ enum modem_dun_pincontrol_status { DUN_PINCONTROL_STATUS_ON = 0x01, }; +enum modem_always_on_state { + MODEM_ALWAYS_OFF = 0x00, + MODEM_ALWAYS_ON = 0x01, + MODEM_ALWAYS_AUTO_ON_OFF, +}; + struct treq_modem_power_on { }; @@ -90,6 +96,9 @@ struct treq_modem_set_dun_pin_control { enum modem_dun_pincontrol_status status; }; +struct treq_modem_set_always_on { + int state; +}; struct tresp_modem_power_on { TReturn result; @@ -149,6 +158,10 @@ struct tresp_modem_set_dun_pin_control { int result; }; +struct tresp_modem_set_always_on { + TReturn result; +}; + struct tnoti_modem_power { enum modem_state state; }; @@ -169,6 +182,10 @@ struct tnoti_modem_bootup { void *plugin; }; +struct tnoti_modem_always_on { + enum modem_always_on_state state; +}; + __END_DECLS #endif diff --git a/include/type/network.h b/include/type/network.h index 8844cfd..4c01c42 100644 --- a/include/type/network.h +++ b/include/type/network.h @@ -34,6 +34,7 @@ __BEGIN_DECLS #define NETWORK_GERAN_NEIGHBORING_CELL_LIST_MAX 6 /**< max count of GERAN neighboring cell list */ #define NETWORK_UMTS_NEIGHBORING_CELL_LIST_MAX 24 /**< max count of UMTS neighboring cell list */ +#define NETWORK_LTE_NEIGHBORING_CELL_LIST_MAX 24 /**< max count of UMTS neighboring cell list */ #define NETWORK_CDMA_SUBSCRIPTION_MIN_MAX 11 #define NETWORK_CDMA_SUBSCRIPTION_MDN_MAX 16 @@ -162,6 +163,12 @@ enum telephony_network_band { NETWORK_BAND_TYPE_LTE_BAND_17 }; +enum telephony_network_lte_band_type { + NETWORK_LTE_BAND_TYPE_UNKNOWN = 0x00, + NETWORK_LTE_BAND_TYPE_FDD, + NETWORK_LTE_BAND_TYPE_TDD, +}; + enum telephony_network_preferred_plmn_operation { NETWORK_PREF_PLMN_ADD = 0x01, NETWORK_PREF_PLMN_EDIT, @@ -244,6 +251,28 @@ enum telephony_network_ecc_rat_search_status { NETWORK_ECC_RAT_SEARCH_STATUS_READY, }; +/* CDMA specific */ +enum telephony_network_subscription_source { + NETWORK_CDMA_SUBSCRIPTION_SOURCE_UNKNOWN, /**< Source unknown */ + NETWORK_CDMA_SUBSCRIPTION_SOURCE_RUIM, /**< Source RUIM */ + NETWORK_CDMA_SUBSCRIPTION_SOURCE_NV /**< Source NV memory */ +}; + +enum telephony_network_act_status{ + NETWORK_ACT_STATUS_NONE = 0x00, /* 0x00 : No more RAT for Emergency Call*/ + NETWORK_ACT_STATUS_USED, /* 0x01 : Current RAT can be used for Emergency Call */ + NETWORK_ACT_STATUS_MAX, /* Not Specified */ +}; + +enum telephony_network_epdg_status { + NETWORK_EPDG_STATUS_UNAVAILABLE = 0x00, /* 0x00 : ePDG status - Unavailable */ + NETWORK_EPDG_STATUS_AVAILABLE, /* 0x01 : ePDG status - Available */ + NETWORK_EPDG_STATUS_NOT_CONNECTED, /* 0x02: Not Connected */ + NETWORK_EPDG_STATUS_CONNECTED, /* 0x03: Connected */ + NETWORK_EPDG_STATUS_HO_LTE_TO_IWLAN, /* 0x04: L2W */ + NETWORK_EPDG_STATUS_HO_IWLAN_TO_LTE, /* 0x05: W2L */ +}; + struct tel_network_geran_cell_info { int cell_id; /* Cell ID (-1 indicates cell ID information not present)*/ int lac; /* Location area code (this field is ignored when cell_id not present)*/ @@ -262,7 +291,7 @@ struct tel_network_umts_cell_info { struct tel_network_lte_cell_info { int cell_id; /* Cell ID (-1 indicates cell ID information not present)*/ - int lac; /* Location area code (this field is ignored when cell_id not present)*/ + int pcid; /* physical cell id*/ int earfcn; /* E-UTRA Absolute RF Channel Number */ int tac; /* Tracking area code */ int rssi; /* RSSI in dBm (signed) */ @@ -295,6 +324,8 @@ struct tel_network_neighboring_cell_info { struct tel_network_geran_cell_info geran_list[NETWORK_GERAN_NEIGHBORING_CELL_LIST_MAX]; int umts_list_count; struct tel_network_umts_cell_info umts_list[NETWORK_UMTS_NEIGHBORING_CELL_LIST_MAX]; + int lte_list_count; + struct tel_network_lte_cell_info lte_list[NETWORK_LTE_NEIGHBORING_CELL_LIST_MAX]; }; /* IMS specific */ @@ -379,7 +410,8 @@ struct treq_network_set_default_subscription { }; struct treq_network_get_default_subscription { /* no data */ }; - +struct treq_network_get_subscription_source { /* no data */ +}; struct tresp_network_search { TReturn result; @@ -521,6 +553,11 @@ struct tresp_network_get_subscription_info { char mdn[NETWORK_CDMA_SUBSCRIPTION_MDN_MAX]; }; +struct tresp_network_get_subscription_source { + TReturn result; + enum telephony_network_subscription_source source; +}; + struct tresp_network_set_default_data_subscription { TReturn result; }; @@ -557,6 +594,7 @@ struct tnoti_network_registration_status { struct tnoti_network_location_cellinfo { unsigned int lac; unsigned int cell_id; + unsigned int physical_cell_id; }; /* @@ -579,6 +617,10 @@ struct tnoti_network_icon_info { int roam_icon_mode; }; +struct tnoti_network_serving_band_info { + enum telephony_network_lte_band_type lte_band_type; +}; + struct tnoti_network_signal_strength { int dbm; }; @@ -650,6 +692,7 @@ struct tnoti_network_ims_voice_status { struct tnoti_network_ecc_rat { enum telephony_network_access_technology ecc_rat; + enum telephony_network_act_status status; }; struct tnoti_network_ims_registration_info { @@ -659,6 +702,13 @@ struct tnoti_network_ims_registration_info { enum telephony_network_ims_reg_ecmp_mode ecmp_mode; /**< Enumeration for emergency call mode preference */ }; +struct tnoti_network_epdg_status { + enum telephony_network_epdg_status status; /**< ePDG status */ + int cid; + char *ipv4_address; + char *ipv6_address; +}; + __END_DECLS diff --git a/include/type/notification.h b/include/type/notification.h index 3a65364..dcd795e 100644 --- a/include/type/notification.h +++ b/include/type/notification.h @@ -78,6 +78,7 @@ enum tcore_notification_command { TNOTI_CALL_INFO_PRIVACY_MODE, TNOTI_CALL_INFO_REC, TNOTI_CALL_INFO_FALLBACK, /*notification of call fallback to other bearer - CSFB(IMS to CS) or Reverse-CSFB(CS to IMS)*/ + TNOTI_CALL_INFO_MODIFIABLE, /*notification of call meta info update - can upgrade/downgrade a specific call - caller & callee are all VoLTE call*/ TNOTI_CALL_OTASP_STATUS, TNOTI_CALL_OTAPA_STATUS, TNOTI_CALL_SIGNAL_INFO, @@ -91,7 +92,8 @@ enum tcore_notification_command { TNOTI_CALL_DISPLAY_INFORMATION, TNOTI_CALL_OTASP_RESULT, TNOTI_CALL_SRVCC_HANDOVER, - TNOTI_CALL_MODIFY_REQUEST, + TNOTI_CALL_UPGRADE_REQUESTED, + TNOTI_CALL_DOWNGRADED, TNOTI_SS = TCORE_NOTIFICATION | TCORE_TYPE_SS, TNOTI_SS_INFO, @@ -110,6 +112,7 @@ enum tcore_notification_command { TNOTI_MODEM_BOOTUP, TNOTI_MODEM_DONGLE_STATUS, TNOTI_MODEM_DONGLE_LOGIN, + TNOTI_MODEM_ALWAYS_ON, TNOTI_SIM = TCORE_NOTIFICATION | TCORE_TYPE_SIM, TNOTI_SIM_STATUS, @@ -143,6 +146,8 @@ enum tcore_notification_command { TNOTI_NETWORK_ECC_RAT, TNOTI_NETWORK_IMS_REGISTRATION_STATUS, TNOTI_NETWORK_LOCATION_CELLINFO_CDMA, + TNOTI_NETWORK_EPDG_STATUS, + TNOTI_NETWORK_SERVING_BAND_INFO, TNOTI_PS = TCORE_NOTIFICATION | TCORE_TYPE_PS, TNOTI_PS_CALL_STATUS, @@ -162,6 +167,7 @@ enum tcore_notification_command { TNOTI_SMS_DEVICE_READY, /* Device Ready indication */ TNOTI_SMS_IND_MAX, TNOTI_SMS_ETWS_INCOM_MSG, /* This is an unsolicited Incoming ETWS message*/ + TNOTI_SMS_FORMAT_CHANGE, /* This is a sms format change notification. This mainly covers sms_over_ip format*/ TNOTI_PHONEBOOK = TCORE_NOTIFICATION | TCORE_TYPE_PHONEBOOK, TNOTI_PHONEBOOK_STATUS, diff --git a/include/type/ps.h b/include/type/ps.h index c7caa46..9b13d0b 100644 --- a/include/type/ps.h +++ b/include/type/ps.h @@ -29,31 +29,31 @@ __BEGIN_DECLS #define MAX_NUM_DEDICATED_BEARER 8 enum telephony_ps_pdp_err { - PDP_FAILURE_CAUSE_NORMAL = 0x00, // 0x00 : Normal Process ( no problem ) - PDP_FAILURE_CAUSE_REL_BY_USER = 0x01, // Call Released by User - PDP_FAILURE_CAUSE_REGULAR_DEACTIVATION = 0x02, // Regular deactivation - PDP_FAILURE_CAUSE_LLC_SNDCP = 0x03, // LLC SNDCP failure - PDP_FAILURE_CAUSE_INSUFFICIENT_RESOURCE = 0x04, // Insufficient resources - PDP_FAILURE_CAUSE_UNKNOWN_APN = 0x05, // Missing or unkown apn - PDP_FAILURE_CAUSE_UNKNOWN_PDP_ADDRESS = 0x06, // Unknown pdp address or type - PDP_FAILURE_CAUSE_USER_AUTH_FAILED = 0x07, // Unknown pdp address or type - PDP_FAILURE_CAUSE_ACT_REJ_GGSN = 0x08, // Unknown pdp address or type - PDP_FAILURE_CAUSE_ACT_REJ_UNSPECIFIED = 0x09, // Unknown pdp address or type - PDP_FAILURE_CAUSE_SVC_OPTION_NOT_SUPPORTED = 0x0A, // Service option not supported - PDP_FAILURE_CAUSE_SVC_NOT_SUBSCRIBED = 0x0B, // Requested service option not subscribed - PDP_FAILURE_CAUSE_SVC_OPT_OUT_ORDER = 0x0C, // Service out of order - PDP_FAILURE_CAUSE_NSAPI_USED = 0x0D, // NSAPI already used - PDP_FAILURE_CAUSE_QOS_NOT_ACCEPTED = 0x0E, // QoS not accepted - PDP_FAILURE_CAUSE_NETWORK_FAILURE = 0x0F, // Network Failure - PDP_FAILURE_CAUSE_REACT_REQUIRED = 0x10, // Reactivation Required - PDP_FAILURE_CAUSE_FEATURE_NOT_SUPPORTED = 0x11, // Feature not supported - PDP_FAILURE_CAUSE_TFT_FILTER_ERROR = 0x12, // TFT or filter error - PDP_FAILURE_CAUSE_UNKOWN_PDP_CONTEXT = 0x13, // Unkown PDP context - PDP_FAILURE_CAUSE_INVALID_MSG = 0x14, // Invalied MSG - PDP_FAILURE_CAUSE_PROTOCOL_ERROR = 0x15, // Protocol error - PDP_FAILURE_CAUSE_MOBILE_FAILURE_ERROR = 0x16, // Mobile failure error - PDP_FAILURE_CAUSE_TIMEOUT_ERROR = 0x17, // Timeout error - PDP_FAILURE_CAUSE_UNKNOWN_ERROR = 0x18, // Unknown error + PDP_FAILURE_CAUSE_NORMAL = 0x00, // 0x00 : Normal Process ( no problem ) + PDP_FAILURE_CAUSE_REL_BY_USER = 0x01, // Call Released by User + PDP_FAILURE_CAUSE_REGULAR_DEACTIVATION = 0x02, // Regular deactivation + PDP_FAILURE_CAUSE_LLC_SNDCP = 0x03, // LLC SNDCP failure + PDP_FAILURE_CAUSE_INSUFFICIENT_RESOURCE = 0x04, // Insufficient resources + PDP_FAILURE_CAUSE_UNKNOWN_APN = 0x05, // Missing or unkown apn + PDP_FAILURE_CAUSE_UNKNOWN_PDP_ADDRESS = 0x06, // Unknown pdp address or type + PDP_FAILURE_CAUSE_USER_AUTH_FAILED = 0x07, // Unknown pdp address or type + PDP_FAILURE_CAUSE_ACT_REJ_GGSN = 0x08, // Unknown pdp address or type + PDP_FAILURE_CAUSE_ACT_REJ_UNSPECIFIED = 0x09, // Unknown pdp address or type + PDP_FAILURE_CAUSE_SVC_OPTION_NOT_SUPPORTED = 0x0A, // Service option not supported + PDP_FAILURE_CAUSE_SVC_NOT_SUBSCRIBED = 0x0B, // Requested service option not subscribed + PDP_FAILURE_CAUSE_SVC_OPT_OUT_ORDER = 0x0C, // Service out of order + PDP_FAILURE_CAUSE_NSAPI_USED = 0x0D, // NSAPI already used + PDP_FAILURE_CAUSE_QOS_NOT_ACCEPTED = 0x0E, // QoS not accepted + PDP_FAILURE_CAUSE_NETWORK_FAILURE = 0x0F, // Network Failure + PDP_FAILURE_CAUSE_REACT_REQUIRED = 0x10, // Reactivation Required + PDP_FAILURE_CAUSE_FEATURE_NOT_SUPPORTED = 0x11, // Feature not supported + PDP_FAILURE_CAUSE_TFT_FILTER_ERROR = 0x12, // TFT or filter error + PDP_FAILURE_CAUSE_UNKOWN_PDP_CONTEXT = 0x13, // Unkown PDP context + PDP_FAILURE_CAUSE_INVALID_MSG = 0x14, // Invalied MSG + PDP_FAILURE_CAUSE_PROTOCOL_ERROR = 0x15, // Protocol error + PDP_FAILURE_CAUSE_MOBILE_FAILURE_ERROR = 0x16, // Mobile failure error + PDP_FAILURE_CAUSE_TIMEOUT_ERROR = 0x17, // Timeout error + PDP_FAILURE_CAUSE_UNKNOWN_ERROR = 0x18, // Unknown error PDP_FAILURE_CAUSE_MAX, }; @@ -74,6 +74,11 @@ enum telephony_ps_state { TELEPHONY_PS_RESTRICTED_SERVICE }; +enum telephony_ps_activation { + TELEPHONY_PS_ACTIVATE, + TELEPHONY_PS_HOLD +}; + struct qos_parameter { char profile_type; char qci; @@ -141,7 +146,7 @@ struct tnoti_ps_pdp_ipconfiguration { unsigned short field_flag; char devname[16]; - unsigned long mtu; + unsigned long mtu; unsigned char ip_address[IPV4_ADDR_LEN]; unsigned char primary_dns[IPV4_ADDR_LEN]; diff --git a/include/type/request.h b/include/type/request.h index 18fd216..e816530 100644 --- a/include/type/request.h +++ b/include/type/request.h @@ -47,6 +47,7 @@ enum tcore_request_command { TREQ_MODEM_GET_SN, TREQ_MODEM_SET_DUN_PIN_CONTROL, TREQ_MODEM_GET_DEVICE_INFO, + TREQ_MODEM_SET_ALWAYS_ON, TREQ_CALL = TCORE_REQUEST | TCORE_TYPE_CALL, TREQ_CALL_DIAL, @@ -75,14 +76,20 @@ enum tcore_request_command { TREQ_CALL_SET_SOUND_CLOCK_STATUS, TREQ_CALL_SET_PREFERRED_VOICE_SUBSCRIPTION, TREQ_CALL_GET_PREFERRED_VOICE_SUBSCRIPTION, - TREQ_CALL_MODIFY, - TREQ_CALL_CONFIRM_MODIFY, + TREQ_CALL_UPGRADE, + TREQ_CALL_DOWNGRADE, + TREQ_CALL_CONFIRM_UPGRADE, TREQ_CALL_SET_ACTIVE_LINE, TREQ_CALL_GET_ACTIVE_LINE, TREQ_CALL_ACTIVATE_CCBS, TREQ_CALL_CUSTOM_SERVICE, + TREQ_CALL_START_CONFERENCE, + TREQ_CALL_MODIFY_PARTICIPANTS_IN_CONFERENCE, + + TREQ_CALL_SET_ECC_STATUS, + TREQ_SS = TCORE_REQUEST | TCORE_TYPE_SS, TREQ_SS_BARRING_ACTIVATE, TREQ_SS_BARRING_DEACTIVATE, @@ -137,10 +144,8 @@ enum tcore_request_command { TREQ_SIM_GET_ICON, TREQ_SIM_SET_POWERSTATE, TREQ_SIM_GET_GID, -#if defined TIZEN_GLOBALCONFIG_ENABLE_CSP - TREQ_SIM_GET_CPHS_CSP_INFO, TREQ_SIM_SET_CPHS_CSP_INFO, -#endif + TREQ_SIM_GET_CPHS_CSP_INFO, TREQ_SIM_GET_IMPI, TREQ_SIM_GET_IMPU, TREQ_SIM_GET_DOMAIN, @@ -191,6 +196,7 @@ enum tcore_request_command { TREQ_NETWORK_SET_ROAMING_PREFERENCE, TREQ_NETWORK_GET_ROAMING_PREFERENCE, TREQ_NETWORK_GET_SUBSCRIPTION_INFO, + TREQ_NETWORK_GET_SUBSCRIPTION_SOURCE, TREQ_NETWORK_SEARCH_ECC_RAT, TREQ_NETWORK_IMS_DEREGISTER, diff --git a/include/type/response.h b/include/type/response.h index 6ea4be9..aef3d8f 100644 --- a/include/type/response.h +++ b/include/type/response.h @@ -42,6 +42,7 @@ enum tcore_response_command { TRESP_MODEM_GET_SN, TRESP_MODEM_SET_DUN_PIN_CONTROL, TRESP_MODEM_GET_DEVICE_INFO, + TRESP_MODEM_SET_ALWAYS_ON, TRESP_CALL = TCORE_RESPONSE | TCORE_TYPE_CALL, TRESP_CALL_DIAL, @@ -73,8 +74,14 @@ enum tcore_response_command { TRESP_CALL_ACTIVATE_CCBS, TRESP_CALL_SET_PREFERRED_VOICE_SUBSCRIPTION, TRESP_CALL_GET_PREFERRED_VOICE_SUBSCRIPTION, - TRESP_CALL_MODIFY, - TRESP_CALL_CONFIRM_MODIFY, + TRESP_CALL_UPGRADE, + TRESP_CALL_DOWNGRADE, + TRESP_CALL_CONFIRM_UPGRADE, + TRESP_CALL_START_CONFERENCE, + TRESP_CALL_MODIFY_PARTICIPANTS_IN_CONFERENCE, + + TRESP_CALL_SET_ECC_STATUS, + TRESP_SS = TCORE_RESPONSE | TCORE_TYPE_SS, TRESP_SS_BARRING_ACTIVATE, @@ -129,10 +136,8 @@ enum tcore_response_command { TRESP_SIM_GET_LOCK_INFO, TRESP_SIM_SET_POWERSTATE, TRESP_SIM_GET_GID, -#if defined TIZEN_GLOBALCONFIG_ENABLE_CSP TRESP_SIM_GET_CPHS_CSP_INFO, TRESP_SIM_SET_CPHS_CSP_INFO, -#endif TRESP_SIM_GET_IMPI, TRESP_SIM_GET_IMPU, TRESP_SIM_GET_DOMAIN, @@ -181,6 +186,7 @@ enum tcore_response_command { TRESP_NETWORK_SET_ROAMING_PREFERENCE, TRESP_NETWORK_GET_ROAMING_PREFERENCE, TRESP_NETWORK_GET_SUBSCRIPTION_INFO, + TRESP_NETWORK_GET_SUBSCRIPTION_SOURCE, TRESP_NETWORK_SEARCH_ECC_RAT, TRESP_NETWORK_IMS_DEREGISTER, diff --git a/include/type/sat.h b/include/type/sat.h index 2d97653..6b3f965 100644 --- a/include/type/sat.h +++ b/include/type/sat.h @@ -45,7 +45,7 @@ __BEGIN_DECLS #define SAT_ITEM_TEXT_ATTRIBUTES_LIST_MAX_COUNT 50 /**< max count of item text attributes list */ #define SAT_EVENT_LIST_MAX 17 /**< max count of event list */ #define SAT_FILE_ID_LIST_MAX_COUNT 255 -#define SAT_ENVELOPE_CMD_LEN_MAX 256 +#define SAT_ENVELOPE_DATA_LEN_MAX 256 #define SAT_AID_LEN_MAX 128 #define SAT_SUB_ADDR_LEN_MAX 30 #define SAT_CCP_DATA_LEN_MAX 30 /**< max length of ccp data */ @@ -1401,6 +1401,7 @@ struct tel_sat_open_channel_local_bearer{ }; struct tel_sat_open_channel_default_bearer{ + struct tel_sat_network_access_name network_access_name; struct tel_sat_other_address other_address; struct tel_sat_text_string_object text_user_login; struct tel_sat_text_string_object text_user_pwd; @@ -1489,6 +1490,9 @@ enum sat_envelop_sub_cmd{ ENVELOP_CALL_CONTROL, ENVELOP_TIMER_EXPIRATION, ENVELOP_EVENT_DOWNLOAD, + ENVELOP_SMS_PP_DOWNLOAD, + + ENVELOP_RAW_DATA = 0xff }; struct tel_sat_envelop_menu_selection_tlv{ @@ -1507,11 +1511,24 @@ struct tel_sat_envelop_event_download_tlv{ struct tel_sat_channel_data_len channel_data_len; }; +struct tel_sat_envelop_sms_pp_download_tlv { + struct tel_sat_device_identities device_identitie; + struct tel_sat_address address; + struct tel_sat_sms_tpdu sms_tpdu; +}; + +struct tel_sat_envelop_raw_data_tlv { + int data_len; + unsigned char data[SAT_ENVELOPE_DATA_LEN_MAX]; +}; + struct treq_sat_envelop_cmd_data{ enum sat_envelop_sub_cmd sub_cmd; union{ struct tel_sat_envelop_menu_selection_tlv menu_select; struct tel_sat_envelop_event_download_tlv event_download; + struct tel_sat_envelop_sms_pp_download_tlv sms_pp_download; + struct tel_sat_envelop_raw_data_tlv raw_data; }envelop_data; }; diff --git a/include/type/sim.h b/include/type/sim.h index b458010..18ca1aa 100644 --- a/include/type/sim.h +++ b/include/type/sim.h @@ -65,12 +65,20 @@ __BEGIN_DECLS #define SIM_GID_LEN_MAX 16 //telephony defined #define SIM_IMPU_CNT_MAX 15 //telephony defined #define SIM_PCSCF_CNT_MAX 15 //telephony defined +#define SIM_FACILITY_PW_LEN_MAX 38 //telephony defined +#define SIM_PIN_LEN_MAX 8 /* As per Spec 3GPP TS 31.102 Max pin Length is 4 ~ 8*/ +#define SIM_PLMN_LEN_MAX 6 //As per 3GPP Spec TS 31.102 +#define SIM_MSIN_LEN_MAX 10 //As per 3GPP Spec TS 31.102 #define SIM_FILE_ID_LIST_MAX_COUNT 255 //followed SAT_FILE_ID_LIST_MAX_COUNT in sat.h -#define SIM_APP_TYPE_SIM 0x01 -#define SIM_APP_TYPE_USIM 0x02 -#define SIM_APP_TYPE_CSIM 0x04 -#define SIM_APP_TYPE_ISIM 0x08 +enum tel_sim_app_type { + SIM_APP_TYPE_UNKNOWN = 0x00, + SIM_APP_TYPE_SIM = 0x01, + SIM_APP_TYPE_USIM = 0x02, + SIM_APP_TYPE_CSIM = 0x04, + SIM_APP_TYPE_ISIM = 0x08, + SIM_APP_TYPE_RUIM = 0x10 +}; enum tel_sim_file_id { SIM_EF_DIR = 0x2F00, /**< Root Directory for the USIM */ @@ -118,6 +126,8 @@ enum tel_sim_file_id { SIM_EF_CPHS_MAILBOX_NUMBERS = 0x6F17, /** < CPHS mail box numbers */ SIM_EF_CPHS_OPERATOR_NAME_SHORT_FORM_STRING = 0x6F18, /** < CPHS operator name short form string */ SIM_EF_CPHS_INFORMATION_NUMBERS = 0x6F19, /** < CPHS information numbers */ + + SIM_EF_SMSP = 0x6F42, /** < SMS parameters information */ /* CPHS ALS FILE ID */ SIM_EF_CPHS_DYNAMICFLAGS = 0x6F9F, /** < CPHS Dynamics flags */ SIM_EF_CPHS_DYNAMIC2FLAG = 0x6F92, /** < CPHS Dynamics2 flags */ @@ -146,6 +156,12 @@ enum tel_sim_type { SIM_TYPE_ISIM /**< Deprecated, do not use */ }; +enum tel_sim_card_type { + SIM_CARD_TYPE_UNKNOWN, /**< Unknown card */ + SIM_CARD_TYPE_ICC, /**< 2G GSM card*/ + SIM_CARD_TYPE_UICC, /**< 3G USIM card */ +}; + enum tel_sim_status { SIM_STATUS_CARD_ERROR = 0x00, /**< Bad card / On the fly SIM gone bad **/ SIM_STATUS_CARD_NOT_PRESENT = 0x01, /**< Card not present **/ @@ -162,6 +178,7 @@ enum tel_sim_status { SIM_STATUS_LOCK_REQUIRED = 0x0c, /**< PH-SIM (phone-SIM) locked state **/ SIM_STATUS_CARD_CRASHED = 0x0d, /**< Runtime SIM card error **/ SIM_STATUS_CARD_POWEROFF = 0x0e, /**< SIM Powered OFF **/ + SIM_STATUS_CARD_INSERTED = 0x0f, /**< SIM card inserted **/ SIM_STATUS_UNKNOWN = 0xff /**< unknown state. not checked yet. **/ }; @@ -188,15 +205,16 @@ enum tel_sim_pin_operation_result { SIM_CARD_ERROR, /**< SIM card error - General errors */ SIM_INCOMPATIBLE_PIN_OPERATION, /**< SIM Incompatible pin operation that is in case when invalid SIM command is given or incorrect parameters are supplied to the SIM. */ SIM_INCORRECT_PASSWORD, /**< SIM PIN Incorrect password */ - SIM_PIN_REQUIRED, /**< PIN Required */ + SIM_PUK_INCORRECT_PASSWORD, /**< SIM PUK incorrect password */ SIM_PUK_REQUIRED, /**< PUK Required */ + SIM_PIN_REQUIRED, /**< PIN Required */ SIM_NCK_REQUIRED, /**< Network Control Key Required */ SIM_NSCK_REQUIRED, /**< Network Subset Control Key Required */ SIM_SPCK_REQUIRED, /**< Service Provider Control Key Required */ SIM_CCK_REQUIRED, /**< Corporate Control Key Required */ SIM_LOCK_REQUIRED, /**< PH-SIM (phone-SIM) locked state **/ - SIM_ADM_REQUIRED, /**< Admin key locked state **/ - SIM_PERM_BLOCKED /**< Permanently Blocked **/ + SIM_PERM_BLOCKED, /**< Permanently Blocked **/ + SIM_ADM_REQUIRED /**< Admin key locked state **/ }; enum tel_sim_language_type { @@ -356,14 +374,15 @@ enum tel_sim_auth_type { }; enum tel_sim_auth_result { - SIM_AUTH_NO_ERROR = 0x00, /**< ISIM no error */ + SIM_AUTH_NO_ERROR = 0x00, /**< status - no error */ SIM_AUTH_CANNOT_PERFORM, /**< status - can't perform authentication */ SIM_AUTH_SKIP_RESPONSE, /**< status - skip authentication response */ SIM_AUTH_MAK_CODE_FAILURE, /**< status - MAK(Multiple Activation Key) code failure */ SIM_AUTH_SQN_FAILURE, /**< status - SQN(SeQuenceNumber) failure */ SIM_AUTH_SYNCH_FAILURE, /**< status - synch failure */ - SIM_AUTH_UNSUPPORTED_CONTEXT, /**< status - unsupported context */ - SIM_AUTH_MAX /**< TBD */ + SIM_AUTH_UNSUPPORTED_CONTEXT, /**< status - unsupported context */ + SIM_AUTH_ERROR, /**< status - default error */ + SIM_AUTH_MAX /**< TBD */ }; enum tel_sim_power_set_result { @@ -674,12 +693,6 @@ enum tel_sim_refresh_command{ SIM_REFRESH_CMD_RESERVED = 0xFF /** + * + * 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 __TYPE_SUBSCRIPTION_H__ +#define __TYPE_SUBSCRIPTION_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/**< Subscription Type - Presently only 2 Subscriptions are support */ +enum telephony_subscription_type { + TELEPHONY_SUBSCRIPTION_TYPE_DEFAULT = 0, /**< 'default' Subscription */ + TELEPHONY_SUBSCRIPTION_TYPE_PRIMARY = TELEPHONY_SUBSCRIPTION_TYPE_DEFAULT, /**< Primary subscription */ + TELEPHONY_SUBSCRIPTION_TYPE_SECONDARY, /**< Secondary subscription */ + TELEPHONY_SUBSCRIPTION_TYPE_MAX +}; + +enum telephony_subscription_type tcore_subscription_get_subscription_type(const char *cp_name); + +#ifdef __cplusplus +} +#endif + +#endif /* __TYPE_SUBSCRIPTION_H__ */ diff --git a/include/util.h b/include/util.h index e122f90..aebafe8 100644 --- a/include/util.h +++ b/include/util.h @@ -93,12 +93,16 @@ unsigned char *tcore_util_decode_hex(const char *src, int len); void tcore_util_hex_dump(const char *pad, int size, const void *data); unsigned char *tcore_util_unpack_gsm7bit(const unsigned char *src, unsigned int src_len); +unsigned char *tcore_util_unpack_gsm7bit_ex(const unsigned char *src, unsigned int src_len, unsigned int *out_len); +unsigned char *tcore_util_pack_gsm7bit_ex(const unsigned char *src, unsigned int src_len, unsigned int *dest_len); unsigned char *tcore_util_pack_gsm7bit(const unsigned char *src, unsigned int src_len); char *tcore_util_convert_bcd_str_2_ascii_str(const char* src, int src_len); char *tcore_util_convert_bcd2ascii(const char *src, int src_len, int max_len); char *tcore_util_convert_digit2ascii(const char* src, int src_len); gboolean tcore_util_convert_utf8_to_gsm(unsigned char *dest, int *dest_len, unsigned char* src, int src_len); gboolean tcore_util_convert_utf8_to_ucs2(char **dest, int *dest_len, unsigned char *src, int src_len); +gboolean tcore_util_convert_gsm7bit_to_utf8(unsigned char *dest, unsigned short *dest_len, + const unsigned char *src, unsigned short src_len); gboolean tcore_util_convert_string_to_utf8(unsigned char *dest, unsigned short *dest_len, enum alphabet_format dcs, const unsigned char *src, unsigned short src_len); gboolean tcore_util_convert_ascii_to_utf8(unsigned char **dest, int *dest_len, unsigned char *src, int src_len); diff --git a/src/core_object/co_call.c b/src/core_object/co_call.c index aa83de1..33c0ce0 100644 --- a/src/core_object/co_call.c +++ b/src/core_object/co_call.c @@ -66,13 +66,20 @@ struct call_object { long end; /* In seconds */ } time; - gboolean is_volte_call; - int session_id; /* VoLTE only */ - int conf_call_session_id; /* Conference call session-id (VoLTE only) */ - gboolean early_media; /* VoLTE only */ - - gboolean is_release_pending; - enum tcore_call_silent_redial_reason redial_reason; + /* IMS: VoLTE/ViLTE speciifc parameters */ + gboolean is_volte_call; /* True: VoLTE Call, False: CS Call */ + int session_id; /* IMS Session ID */ + int conf_call_session_id; /* N-way Conference call session-id (VoLTE only) */ + gboolean early_media; /* Early media started */ + gboolean conf_call; /* host of resource-based conf.call or not */ + + gboolean is_hd_icon; /* Show HD icon or not in VoLTE call */ + gboolean is_modifiable; /* Show Upgrade/Downgrade options or not in VoLTE call */ + gboolean added_to_conference; /* MT ViLTE call added to conference call */ + gchar *audio_codec; /* Audio codec information */ + + gboolean is_release_pending; /* Need to end call */ + enum tcore_call_silent_redial_reason redial_reason; /* Call re-dial reason */ }; struct private_object_data { @@ -278,17 +285,42 @@ static TReturn _dispatcher(CoreObject *o, UserRequest *ur, enum tcore_ops_type o return ops->get_preferred_voice_subscription(o, ur); - case TREQ_CALL_MODIFY: - tcore_check_null_ret_err("ops->modify", - ops->modify, TCORE_RETURN_ENOSYS); + case TREQ_CALL_UPGRADE: + tcore_check_null_ret_err("ops->upgrade", + ops->upgrade, TCORE_RETURN_ENOSYS); + + return ops->upgrade(o, ur); + + case TREQ_CALL_DOWNGRADE: + tcore_check_null_ret_err("ops->downgrade", + ops->downgrade, TCORE_RETURN_ENOSYS); + + return ops->downgrade(o, ur); + + case TREQ_CALL_CONFIRM_UPGRADE: + tcore_check_null_ret_err("ops->confirm_upgrade", + ops->confirm_upgrade, TCORE_RETURN_ENOSYS); + + return ops->confirm_upgrade(o, ur); + + case TREQ_CALL_START_CONFERENCE: + tcore_check_null_ret_err("ops->start_conference", + ops->start_conference, TCORE_RETURN_ENOSYS); + + return ops->start_conference(o, ur); + + case TREQ_CALL_MODIFY_PARTICIPANTS_IN_CONFERENCE: + tcore_check_null_ret_err("ops->modify_participants_in_conference", + ops->modify_participants_in_conference, TCORE_RETURN_ENOSYS); + + return ops->modify_participants_in_conference(o, ur); - return ops->modify(o, ur); + case TREQ_CALL_SET_ECC_STATUS: + tcore_check_null_ret_err("ops->set_ecc_status", + ops->set_ecc_status, TCORE_RETURN_ENOSYS); - case TREQ_CALL_CONFIRM_MODIFY: - tcore_check_null_ret_err("ops->confirm_modify", - ops->confirm_modify, TCORE_RETURN_ENOSYS); + return ops->set_ecc_status(o, ur); - return ops->confirm_modify(o, ur); default: break; @@ -297,15 +329,27 @@ static TReturn _dispatcher(CoreObject *o, UserRequest *ur, enum tcore_ops_type o return TCORE_RETURN_SUCCESS; } +static void __free_call_object(gpointer object) +{ + struct call_object *co = (struct call_object *)object; + + if (co) { + g_free(co->audio_codec); + g_free(co); + } +} + static void _free_hook(CoreObject *o) { struct private_object_data *po = NULL; po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return; + } - g_slist_free_full(po->cobjs, g_free); + g_slist_free_full(po->cobjs, __free_call_object); g_free(po); tcore_object_link_object(o, NULL); @@ -810,6 +854,22 @@ gboolean tcore_call_object_get_multiparty_state(CallObject *co) return co->mpty; } +gboolean tcore_call_object_set_conference_state(CallObject *co, gboolean is) +{ + tcore_check_null_ret_err("co", co, FALSE); + + co->conf_call = is; + + return TRUE; +} + +gboolean tcore_call_object_get_conference_state(CallObject *co) +{ + tcore_check_null_ret_err("co", co, FALSE); + + return co->conf_call; +} + gboolean tcore_call_object_set_active_line(CallObject *co, unsigned int line) { tcore_check_null_ret_err("co", co, FALSE); @@ -890,6 +950,63 @@ gboolean tcore_call_object_get_early_media(CallObject *co) return co->early_media; } +gboolean tcore_call_object_set_hd_icon(CallObject *co, gboolean is_hd_icon) +{ + tcore_check_null_ret_err("co", co, FALSE); + + co->is_hd_icon = is_hd_icon; + return TRUE; +} + +gboolean tcore_call_object_get_hd_icon(CallObject *co) +{ + tcore_check_null_ret_err("co", co, FALSE); + + return co->is_hd_icon; +} + +gboolean tcore_call_object_set_modifiable(CallObject *co, gboolean is_modifiable) +{ + tcore_check_null_ret_err("co", co, FALSE); + co->is_modifiable = is_modifiable; + + return TRUE; +} + +gboolean tcore_call_object_get_modifiable(CallObject *co) +{ + tcore_check_null_ret_err("co", co, FALSE); + return co->is_modifiable; +} + +gboolean tcore_call_object_set_added_to_conference(CallObject *co, gboolean added_to_conference) +{ + tcore_check_null_ret_err("co", co, FALSE); + co->added_to_conference = added_to_conference; + + return TRUE; +} + +gboolean tcore_call_object_get_added_to_conference(CallObject *co) +{ + tcore_check_null_ret_err("co", co, FALSE); + return co->added_to_conference; +} + +gboolean tcore_call_object_set_audio_codec(CallObject *co, gchar *audio_codec) +{ + tcore_check_null_ret_err("co", co, FALSE); + co->audio_codec = g_strdup(audio_codec); + + return TRUE; +} + +gchar *tcore_call_object_get_audio_codec(CallObject *co) +{ + tcore_check_null_ret_err("co", co, FALSE); + return g_strdup(co->audio_codec); +} + CallObject *tcore_call_object_find_by_session_id(CoreObject *o, int session_id) { struct private_object_data *po = NULL; diff --git a/src/core_object/co_context.c b/src/core_object/co_context.c index c9d92ae..7686f52 100644 --- a/src/core_object/co_context.c +++ b/src/core_object/co_context.c @@ -35,8 +35,10 @@ struct private_object_data { unsigned char id; enum co_context_role role; gboolean default_profile; + gboolean default_pdn; gboolean attach_apn; gboolean roaming_apn; + gboolean disable_apn; char *apn; char *addr; @@ -154,6 +156,7 @@ CoreObject *tcore_context_new(TcorePlugin *p, const char *name, TcoreHal *hal) po->role = CONTEXT_ROLE_UNKNOWN; po->auth = CONTEXT_AUTH_NONE; po->tech_pref = CONTEXT_TECH_3GPP; + po->disable_apn = FALSE; tcore_object_set_type(o, CORE_OBJECT_TYPE_PS_CONTEXT); tcore_object_link_object(o, po); @@ -175,8 +178,10 @@ TReturn tcore_context_set_state(CoreObject *o, enum co_context_state state) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->state = state; @@ -190,8 +195,10 @@ enum co_context_state tcore_context_get_state(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return 0; + } return po->state; } @@ -203,8 +210,10 @@ TReturn tcore_context_set_id(CoreObject *o, unsigned char id) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->id = id; @@ -218,8 +227,10 @@ unsigned char tcore_context_get_id(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return 0; + } return po->id; } @@ -231,8 +242,10 @@ TReturn tcore_context_set_apn(CoreObject *o, const char *apn) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return FALSE; + } if (po->apn) { g_free(po->apn); @@ -252,8 +265,10 @@ char *tcore_context_get_apn(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } if (!po->apn) return NULL; @@ -268,8 +283,10 @@ TReturn tcore_context_set_address(CoreObject *o, const char *addr) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (po->addr) { g_free(po->addr); @@ -289,8 +306,10 @@ char *tcore_context_get_address(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } if (!po->addr) return NULL; @@ -305,8 +324,10 @@ TReturn tcore_context_set_role(CoreObject *o, enum co_context_role role) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->role = role; @@ -320,8 +341,10 @@ enum co_context_role tcore_context_get_role(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return 0; + } return po->role; } @@ -333,8 +356,10 @@ TReturn tcore_context_set_type(CoreObject *o, enum co_context_type type) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->type = type; @@ -348,8 +373,10 @@ enum co_context_type tcore_context_get_type(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return 0; + } return po->type; } @@ -361,8 +388,10 @@ TReturn tcore_context_set_roam_pdp_type(CoreObject *o, enum co_context_type roam CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->roam_pdp_type = roam_pdp_type; @@ -376,8 +405,10 @@ enum co_context_type tcore_context_get_roam_pdp_type(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return 0; + } return po->roam_pdp_type; } @@ -389,8 +420,10 @@ TReturn tcore_context_set_data_compression(CoreObject *o, enum co_context_d_comp CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->d_comp = comp; @@ -404,8 +437,10 @@ enum co_context_d_comp tcore_context_get_data_compression(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return 0; + } return po->d_comp; } @@ -417,8 +452,10 @@ TReturn tcore_context_set_header_compression(CoreObject *o, enum co_context_h_co CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->h_comp = comp; @@ -432,8 +469,10 @@ enum co_context_h_comp tcore_context_get_header_compression(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return 0; + } return po->h_comp; } @@ -445,8 +484,10 @@ TReturn tcore_context_set_tech_preference(CoreObject *o, enum co_context_tech te CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->tech_pref = tech; @@ -460,8 +501,10 @@ enum co_context_tech tcore_context_get_tech_preference(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return CONTEXT_TECH_INVALID; + } return po->tech_pref; } @@ -473,8 +516,10 @@ TReturn tcore_context_set_username(CoreObject *o, const char *username) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (po->username) { g_free(po->username); @@ -494,8 +539,10 @@ char *tcore_context_get_username(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } if (!po->username) return NULL; @@ -510,8 +557,10 @@ TReturn tcore_context_set_password(CoreObject *o, const char *password) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (po->password) { g_free(po->password); @@ -531,8 +580,10 @@ char *tcore_context_get_password(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } if (!po->password) return NULL; @@ -547,8 +598,10 @@ TReturn tcore_context_set_dns1(CoreObject *o, const char *dns) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (po->dns1) { g_free(po->dns1); @@ -568,8 +621,10 @@ TReturn tcore_context_set_ipv6_dns1(CoreObject *o, const char *dns) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (po->dns_primary_v6) { g_free(po->dns_primary_v6); @@ -589,8 +644,10 @@ char *tcore_context_get_dns1(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } if (!po->dns1) return NULL; @@ -605,8 +662,10 @@ TReturn tcore_context_set_dns2(CoreObject *o, const char *dns) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (po->dns2) { g_free(po->dns2); @@ -626,8 +685,10 @@ TReturn tcore_context_set_ipv6_dns2(CoreObject *o, const char *dns) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (po->dns_secondary_v6) { g_free(po->dns_secondary_v6); @@ -647,8 +708,10 @@ char *tcore_context_get_dns2(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } if (!po->dns2) return NULL; @@ -663,8 +726,10 @@ TReturn tcore_context_set_auth(CoreObject *o, enum co_context_auth auth) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->auth = auth; @@ -678,8 +743,10 @@ enum co_context_auth tcore_context_get_auth(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, 0); po = tcore_object_ref_object(o); - if (!po) - return 0; + if (!po) { + err("po is NULL"); + return CONTEXT_AUTH_NONE; + } return po->auth; } @@ -691,8 +758,10 @@ TReturn tcore_context_set_proxy(CoreObject *o, const char *proxy) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) - return FALSE; + if (!po) { + err("po is NULL"); + return TCORE_RETURN_EINVAL; + } if (po->proxy) { g_free(po->proxy); @@ -712,8 +781,10 @@ char *tcore_context_get_proxy(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } if (!po->proxy) return NULL; @@ -728,8 +799,10 @@ TReturn tcore_context_set_mmsurl(CoreObject *o, const char *mmsurl) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) - return FALSE; + if (!po) { + err("po is NULL"); + return TCORE_RETURN_EINVAL; + } if (po->mmsurl) { g_free(po->mmsurl); @@ -749,8 +822,10 @@ char *tcore_context_get_mmsurl(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } if (!po->mmsurl) return NULL; @@ -765,8 +840,10 @@ TReturn tcore_context_set_profile_name(CoreObject *o, const char *profile_name) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) - return FALSE; + if (!po) { + err("po is NULL"); + return TCORE_RETURN_EINVAL; + } if (po->profile_name) { g_free(po->profile_name); @@ -786,8 +863,10 @@ char *tcore_context_get_profile_name(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } if (!po->profile_name) return NULL; @@ -802,8 +881,10 @@ TReturn tcore_context_set_default_profile(CoreObject *o, gboolean default_conn) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->default_profile = default_conn; @@ -817,12 +898,46 @@ gboolean tcore_context_get_default_profile(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return FALSE; + } return po->default_profile; } +TReturn tcore_context_set_default_pdn(CoreObject *o, gboolean default_pdn) +{ + struct private_object_data *po = NULL; + + CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); + + po = tcore_object_ref_object(o); + if (!po) { + err("po is NULL"); + return TCORE_RETURN_EINVAL; + } + + po->default_pdn = default_pdn; + + return TCORE_RETURN_SUCCESS; +} + +gboolean tcore_context_get_default_pdn(CoreObject *o) +{ + struct private_object_data *po = NULL; + + CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE); + + po = tcore_object_ref_object(o); + if (!po) { + err("po is NULL"); + return FALSE; + } + + return po->default_pdn; +} + TReturn tcore_context_set_devinfo(CoreObject *o, struct tnoti_ps_pdp_ipconfiguration *devinfo) { struct private_object_data *po = NULL; @@ -831,8 +946,10 @@ TReturn tcore_context_set_devinfo(CoreObject *o, struct tnoti_ps_pdp_ipconfigura po = tcore_object_ref_object(o); - if (!po || !devinfo) + if (!po || !devinfo) { + err("po or devinfo is NULL"); return TCORE_RETURN_EINVAL; + } /* Free context resource if it was already allocated */ tcore_context_reset_devinfo(o); @@ -882,8 +999,10 @@ TReturn tcore_context_reset_devinfo(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (po->ip_v6) { g_free(po->ip_v6); @@ -935,8 +1054,10 @@ TReturn tcore_context_set_bearer_info(CoreObject *o, struct tnoti_ps_dedicated_b CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (!bearer_info) return TCORE_RETURN_EINVAL; @@ -955,8 +1076,10 @@ TReturn tcore_context_get_bearer_info(CoreObject *o, struct dedicated_bearer_inf CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (!bearer_info) return TCORE_RETURN_EINVAL; @@ -981,8 +1104,10 @@ TReturn tcore_context_reset_bearer_info(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (po->dedicated_bearer.num_dedicated_bearer > 0) memset(&(po->dedicated_bearer), 0, sizeof(struct dedicated_bearer_info)); @@ -1001,8 +1126,10 @@ void tcore_context_cp_service_info(CoreObject *dest, CoreObject *src) d_po = tcore_object_ref_object(dest); s_po = tcore_object_ref_object(src); - if (!d_po || !s_po) + if (!d_po || !s_po) { + err("d_po or s_do is NULL"); return; + } d_po->state = s_po->state; d_po->id = s_po->id; @@ -1019,6 +1146,23 @@ void tcore_context_cp_service_info(CoreObject *dest, CoreObject *src) memcpy(d_po->devname, s_po->devname, sizeof(char) * 16); } +TReturn tcore_context_set_ipv4_addr(CoreObject *o, unsigned char *ipv4_address) +{ + struct private_object_data *po = NULL; + + CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); + + po = tcore_object_ref_object(o); + if (!po) { + err("po is NULL"); + return TCORE_RETURN_EINVAL; + } + + memcpy(&(po->ip_v4), ipv4_address, sizeof(union tcore_ip4_type)); + + return TCORE_RETURN_SUCCESS; +} + char *tcore_context_get_ipv4_addr(CoreObject *o) { struct private_object_data *po = NULL; @@ -1026,8 +1170,10 @@ char *tcore_context_get_ipv4_addr(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } return tcore_util_get_string_by_ip4type(po->ip_v4); } @@ -1039,8 +1185,10 @@ char *tcore_context_get_ipv4_dns1(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } return tcore_util_get_string_by_ip4type(po->dns_primary_v4); } @@ -1052,8 +1200,10 @@ char *tcore_context_get_ipv4_dns2(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } return tcore_util_get_string_by_ip4type(po->dns_secondary_v4); } @@ -1065,8 +1215,10 @@ char *tcore_context_get_ipv4_gw(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } return tcore_util_get_string_by_ip4type(po->gateway_v4); } @@ -1078,8 +1230,10 @@ char *tcore_context_get_ipv4_devname(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } if (po->devname[0] == 0) return NULL; @@ -1087,6 +1241,26 @@ char *tcore_context_get_ipv4_devname(CoreObject *o) return g_strdup(po->devname); } +TReturn tcore_context_set_ipv6_addr(CoreObject *o, char *ipv6_address) +{ + struct private_object_data *po = NULL; + + CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); + + po = tcore_object_ref_object(o); + if (!po) { + err("po is NULL"); + return TCORE_RETURN_EINVAL; + } + + if (po->ip_v6) + g_free(po->ip_v6); + + po->ip_v6 = g_strdup((gchar *)ipv6_address); + + return TCORE_RETURN_SUCCESS; +} + char *tcore_context_get_ipv6_addr(CoreObject *o) { struct private_object_data *po = NULL; @@ -1094,8 +1268,10 @@ char *tcore_context_get_ipv6_addr(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } return g_strdup(po->ip_v6); } @@ -1107,8 +1283,10 @@ char *tcore_context_get_ipv6_dns1(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } return g_strdup(po->dns_primary_v6); } @@ -1120,8 +1298,10 @@ char *tcore_context_get_ipv6_dns2(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } return g_strdup(po->dns_secondary_v6); } @@ -1133,8 +1313,10 @@ char *tcore_context_get_ipv6_gw(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } return g_strdup(po->gateway_v6); } @@ -1147,11 +1329,15 @@ pcscf_addr *tcore_context_get_pcscf_ipv4_addr(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } - if (!po->pcscf_ipv4) + if (!po->pcscf_ipv4) { + err("po->pcscf_ipv4 is NULL"); return NULL; + } pcscf_tmp = g_try_malloc0(sizeof(pcscf_addr)); if (!pcscf_tmp) @@ -1181,11 +1367,15 @@ pcscf_addr *tcore_context_get_pcscf_ipv6_addr(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } - if (!po->pcscf_ipv6) + if (!po->pcscf_ipv6) { + err("po->pcscf_ipv6 is NULL"); return NULL; + } pcscf_tmp = g_try_malloc0(sizeof(pcscf_addr)); if (!pcscf_tmp) @@ -1214,8 +1404,10 @@ TReturn tcore_context_set_attach_apn(CoreObject *o, gboolean flag) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->attach_apn = flag; @@ -1229,8 +1421,10 @@ gboolean tcore_context_get_attach_apn(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return FALSE; + } return po->attach_apn; } @@ -1242,8 +1436,10 @@ TReturn tcore_context_set_roaming_apn(CoreObject *o, gboolean flag) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->roaming_apn = flag; @@ -1257,8 +1453,42 @@ gboolean tcore_context_get_roaming_apn(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return FALSE; + } return po->roaming_apn; } + +TReturn tcore_context_set_disable_apn(CoreObject *o, gboolean flag) +{ + struct private_object_data *po = NULL; + + CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); + + po = tcore_object_ref_object(o); + if (!po) { + err("po is NULL"); + return TCORE_RETURN_EINVAL; + } + + po->disable_apn = flag; + + return TCORE_RETURN_SUCCESS; +} + +gboolean tcore_context_get_disable_apn(CoreObject *o) +{ + struct private_object_data *po = NULL; + + CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS_CONTEXT, FALSE); + + po = tcore_object_ref_object(o); + if (!po) { + err("po is NULL"); + return FALSE; + } + + return po->disable_apn; +} diff --git a/src/core_object/co_modem.c b/src/core_object/co_modem.c index db4aa2e..ac65c12 100644 --- a/src/core_object/co_modem.c +++ b/src/core_object/co_modem.c @@ -36,6 +36,7 @@ struct private_object_data { gboolean flight_mode; gboolean powered; + enum modem_state modem_power_state; }; static void _free_hook(CoreObject *o) @@ -132,6 +133,12 @@ static TReturn _dispatcher(CoreObject *o, UserRequest *ur, enum tcore_ops_type o return ops->get_device_info(o, ur); + case TREQ_MODEM_SET_ALWAYS_ON: + tcore_check_null_ret_err("ops->set_always_on", + ops->set_always_on, TCORE_RETURN_ENOSYS); + + return ops->set_always_on(o, ur); + default: return TCORE_RETURN_EINVAL; } @@ -198,8 +205,10 @@ TReturn tcore_modem_set_flight_mode_state(CoreObject *o, gboolean flag) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_MODEM, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->flight_mode = flag; @@ -213,8 +222,10 @@ gboolean tcore_modem_get_flight_mode_state(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_MODEM, FALSE); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return FALSE; + } return po->flight_mode; } @@ -246,3 +257,40 @@ gboolean tcore_modem_get_powered(CoreObject *o) return tcore_hal_get_power_state(h); } + +TReturn tcore_modem_set_modem_power_state(CoreObject *o, enum modem_state modem_power_state) +{ + struct private_object_data *po = NULL; + + CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_MODEM, TCORE_RETURN_EINVAL); + + po = tcore_object_ref_object(o); + if (!po) { + err("po is NULL"); + return TCORE_RETURN_EINVAL; + } + + po->modem_power_state = modem_power_state; + + return TCORE_RETURN_SUCCESS; +} + +TReturn tcore_modem_get_modem_power_state(CoreObject *o, enum modem_state *modem_power_state) +{ + struct private_object_data *po = NULL; + + CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_MODEM, TCORE_RETURN_EINVAL); + + if (!modem_power_state) + return TCORE_RETURN_EINVAL; + + po = tcore_object_ref_object(o); + if (!po) { + err("po is NULL"); + return TCORE_RETURN_EINVAL; + } + + *modem_power_state = po->modem_power_state; + + return TCORE_RETURN_SUCCESS; +} diff --git a/src/core_object/co_network.c b/src/core_object/co_network.c index 53440d0..6064d2e 100644 --- a/src/core_object/co_network.c +++ b/src/core_object/co_network.c @@ -50,6 +50,8 @@ struct private_object_data { unsigned int lac; /* represent LAC or TAC(in case of LTE) */ unsigned int rac; unsigned int cell_id; + unsigned int physical_cell_id; + int reject_reason; gboolean gsm_dtm_support; /* DTM (Dual Transfer Mode) */ char *network_name_short; @@ -242,6 +244,12 @@ static TReturn _dispatcher(CoreObject *co, UserRequest *ur, enum tcore_ops_type return ops->get_subscription_info(co, ur); + case TREQ_NETWORK_GET_SUBSCRIPTION_SOURCE: + tcore_check_null_ret_err( "ops->get_subscription_source", + ops->get_subscription_source, TCORE_RETURN_ENOSYS); + + return ops->get_subscription_source(co, ur); + case TREQ_NETWORK_SEARCH_ECC_RAT: tcore_check_null_ret_err("ops->search_ecc_rat", ops->search_ecc_rat, TCORE_RETURN_ENOSYS); @@ -313,8 +321,10 @@ void tcore_network_free(CoreObject *co) CORE_OBJECT_CHECK(co, CORE_OBJECT_TYPE_NETWORK); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return; + } if (po->network_name_short) free(po->network_name_short); @@ -358,8 +368,10 @@ char *tcore_network_get_plmn(CoreObject *co) CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, NULL); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } return g_strdup(po->plmn); } @@ -371,8 +383,10 @@ TReturn tcore_network_set_plmn(CoreObject *co, const char *plmn) CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (po->plmn) free(po->plmn); @@ -391,8 +405,10 @@ char *tcore_network_get_network_name(CoreObject *co, CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, NULL); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } if (type == TCORE_NETWORK_NAME_TYPE_SHORT) return g_strdup(po->network_name_short); @@ -412,8 +428,10 @@ TReturn tcore_network_set_network_name(CoreObject *co, CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } switch (type) { case TCORE_NETWORK_NAME_TYPE_SHORT: @@ -467,8 +485,10 @@ TReturn tcore_network_get_network_name_priority(CoreObject *co, return TCORE_RETURN_EINVAL; po = tcore_object_ref_object(co); - if (!po) - return FALSE; + if (!po) { + err("po is NULL"); + return TCORE_RETURN_EINVAL; + } *priority = po->network_name_priority; @@ -483,8 +503,10 @@ TReturn tcore_network_set_network_name_priority(CoreObject *co, CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->network_name_priority = priority; @@ -498,8 +520,10 @@ gboolean tcore_network_get_roaming_state(CoreObject *co) CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, FALSE); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return FALSE; + } return po->roaming_state; } @@ -511,8 +535,10 @@ TReturn tcore_network_set_roaming_state(CoreObject *co, gboolean state) CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->roaming_state = state; dbg("roaming_state = 0x%x", state); @@ -527,8 +553,10 @@ int tcore_network_get_restricted_state(CoreObject *co) CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, FALSE); po = tcore_object_ref_object(co); - if (!po) - return FALSE; + if (!po) { + err("po is NULL"); + return 0; + } return po->restricted_state; } @@ -540,8 +568,10 @@ TReturn tcore_network_set_restricted_state(CoreObject *co, int state) CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->restricted_state = state; dbg("restricted_state = 0x%x", state); @@ -561,8 +591,10 @@ TReturn tcore_network_get_service_status(CoreObject *co, return TCORE_RETURN_EINVAL; po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } switch (type) { case TCORE_NETWORK_SERVICE_DOMAIN_TYPE_CIRCUIT: @@ -590,8 +622,10 @@ TReturn tcore_network_set_service_status(CoreObject *co, CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } switch (type) { case TCORE_NETWORK_SERVICE_DOMAIN_TYPE_CIRCUIT: @@ -620,8 +654,10 @@ TReturn tcore_network_set_access_technology(CoreObject *co, CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->act = act; @@ -639,8 +675,10 @@ TReturn tcore_network_get_access_technology(CoreObject *co, return TCORE_RETURN_EINVAL; po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } *result = po->act; @@ -654,8 +692,10 @@ TReturn tcore_network_set_lac(CoreObject *co, unsigned int lac) CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->lac = lac; @@ -672,8 +712,10 @@ TReturn tcore_network_get_lac(CoreObject *co, unsigned int *result) return TCORE_RETURN_EINVAL; po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } *result = po->lac; @@ -687,8 +729,10 @@ TReturn tcore_network_set_rac(CoreObject *co, unsigned int rac) CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->rac = rac; @@ -705,8 +749,10 @@ TReturn tcore_network_get_rac(CoreObject *co, unsigned int *result) return TCORE_RETURN_EINVAL; po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } *result = po->rac; @@ -720,8 +766,10 @@ TReturn tcore_network_set_cell_id(CoreObject *co, unsigned int cell_id) CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->cell_id = cell_id; @@ -738,14 +786,90 @@ TReturn tcore_network_get_cell_id(CoreObject *co, unsigned int *result) return TCORE_RETURN_EINVAL; po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } *result = po->cell_id; return TCORE_RETURN_SUCCESS; } +TReturn tcore_network_set_physical_cell_id(CoreObject *co, unsigned int physical_cell_id) +{ + struct private_object_data *po = NULL; + + CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); + + po = tcore_object_ref_object(co); + if (!po) { + err("po is NULL"); + return TCORE_RETURN_EINVAL; + } + + po->physical_cell_id = physical_cell_id; + + return TCORE_RETURN_SUCCESS; +} + +TReturn tcore_network_get_physical_cell_id(CoreObject *co, unsigned int *result) +{ + struct private_object_data *po = NULL; + + CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); + + if (!result) + return TCORE_RETURN_EINVAL; + + po = tcore_object_ref_object(co); + if (!po) { + err("po is NULL"); + return TCORE_RETURN_EINVAL; + } + + *result = po->physical_cell_id; + + return TCORE_RETURN_SUCCESS; +} + +TReturn tcore_network_set_reject_reason(CoreObject *co, int reject_reason) +{ + struct private_object_data *po = NULL; + + CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); + + po = tcore_object_ref_object(co); + if (!po) { + err("po is NULL"); + return TCORE_RETURN_EINVAL; + } + + po->reject_reason = reject_reason; + + return TCORE_RETURN_SUCCESS; +} + +TReturn tcore_network_get_reject_reason(CoreObject *co, int *result) +{ + struct private_object_data *po = NULL; + + CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); + + if (!result) + return TCORE_RETURN_EINVAL; + + po = tcore_object_ref_object(co); + if (!po) { + err("po is NULL"); + return TCORE_RETURN_EINVAL; + } + + *result = po->reject_reason; + + return TCORE_RETURN_SUCCESS; +} + gboolean tcore_network_get_gsm_dtm_support(CoreObject *co) { struct private_object_data *po = NULL; @@ -753,8 +877,10 @@ gboolean tcore_network_get_gsm_dtm_support(CoreObject *co) CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, FALSE); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return FALSE; + } return po->gsm_dtm_support; } @@ -766,8 +892,10 @@ TReturn tcore_network_set_gsm_dtm_support(CoreObject *co, gboolean state) CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->gsm_dtm_support = state; dbg("gsm_dtm_support = %d", state); @@ -783,8 +911,10 @@ TReturn tcore_network_set_service_type(CoreObject *co, CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->service_type = service_type; @@ -802,8 +932,10 @@ TReturn tcore_network_get_service_type(CoreObject *co, return TCORE_RETURN_EINVAL; po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } *result = po->service_type; @@ -818,8 +950,10 @@ TReturn tcore_network_set_ims_reg_info(CoreObject *co, CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->ims_reg_info.is_registered = ims_reg_info.is_registered; po->ims_reg_info.feature_mask = ims_reg_info.feature_mask; @@ -840,8 +974,10 @@ TReturn tcore_network_get_ims_reg_info(CoreObject *co, return TCORE_RETURN_EINVAL; po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } ims_reg_info->is_registered = po->ims_reg_info.is_registered; ims_reg_info->feature_mask = po->ims_reg_info.feature_mask; @@ -858,8 +994,10 @@ TReturn tcore_network_set_ims_voice_status(CoreObject *co, gboolean status) CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->ims_voice_status = status; @@ -876,8 +1014,10 @@ TReturn tcore_network_get_ims_voice_status(CoreObject *co, gboolean *status) return TCORE_RETURN_EINVAL; po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } *status = po->ims_voice_status; @@ -892,8 +1032,10 @@ TReturn tcore_network_set_ecc_rat_search_status(CoreObject *co, CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->rat_search_status = status; @@ -911,8 +1053,10 @@ TReturn tcore_network_get_ecc_rat_search_status(CoreObject *co, return TCORE_RETURN_EINVAL; po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } *status = po->rat_search_status; @@ -927,8 +1071,10 @@ TReturn tcore_network_set_ecc_rat(CoreObject *co, CORE_OBJECT_CHECK_RETURN(co, CORE_OBJECT_TYPE_NETWORK, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->ecc_rat = ecc_rat; @@ -946,8 +1092,10 @@ TReturn tcore_network_get_ecc_rat(CoreObject *co, return TCORE_RETURN_EINVAL; po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } *ecc_rat = po->ecc_rat; @@ -975,8 +1123,10 @@ TReturn tcore_network_operator_info_add(CoreObject *co, } po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } g_strlcpy(plmn, noi->mcc, NETWORK_MAX_MCC_LEN + 1); g_strlcpy(plmn + NETWORK_MAX_MCC_LEN, noi->mnc, NETWORK_MAX_MNC_LEN + 1); @@ -1013,8 +1163,10 @@ tcore_network_operator_info_find(CoreObject *co, const char *mcc, const char *mn } po = tcore_object_ref_object(co); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } g_strlcpy(plmn, mcc, NETWORK_MAX_MCC_LEN + 1); g_strlcpy(plmn + NETWORK_MAX_MCC_LEN, mnc, NETWORK_MAX_MNC_LEN + 1); @@ -1105,20 +1257,12 @@ gboolean tcore_network_load_mcc_mnc_oper_list_from_db(TcorePlugin *p, mcc, mnc); dbg("query = [%s]", query); - result = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, - (GDestroyNotify) g_hash_table_destroy); - if (!result) { - err("fail to create new hash table"); + if (tcore_storage_read_query_database(strg, handle, query, NULL, &result, 4) == FALSE) { + err("DB read failed"); tcore_storage_remove_handle(strg, handle); return FALSE; } - if (tcore_storage_read_query_database(strg, handle, query, NULL, result, 4) == FALSE) { - tcore_storage_remove_handle(strg, handle); - g_hash_table_destroy(result); - return FALSE; - } - g_hash_table_iter_init(&iter, result); noi = g_try_malloc0(sizeof(struct tcore_network_operator_info)); if (noi == NULL) { @@ -1205,16 +1349,12 @@ void tcore_network_update_mcc_mnc_oper_list_db(TcorePlugin *p, const char *mcc, mcc, mnc); dbg("query = [%s]", query); - result = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, - (GDestroyNotify) g_hash_table_destroy); - if (!result) { - err("fail to create new hash table"); + if (tcore_storage_read_query_database(strg, handle, query, NULL, &result, 4) == FALSE) { + err("DB read failed"); tcore_storage_remove_handle(strg, handle); return; } - tcore_storage_read_query_database(strg, handle, query, NULL, result, 4); - g_hash_table_iter_init(&iter, result); noi = g_try_malloc0(sizeof(struct tcore_network_operator_info)); if (noi == NULL) { diff --git a/src/core_object/co_phonebook.c b/src/core_object/co_phonebook.c index d82e77b..0c53b77 100644 --- a/src/core_object/co_phonebook.c +++ b/src/core_object/co_phonebook.c @@ -119,8 +119,10 @@ gboolean tcore_phonebook_get_status(CoreObject *o) struct private_object_data *po = NULL; CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PHONEBOOK, FALSE); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return FALSE; + } return po->b_init; } @@ -130,8 +132,10 @@ gboolean tcore_phonebook_set_status(CoreObject *o, gboolean b_init) struct private_object_data *po = NULL; CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PHONEBOOK, FALSE); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return FALSE; + } po->b_init = b_init; @@ -144,8 +148,10 @@ struct tel_phonebook_support_list *tcore_phonebook_get_support_list(CoreObject * CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PHONEBOOK, NULL); po = tcore_object_ref_object(o); - if (po == NULL) + if (po == NULL) { + err("po is NULL"); return NULL; + } return g_memdup(&po->support_list, sizeof(struct tel_phonebook_support_list)); } @@ -156,6 +162,11 @@ gboolean tcore_phonebook_set_support_list(CoreObject *o, struct tel_phonebook_su CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PHONEBOOK, FALSE); po = tcore_object_ref_object(o); + if (po == NULL) { + err("po is NULL"); + return FALSE; + } + memcpy(&po->support_list, list, sizeof(struct tel_phonebook_support_list)); return TRUE; @@ -167,8 +178,10 @@ struct tel_phonebook_field_support_list *tcore_phonebook_get_field_support_list( CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PHONEBOOK, NULL); po = tcore_object_ref_object(o); - if (po == NULL) + if (po == NULL) { + err("po is NULL"); return NULL; + } return g_memdup(&po->field_support_list, sizeof(struct tel_phonebook_field_support_list)); } @@ -179,6 +192,11 @@ gboolean tcore_phonebook_set_field_support_list(CoreObject *o, struct tel_phoneb CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PHONEBOOK, FALSE); po = tcore_object_ref_object(o); + if (po == NULL) { + err("po is NULL"); + return FALSE; + } + memcpy(&po->field_support_list, list, sizeof(struct tel_phonebook_field_support_list)); return TRUE; @@ -189,8 +207,10 @@ enum tel_phonebook_type tcore_phonebook_get_selected_type(CoreObject *o) struct private_object_data *po = NULL; CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PHONEBOOK, PB_TYPE_UNKNOWNN); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return PB_TYPE_UNKNOWNN; + } return po->selected; } @@ -200,8 +220,10 @@ gboolean tcore_phonebook_set_selected_type(CoreObject *o, enum tel_phonebook_typ struct private_object_data *po = NULL; CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PHONEBOOK, FALSE); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return FALSE; + } po->selected = t; diff --git a/src/core_object/co_ps.c b/src/core_object/co_ps.c index 86afd43..74ee180 100644 --- a/src/core_object/co_ps.c +++ b/src/core_object/co_ps.c @@ -26,6 +26,7 @@ #include "tcore.h" #include "internal/tcore_types.h" +#include "server.h" #include "plugin.h" #include "user_request.h" #include "co_ps.h" @@ -42,11 +43,31 @@ struct p_callid_type { struct private_object_data { struct tcore_ps_operations *ops[TCORE_OPS_TYPE_MAX]; + enum telephony_ps_activation activation; gboolean online; + gint num_of_pdn; - /* 1 ~ UMTS_PS_MAX_CID */ - struct p_callid_type cid[PS_MAX_CID + 1]; + /* + * For DSDS, we need to maintain 2 sets of cid's + * SIM 1 - 1 + * SIM 2 - 5 + */ + gint start_cid; + + /* + * Context ID list; asssuming PS_MAX_CID = 4 + * ---------------------------------- + * SIM | ROLE | cid + * ---------------------------------- + * SIM 1 | INTERNET | 1 + * SIM 1 | OTHERS | 2-4 + * ---------------------------------- + * SIM 2 | INTERNET | 5 + * SIM 2 | OTHERS | 6-8 + * ---------------------------------- + */ + struct p_callid_type cid[(PS_MAX_CID * 2) + 1]; GSList *context_list; }; @@ -81,8 +102,10 @@ static void _free_hook(CoreObject *o) GSList *list; po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return; + } if (po->context_list) { for (list = po->context_list; list; list = list->next) { @@ -105,16 +128,20 @@ static gboolean _ps_is_active_context(CoreObject *o, CoreObject *ps_context) GSList *contexts = NULL; CoreObject *s_context = NULL; - int idx_cid = 0; + unsigned int idx_cid = 0; struct private_object_data *po = NULL; + enum telephony_subscription_type subs_type; CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE); + subs_type = tcore_object_ref_subscription_type(o); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return FALSE; + } - for (idx_cid = 1; idx_cid <= po->num_of_pdn; idx_cid++) { + for (idx_cid = po->start_cid; idx_cid <= (po->num_of_pdn * (subs_type + 1)); idx_cid++) { if (po->cid[idx_cid].cid == 0) continue; @@ -149,17 +176,22 @@ static gboolean _ps_is_duplicated_apn(CoreObject *o, CoreObject *ps_context) CoreObject *s_context = NULL; gchar *t_apn = NULL, *s_apn = NULL; - int idx_cid = 0; + unsigned int idx_cid = 0; struct private_object_data *po = NULL; + enum telephony_subscription_type subs_type; CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, FALSE); + subs_type = tcore_object_ref_subscription_type(o); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return FALSE; + } + t_apn = tcore_context_get_apn(ps_context); - for (idx_cid = 1; idx_cid <= po->num_of_pdn; idx_cid++) { + for (idx_cid = po->start_cid; idx_cid <= (po->num_of_pdn * (subs_type + 1)); idx_cid++) { if (po->cid[idx_cid].cid == 0) continue; @@ -209,31 +241,43 @@ static void _deactivate_context(gpointer context, gpointer user_data) CoreObject *tcore_ps_new(TcorePlugin *p, const char *name, struct tcore_ps_operations *ops, TcoreHal *hal) { - CoreObject *o = NULL; + CoreObject *co_ps = NULL; struct private_object_data *po = NULL; + enum telephony_subscription_type subs_type; if (!p) return NULL; - o = tcore_object_new(p, name, hal); - if (!o) + co_ps = tcore_object_new(p, name, hal); + if (!co_ps) return NULL; po = g_try_malloc0(sizeof(struct private_object_data)); if (!po) { - tcore_object_free(o); + tcore_object_free(co_ps); return NULL; } /* set ops to default type when core object is created. */ po->ops[TCORE_OPS_TYPE_CP] = ops; + po->activation = TRUE; + + tcore_object_set_type(co_ps, CORE_OBJECT_TYPE_PS); + tcore_object_link_object(co_ps, po); + tcore_object_set_free_hook(co_ps, _free_hook); + tcore_object_set_dispatcher(co_ps, _dispatcher); + + subs_type = tcore_object_ref_subscription_type(co_ps); + if (subs_type == TELEPHONY_SUBSCRIPTION_TYPE_PRIMARY) { + po->start_cid = 1; /* '1' for SIM 1 */ + } else if (subs_type == TELEPHONY_SUBSCRIPTION_TYPE_SECONDARY) { + po->start_cid = 5; /* '5' for SIM 2 */ + } else { + tcore_object_free(co_ps); + return NULL; + } - tcore_object_set_type(o, CORE_OBJECT_TYPE_PS); - tcore_object_link_object(o, po); - tcore_object_set_free_hook(o, _free_hook); - tcore_object_set_dispatcher(o, _dispatcher); - - return o; + return co_ps; } void tcore_ps_free(CoreObject *o) @@ -268,8 +312,10 @@ TReturn tcore_ps_add_context(CoreObject *o, CoreObject *ctx_o) CORE_OBJECT_CHECK_RETURN(ctx_o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } count = g_slist_length(po->context_list); po->context_list = g_slist_insert(po->context_list, ctx_o, 0); @@ -287,8 +333,10 @@ TReturn tcore_ps_remove_context(CoreObject *o, CoreObject *ctx_o) CORE_OBJECT_CHECK_RETURN(ctx_o, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } tcore_ps_clear_context_id(o, ctx_o); count = g_slist_length(po->context_list); @@ -298,6 +346,25 @@ TReturn tcore_ps_remove_context(CoreObject *o, CoreObject *ctx_o) return TCORE_RETURN_SUCCESS; } +TReturn tcore_ps_set_activation(CoreObject *o, enum telephony_ps_activation activation) +{ + struct private_object_data *po = NULL; + + CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL); + + po = tcore_object_ref_object(o); + if (!po) { + err("po is NULL"); + return TCORE_RETURN_EINVAL; + } + + po->activation = activation; + dbg("PS Activation state: [%s]", + (po->activation == TELEPHONY_PS_ACTIVATE ? "ACTIVATE" : "HOLD")); + + return TCORE_RETURN_SUCCESS; +} + TReturn tcore_ps_set_online(CoreObject *o, gboolean state) { struct private_object_data *po = NULL; @@ -305,8 +372,10 @@ TReturn tcore_ps_set_online(CoreObject *o, gboolean state) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } po->online = state; dbg("PS Status: [%s]", (po->online ? "ONLINE" : "OFFLINE")); @@ -321,8 +390,10 @@ TReturn tcore_ps_set_num_of_pdn(CoreObject *o, gint numbers) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (numbers <= 0 || numbers > PS_MAX_CID) po->num_of_pdn = PS_MAX_CID; @@ -341,26 +412,33 @@ unsigned int tcore_ps_get_num_of_pdn(CoreObject *o) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, 0); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return 0; + } return po->num_of_pdn; } unsigned int tcore_ps_set_cid_active(CoreObject *o, unsigned int cid, unsigned int enable) { - int idx_cid = 0; + unsigned int idx_cid = 0; struct private_object_data *po = NULL; + enum telephony_subscription_type subs_type; CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, 0); + if (cid == 0) return 0; + subs_type = tcore_object_ref_subscription_type(o); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return 0; + } - for (idx_cid = 1; idx_cid <= po->num_of_pdn; idx_cid++) { + for (idx_cid = po->start_cid; idx_cid <= (po->num_of_pdn * (subs_type + 1)); idx_cid++) { if (po->cid[idx_cid].cid == cid) { po->cid[idx_cid].active = enable; return 1; @@ -372,18 +450,23 @@ unsigned int tcore_ps_set_cid_active(CoreObject *o, unsigned int cid, unsigned i unsigned int tcore_ps_get_cid_active(CoreObject *o, unsigned int cid) { - int idx_cid = 0; + unsigned int idx_cid = 0; struct private_object_data *po = NULL; + enum telephony_subscription_type subs_type; CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, 0); + if (cid == 0) return 0; + subs_type = tcore_object_ref_subscription_type(o); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return 0; + } - for (idx_cid = 1; idx_cid <= po->num_of_pdn; idx_cid++) + for (idx_cid = po->start_cid; idx_cid <= (po->num_of_pdn * (subs_type + 1)); idx_cid++) if (po->cid[idx_cid].cid == cid) return po->cid[idx_cid].active; @@ -392,17 +475,22 @@ unsigned int tcore_ps_get_cid_active(CoreObject *o, unsigned int cid) GSList *tcore_ps_get_active_cids(CoreObject *o) { - int idx_cid = 0; + unsigned int idx_cid = 0; GSList *active_list = NULL; struct private_object_data *po = NULL; + enum telephony_subscription_type subs_type; + CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, NULL); + subs_type = tcore_object_ref_subscription_type(o); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } - for (idx_cid = 1; idx_cid <= po->num_of_pdn; idx_cid++) + for (idx_cid = po->start_cid; idx_cid <= (po->num_of_pdn * (subs_type + 1)); idx_cid++) if (po->cid[idx_cid].active) active_list = g_slist_append(active_list, &po->cid[idx_cid].cid); @@ -411,18 +499,24 @@ GSList *tcore_ps_get_active_cids(CoreObject *o) unsigned int tcore_ps_set_cid_connected(CoreObject *o, unsigned int cid, unsigned int connected) { - int idx_cid = 0; + unsigned int idx_cid = 0; struct private_object_data *po = NULL; + enum telephony_subscription_type subs_type; + CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, 0); + if (cid == 0) return 0; + subs_type = tcore_object_ref_subscription_type(o); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return 0; + } - for (idx_cid = 1; idx_cid <= po->num_of_pdn; idx_cid++) { + for (idx_cid = po->start_cid; idx_cid <= (po->num_of_pdn * (subs_type + 1)); idx_cid++) { if (po->cid[idx_cid].cid == cid) { po->cid[idx_cid].connected = connected; return 1; @@ -434,18 +528,24 @@ unsigned int tcore_ps_set_cid_connected(CoreObject *o, unsigned int cid, unsigne unsigned int tcore_ps_get_cid_connected(CoreObject *o, unsigned int cid) { - int idx_cid = 0; + unsigned int idx_cid = 0; struct private_object_data *po = NULL; + enum telephony_subscription_type subs_type; + CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, 0); + if (cid == 0) return 0; + subs_type = tcore_object_ref_subscription_type(o); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return 0; + } - for (idx_cid = 1; idx_cid <= po->num_of_pdn; idx_cid++) + for (idx_cid = po->start_cid; idx_cid <= (po->num_of_pdn * (subs_type + 1)); idx_cid++) if (po->cid[idx_cid].cid == cid) return po->cid[idx_cid].connected; @@ -454,17 +554,22 @@ unsigned int tcore_ps_get_cid_connected(CoreObject *o, unsigned int cid) GSList *tcore_ps_get_connected_cids(CoreObject *o) { - int idx_cid = 0; + unsigned int idx_cid = 0; GSList *active_list = NULL; struct private_object_data *po = NULL; + enum telephony_subscription_type subs_type; + CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, NULL); + subs_type = tcore_object_ref_subscription_type(o); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } - for (idx_cid = 1; idx_cid <= po->num_of_pdn; idx_cid++) + for (idx_cid = po->start_cid; idx_cid <= (po->num_of_pdn * (subs_type + 1)); idx_cid++) if (po->cid[idx_cid].connected) active_list = g_slist_append(active_list, &po->cid[idx_cid].cid); @@ -473,16 +578,21 @@ GSList *tcore_ps_get_connected_cids(CoreObject *o) unsigned int tcore_ps_is_active_apn(CoreObject *o, const char *apn) { - int idx_cid = 0; + unsigned int idx_cid = 0; struct private_object_data *po = NULL; + enum telephony_subscription_type subs_type; + CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, 0); + subs_type = tcore_object_ref_subscription_type(o); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return 0; + } - for (idx_cid = 1; idx_cid <= po->num_of_pdn; idx_cid++) { + for (idx_cid = po->start_cid; idx_cid <= (po->num_of_pdn * (subs_type + 1)); idx_cid++) { if (po->cid[idx_cid].cid == 0) continue; @@ -503,8 +613,10 @@ CoreObject *tcore_ps_ref_context_by_role(CoreObject *o, enum co_context_role rol CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } p = tcore_object_ref_plugin(o); if (!p) @@ -534,13 +646,18 @@ GSList *tcore_ps_ref_context_by_id(CoreObject *o, unsigned int id) { struct private_object_data *po = NULL; + enum telephony_subscription_type subs_type; + CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, NULL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return NULL; + } - if (id == 0 || id > (unsigned int)po->num_of_pdn) + subs_type = tcore_object_ref_subscription_type(o); + if ((id == 0) || (id > (unsigned int)po->num_of_pdn * (subs_type + 1))) return NULL; if (po->cid[id].cid != id) @@ -549,17 +666,20 @@ GSList *tcore_ps_ref_context_by_id(CoreObject *o, unsigned int id) return po->cid[id].contexts; } -gboolean tcore_ps_any_context_activating_activated(CoreObject *o, int * state) +gboolean tcore_ps_any_internet_mms_tethering_context_activating_activated(CoreObject *o, int * state) { struct private_object_data *po = NULL; CoreObject *pdp_o; gboolean ret = FALSE; GSList *list = NULL; enum co_context_state context_state = CONTEXT_STATE_DEACTIVATED; + enum co_context_role role = CONTEXT_ROLE_UNKNOWN; po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return ret; + } if (po->context_list) { for (list = po->context_list; list; list = list->next) { @@ -571,6 +691,21 @@ gboolean tcore_ps_any_context_activating_activated(CoreObject *o, int * state) if (tcore_object_get_type(pdp_o) != CORE_OBJECT_TYPE_PS_CONTEXT) continue; + role = tcore_context_get_role(pdp_o); + switch (role) { + case CONTEXT_ROLE_INTERNET: + case CONTEXT_ROLE_MMS: + case CONTEXT_ROLE_PREPAID_INTERNET: + case CONTEXT_ROLE_PREPAID_MMS: + case CONTEXT_ROLE_TETHERING: + break; + case CONTEXT_ROLE_IMS: + case CONTEXT_ROLE_IMS_EMERGENCY: + case CONTEXT_ROLE_IMS_UT: + default: + continue; + + } context_state = tcore_context_get_state(pdp_o); if (CONTEXT_STATE_ACTIVATED == context_state) { @@ -591,25 +726,105 @@ gboolean tcore_ps_any_context_activating_activated(CoreObject *o, int * state) return ret; } +gboolean tcore_ps_any_context_activating_activated(CoreObject *o, int * state) +{ + struct private_object_data *po = NULL; + CoreObject *pdp_o; + gboolean ret = FALSE; + GSList *list = NULL; + enum co_context_state context_state = CONTEXT_STATE_DEACTIVATED; + + po = tcore_object_ref_object(o); + if (!po) { + err("po is NULL"); + return ret; + } + + if (po->context_list) { + for (list = po->context_list; list; list = list->next) { + if (!list->data) + continue; + + pdp_o = list->data; + + if (tcore_object_get_type(pdp_o) != CORE_OBJECT_TYPE_PS_CONTEXT) + continue; + + context_state = tcore_context_get_state(pdp_o); + + if (CONTEXT_STATE_ACTIVATED == context_state) { + *state = CONTEXT_STATE_ACTIVATED; + return TRUE; + } else if (CONTEXT_STATE_ACTIVATING == context_state) { + *state = CONTEXT_STATE_ACTIVATING; + ret = TRUE; + continue; + } else if (CONTEXT_STATE_DEACTIVATING == context_state) { + *state = CONTEXT_STATE_DEACTIVATING; + ret = TRUE; + continue; + } + } + } + + return ret; +} TReturn tcore_ps_assign_context_id(CoreObject *o, CoreObject *context, unsigned char cid) { struct private_object_data *po = NULL; unsigned char idx; + enum telephony_subscription_type subs_type; CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL); CORE_OBJECT_CHECK_RETURN(context, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } - if (cid > (unsigned int)po->num_of_pdn) + subs_type = tcore_object_ref_subscription_type(o); + if (cid > (unsigned int)po->num_of_pdn * (subs_type + 1)) return TCORE_RETURN_PS_CID_ERROR; if (cid == 0) { - /* Automatic assign */ - for (idx = 1; idx <= po->num_of_pdn; idx++) { + /* + * Automatic assignment of 'cid' + */ + if (subs_type == TELEPHONY_SUBSCRIPTION_TYPE_PRIMARY) { + idx = po->start_cid; + } else if (subs_type == TELEPHONY_SUBSCRIPTION_TYPE_SECONDARY) { + idx = po->start_cid; + } else { + err("Unknwon/Unhandled subs_type: [%d]", subs_type); + return TCORE_RETURN_EINVAL; + } + + if (tcore_context_get_default_pdn(context) == TRUE) { + if (po->cid[idx].cid == 0) { + po->cid[idx].cid = idx; + po->cid[idx].contexts = g_slist_append(po->cid[idx].contexts, context); + po->cid[idx].apn = tcore_context_get_apn(context); + + dbg("assign contexts(%p) in cid(%d), apn(%s)", context, idx, po->cid[idx].apn); + + return tcore_context_set_id(context, idx); + } else { + dbg("cid[%d] is not null", idx); + return TCORE_RETURN_PS_CID_ERROR; + } + } else { + /* + * Increment cid for OTHER roles (idx++)- + * SIM 1: 2-4 + * SIM 2: 6-8 + */ + idx++; + } + + for (; idx <= (po->num_of_pdn * (subs_type + 1)); idx++) { if (po->cid[idx].cid == 0) { po->cid[idx].cid = idx; po->cid[idx].contexts = g_slist_append(po->cid[idx].contexts, context); @@ -642,14 +857,21 @@ TReturn tcore_ps_send_dormant_request(CoreObject *o, void *user_data) CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (!po->online) { dbg("ps network is not online !"); return TCORE_RETURN_PS_NETWORK_NOT_READY; } + if (!po->activation) { + dbg("ps network is on HOLD!"); + return TCORE_RETURN_PS_ACTIVATION_ON_HOLD; + } + /* By 'default' considering Modem/CP opearations */ return po->ops[TCORE_OPS_TYPE_CP]->send_dormant_request(o, user_data); } @@ -658,19 +880,24 @@ TReturn tcore_ps_clear_context_id(CoreObject *o, CoreObject *context) { struct private_object_data *po = NULL; unsigned char i = 0, cnt = 0; + enum telephony_subscription_type subs_type; CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL); CORE_OBJECT_CHECK_RETURN(context, CORE_OBJECT_TYPE_PS_CONTEXT, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } i = tcore_context_get_id(context); if (i == 0) return TCORE_RETURN_PS_CID_ERROR; - if (i > po->num_of_pdn) + subs_type = tcore_object_ref_subscription_type(o); + + if (i > (po->num_of_pdn * (subs_type + 1))) return TCORE_RETURN_PS_CID_ERROR; po->cid[i].contexts = g_slist_remove(po->cid[i].contexts, context); @@ -686,18 +913,71 @@ TReturn tcore_ps_clear_context_id(CoreObject *o, CoreObject *context) return tcore_context_set_id(context, 0); } +TReturn tcore_ps_set_data_profile(CoreObject *o, CoreObject *ps_context, void *user_data) +{ + int rv; + struct private_object_data *po = NULL; + CoreObject *co_nw = NULL; + enum telephony_network_access_technology act = NETWORK_ACT_UNKNOWN; + + CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL); + + po = tcore_object_ref_object(o); + if (!po) { + err("po is NULL"); + return TCORE_RETURN_EINVAL; + } + + if (!ps_context) + return TCORE_RETURN_EINVAL; + + rv = _ps_is_active_context(o, ps_context); + if (rv) + return TCORE_RETURN_SUCCESS; + + co_nw = tcore_plugin_ref_core_object(tcore_object_ref_plugin(o), CORE_OBJECT_TYPE_NETWORK); + tcore_network_get_access_technology(co_nw, &act); + if (act >= NETWORK_ACT_IS95A && act <= NETWORK_ACT_EHRPD) + tcore_context_set_tech_preference(ps_context, CONTEXT_TECH_3GPP2); + else { + tcore_context_set_tech_preference(ps_context, CONTEXT_TECH_3GPP); + dbg("3GPP preference by default"); + } + + rv = _ps_is_duplicated_apn(o, ps_context); + if (rv) { + unsigned char cid = 0; + cid = tcore_context_get_id(ps_context); + po->cid[cid].contexts = g_slist_append(po->cid[cid].contexts, ps_context); + return TCORE_RETURN_SUCCESS; + } + + if (tcore_context_get_id(ps_context) == 0) + if (tcore_ps_assign_context_id(o, ps_context, 0) != TCORE_RETURN_SUCCESS) + return TCORE_RETURN_PS_CID_ERROR; + + dbg("contexts(%p), cid = %d", ps_context, tcore_context_get_id(ps_context)); + + /* By 'default' considering Modem/CP opearations */ + return po->ops[TCORE_OPS_TYPE_CP]->set_data_profile(o, ps_context, user_data); +} + TReturn tcore_ps_define_context(CoreObject *o, CoreObject *ps_context, void *user_data) { int rv; struct private_object_data *po = NULL; CoreObject *co_nw = NULL; enum telephony_network_access_technology act = NETWORK_ACT_UNKNOWN; + gchar status[20] = {0}; + enum co_context_state context_state = CONTEXT_STATE_DEACTIVATED; CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (!ps_context) return TCORE_RETURN_EINVAL; @@ -720,6 +1000,17 @@ TReturn tcore_ps_define_context(CoreObject *o, CoreObject *ps_context, void *use unsigned char cid = 0; cid = tcore_context_get_id(ps_context); po->cid[cid].contexts = g_slist_append(po->cid[cid].contexts, ps_context); + if (tcore_context_get_role(ps_context) == CONTEXT_ROLE_INTERNET) { + context_state = tcore_context_get_state(ps_context); + info("context_state %d", context_state); + if (context_state == CONTEXT_STATE_ACTIVATED) { + g_strlcpy(status, (gchar*)&cid, 2); + g_strlcpy(status+1, "_connected", sizeof("_connected")+2); + info("activate internet context with duplicate apn for cid %d", cid); + tcore_object_set_property (o, PROP_DNET_CONNECTION_STATUS, status); + } + } + tcore_object_set_property (o, PROP_DNET_CONNECTION_STATUS, NULL); return TCORE_RETURN_SUCCESS; } @@ -738,18 +1029,27 @@ TReturn tcore_ps_activate_context(CoreObject *o, CoreObject *ps_context, void *u int rv; struct private_object_data *po = NULL; enum co_context_state context_state = CONTEXT_STATE_DEACTIVATED; + gchar status[20] = {0}; + unsigned char cid; CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (!po->online) { dbg("ps network is not online !"); return TCORE_RETURN_PS_NETWORK_NOT_READY; } + if (!po->activation) { + dbg("ps network is on HOLD!"); + return TCORE_RETURN_PS_ACTIVATION_ON_HOLD; + } + if (!ps_context) return TCORE_RETURN_EINVAL; @@ -761,8 +1061,16 @@ TReturn tcore_ps_activate_context(CoreObject *o, CoreObject *ps_context, void *u rv = _ps_is_duplicated_apn(o, ps_context); if (rv) { + if (tcore_context_get_role(ps_context) == CONTEXT_ROLE_INTERNET) { + cid = tcore_context_get_id(ps_context); + g_strlcpy(status, (gchar*)&cid, 2); + g_strlcpy(status+1, "_connected", sizeof("_connected")+2); + info("activate internet context with duplicate apn for cid %d", cid); + tcore_object_set_property (o, PROP_DNET_CONNECTION_STATUS, status); + } dbg("context activation is already requested for the same apn(%s)", tcore_context_get_apn(ps_context)); + tcore_object_set_property (o, PROP_DNET_CONNECTION_STATUS, NULL); return TCORE_RETURN_SUCCESS; } @@ -796,12 +1104,16 @@ TReturn tcore_ps_deactivate_context(CoreObject *o, CoreObject *ps_context, void int rv; struct private_object_data *po = NULL; enum co_context_state context_state = CONTEXT_STATE_DEACTIVATED; + gchar status[20] = {0}; + unsigned char cid; CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (!ps_context) return TCORE_RETURN_EINVAL; @@ -812,9 +1124,17 @@ TReturn tcore_ps_deactivate_context(CoreObject *o, CoreObject *ps_context, void rv = _ps_is_duplicated_apn(o, ps_context); if (rv) { + if (tcore_context_get_role(ps_context) == CONTEXT_ROLE_INTERNET) { + cid = tcore_context_get_id(ps_context); + g_strlcpy(status, (gchar*)&cid, 2); + g_strlcpy(status+1, "_disconnected", sizeof("_disconnected")+2); + info("deactivate internet context with duplicate apn"); + tcore_object_set_property (o, PROP_DNET_CONNECTION_STATUS, status); + } tcore_ps_clear_context_id(o, ps_context); tcore_context_set_state(ps_context, CONTEXT_STATE_DEACTIVATED); - return TCORE_RETURN_SUCCESS; + tcore_object_set_property (o, PROP_DNET_CONNECTION_STATUS, NULL); + return TCORE_RETURN_PS_DEACTIVATED; } context_state = tcore_context_get_state(ps_context); @@ -842,22 +1162,32 @@ TReturn tcore_ps_deactivate_context(CoreObject *o, CoreObject *ps_context, void TReturn tcore_ps_deactivate_contexts(CoreObject *o) { - int temp_index = 0; + unsigned int temp_index = 0; struct private_object_data *po = NULL; GSList *contexts = NULL; + enum telephony_subscription_type subs_type; CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (!po->online) { dbg("ps network is not online !"); return TCORE_RETURN_PS_NETWORK_NOT_READY; } - for (temp_index = 1; temp_index <= po->num_of_pdn; temp_index++) { + if (!po->activation) { + dbg("ps network is on HOLD!"); + return TCORE_RETURN_PS_ACTIVATION_ON_HOLD; + } + + subs_type = tcore_object_ref_subscription_type(o); + + for (temp_index = po->start_cid; temp_index <= (po->num_of_pdn * (subs_type + 1)); temp_index++) { if (po->cid[temp_index].cid != 0) { contexts = po->cid[temp_index].contexts; if (!contexts) @@ -872,22 +1202,32 @@ TReturn tcore_ps_deactivate_contexts(CoreObject *o) TReturn tcore_ps_deactivate_cid(CoreObject *o, unsigned int cid) { - int temp_index = 0; + unsigned int temp_index = 0; struct private_object_data *po = NULL; GSList *contexts = NULL; + enum telephony_subscription_type subs_type; CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL); po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_RETURN_EINVAL; + } if (!po->online) { dbg("ps network is not online !"); return TCORE_RETURN_PS_NETWORK_NOT_READY; } - for (temp_index = 1; temp_index <= po->num_of_pdn; temp_index++) { + if (!po->activation) { + dbg("ps network is on HOLD!"); + return TCORE_RETURN_PS_ACTIVATION_ON_HOLD; + } + + subs_type = tcore_object_ref_subscription_type(o); + + for (temp_index = po->start_cid; temp_index <= (po->num_of_pdn * (subs_type + 1)); temp_index++) { if (po->cid[temp_index].cid != 0 && po->cid[temp_index].cid == cid) { contexts = po->cid[temp_index].contexts; if (!contexts) @@ -899,3 +1239,24 @@ TReturn tcore_ps_deactivate_cid(CoreObject *o, unsigned int cid) return TCORE_RETURN_SUCCESS; } + +TReturn tcore_ps_set_attach_request(CoreObject *o, gint attach_req_info) +{ + struct private_object_data *po = NULL; + + CORE_OBJECT_CHECK_RETURN(o, CORE_OBJECT_TYPE_PS, TCORE_RETURN_EINVAL); + po = tcore_object_ref_object(o); + if (!po) { + err("po is NULL"); + return TCORE_RETURN_EINVAL; + } + + /* + dbg("PS req info (att:%x, reatt:%x, detachreason:%x)", + (0xff0000 & attach_req_info), (0x00ff00 & attach_req_info), (0x0000ff & attach_req_info)); + dbg("PS %s requested", (0xff0000 & attach_req_info) ? "ATTACH" : "DETACH"); + */ + /* By 'default' considering Modem/CP opearations */ + return po->ops[TCORE_OPS_TYPE_CP]->set_attach_request(o, attach_req_info); +} + diff --git a/src/core_object/co_sat.c b/src/core_object/co_sat.c index 1855450..2d5017e 100644 --- a/src/core_object/co_sat.c +++ b/src/core_object/co_sat.c @@ -34,6 +34,7 @@ #include "co_sat.h" #define SATK_PROACTIVE_CMD_TAG 0xD0 /* Proactive Command Tag */ +#define SATK_SMS_PP_DOWNLOAD_TAG 0xD1 /* SMS-PP Download Tag */ #define SATK_MENU_SELECTION_TAG 0xD3 /* Menu Selection Tag */ #define SATK_EVENT_DOWNLOAD_TAG 0xD6 /* Event Download Tag */ @@ -2486,11 +2487,13 @@ static enum tcore_sat_result _sat_decode_network_access_name_tlv(unsigned char * name_idx = 0; for (idx = 0; idx < access_name_obj->length; idx++) { - dbg("data (%c) Bool(%d)", src_data[temp_index], g_ascii_isalpha(src_data[temp_index])); - + dbg("data (%c)", src_data[temp_index]); if (g_ascii_isalpha(src_data[temp_index])) { access_name_obj->network_access_name[name_idx] = src_data[temp_index]; name_idx++; + } else if (g_ascii_isdigit(src_data[temp_index])) { + access_name_obj->network_access_name[name_idx] = src_data[temp_index]; + name_idx++; } else { if (src_data[temp_index] == 0x02) {/* 02 convert to "." */ access_name_obj->network_access_name[name_idx] = '.'; @@ -5147,6 +5150,22 @@ static enum tcore_sat_result _sat_decode_open_channel(unsigned char *o_cmd_data, return TCORE_SAT_SUCCESS; } + /* Network Access Name - optional */ + if ((cmd_data[temp_index] & 0x7F) == SATK_NETWORK_ACCESS_TAG) { + data_len_consumed = 0; + rv = _sat_decode_network_access_name_tlv(o_cmd_data, o_length, temp_index, + &sat_cmd_ind_data->data.open_channel.bearer_detail.default_bearer.network_access_name, + &data_len_consumed); + if (rv != TCORE_SAT_SUCCESS) + return rv; /* Send TR */ + + temp_index += data_len_consumed; + if (temp_index >= o_length) { + dbg("[SAT] SAT PARSER - no more TLVs to decode."); + return TCORE_SAT_SUCCESS; + } + } + /* other address - optional */ if ((cmd_data[temp_index] & 0x7F) == SATK_OTHER_ADDRESS_TAG) { data_len_consumed = 0; @@ -6340,7 +6359,6 @@ static int _sat_encode_browser_termination_tlv(const enum browser_termination_ca return 3; } -#if 0 static int _sat_encode_bearer_desc_tlv(const struct tel_sat_bearer_description *src, char *dst, int current_temp_index) { int total_len = 0; @@ -6393,7 +6411,6 @@ static int _sat_encode_buffer_size_tlv(const struct tel_sat_buffer_size *src, ch return 4; } -#endif static int _sat_encode_channel_data_tlv(const struct tel_sat_channel_data *src, char *dst, int current_temp_index) { @@ -6508,8 +6525,7 @@ int tcore_sat_encode_envelop_cmd(const struct treq_sat_envelop_cmd_data *src_env if (!dst_envelop) return 0; - if (src_envelop->sub_cmd - == ENVELOP_MENU_SELECTION) { + if (src_envelop->sub_cmd == ENVELOP_MENU_SELECTION) { temp_index = 2; /* set the cursor to device identity */ dbg("item id(%d)", src_envelop->envelop_data.menu_select.item_identifier.item_identifier); encoded_len = _sat_encode_device_identities_tlv(&(src_envelop->envelop_data.menu_select.device_identitie), dst_envelop, temp_index); @@ -6530,10 +6546,15 @@ int tcore_sat_encode_envelop_cmd(const struct treq_sat_envelop_cmd_data *src_env /* main cmd */ dst_envelop[0] = SATK_MENU_SELECTION_TAG; dst_envelop[1] = temp_index-2; - } else if (src_envelop->sub_cmd - == ENVELOP_EVENT_DOWNLOAD) + + } else if (src_envelop->sub_cmd == ENVELOP_EVENT_DOWNLOAD) { temp_index = _sat_encode_download_event(&(src_envelop->envelop_data.event_download), dst_envelop); + } else if (src_envelop->sub_cmd == ENVELOP_RAW_DATA) { + memcpy(dst_envelop, src_envelop->envelop_data.raw_data.data, SAT_ENVELOPE_DATA_LEN_MAX); + temp_index = src_envelop->envelop_data.raw_data.data_len; + } + return temp_index; } @@ -7459,6 +7480,7 @@ static int _sat_encode_launch_browser(const struct tel_sat_tr_launch_browser_tlv break; case RESULT_LAUNCH_BROWSER_GENERIC_ERROR_CODE: + case RESULT_USER_DID_NOT_ACCEPT_CALL_SETUP_REQ: dst_tr[temp_index++] = 2; dst_tr[temp_index++] = src_tr->result_type; dst_tr[temp_index++] = src_tr->browser_problem_type; @@ -7499,6 +7521,16 @@ static int _sat_encode_open_channel(const struct tel_sat_tr_open_channel_tlv *sr /* set channel status */ encoded_len = _sat_encode_channel_status_tlv(&(src_tr->channel_status), dst_tr, temp_index); temp_index += encoded_len; + + /* set bearer description */ + encoded_len = _sat_encode_bearer_desc_tlv(&(src_tr->bearer_desc), dst_tr, temp_index); + temp_index += encoded_len; + + /* set buffer size */ + encoded_len = _sat_encode_buffer_size_tlv(&(src_tr->buffer_size), dst_tr, temp_index); + temp_index += encoded_len; + + break; case RESULT_REFRESH_PRFRMD_BUT_INDICATED_USIM_NOT_ACTIVE: diff --git a/src/core_object/co_sim.c b/src/core_object/co_sim.c index 0418409..4c7b7df 100644 --- a/src/core_object/co_sim.c +++ b/src/core_object/co_sim.c @@ -51,10 +51,11 @@ struct private_object_data { struct tcore_sim_operations *ops[TCORE_OPS_TYPE_MAX]; - unsigned char app_list; + enum tel_sim_app_type app_list; enum tel_sim_type type; /**< Provides the SIM card type*/ enum tel_sim_status sim_status; /**< Provides the card status*/ struct tel_sim_imsi imsi; /**< Provides IMSI information*/ + struct tel_sim_imsi imsi_m; /**< Provides IMSI_M information*/ gboolean b_sim_changed; /**< Provides SIM card Identification- 0:no changed, 1:changed*/ gboolean b_cphs; /**< Whether current SIM is for CPHS or not*/ struct tel_sim_service_table *svct; /**< (U)SIM Service Table information*/ @@ -64,7 +65,10 @@ struct private_object_data { struct tel_sim_cphs_netname *cphs_netname; struct tel_sim_iccid *iccid; struct tel_sim_cphs_csp *csp; + struct tel_sim_ist *ist; + char *impi; + void *userdata; /**< free use data*/ }; @@ -126,6 +130,8 @@ static const char *plmn_having_3digits_mnc[] = { "722070", /* Movistar AR */ "722310", /* Claro AR */ "722341", /* Personal AR */ + /* For VZW LC TC */ + "246081", }; gboolean tcore_sim_check_plmn_having_3digits_mnc(char *plmn) @@ -231,9 +237,7 @@ static TReturn _dispatcher(CoreObject *o, UserRequest *ur, enum tcore_ops_type o case TREQ_SIM_SET_CALLFORWARDING: case TREQ_SIM_SET_MESSAGEWAITING: case TREQ_SIM_SET_MAILBOX: -#if defined TIZEN_GLOBALCONFIG_ENABLE_CSP case TREQ_SIM_SET_CPHS_CSP_INFO: -#endif tcore_check_null_ret_err("ops->update_file", ops->update_file, TCORE_RETURN_ENOSYS); @@ -258,6 +262,7 @@ static TReturn _dispatcher(CoreObject *o, UserRequest *ur, enum tcore_ops_type o case TREQ_SIM_GET_IMPI: case TREQ_SIM_GET_IMPU: case TREQ_SIM_GET_GID: + case TREQ_SIM_GET_CPHS_CSP_INFO: case TREQ_SIM_GET_DOMAIN: case TREQ_SIM_GET_PCSCF: case TREQ_SIM_GET_ISIM_SERVICE_TABLE: @@ -1298,7 +1303,7 @@ gboolean tcore_sim_decode_sst(struct tel_sim_sst *p_sst, unsigned char *p_in, in return TRUE; } -gboolean tcore_sim_decode_cdma_st(struct tel_sim_cst *p_cdma_st, unsigned char *p_in, int in_length) +gboolean tcore_sim_decode_cdma_st(struct tel_sim_ruimst *p_cdma_st, unsigned char *p_in, int in_length) { unsigned char sstByte, rast, mask = 0; char simServiceID = 1; /* set "CHV1 disable function" */ @@ -1320,9 +1325,7 @@ gboolean tcore_sim_decode_cdma_st(struct tel_sim_cst *p_cdma_st, unsigned char * if (svc_count > SIM_CDMA_ST_SERVICE_CNT_MAX) svc_count = SIM_CDMA_ST_SERVICE_CNT_MAX; - p_cdma_st->cdma_svc_table = SIM_CDMA_SVC_TABLE; - - p_index = (char *)p_cdma_st->service.cdma_service; + p_index = (char*)p_cdma_st; for (i = 0; i < svc_count; i++) { sstByte = p_in[(simServiceID - 1) / 4]; @@ -1369,8 +1372,7 @@ gboolean tcore_sim_decode_csim_st(struct tel_sim_cst *p_csim_st, unsigned char * char *p_index; memset((void *) p_csim_st, 0, sizeof(struct tel_sim_cst)); - p_csim_st->cdma_svc_table = SIM_CSIM_SVC_TABLE; - p_index = (char *)p_csim_st->service.csim_service; + p_index = (char*)p_csim_st; /* * CSIM_ST service is described to 41(1 byte includes 8 service status) in C.S0065 5.2.18. @@ -2051,9 +2053,8 @@ char *tcore_sim_encode_cff(const struct tel_sim_cphs_cf *cff, int in_length) gboolean tcore_sim_decode_csp(struct tel_sim_cphs_csp *p_csp, unsigned char *p_in, int in_length) { - int i, j, k = 0; + int i, j; unsigned char byteSignificance = 0x00; - unsigned char mask = 0x80; if (in_length == 0) return FALSE; @@ -2062,318 +2063,176 @@ gboolean tcore_sim_decode_csp(struct tel_sim_cphs_csp *p_csp, unsigned char *p_i /* current telephony supports 22 byte cphs-csp data. 18 byte is mandatory, the other is optional. */ for (i = 0, j = 0; i < SIM_CPHS_CSP_LEN_MAX && j < SIM_CPHS_CSP_ENTRY_CNT_MAX; i++, j++) { - p_csp->service_profile_entry[j].customer_service_group = (enum tel_sim_cphs_csp_group) p_in[i]; + p_csp->entry[j].group = (enum tel_sim_cphs_csp_group) p_in[i]; byteSignificance = p_in[++i]; - mask = 0x80; - - switch (p_csp->service_profile_entry[j].customer_service_group) { - case 0x01: - for (k = 0; k < 5; k++) { - switch (byteSignificance & mask) { - case 0x80: - p_csp->service_profile_entry[j].service.call_offering.b_call_forwarding_unconditional = TRUE; - break; + dbg("group[%d] byteSignificance:[0x%x]", p_csp->entry[j].group, byteSignificance); - case 0x40: - p_csp->service_profile_entry[j].service.call_offering.b_call_forwarding_on_user_busy = TRUE; - break; + switch (p_csp->entry[j].group) { + case SIM_CPHS_CSP_GROUP_CALL_OFFERING: + if (byteSignificance & 0x80) + p_csp->entry[j].service.call_offering.b_call_forwarding_unconditional = TRUE; - case 0x20: - p_csp->service_profile_entry[j].service.call_offering.b_call_forwarding_on_no_reply = TRUE; - break; + if (byteSignificance & 0x40) + p_csp->entry[j].service.call_offering.b_call_forwarding_on_user_busy = TRUE; - case 0x10: - p_csp->service_profile_entry[j].service.call_offering.b_call_forwarding_on_user_not_reachable = TRUE; - break; + if (byteSignificance & 0x20) + p_csp->entry[j].service.call_offering.b_call_forwarding_on_no_reply = TRUE; - case 0x08: - p_csp->service_profile_entry[j].service.call_offering.b_call_transfer = TRUE; - break; + if (byteSignificance & 0x10) + p_csp->entry[j].service.call_offering.b_call_forwarding_on_user_not_reachable = TRUE; - default: - break; - } - mask = mask >> 1; - } + if (byteSignificance & 0x08) + p_csp->entry[j].service.call_offering.b_call_transfer = TRUE; break; - case 0x02: - for (k = 0; k < 5; k++) { - switch (byteSignificance & mask) { - case 0x80: - p_csp->service_profile_entry[j].service.call_restriction.b_barring_of_all_outgoing_calls = TRUE; - break; + case SIM_CPHS_CSP_GROUP_CALL_RESTRICTION: + if (byteSignificance & 0x80) + p_csp->entry[j].service.call_restriction.b_barring_of_all_outgoing_calls = TRUE; - case 0x40: - p_csp->service_profile_entry[j].service.call_restriction.b_barring_of_outgoing_international_calls = TRUE; - break; + if (byteSignificance & 0x40) + p_csp->entry[j].service.call_restriction.b_barring_of_outgoing_international_calls = TRUE; - case 0x20: - p_csp->service_profile_entry[j].service.call_restriction.b_barring_of_outgoing_international_calls_except_hplmn = TRUE; - break; + if (byteSignificance & 0x20) + p_csp->entry[j].service.call_restriction.b_barring_of_outgoing_international_calls_except_hplmn = TRUE; - case 0x10: - p_csp->service_profile_entry[j].service.call_restriction.b_barring_of_all_incoming_calls_roaming_outside_hplmn = TRUE; - break; + if (byteSignificance & 0x10) + p_csp->entry[j].service.call_restriction.b_barring_of_all_incoming_calls_roaming_outside_hplmn = TRUE; - case 0x08: - p_csp->service_profile_entry[j].service.call_restriction.b_barring_of_incoming_calls_when_roaming = TRUE; - break; + if (byteSignificance & 0x08) + p_csp->entry[j].service.call_restriction.b_barring_of_incoming_calls_when_roaming = TRUE; - default: - break; - } - mask = mask >> 1; - } break; - case 0x03: - for (k = 0; k < 5; k++) { - switch (byteSignificance & mask) { - case 0x80: - p_csp->service_profile_entry[j].service.other_supp_services.b_multi_party_service = TRUE; - break; + case SIM_CPHS_CSP_GROUP_OTHER_SUPP_SERVICES: + if (byteSignificance & 0x80) + p_csp->entry[j].service.other_supp_services.b_multi_party_service = TRUE; - case 0x40: - p_csp->service_profile_entry[j].service.other_supp_services.b_closed_user_group = TRUE; - break; - - case 0x20: - p_csp->service_profile_entry[j].service.other_supp_services.b_advice_of_charge = TRUE; - break; + if (byteSignificance & 0x40) + p_csp->entry[j].service.other_supp_services.b_closed_user_group = TRUE; - case 0x10: - p_csp->service_profile_entry[j].service.other_supp_services.b_preferential_closed_user_group = TRUE; - break; + if (byteSignificance & 0x20) + p_csp->entry[j].service.other_supp_services.b_advice_of_charge = TRUE; - case 0x08: - p_csp->service_profile_entry[j].service.other_supp_services.b_closed_user_group_outgoing_access = TRUE; - break; + if (byteSignificance & 0x10) + p_csp->entry[j].service.other_supp_services.b_preferential_closed_user_group = TRUE; - default: - break; - } - mask = mask >> 1; - } + if (byteSignificance & 0x08) + p_csp->entry[j].service.other_supp_services.b_closed_user_group_outgoing_access = TRUE; break; - case 0x04: - for (k = 0; k < 4; k++) { - switch (byteSignificance & mask) { - case 0x80: - p_csp->service_profile_entry[j].service.call_complete.b_call_hold = TRUE; - break; - - case 0x40: - p_csp->service_profile_entry[j].service.call_complete.b_call_waiting = TRUE; - break; + case SIM_CPHS_CSP_GROUP_CALL_COMPLETION: + if (byteSignificance & 0x80) + p_csp->entry[j].service.call_complete.b_call_hold = TRUE; - case 0x20: - p_csp->service_profile_entry[j].service.call_complete.b_completion_of_call_to_busy_subscriber = TRUE; - break; + if (byteSignificance & 0x40) + p_csp->entry[j].service.call_complete.b_call_waiting = TRUE; - case 0x10: - p_csp->service_profile_entry[j].service.call_complete.b_user_user_signalling = TRUE; - break; + if (byteSignificance & 0x20) + p_csp->entry[j].service.call_complete.b_completion_of_call_to_busy_subscriber = TRUE; - default: - break; - } - mask = mask >> 1; - } + if (byteSignificance & 0x10) + p_csp->entry[j].service.call_complete.b_user_user_signalling = TRUE; break; - case 0x05: - for (k = 0; k < 7; k++) { - switch (byteSignificance & mask) { - case 0x80: - p_csp->service_profile_entry[j].service.teleservices.b_short_message_mobile_terminated = TRUE; - break; + case SIM_CPHS_CSP_GROUP_TELESERVICES: + if (byteSignificance & 0x80) + p_csp->entry[j].service.teleservices.b_short_message_mobile_terminated = TRUE; - case 0x40: - p_csp->service_profile_entry[j].service.teleservices.b_short_message_mobile_originated = TRUE; - break; + if (byteSignificance & 0x40) + p_csp->entry[j].service.teleservices.b_short_message_mobile_originated = TRUE; - case 0x20: - p_csp->service_profile_entry[j].service.teleservices.b_short_message_cell_broadcast = TRUE; - break; + if (byteSignificance & 0x20) + p_csp->entry[j].service.teleservices.b_short_message_cell_broadcast = TRUE; - case 0x10: - p_csp->service_profile_entry[j].service.teleservices.b_short_message_reply_path = TRUE; - break; + if (byteSignificance & 0x10) + p_csp->entry[j].service.teleservices.b_short_message_reply_path = TRUE; - case 0x08: - p_csp->service_profile_entry[j].service.teleservices.b_short_message_delivery_conf = TRUE; - break; + if (byteSignificance & 0x08) + p_csp->entry[j].service.teleservices.b_short_message_delivery_conf = TRUE; - case 0x04: - p_csp->service_profile_entry[j].service.teleservices.b_short_message_protocol_identifier = TRUE; - break; + if (byteSignificance & 0x04) + p_csp->entry[j].service.teleservices.b_short_message_protocol_identifier = TRUE; - case 0x02: - p_csp->service_profile_entry[j].service.teleservices.b_short_message_validity_period = TRUE; - break; - - default: - break; - } - mask = mask >> 1; - } + if (byteSignificance & 0x02) + p_csp->entry[j].service.teleservices.b_short_message_validity_period = TRUE; break; - case 0x06: - for (k = 0; k < 1; k++) { - switch (byteSignificance & mask) { - case 0x80: - p_csp->service_profile_entry[j].service.cphs_teleservices.b_alternative_line_service = TRUE; - break; - - default: - break; - } - mask = mask >> 1; - } + case SIM_CPHS_CSP_GROUP_CPHS_TELESERVICES: + if (byteSignificance & 0x80) + p_csp->entry[j].service.cphs_teleservices.b_alternative_line_service = TRUE; break; - case 0x07: - for (k = 0; k < 1; k++) { - switch (byteSignificance & mask) { - case 0x80: - p_csp->service_profile_entry[j].service.cphs_features.b_string_service_table = TRUE; - break; - - default: - break; - } - mask = mask >> 1; - } + case SIM_CPHS_CSP_GROUP_CPHS_FEATURES: + if (byteSignificance & 0x80) + p_csp->entry[j].service.cphs_features.b_string_service_table = TRUE; break; - case 0x08: - for (k = 0; k < 8; k++) { - switch (byteSignificance & mask) { - case 0x80: - p_csp->service_profile_entry[j].service.number_identifiers.b_calling_line_identification_present = TRUE; - break; + case SIM_CPHS_CSP_GROUP_NUMBER_IDENTIFIERS: + if (byteSignificance & 0x80) + p_csp->entry[j].service.number_identifiers.b_calling_line_identification_present = TRUE; - case 0x20: - p_csp->service_profile_entry[j].service.number_identifiers.b_connected_line_identification_restrict = TRUE; - break; + if (byteSignificance & 0x20) + p_csp->entry[j].service.number_identifiers.b_connected_line_identification_restrict = TRUE; - case 0x10: - p_csp->service_profile_entry[j].service.number_identifiers.b_connected_line_identification_present = TRUE; - break; - - case 0x08: - p_csp->service_profile_entry[j].service.number_identifiers.b_malicious_call_identifier = TRUE; - break; + if (byteSignificance & 0x10) + p_csp->entry[j].service.number_identifiers.b_connected_line_identification_present = TRUE; - case 0x02: - p_csp->service_profile_entry[j].service.number_identifiers.b_calling_line_identification_send = TRUE; - break; + if (byteSignificance & 0x08) + p_csp->entry[j].service.number_identifiers.b_malicious_call_identifier = TRUE; - case 0x01: - p_csp->service_profile_entry[j].service.number_identifiers.b_calling_line_identification_block = TRUE; - break; + if (byteSignificance & 0x02) + p_csp->entry[j].service.number_identifiers.b_calling_line_identification_send = TRUE; - default: - break; - } - mask = mask >> 1; - } + if (byteSignificance & 0x01) + p_csp->entry[j].service.number_identifiers.b_calling_line_identification_block = TRUE; break; - case 0x09: - for (k = 0; k < 6; k++) { - switch (byteSignificance & mask) { - case 0x80: - p_csp->service_profile_entry[j].service.phase_services.b_menu_for_gprs = TRUE; - break; + case SIM_CPHS_CSP_GROUP_PHASE_SERVICES: + if (byteSignificance & 0x80) + p_csp->entry[j].service.phase_services.b_menu_for_gprs = TRUE; - case 0x40: - p_csp->service_profile_entry[j].service.phase_services.b_menu_for_high_speed_csd = TRUE; - break; + if (byteSignificance & 0x40) + p_csp->entry[j].service.phase_services.b_menu_for_high_speed_csd = TRUE; - case 0x20: - p_csp->service_profile_entry[j].service.phase_services.b_menu_for_voice_group_call = TRUE; - break; + if (byteSignificance & 0x20) + p_csp->entry[j].service.phase_services.b_menu_for_voice_group_call = TRUE; - case 0x10: - p_csp->service_profile_entry[j].service.phase_services.b_menu_for_voice_broadcast_service = TRUE; - break; + if (byteSignificance & 0x10) + p_csp->entry[j].service.phase_services.b_menu_for_voice_broadcast_service = TRUE; - case 0x08: - p_csp->service_profile_entry[j].service.phase_services.b_menu_for_multiple_subscriber_profile = TRUE; - break; + if (byteSignificance & 0x08) + p_csp->entry[j].service.phase_services.b_menu_for_multiple_subscriber_profile = TRUE; - case 0x04: - p_csp->service_profile_entry[j].service.phase_services.b_menu_for_multiple_band = TRUE; - break; - - default: - break; - } - mask = mask >> 1; - } + if (byteSignificance & 0x04) + p_csp->entry[j].service.phase_services.b_menu_for_multiple_band = TRUE; break; - case 0xC0: - for (k = 0; k < 8; k++) { - switch (byteSignificance & mask) { - case 0x80: - p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_manual_selection = TRUE; - break; + case SIM_CPHS_CSP_GROUP_VALUE_ADDED_SERVICES: + if (byteSignificance & 0x80) + p_csp->entry[j].service.value_added_services.b_restrict_menu_for_manual_selection = TRUE; - case 0x40: - p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_voice_mail = TRUE; - break; + if (byteSignificance & 0x40) + p_csp->entry[j].service.value_added_services.b_restrict_menu_for_voice_mail = TRUE; - case 0x20: - p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_mo_sms_and_paging = TRUE; - break; + if (byteSignificance & 0x20) + p_csp->entry[j].service.value_added_services.b_restrict_menu_for_mo_sms_and_paging = TRUE; - case 0x10: - p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_mo_sms_with_emial_type = TRUE; - break; + if (byteSignificance & 0x10) + p_csp->entry[j].service.value_added_services.b_restrict_menu_for_mo_sms_with_emial_type = TRUE; - case 0x08: - p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_fax_calls = TRUE; - break; - - case 0x04: - p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_data_calls = TRUE; - break; + if (byteSignificance & 0x08) + p_csp->entry[j].service.value_added_services.b_restrict_menu_for_fax_calls = TRUE; - case 0x01: - p_csp->service_profile_entry[j].service.value_added_services.b_restrict_menu_for_change_language = TRUE; - break; + if (byteSignificance & 0x04) + p_csp->entry[j].service.value_added_services.b_restrict_menu_for_data_calls = TRUE; - default: - break; - } - mask = mask >> 1; - } + if (byteSignificance & 0x01) + p_csp->entry[j].service.value_added_services.b_restrict_menu_for_change_language = TRUE; break; - case 0xD5: - for (k = 0; k < 8; k++) { - switch (byteSignificance & mask) { - case 0x80: - case 0x40: - case 0x20: - case 0x10: - case 0x08: - case 0x04: - case 0x02: - case 0x01: - p_csp->service_profile_entry[j].service.information_numbers.b_information_numbers = TRUE; - break; - - default: - break; - } - mask = mask >> 1; - } + case SIM_CPHS_CSP_GROUP_INFORMATION_NUMBERS: + if (byteSignificance & 0xFF) + p_csp->entry[j].service.information_numbers.b_information_numbers = TRUE; break; default: @@ -2383,6 +2242,7 @@ gboolean tcore_sim_decode_csp(struct tel_sim_cphs_csp *p_csp, unsigned char *p_i return TRUE; } +#if 0 gboolean tcore_sim_encode_csp(unsigned char *p_out, int out_length, struct tel_sim_cphs_csp *p_csp) { unsigned char i, j = 0; @@ -2492,6 +2352,7 @@ gboolean tcore_sim_encode_csp(unsigned char *p_out, int out_length, struct tel_s return TRUE; } +#endif gboolean tcore_sim_decode_mwis(struct tel_sim_mw *pMwis, unsigned char *p_in, int in_length) { @@ -2789,10 +2650,8 @@ gboolean tcore_sim_decode_isim_impi(struct tel_sim_impi *p_out, unsigned char *p err("invalid length. in_length[%d] < TLV_len[%d] + 2", in_length, len); p_out->impi = calloc(1, len + 1); - memcpy(p_out->impi, &p_in[2], len); - return TRUE; } @@ -2814,7 +2673,8 @@ gboolean tcore_sim_decode_isim_domain(struct tel_sim_domain *p_out, unsigned cha if (in_length < len + 2) err("invalid length. in_length[%d] < TLV_len[%d] + 2", in_length, len); - p_out->domain = g_memdup(&p_in[2], len); + p_out->domain = calloc(1, len+1); + memcpy(p_out->domain, &p_in[2], len); return TRUE; } @@ -2837,7 +2697,8 @@ gboolean tcore_sim_decode_isim_impu(struct tel_sim_impu *p_out, unsigned char *p if (in_length < len + 2) err("invalid length. in_length[%d] < TLV_len[%d] + 2", in_length, len); - p_out->impu = g_memdup(&p_in[2], len); + p_out->impu = calloc(1, len+1); + memcpy(p_out->impu, &p_in[2], len); return TRUE; } @@ -2881,7 +2742,8 @@ gboolean tcore_sim_decode_isim_pcscf(struct tel_sim_pcscf *p_out, unsigned char * So, no need to convert it to UTF-8. */ if (p_out->type == SIM_PCSCF_TYPE_FQDN) { - p_out->pcscf = g_memdup(&p_in[3], len - 1); + p_out->pcscf = calloc(1, len); + memcpy(p_out->pcscf, &p_in[3], len-1); } else { unsigned char buf[255] = {0, }; unsigned short buf_len; @@ -2889,8 +2751,10 @@ gboolean tcore_sim_decode_isim_pcscf(struct tel_sim_pcscf *p_out, unsigned char ret = tcore_util_convert_string_to_utf8(buf, &buf_len, ALPHABET_FORMAT_SMS_DEFAULT, (const unsigned char *)&p_in[3], len - 1); - if (ret) - p_out->pcscf = g_memdup(buf, buf_len); + if (ret) { + p_out->pcscf = calloc(1, buf_len+1); + memcpy(p_out->pcscf, buf, buf_len); + } } return TRUE; @@ -3147,7 +3011,7 @@ gboolean tcore_sim_decode_pnn(struct tel_sim_pnn *p_pnn, unsigned char *p_in, in if (_is_empty(p_in, in_length) == TRUE) { memset(p_pnn, 0x00, sizeof(struct tel_sim_pnn)); - return FALSE; /* this is empty record */ + return TRUE; /* this is empty record */ } /* Full name for network IEI(Information Element Identifier), 0x43 */ @@ -3656,6 +3520,125 @@ EXIT: return ret; } +enum tel_sim_access_result tcore_sim_decode_status_word(unsigned short status_word1, unsigned short status_word2) +{ + enum tel_sim_access_result rst = SIM_ACCESS_CARD_ERROR; + + err("status_word [0x%x][0x%x]", status_word1, status_word2); + switch(status_word1) { + case 0x93: + if (status_word2 == 0x00) { + err("error - SIM application toolkit busy"); + rst = SIM_ACCESS_FAILED; + } + break; + case 0x94: + switch(status_word2) { + case 0x00: + err("error - No EF Selected]"); + rst = SIM_ACCESS_FAILED; + break; + case 0x02: + err("error - Out of Range - Invalid address or record number"); + rst = SIM_ACCESS_FAILED; + break; + case 0x04: + /*Failed SIM request command*/ + err("error - File ID not found"); + rst = SIM_ACCESS_FILE_NOT_FOUND; + break; + case 0x08: + /* MOdem not support */ + err("error - File is inconsistent with command - Modem not support or USE IPC"); + rst = SIM_ACCESS_FAILED; + break; + default: + err("Not able to map. Will throw default error"); + break; + } + break; + case 0x98: + switch(status_word2) { + case 0x02: + err("error - CHV not initialized "); + rst = SIM_ACCESS_CONDITION_NOT_SATISFIED; + break; + case 0x04: + err("error - Access condition not fullfilled"); + rst = SIM_ACCESS_CONDITION_NOT_SATISFIED; + break; + case 0x08: + /*Failed SIM request command*/ + err("error - Contradiction with CHV status"); + rst = SIM_ACCESS_CONDITION_NOT_SATISFIED; + break; + case 0x10: + /*Failed SIM request command*/ + err("error - Contradiction with invalidation status"); + rst = SIM_ACCESS_CONDITION_NOT_SATISFIED; + break; + case 0x40: + /*Failed SIM request command*/ + err("error -Unsuccessful CHV verification - no attempt left/Unblock CHV/CHV blocked"); + rst = SIM_ACCESS_CONDITION_NOT_SATISFIED; + break; + default: + err("Not able to map. Will throw default error"); + break; + } + break; + case 0x67: + if (status_word2 == 0x00) { + err("error -Incorrect Parameter 3"); + rst = SIM_ACCESS_FAILED; + } + break; + case 0x6B: + if (status_word2 == 0x00) { + err("error -Incorrect Parameter 1 or 2"); + rst = SIM_ACCESS_FAILED; + } + break; + case 0x6D: + if (status_word2 == 0x00) { + err("error -Unknown instruction given as command"); + rst = SIM_ACCESS_FAILED; + } + break; + case 0x6E: + if (status_word2 == 0x00) { + err("error -Unknown instruction given as command"); + rst = SIM_ACCESS_CONDITION_NOT_SATISFIED; + } + break; + case 0x69: + if (status_word2 == 0x82) { + err("error -Access denied"); + rst = SIM_ACCESS_CONDITION_NOT_SATISFIED; + } + break; + case 0x6A: + if (status_word2 == 0x87) { + err("error -Incorrect parameters"); + rst = SIM_ACCESS_FAILED; + } else if (status_word2 == 0x82) { + err("error -File Not found"); + rst = SIM_ACCESS_FILE_NOT_FOUND; /* not sure of the SW1 and SW2 meaning here */ + } else if (status_word2 == 0x83) { + err("error -Record Not found "); + rst = SIM_ACCESS_FILE_NOT_FOUND; /* not sure of the SW1 and SW2 meaning here */ + } else { + err("Not able to map. Will throw default error"); + } + break; + default: + err("Not able to map. Will throw default error"); + break; + } + err("Error returned %d", rst); + return rst; +} + enum tel_sim_status tcore_sim_get_status(CoreObject *o) { struct private_object_data *po = NULL; @@ -3766,7 +3749,35 @@ gboolean tcore_sim_set_imsi(CoreObject *o, const struct tel_sim_imsi *imsi) return TRUE; } -struct tel_sim_msisdn_list *tcore_sim_get_msisdn_list(CoreObject *o) +struct tel_sim_imsi* tcore_sim_get_imsi_m(CoreObject *o) +{ + struct tel_sim_imsi *tmp_imsi; + struct private_object_data *po = NULL; + po = tcore_object_ref_object(o); + if (!po) { + dbg("po access fail"); + return NULL; + } + tmp_imsi = calloc(1, sizeof(struct tel_sim_imsi)); + memcpy(tmp_imsi, &po->imsi_m, sizeof(struct tel_sim_imsi)); + dbg("imsi_m mcc//mnc(%s)", tmp_imsi->plmn); + return tmp_imsi; +} + +gboolean tcore_sim_set_imsi_m(CoreObject *o, const struct tel_sim_imsi *imsi_m) +{ + struct private_object_data *po = NULL; + po = tcore_object_ref_object(o); + if (!po) { + dbg("po access fail"); + return FALSE; + } + memcpy(&po->imsi_m, imsi_m, sizeof(struct tel_sim_imsi)); + dbg("imsi_m mcc//mnc(%s)", imsi_m->plmn); + return TRUE; +} + +struct tel_sim_msisdn_list* tcore_sim_get_msisdn_list(CoreObject *o) { struct private_object_data *po = NULL; @@ -4254,7 +4265,7 @@ static void tcore_sim_initialize_context(CoreObject *o) po->sim_status = SIM_STATUS_UNKNOWN; } -unsigned char tcore_sim_get_app_list(CoreObject *o) +enum tel_sim_app_type tcore_sim_get_app_list(CoreObject *o) { struct private_object_data *po = NULL; @@ -4267,7 +4278,7 @@ unsigned char tcore_sim_get_app_list(CoreObject *o) return po->app_list; } -gboolean tcore_sim_set_app_list(CoreObject *o, unsigned char app_list) +gboolean tcore_sim_set_app_list(CoreObject *o, enum tel_sim_app_type app_list) { struct private_object_data *po = NULL; @@ -4300,7 +4311,7 @@ struct tel_sim_ist *tcore_sim_get_isim_service_table(CoreObject *o) return g_memdup(po->ist, sizeof(struct tel_sim_ist)); } -gboolean tcore_sim_set_isim_service_table(CoreObject *o, struct tel_sim_ist *ist) +gboolean tcore_sim_set_isim_service_table(CoreObject *o, const struct tel_sim_ist *ist) { struct private_object_data *po = NULL; @@ -4333,13 +4344,102 @@ enum tcore_return tcore_sim_delete_isim_service_table(CoreObject *o) } if (po->ist) { - free(po->ist); + g_free(po->ist); po->ist = NULL; } return TCORE_RETURN_SUCCESS; } +char *tcore_sim_get_isim_impi(CoreObject *o) +{ + struct private_object_data *po = NULL; + + po = tcore_object_ref_object(o); + if (!po) { + err("po access fail"); + return NULL; + } + + if (!po->impi) { + err("po->impi is NULL"); + return NULL; + } + + return g_strdup(po->impi); +} + +gboolean tcore_sim_set_isim_impi(CoreObject *o, const char *impi) +{ + struct private_object_data *po = NULL; + + po = tcore_object_ref_object(o); + if (!po) { + err("po access fail"); + return FALSE; + } + + if (!impi) { + err("impi is NULL"); + return FALSE; + } + + if (po->impi) + g_free(po->impi); + + po->impi = g_strdup(impi); + + return TRUE; +} + +enum tcore_return tcore_sim_delete_isim_impi(CoreObject *o) +{ + struct private_object_data *po = NULL; + po = tcore_object_ref_object(o); + if (!po) { + err("po access fail"); + return TCORE_RETURN_EINVAL; + } + + if (po->impi) { + g_free(po->impi); + po->impi = NULL; + } + + return TCORE_RETURN_SUCCESS; +} + +gboolean tcore_sim_is_jio_sim(CoreObject *co_sim) +{ + struct tel_sim_imsi *imsi = NULL; + int index, count; + + const char *jio_plmn_list[] = { + /* RJIL */ + "405840", "405854", "405855", "405856", "405857", "405858", "405859", "405860", + "405861", "405862", "405863", "405864", "405865", "405866", "405867", "405868", + "405869", "405870", "405871", "405872", "405873", "405874", + }; + + imsi = tcore_sim_get_imsi(co_sim); + if (!imsi) { + err("imsi : NULL"); + return FALSE; + } + + count = sizeof(jio_plmn_list)/sizeof(jio_plmn_list[0]); + for (index = 0; index < count; index++) { + if (g_strcmp0(imsi->plmn, jio_plmn_list[index]) == 0) { + dbg("Jio SIM - PLMN: [%s]", imsi->plmn); + g_free(imsi); + return TRUE; + } + } + + g_free(imsi); + return FALSE; +} + CoreObject *tcore_sim_new(TcorePlugin *p, const char *name, struct tcore_sim_operations *ops, TcoreHal *hal) { diff --git a/src/core_object/co_ss.c b/src/core_object/co_ss.c index 45a8830..2e8dc82 100644 --- a/src/core_object/co_ss.c +++ b/src/core_object/co_ss.c @@ -213,8 +213,10 @@ static void _free_hook(CoreObject *o) struct private_object_data *po = NULL; po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return; + } free(po); tcore_object_link_object(o, NULL); @@ -234,8 +236,10 @@ struct ussd_session *tcore_ss_ussd_create_session(CoreObject *o, struct private_object_data *po = NULL; po = tcore_object_ref_object(o); - if (!po) - return 0; + if (!po) { + err("po is NULL"); + return NULL; + } if (type < TCORE_SS_USSD_TYPE_USER_INITIATED || type > TCORE_SS_USSD_TYPE_NETWORK_INITIATED) { @@ -274,8 +278,10 @@ struct ussd_session *tcore_ss_ussd_get_session(CoreObject *o) struct private_object_data *po = NULL; po = tcore_object_ref_object(o); - if (!po) - return 0; + if (!po) { + err("po is NULL"); + return NULL; + } if (!po->ussd_s.session) return 0; @@ -331,8 +337,10 @@ void tcore_ss_set_ussd_routing(CoreObject *o, enum tcore_ussd_routing_policy uss struct private_object_data *po = NULL; po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return; + } po->routing_policy.ussd_routing_policy = ussd_routing_policy; } @@ -342,8 +350,10 @@ enum tcore_ussd_routing_policy tcore_ss_get_ussd_routing(CoreObject *o) struct private_object_data *po = NULL; po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_SS_USSD_ROUTING_POLICY_CS_ALWAYS; /* 'default' to CS */ + } return po->routing_policy.ussd_routing_policy; } @@ -353,8 +363,10 @@ void tcore_ss_set_ss_routing(CoreObject *o, enum tcore_ss_routing_policy ss_rout struct private_object_data *po = NULL; po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return; + } po->routing_policy.ss_routing_policy = ss_routing_policy; } @@ -364,8 +376,10 @@ enum tcore_ss_routing_policy tcore_ss_get_ss_routing(CoreObject *o) struct private_object_data *po = NULL; po = tcore_object_ref_object(o); - if (!po) + if (!po) { + err("po is NULL"); return TCORE_SS_ROUTING_POLICY_CS_ALWAYS; /* 'default' to CS */ + } return po->routing_policy.ss_routing_policy; } @@ -391,8 +405,8 @@ CoreObject *tcore_ss_new(TcorePlugin *p, const char *name, /* set ops to default type when core object is created. */ po->ops[TCORE_OPS_TYPE_CP] = ops; - po->routing_policy.ss_routing_policy = TCORE_SS_ROUTING_POLICY_CS_ALWAYS; /* 'default' to CS */ - po->routing_policy.ussd_routing_policy = TCORE_SS_USSD_ROUTING_POLICY_CS_ALWAYS; /* 'default' to CS */ + po->routing_policy.ss_routing_policy = TCORE_SS_ROUTING_POLICY_IMS_CS; /* 'default' to IMS_CS */ + po->routing_policy.ussd_routing_policy = TCORE_SS_USSD_ROUTING_POLICY_IMS_CS; /* 'default' to IMS_CS */ _ussd_session_init(&po->ussd_s); diff --git a/src/core_object/core_object.c b/src/core_object/core_object.c index 163bfa0..6cb9d3f 100644 --- a/src/core_object/core_object.c +++ b/src/core_object/core_object.c @@ -55,6 +55,7 @@ struct tcore_object_type { char *name; TcorePlugin *parent_plugin; + enum telephony_subscription_type subs_type; void *object; void *user_data; @@ -483,9 +484,24 @@ CoreObject *tcore_object_new(TcorePlugin *plugin, tcore_object_set_hal(co, hal); tcore_object_set_name(co, name); - if (plugin) + if (plugin) { + enum telephony_subscription_type subs_type; + const char *cp_name; + tcore_plugin_add_core_object(plugin, co); + cp_name = tcore_server_get_cp_name_by_plugin(plugin); + if (cp_name == NULL) { + /* Use 'default' subscription */ + subs_type = TELEPHONY_SUBSCRIPTION_TYPE_DEFAULT; + } else { + subs_type = tcore_subscription_get_subscription_type(cp_name); + } + + /* Update Subscription type */ + co->subs_type = subs_type; + } + return co; } @@ -535,6 +551,14 @@ void tcore_object_free(CoreObject *co) free(co); } +enum telephony_subscription_type tcore_object_ref_subscription_type(CoreObject *co) +{ + if (!co) + return TELEPHONY_SUBSCRIPTION_TYPE_DEFAULT; + + return co->subs_type; +} + const char *tcore_object_ref_name(CoreObject *co) { if (!co) diff --git a/src/hal.c b/src/hal.c index e422fca..76fa7b5 100644 --- a/src/hal.c +++ b/src/hal.c @@ -208,6 +208,14 @@ char *tcore_hal_get_name(TcoreHal *hal) return NULL; } +char *tcore_hal_ref_name(TcoreHal *hal) +{ + if (!hal) + return NULL; + + return hal->name; +} + TcoreAT *tcore_hal_get_at(TcoreHal *hal) { if (!hal) @@ -380,7 +388,9 @@ TReturn tcore_hal_dispatch_response_data(TcoreHal *hal, int id, } } else { if (hal->mode == TCORE_HAL_MODE_CUSTOM) { +#ifdef TCORE_HAL_DEBUG dbg("TCORE_HAL_MODE_CUSTOM"); +#endif p = tcore_queue_pop_by_id(hal->queue, id); if (!p) { dbg("unknown pending (id=0x%x)", id); @@ -553,6 +563,7 @@ TReturn tcore_hal_set_power(TcoreHal *hal, gboolean flag) return hal->ops->power(hal, flag); } + TReturn tcore_hal_setup_netif(TcoreHal *hal, CoreObject *co, TcoreHalSetupNetifCallback func, void *user_data, unsigned int cid, gboolean enable) @@ -562,3 +573,20 @@ TReturn tcore_hal_setup_netif(TcoreHal *hal, CoreObject *co, return hal->ops->setup_netif(co, func, user_data, cid, enable); } + +TReturn tcore_hal_control_nvdata(TcoreHal *hal, int option) +{ + if ((hal == NULL) || (hal->ops == NULL) || (hal->ops->control_nvdata == NULL)) + return TCORE_RETURN_EINVAL; + + return hal->ops->control_nvdata(hal, option); +} + +TReturn tcore_hal_reset(TcoreHal *hal, int option) +{ + if ((hal == NULL) || (hal->ops == NULL) || (hal->ops->reset == NULL)) + return TCORE_RETURN_EINVAL; + + return hal->ops->reset(hal, option); +} + diff --git a/src/plugin.c b/src/plugin.c index f6b247b..04801f3 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -286,7 +286,7 @@ TReturn tcore_plugin_link_property(TcorePlugin *plugin, const char *key, void *d prev = g_hash_table_lookup(plugin->property, key); if (prev != NULL) { free(prev); - g_hash_table_replace(plugin->property, (gpointer)key, data); + g_hash_table_insert(plugin->property, (gpointer)key, data); } else g_hash_table_insert(plugin->property, strdup(key), data); diff --git a/src/server.c b/src/server.c index 1451513..18cee83 100644 --- a/src/server.c +++ b/src/server.c @@ -93,10 +93,10 @@ static gint _compare_priority(gconstpointer a, gconstpointer b) tcore_plugin_get_description(plugin2)->priority; } -static char *_server_enumerate_modem(TcorePlugin *plugin) +static gchar *_server_enumerate_modem(TcorePlugin *plugin) { static unsigned int cp_counter = 0; - const char *filename; + const gchar *filename; if (plugin == NULL) return NULL; @@ -170,7 +170,7 @@ Server *tcore_server_new() { Server *s; - s = calloc(1, sizeof(struct tcore_server_type)); + s = g_try_malloc0(sizeof(Server)); if (!s) { err("Server allocation failed!!!"); return NULL; @@ -179,18 +179,10 @@ Server *tcore_server_new() s->mainloop = g_main_loop_new(NULL, FALSE); if (!s->mainloop) { err("mainloop creation failed!!!"); - free(s); + g_free(s); return NULL; } - s->plugins = NULL; - s->communicators = NULL; - s->storages = NULL; - s->hals = NULL; - s->hook_list_request = NULL; - s->hook_list_notification = NULL; - s->default_plugin = NULL; - return s; } @@ -234,7 +226,7 @@ void tcore_server_free(Server *s) g_main_loop_unref(s->mainloop); /* Free server */ - free(s); + g_free(s); dbg("Freeing Server"); } @@ -303,7 +295,6 @@ TcorePlugin *tcore_server_find_plugin(Server *s, const char *name) GSList *list; TcoreModem *modem; - dbg("Name: [%s]", name); if (g_strcmp0(TCORE_PLUGIN_DEFAULT, name) == 0) return _find_default_plugin(s); @@ -316,11 +307,35 @@ TcorePlugin *tcore_server_find_plugin(Server *s, const char *name) return modem->modem_plugin; } - err("Modem plugin not found"); + err("Modem plugin (%s) not found", name); return NULL; } +TcorePlugin *tcore_server_search_plugin_list(Server *s, const char *desc_name){ + GSList *list; + TcorePlugin* plugin = NULL; + struct tcore_plugin_define_desc *desc = NULL; + + dbg("Name: [%s]", desc_name); + + for(list = s->plugins; list; list = list->next){ + plugin = list->data; + + if(plugin == NULL) + continue; + desc = (struct tcore_plugin_define_desc *)tcore_plugin_get_description(plugin); + + if(g_strcmp0(desc->name, desc_name) == 0){ + return plugin; + } + desc = NULL; + } + err("plugin with desc_name %s not found"); + return NULL; +} + + GSList *tcore_server_ref_plugins(Server *s) { if (!s) @@ -486,7 +501,8 @@ TcoreHal *tcore_server_find_hal(Server *s, const char *name) return NULL; } -TReturn tcore_server_dispatch_request(Server *s, UserRequest *ur) +TReturn tcore_server_dispatch_request_ex(Server *s, + UserRequest *ur, enum tcore_ops_type ops_type) { char *modem_name = NULL; TcorePlugin *p; @@ -497,32 +513,6 @@ TReturn tcore_server_dispatch_request(Server *s, UserRequest *ur) CoreObject *o; TReturn ret = TCORE_RETURN_ENOSYS; TReturn prev_ret = TCORE_RETURN_FAILURE; - enum tcore_ops_type ops_type = TCORE_OPS_TYPE_CP; - - if (!s || !ur) - return TCORE_RETURN_EINVAL; - - /* In case Manager is available, process Request in Manager */ - if (s->manager) { - enum tcore_manager_return mgr_ret; - - mgr_ret = tcore_manager_dispatch_request(s->manager, ur); - switch (mgr_ret) { - case TCORE_MANAGER_RETURN_FAILURE: - return TCORE_RETURN_FAILURE; - - case TCORE_MANAGER_RETURN_STOP: - return TCORE_RETURN_SUCCESS; - - case TCORE_MANAGER_RETURN_CONTINUE_IMS: - ops_type = TCORE_OPS_TYPE_IMS; - break; - - default: - ops_type = TCORE_OPS_TYPE_CP; - break; - } - } for (list = s->hook_list_request; list; list = list->next) { hook = list->data; @@ -588,6 +578,38 @@ TReturn tcore_server_dispatch_request(Server *s, UserRequest *ur) return ret; } +TReturn tcore_server_dispatch_request(Server *s, UserRequest *ur) +{ + enum tcore_ops_type ops_type = TCORE_OPS_TYPE_CP; + + if (!s || !ur) + return TCORE_RETURN_EINVAL; + + /* In case Manager is available, process Request in Manager */ + if (s->manager) { + enum tcore_manager_return mgr_ret; + + mgr_ret = tcore_manager_dispatch_request(s->manager, ur); + switch (mgr_ret) { + case TCORE_MANAGER_RETURN_FAILURE: + return TCORE_RETURN_FAILURE; + + case TCORE_MANAGER_RETURN_STOP: + return TCORE_RETURN_SUCCESS; + + case TCORE_MANAGER_RETURN_CONTINUE_IMS: + ops_type = TCORE_OPS_TYPE_IMS; + break; + + default: + ops_type = TCORE_OPS_TYPE_CP; + break; + } + } + + return tcore_server_dispatch_request_ex(s, ur, ops_type); +} + TReturn tcore_server_broadcast_notification(Server *s, CoreObject *source, enum tcore_notification_command command, unsigned int data_len, void *data) { @@ -791,8 +813,6 @@ GSList *tcore_server_get_cp_name_list(Server *s) GSList *list; TcoreModem *modem; - int i = 0; - if (s == NULL) { err("Server is NULL"); return NULL; @@ -801,12 +821,11 @@ GSList *tcore_server_get_cp_name_list(Server *s) for (list = s->modems; list; list = list->next) { modem = list->data; if (modem == NULL) { - dbg("No modem - continue"); + warn("No modem - continue"); continue; } /* Add CP name to 'cp_name_list' */ - dbg("[%d] CP Name: [%s]", i++, modem->cp_name); cp_name_list = g_slist_append(cp_name_list, g_strdup(modem->cp_name)); } diff --git a/src/storage.c b/src/storage.c index 75b4870..48a9060 100644 --- a/src/storage.c +++ b/src/storage.c @@ -285,7 +285,7 @@ gboolean tcore_storage_update_query_database(Storage *strg, void *handle, gboolean tcore_storage_read_query_database(Storage *strg, void *handle, const char *query, GHashTable *in_param, - GHashTable *out_param, int out_param_cnt) + GHashTable **out_param, int out_param_cnt) { if (!strg || !handle || !query) return FALSE; diff --git a/src/subscription.c b/src/subscription.c new file mode 100644 index 0000000..cb9f968 --- /dev/null +++ b/src/subscription.c @@ -0,0 +1,41 @@ +/* + * libtcore + * + * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Ja-young Gu + * + * 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 +#include +#include + +#include + +#include "tcore.h" +#include "server.h" +#include "plugin.h" + +enum telephony_subscription_type tcore_subscription_get_subscription_type(const char *cp_name) +{ + if (g_str_has_suffix((const gchar *)cp_name, "0")) { + return TELEPHONY_SUBSCRIPTION_TYPE_PRIMARY; + } else if (g_str_has_suffix((const gchar *)cp_name, "1")) { + return TELEPHONY_SUBSCRIPTION_TYPE_SECONDARY; + } else { + /* Return 'default' subscription */ + return TELEPHONY_SUBSCRIPTION_TYPE_DEFAULT; + } +} \ No newline at end of file diff --git a/src/util.c b/src/util.c index d775eaa..fef6d71 100644 --- a/src/util.c +++ b/src/util.c @@ -788,6 +788,33 @@ try_again: return TRUE; } +gboolean tcore_util_convert_gsm7bit_to_utf8(unsigned char *dest, unsigned short *dest_len, + const unsigned char *src, unsigned short src_len) +{ + unsigned char *tmp_dest_str = NULL; + unsigned int tmp_dest_str_len = 0; + dbg("src=[%s], src_len=[%d]", src, src_len); + + if (src == NULL || src_len == 0) { + err("src is NULL or src_len is 0"); + return FALSE; + } + + + tmp_dest_str = (unsigned char *)tcore_util_unpack_gsm7bit_ex((const unsigned char *)src, src_len, &tmp_dest_str_len); + + if (!tmp_dest_str) { + err("temp_dest_str is NULL"); + return FALSE; + } + _convert_gsm_to_utf8(dest, dest_len, tmp_dest_str, tmp_dest_str_len); + + if (tmp_dest_str) + free(tmp_dest_str); + + return TRUE; +} + gboolean tcore_util_convert_string_to_utf8(unsigned char *dest, unsigned short *dest_len, enum alphabet_format dcs, const unsigned char *src, unsigned short src_len) { @@ -1536,7 +1563,7 @@ void tcore_util_hex_dump(const char *pad, int size, const void *data) if ((i + 1) % 8 == 0) { if ((i + 1) % 16 == 0) { - dbg("%s", buf); + msg("%s", buf); memset(buf, 0, 255); snprintf(buf, 255, "%s%04X: ", pad, i + 1); } else @@ -1544,7 +1571,63 @@ void tcore_util_hex_dump(const char *pad, int size, const void *data) } } - dbg("%s", buf); + msg("%s", buf); +} + +unsigned char *tcore_util_unpack_gsm7bit_ex(const unsigned char *src, unsigned int src_len, unsigned int *out_len) +{ + unsigned char *dest; + int i = 0, j = 0; + unsigned int pos = 0; + unsigned char shift = 0; + int outlen = 0; + + if (!src || src_len == 0) + return NULL; + + outlen = (src_len * 8) / 7; + + dest = calloc(1, outlen + 1); + if (!dest) + return NULL; + + for (i = 0; pos < src_len; i++, pos++) { + dest[i] = (src[pos] << shift) & 0x7F; + + if (pos != 0) { + /* + * except the first byte, a character contains some bits + * from the previous byte. + */ + dest[i] |= src[pos - 1] >> (8 - shift); + } + + shift++; + + if (shift == 7) { + shift = 0; + + /* a possible extra complete character is available */ + i++; + dest[i] = src[pos] >> 1; + } + } + + /* If a character is '\r'(13), change it to space(32) */ + for (i = 0, j = 0; i < outlen; i++, j++) { + if (dest[i] == '\r') + dest[j] = ' '; + else if (dest[i] == 0x1B) /* If a charater is 0x1B (escape), next charater is changed on gsm 7bit extension table */ + dest[j] = _convert_gsm7bit_extension(dest[++i]); + else + dest[j] = dest[i]; + } + + outlen -= (i - j); + + dest[outlen] = '\0'; + *out_len = outlen; + return dest; } unsigned char *tcore_util_unpack_gsm7bit(const unsigned char *src, unsigned int src_len) @@ -1603,6 +1686,50 @@ unsigned char *tcore_util_unpack_gsm7bit(const unsigned char *src, unsigned int return dest; } +unsigned char *tcore_util_pack_gsm7bit_ex(const unsigned char *src, unsigned int src_len, unsigned int *dest_len) +{ + unsigned char *dest; + unsigned int i = 0; + unsigned int pos = 0, shift = 0; + unsigned int outlen = 0; + + if (!src || src_len == 0) + return NULL; + + outlen = ((src_len * 7) / 8) + 1; + + dest = calloc(1, outlen + 1); + if (!dest) + return NULL; + + for (pos = 0, i = 0; i < src_len; pos++, i++) { + if (pos >= outlen) { + free(dest); + return NULL; + } + + /* pack the low bits */ + dest[pos] = src[i] >> shift; + + if (i + 1 < src_len) { + /* pack the high bits using the low bits of the next character */ + dest[pos] |= src[i + 1] << (7 - shift); + + shift++; + + if (shift == 7) { + shift = 0; + i++; + } + } else { + if (shift == 6) + dest[pos] |= 0x1a; + } + } + *dest_len = pos; + return dest; +} + unsigned char *tcore_util_pack_gsm7bit(const unsigned char *src, unsigned int src_len) { unsigned char *dest; @@ -2033,3 +2160,4 @@ gboolean tcore_util_is_country_NA(char *plmn) return FALSE; } + -- 2.7.4