char* tcore_at_tok_extract(const char *src);
char* tcore_at_tok_nth(GSList *tokens, unsigned int token_index);
-
+TReturn tcore_prepare_and_send_at_request(CoreObject *co,
+ const char *at_cmd,
+ const char *at_cmd_prefix,
+ enum tcore_at_command_type at_cmd_type,
+ UserRequest *ur,
+ TcorePendingResponseCallback resp_cb,
+ void *resp_cb_data,
+ TcorePendingSendCallback send_cb,
+ void *send_cb_data);
__END_DECLS
#endif
CoreObject* tcore_call_new(TcorePlugin *p, const char *name, struct tcore_call_operations *ops, TcoreHal *hal);
void tcore_call_free( CoreObject *o);
+CoreObject *tcore_call_clone(TcorePlugin *p, const char *name, TcoreHal *hal);
+void tcore_call_override_ops(CoreObject *o,
+ struct tcore_call_operations *call_ops,
+ struct tcore_call_control_operations *control_ops,
+ struct tcore_call_information_operations *info_ops);
// Call Object API
CallObject* tcore_call_object_new( CoreObject *o, int id );
CoreObject* tcore_context_new(TcorePlugin *p, const char *name, TcoreHal *hal);
void tcore_context_free(CoreObject *o);
+CoreObject *tcore_context_clone(TcorePlugin *p, const char *name, TcoreHal *hal);
+
TReturn tcore_context_set_state(CoreObject *o, enum co_context_state state);
enum co_context_state tcore_context_get_state(CoreObject *o);
TReturn tcore_context_set_id(CoreObject *o, unsigned int id);
CoreObject* tcore_gps_new(TcorePlugin *p, const char *name, struct tcore_gps_operations *ops, TcoreHal *hal);
void tcore_gps_free(CoreObject *o);
+CoreObject *tcore_gps_clone(TcorePlugin *p, const char *name, TcoreHal *hal);
+void tcore_gps_override_ops(CoreObject *o, struct tcore_gps_operations *gps_ops);
+
__END_DECLS
#endif
TReturn (*get_flight_mode)(CoreObject *o, UserRequest *ur);
};
-
CoreObject* tcore_modem_new(TcorePlugin *p, const char *name, struct tcore_modem_operations *ops, TcoreHal *hal);
void tcore_modem_free(CoreObject *o);
+CoreObject *tcore_modem_clone(TcorePlugin *p, const char *name, TcoreHal *hal);
+void tcore_modem_override_ops(CoreObject *o, struct tcore_modem_operations *modem_ops);
+
TReturn tcore_modem_set_flight_mode_state(CoreObject *o, gboolean flag);
gboolean tcore_modem_get_flight_mode_state(CoreObject *o);
TReturn tcore_modem_set_powered(CoreObject *o, gboolean pwr);
TReturn (*get_neighboring_cell_info)(CoreObject *o, UserRequest *ur);
};
-
CoreObject* tcore_network_new(TcorePlugin *plugin, const char *name,
struct tcore_network_operations *ops, TcoreHal *hal);
void tcore_network_free(CoreObject *co);
+CoreObject *tcore_network_clone(TcorePlugin *p, const char *name, TcoreHal *hal);
+void tcore_network_override_ops(CoreObject *o, struct tcore_network_operations *network_ops);
+
TReturn tcore_network_set_plmn(CoreObject *co, const char *plmn);
char* tcore_network_get_plmn(CoreObject *co);
CoreObject* tcore_phonebook_new(TcorePlugin *p, const char *name, struct tcore_phonebook_operations *ops, TcoreHal *hal);
void tcore_phonebook_free(CoreObject *n);
+CoreObject *tcore_phonebook_clone(TcorePlugin *p, const char *name, TcoreHal *hal);
+void tcore_phonebook_override_ops(CoreObject *o, struct tcore_phonebook_operations *phonebook_ops);
+
gboolean tcore_phonebook_get_status(CoreObject *o);
gboolean tcore_phonebook_set_status(CoreObject *o, gboolean b_init);
CoreObject* tcore_ps_new(TcorePlugin *p, const char *name, struct tcore_ps_operations *ops, TcoreHal *hal);
void tcore_ps_free(CoreObject *o);
+CoreObject *tcore_ps_clone(TcorePlugin *p, const char *name, TcoreHal *hal);
+void tcore_ps_override_ops(CoreObject *o, struct tcore_ps_operations *ps_ops);
+
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);
CoreObject* tcore_sap_new(TcorePlugin *p, const char *name, struct tcore_sap_operations *ops, TcoreHal *hal);
void tcore_sap_free(CoreObject *o);
+CoreObject *tcore_sap_clone(TcorePlugin *p, const char *name, TcoreHal *hal);
+void tcore_sap_override_ops(CoreObject *o, struct tcore_sap_operations *sap_ops);
+
__END_DECLS
#endif
CoreObject* tcore_sat_new(TcorePlugin *p, const char *name, struct tcore_sat_operations *ops, TcoreHal *hal);
void tcore_sat_free(CoreObject *n);
+CoreObject *tcore_sat_clone(TcorePlugin *p, const char *name, TcoreHal *hal);
+void tcore_sat_override_ops(CoreObject *o, struct tcore_sat_operations *sat_ops);
+
#endif
CoreObject* tcore_sim_new(TcorePlugin *p, const char *name, struct tcore_sim_operations *ops, TcoreHal *hal);
void tcore_sim_free(CoreObject *n);
+CoreObject *tcore_sim_clone(TcorePlugin *p, const char *name, TcoreHal *hal);
+void tcore_sim_override_ops(CoreObject *o, struct tcore_sim_operations *sim_ops);
+
enum tel_sim_type tcore_sim_get_type(CoreObject *o);
gboolean tcore_sim_set_type(CoreObject *o, enum tel_sim_type type);
CoreObject* tcore_sms_new(TcorePlugin *p, const char *name, struct tcore_sms_operations *ops, TcoreHal *hal);
void tcore_sms_free(CoreObject * n);
+CoreObject *tcore_sms_clone(TcorePlugin *p, const char *name, TcoreHal *hal);
+void tcore_sms_override_ops(CoreObject *o, struct tcore_sms_operations *sms_ops);
+
__END_DECLS
#endif
CoreObject* tcore_ss_new(TcorePlugin *p, const char *name, struct tcore_ss_operations *ops, TcoreHal *hal);
void tcore_ss_free(CoreObject *o);
+CoreObject *tcore_ss_clone(TcorePlugin *p, const char *name, TcoreHal *hal);
+void tcore_ss_override_ops(CoreObject *o, struct tcore_ss_operations *ss_ops);
+
struct ussd_session* tcore_ss_ussd_create_session( CoreObject *o, enum tcore_ss_ussd_type type, void *data, int data_len );
void tcore_ss_ussd_destroy_session( struct ussd_session *ussd_s );
struct ussd_session* tcore_ss_ussd_get_session( CoreObject *o );
TReturn tcore_object_set_clone_hook(CoreObject *co, CoreObjectCloneHook clone_hook);
CoreObject* tcore_object_clone(CoreObject *src, TcorePlugin *new_parent, const char *new_name);
+CoreObject *tcore_object_clone_template_object(TcorePlugin *p, const char *co_name, unsigned int co_type);
TReturn tcore_object_set_name(CoreObject *co, const char *name);
const char* tcore_object_ref_name(CoreObject *co);
GSList* tcore_server_ref_hals(Server *s);
TcoreHal* tcore_server_find_hal(Server *s, const char *name);
+TReturn tcore_server_add_template_object(Server *s, CoreObject *template_co);
+GSList *tcore_server_ref_template_object(Server *s);
+CoreObject *tcore_server_find_template_object(Server *s, unsigned int type);
+
TReturn tcore_server_link_udev(Server *s, TcoreUdev *udev);
TcoreUdev* tcore_server_ref_udev(Server *s);
#include "queue.h"
#include "user_request.h"
#include "at.h"
+#include "core_object.h"
#define NUM_ELEMS(x) (sizeof(x)/sizeof(x[0]))
#define MODE_HEX 0
dbg("AT is NULL !!!");
return FALSE;
}
+
+TReturn tcore_prepare_and_send_at_request(CoreObject *co,
+ const char *at_cmd,
+ const char *at_cmd_prefix,
+ enum tcore_at_command_type at_cmd_type,
+ UserRequest *ur,
+ TcorePendingResponseCallback resp_cb,
+ void *resp_cb_data,
+ TcorePendingSendCallback send_cb,
+ void *send_cb_data)
+{
+ TcorePending *pending = NULL;
+ TcoreATRequest *req = NULL;
+ TcoreHal *hal = NULL;
+ TReturn ret = TCORE_RETURN_FAILURE;
+
+ hal = tcore_object_get_hal(co);
+ if (!hal) {
+ dbg("HAL is NULL");
+ return ret;
+ }
+
+ /* Create Pending Request */
+ pending = tcore_pending_new(co, 0);
+ if (!pending) {
+ dbg("Pending is NULL");
+ return ret;
+ }
+
+ /* Create AT-Command Request */
+ req = tcore_at_request_new(at_cmd, at_cmd_prefix, at_cmd_type);
+ if (!req) {
+ dbg("Request is NULL");
+ tcore_pending_free(pending);
+ return ret;
+ }
+ dbg("AT Command: %s, Prefix(if any):%s, AT-Command length: %d", req->cmd, req->prefix, strlen(req->cmd));
+
+ tcore_pending_set_request_data(pending, 0, req);
+ tcore_pending_set_response_callback(pending, resp_cb, resp_cb_data);
+ tcore_pending_set_send_callback(pending, send_cb, send_cb_data);
+ tcore_pending_link_user_request(pending, ur);
+
+ ret = tcore_hal_send_request(hal, pending);
+ return ret;
+}
tcore_object_link_object(dest, dest_po);
}
+static void _clone_call_operations(struct private_object_data *po, struct tcore_call_operations *call_ops)
+{
+ if(call_ops->dial) {
+ po->ops->dial = call_ops->dial;
+ }
+ if(call_ops->answer) {
+ po->ops->answer = call_ops->answer;
+ }
+ if(call_ops->end) {
+ po->ops->end = call_ops->end;
+ }
+ if(call_ops->hold) {
+ po->ops->hold = call_ops->hold;
+ }
+ if(call_ops->active) {
+ po->ops->active = call_ops->active;
+ }
+ if(call_ops->swap) {
+ po->ops->swap = call_ops->swap;
+ }
+ if(call_ops->join) {
+ po->ops->join = call_ops->join;
+ }
+ if(call_ops->split) {
+ po->ops->split = call_ops->split;
+ }
+ if(call_ops->deflect) {
+ po->ops->deflect = call_ops->deflect;
+ }
+ if(call_ops->transfer) {
+ po->ops->transfer = call_ops->transfer;
+ }
+ if(call_ops->send_dtmf) {
+ po->ops->send_dtmf = call_ops->send_dtmf;
+ }
+ if(call_ops->set_sound_path) {
+ po->ops->set_sound_path = call_ops->set_sound_path;
+ }
+ if(call_ops->set_sound_volume_level) {
+ po->ops->set_sound_volume_level = call_ops->set_sound_volume_level;
+ }
+ if(call_ops->get_sound_volume_level) {
+ po->ops->get_sound_volume_level = call_ops->get_sound_volume_level;
+ }
+ if(call_ops->mute) {
+ po->ops->mute = call_ops->mute;
+ }
+ if(call_ops->unmute) {
+ po->ops->unmute = call_ops->unmute;
+ }
+ if(call_ops->get_mute_status) {
+ po->ops->get_mute_status = call_ops->get_mute_status;
+ }
+ if(call_ops->set_sound_recording) {
+ po->ops->set_sound_recording = call_ops->set_sound_recording;
+ }
+ if(call_ops->set_sound_equalization) {
+ po->ops->set_sound_equalization = call_ops->set_sound_equalization;
+ }
+ if(call_ops->set_sound_noise_reduction) {
+ po->ops->set_sound_noise_reduction = call_ops->set_sound_noise_reduction;
+ }
+ if(call_ops->set_active_line) {
+ po->ops->set_active_line = call_ops->set_active_line;
+ }
+ if(call_ops->get_active_line) {
+ po->ops->get_active_line = call_ops->get_active_line;
+ }
+ if(call_ops->activate_ccbs) {
+ po->ops->activate_ccbs = call_ops->activate_ccbs;
+ }
+
+ return;
+}
+
+static void _clone_call_control_operations(struct private_object_data *po, struct tcore_call_control_operations *control_ops)
+{
+ if(control_ops->answer_hold_and_accept) {
+ po->cops->answer_hold_and_accept = control_ops->answer_hold_and_accept;
+ }
+ if(control_ops->answer_replace) {
+ po->cops->answer_replace = control_ops->answer_replace;
+ }
+ if(control_ops->answer_reject) {
+ po->cops->answer_reject = control_ops->answer_reject;
+ }
+ if(control_ops->end_specific) {
+ po->cops->end_specific = control_ops->end_specific;
+ }
+ if(control_ops->end_all_active) {
+ po->cops->end_all_active = control_ops->end_all_active;
+ }
+ if(control_ops->end_all_held) {
+ po->cops->end_all_held = control_ops->end_all_held;
+ }
+ if(control_ops->active) {
+ po->cops->active = control_ops->active;
+ }
+ if(control_ops->hold) {
+ po->cops->hold = control_ops->hold;
+ }
+ if(control_ops->swap) {
+ po->cops->swap = control_ops->swap;
+ }
+ if(control_ops->join) {
+ po->cops->join = control_ops->join;
+ }
+ if(control_ops->split) {
+ po->cops->split = control_ops->split;
+ }
+ if(control_ops->transfer) {
+ po->cops->transfer = control_ops->transfer;
+ }
+ if(control_ops->deflect) {
+ po->cops->deflect = control_ops->deflect;
+ }
+
+ return;
+}
+
+static void _clone_call_info_operations(struct private_object_data *po, struct tcore_call_information_operations *info_ops)
+{
+ if(info_ops->mo_call_col) {
+ po->iops->mo_call_col = info_ops->mo_call_col;
+ }
+ if(info_ops->mo_call_waiting) {
+ po->iops->mo_call_waiting = info_ops->mo_call_waiting;
+ }
+ if(info_ops->mo_call_cug) {
+ po->iops->mo_call_cug = info_ops->mo_call_cug;
+ }
+ if(info_ops->mo_call_forwarded) {
+ po->iops->mo_call_forwarded = info_ops->mo_call_forwarded;
+ }
+ if(info_ops->mo_call_barred_incoming) {
+ po->iops->mo_call_barred_incoming = info_ops->mo_call_barred_incoming;
+ }
+ if(info_ops->mo_call_barred_outgoing) {
+ po->iops->mo_call_barred_outgoing = info_ops->mo_call_barred_outgoing;
+ }
+ if(info_ops->mo_call_deflected) {
+ po->iops->mo_call_deflected = info_ops->mo_call_deflected;
+ }
+ if(info_ops->mo_call_clir_suppression_reject) {
+ po->iops->mo_call_clir_suppression_reject = info_ops->mo_call_clir_suppression_reject;
+ }
+ if(info_ops->mo_call_cfu) {
+ po->iops->mo_call_cfu = info_ops->mo_call_cfu;
+ }
+ if(info_ops->mo_call_cfc) {
+ po->iops->mo_call_cfc = info_ops->mo_call_cfc;
+ }
+ if(info_ops->mt_call_cli) {
+ po->iops->mt_call_cli = info_ops->mt_call_cli;
+ }
+ if(info_ops->mt_call_cna) {
+ po->iops->mt_call_cna = info_ops->mt_call_cna;
+ }
+ if(info_ops->mt_call_forwarded_call) {
+ po->iops->mt_call_forwarded_call = info_ops->mt_call_forwarded_call;
+ }
+ if(info_ops->mt_call_cug_call) {
+ po->iops->mt_call_cug_call = info_ops->mt_call_cug_call;
+ }
+ if(info_ops->mt_call_deflected_call) {
+ po->iops->mt_call_deflected_call = info_ops->mt_call_deflected_call;
+ }
+ if(info_ops->mt_call_transfered) {
+ po->iops->mt_call_transfered = info_ops->mt_call_transfered;
+ }
+ if(info_ops->call_held) {
+ po->iops->call_held = info_ops->call_held;
+ }
+ if(info_ops->call_active) {
+ po->iops->call_active = info_ops->call_active;
+ }
+ if(info_ops->call_joined) {
+ po->iops->call_joined = info_ops->call_joined;
+ }
+ if(info_ops->call_released_on_hold) {
+ po->iops->call_released_on_hold = info_ops->call_released_on_hold;
+ }
+ if(info_ops->call_transfer_alert) {
+ po->iops->call_transfer_alert = info_ops->call_transfer_alert;
+ }
+ if(info_ops->call_transfered) {
+ po->iops->call_transfered = info_ops->call_transfered;
+ }
+ if(info_ops->call_cf_check_message) {
+ po->iops->call_cf_check_message = info_ops->call_cf_check_message;
+ }
+
+ return;
+}
+
static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
{
enum tcore_request_command command;
po->iops = ops;
}
+void tcore_call_override_ops(CoreObject *o,
+ struct tcore_call_operations *call_ops,
+ struct tcore_call_control_operations *control_ops,
+ struct tcore_call_information_operations *info_ops)
+{
+ struct private_object_data *po = NULL;
+
+ CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_CALL);
+
+ po = (struct private_object_data *)tcore_object_ref_object(o);
+ if (!po) {
+ return;
+ }
+
+ if(call_ops) {
+ _clone_call_operations(po, call_ops);
+ }
+
+ if(control_ops) {
+ _clone_call_control_operations(po, control_ops);
+ }
+
+ if(info_ops) {
+ _clone_call_info_operations(po, info_ops);
+ }
+
+ return;
+}
+
CoreObject *tcore_call_new(TcorePlugin *p, const char *name, struct tcore_call_operations *ops, TcoreHal *hal)
{
CoreObject *o = NULL;
return o;
}
+CoreObject *tcore_call_clone(TcorePlugin *p, const char *name, TcoreHal *hal)
+{
+ CoreObject *o = NULL;
+
+ if (!p)
+ return NULL;
+
+ o = tcore_object_clone_template_object(p, name, CORE_OBJECT_TYPE_CALL);
+ if (!o)
+ return NULL;
+
+ tcore_object_set_hal(o, hal);
+
+ return o;
+}
+
void tcore_call_free(CoreObject *o)
{
struct private_object_data *po = NULL;
return o;
}
+CoreObject *tcore_context_clone(TcorePlugin *p, const char *name, TcoreHal *hal)
+{
+ CoreObject *o = NULL;
+
+ if (!p)
+ return NULL;
+
+ o = tcore_object_clone_template_object(p, name, CORE_OBJECT_TYPE_PS_CONTEXT);
+ if (!o)
+ return NULL;
+
+ tcore_object_set_hal(o, hal);
+
+ return o;
+}
+
void tcore_context_free(CoreObject *o)
{
struct private_object_data *po = NULL;
tcore_object_link_object(dest, dest_po);
}
+static void _clone_gps_operations(struct private_object_data *po, struct tcore_gps_operations *gps_ops)
+{
+ if(gps_ops->confirm_measure_pos) {
+ po->ops->confirm_measure_pos = gps_ops->confirm_measure_pos;
+ }
+
+ return;
+}
+
static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
{
enum tcore_request_command command;
return TCORE_RETURN_SUCCESS;
}
+void tcore_gps_override_ops(CoreObject *o, struct tcore_gps_operations *gps_ops)
+{
+ struct private_object_data *po = NULL;
+
+ CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_GPS);
+
+ po = (struct private_object_data *)tcore_object_ref_object(o);
+ if (!po) {
+ return;
+ }
+
+ if(gps_ops) {
+ _clone_gps_operations(po, gps_ops);
+ }
+
+ return;
+}
+
CoreObject *tcore_gps_new(TcorePlugin *p, const char *name,
struct tcore_gps_operations *ops, TcoreHal *hal)
{
return o;
}
+CoreObject *tcore_gps_clone(TcorePlugin *p, const char *name, TcoreHal *hal)
+{
+ CoreObject *o = NULL;
+
+ if (!p)
+ return NULL;
+
+ o = tcore_object_clone_template_object(p, name, CORE_OBJECT_TYPE_GPS);
+ if (!o)
+ return NULL;
+
+ tcore_object_set_hal(o, hal);
+
+ return o;
+}
+
void tcore_gps_free(CoreObject *o)
{
struct private_object_data *po = NULL;
tcore_object_link_object(dest, dest_po);
}
+static void _clone_modem_operations(struct private_object_data *po, struct tcore_modem_operations *modem_ops)
+{
+ if(modem_ops->power_on) {
+ po->ops->power_on = modem_ops->power_on;
+ }
+ if(modem_ops->power_off) {
+ po->ops->power_off = modem_ops->power_off;
+ }
+ if(modem_ops->power_reset) {
+ po->ops->power_reset = modem_ops->power_reset;
+ }
+ if(modem_ops->set_flight_mode) {
+ po->ops->set_flight_mode = modem_ops->set_flight_mode;
+ }
+ if(modem_ops->get_imei) {
+ po->ops->get_imei = modem_ops->get_imei;
+ }
+ if(modem_ops->get_version) {
+ po->ops->get_version = modem_ops->get_version;
+ }
+ if(modem_ops->get_sn) {
+ po->ops->get_sn = modem_ops->get_sn;
+ }
+ if(modem_ops->dun_pin_ctrl) {
+ po->ops->dun_pin_ctrl = modem_ops->dun_pin_ctrl;
+ }
+ if(modem_ops->get_flight_mode) {
+ po->ops->get_flight_mode = modem_ops->get_flight_mode;
+ }
+
+ return;
+}
+
static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
{
enum tcore_request_command command;
return TCORE_RETURN_SUCCESS;
}
+void tcore_modem_override_ops(CoreObject *o, struct tcore_modem_operations *modem_ops)
+{
+ struct private_object_data *po = NULL;
+
+ CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_MODEM);
+
+ po = (struct private_object_data *)tcore_object_ref_object(o);
+ if (!po) {
+ return;
+ }
+
+ if(modem_ops) {
+ _clone_modem_operations(po, modem_ops);
+ }
+
+ return;
+}
+
CoreObject *tcore_modem_new(TcorePlugin *p, const char *name,
struct tcore_modem_operations *ops, TcoreHal *hal)
{
return o;
}
+CoreObject *tcore_modem_clone(TcorePlugin *p, const char *name, TcoreHal *hal)
+{
+ CoreObject *o = NULL;
+
+ if (!p)
+ return NULL;
+
+ o = tcore_object_clone_template_object(p, name, CORE_OBJECT_TYPE_MODEM);
+ if (!o)
+ return NULL;
+
+ tcore_object_set_hal(o, hal);
+
+ return o;
+}
+
void tcore_modem_free(CoreObject *o)
{
struct private_object_data *po = NULL;
GSList *network_operator_info_table[1000];
};
+static void _clone_network_operations(struct private_object_data *po, struct tcore_network_operations *network_ops)
+{
+ if(network_ops->search) {
+ po->ops->search = network_ops->search;
+ }
+ if(network_ops->set_plmn_selection_mode) {
+ po->ops->set_plmn_selection_mode = network_ops->set_plmn_selection_mode;
+ }
+ if(network_ops->get_plmn_selection_mode) {
+ po->ops->get_plmn_selection_mode = network_ops->get_plmn_selection_mode;
+ }
+ if(network_ops->set_service_domain) {
+ po->ops->set_service_domain = network_ops->set_service_domain;
+ }
+ if(network_ops->get_service_domain) {
+ po->ops->get_service_domain = network_ops->get_service_domain;
+ }
+ if(network_ops->set_band) {
+ po->ops->set_band = network_ops->set_band;
+ }
+ if(network_ops->get_band) {
+ po->ops->get_band = network_ops->get_band;
+ }
+ if(network_ops->set_preferred_plmn) {
+ po->ops->set_preferred_plmn = network_ops->set_preferred_plmn;
+ }
+ if(network_ops->get_preferred_plmn) {
+ po->ops->get_preferred_plmn = network_ops->get_preferred_plmn;
+ }
+ if(network_ops->set_order) {
+ po->ops->set_order = network_ops->set_order;
+ }
+ if(network_ops->get_order) {
+ po->ops->get_order = network_ops->get_order;
+ }
+ if(network_ops->set_power_on_attach) {
+ po->ops->set_power_on_attach = network_ops->set_power_on_attach;
+ }
+ if(network_ops->get_power_on_attach) {
+ po->ops->get_power_on_attach = network_ops->get_power_on_attach;
+ }
+ if(network_ops->set_cancel_manual_search) {
+ po->ops->set_cancel_manual_search = network_ops->set_cancel_manual_search;
+ }
+ if(network_ops->get_serving_network) {
+ po->ops->get_serving_network = network_ops->get_serving_network;
+ }
+ if(network_ops->set_mode) {
+ po->ops->set_mode = network_ops->set_mode;
+ }
+ if(network_ops->get_mode) {
+ po->ops->get_mode = network_ops->get_mode;
+ }
+
+ return;
+}
+
static TReturn _dispatcher(CoreObject *co, UserRequest *ur)
{
enum tcore_request_command command;
tcore_object_link_object(dest, dest_po);
}
+void tcore_network_override_ops(CoreObject *o, struct tcore_network_operations *network_ops)
+{
+ struct private_object_data *po = NULL;
+
+ CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_NETWORK);
+
+ po = (struct private_object_data *)tcore_object_ref_object(o);
+ if (!po) {
+ return;
+ }
+
+ if(network_ops) {
+ _clone_network_operations(po, network_ops);
+ }
+
+ return;
+}
+
CoreObject *tcore_network_new(TcorePlugin *plugin, const char *name,
struct tcore_network_operations *ops, TcoreHal *hal)
{
return o;
}
+CoreObject *tcore_network_clone(TcorePlugin *p, const char *name, TcoreHal *hal)
+{
+ CoreObject *o = NULL;
+
+ if (!p)
+ return NULL;
+
+ o = tcore_object_clone_template_object(p, name, CORE_OBJECT_TYPE_NETWORK);
+ if (!o)
+ return NULL;
+
+ tcore_object_set_hal(o, hal);
+
+ return o;
+}
+
void tcore_network_free(CoreObject *co)
{
struct private_object_data *po = NULL;
enum tel_phonebook_type selected;
};
+static void _clone_phonebook_operations(struct private_object_data *po, struct tcore_phonebook_operations *phonebook_ops)
+{
+ if(phonebook_ops->get_count) {
+ po->ops->get_count = phonebook_ops->get_count;
+ }
+ if(phonebook_ops->get_info) {
+ po->ops->get_info = phonebook_ops->get_info;
+ }
+ if(phonebook_ops->get_usim_info) {
+ po->ops->get_usim_info = phonebook_ops->get_usim_info;
+ }
+ if(phonebook_ops->read_record) {
+ po->ops->read_record = phonebook_ops->read_record;
+ }
+ if(phonebook_ops->update_record) {
+ po->ops->update_record = phonebook_ops->update_record;
+ }
+ if(phonebook_ops->delete_record) {
+ po->ops->delete_record = phonebook_ops->delete_record;
+ }
+
+ return;
+}
+
static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
{
enum tcore_request_command command;
return TRUE;
}
+void tcore_phonebook_override_ops(CoreObject *o, struct tcore_phonebook_operations *phonebook_ops)
+{
+ struct private_object_data *po = NULL;
+
+ CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_PHONEBOOK);
+
+ po = (struct private_object_data *)tcore_object_ref_object(o);
+ if (!po) {
+ return;
+ }
+
+ if(phonebook_ops) {
+ _clone_phonebook_operations(po, phonebook_ops);
+ }
+
+ return;
+}
+
CoreObject *tcore_phonebook_new(TcorePlugin *p, const char *name,
struct tcore_phonebook_operations *ops, TcoreHal *hal)
{
return o;
}
+CoreObject *tcore_phonebook_clone(TcorePlugin *p, const char *name, TcoreHal *hal)
+{
+ CoreObject *o = NULL;
+
+ if (!p)
+ return NULL;
+
+ o = tcore_object_clone_template_object(p, name, CORE_OBJECT_TYPE_PHONEBOOK);
+ if (!o)
+ return NULL;
+
+ tcore_object_set_hal(o, hal);
+
+ return o;
+}
+
void tcore_phonebook_free(CoreObject *o)
{
struct private_object_data *po = NULL;
GSList *context_list;
};
+static void _clone_ps_operations(struct private_object_data *po, struct tcore_ps_operations *ps_ops)
+{
+ if(ps_ops->activate_context) {
+ po->ops->activate_context = ps_ops->activate_context;
+ }
+ if(ps_ops->deactivate_context) {
+ po->ops->deactivate_context = ps_ops->deactivate_context;
+ }
+
+ return;
+}
+
static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
{
enum tcore_request_command command;
return FALSE;
}
+void tcore_ps_override_ops(CoreObject *o, struct tcore_ps_operations *ps_ops)
+{
+ struct private_object_data *po = NULL;
+
+ CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_PS);
+
+ po = (struct private_object_data *)tcore_object_ref_object(o);
+ if (!po) {
+ return;
+ }
+
+ if(ps_ops) {
+ _clone_ps_operations(po, ps_ops);
+ }
+
+ return;
+}
+
CoreObject *tcore_ps_new(TcorePlugin *p, const char *name,
struct tcore_ps_operations *ops, TcoreHal *hal)
{
return o;
}
+CoreObject *tcore_ps_clone(TcorePlugin *p, const char *name, TcoreHal *hal)
+{
+ CoreObject *o = NULL;
+
+ if (!p)
+ return NULL;
+
+ o = tcore_object_clone_template_object(p, name, CORE_OBJECT_TYPE_PS);
+ if (!o)
+ return NULL;
+
+ tcore_object_set_hal(o, hal);
+
+ return o;
+}
+
void tcore_ps_free(CoreObject *o)
{
struct private_object_data *po = NULL;
struct tcore_sap_operations *ops;
};
+static void _clone_sap_operations(struct private_object_data *po, struct tcore_sap_operations *sap_ops)
+{
+ if(sap_ops->connect) {
+ po->ops->connect = sap_ops->connect;
+ }
+ if(sap_ops->disconnect) {
+ po->ops->disconnect = sap_ops->disconnect;
+ }
+ if(sap_ops->req_status) {
+ po->ops->req_status = sap_ops->req_status;
+ }
+ if(sap_ops->set_transport_protocol) {
+ po->ops->set_transport_protocol = sap_ops->set_transport_protocol;
+ }
+ if(sap_ops->set_power) {
+ po->ops->set_power = sap_ops->set_power;
+ }
+ if(sap_ops->get_atr) {
+ po->ops->get_atr = sap_ops->get_atr;
+ }
+ if(sap_ops->transfer_apdu) {
+ po->ops->transfer_apdu = sap_ops->transfer_apdu;
+ }
+ if(sap_ops->get_cardreader_status) {
+ po->ops->get_cardreader_status = sap_ops->get_cardreader_status;
+ }
+
+ return;
+}
+
static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
{
enum tcore_request_command command;
}
}
+void tcore_sap_override_ops(CoreObject *o, struct tcore_sap_operations *sap_ops)
+{
+ struct private_object_data *po = NULL;
+
+ CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SAP);
+
+ po = (struct private_object_data *)tcore_object_ref_object(o);
+ if (!po) {
+ return;
+ }
+
+ if(sap_ops) {
+ _clone_sap_operations(po, sap_ops);
+ }
+
+ return;
+}
+
CoreObject *tcore_sap_new(TcorePlugin *p, const char *name,
struct tcore_sap_operations *ops, TcoreHal *hal)
{
return o;
}
+CoreObject *tcore_sap_clone(TcorePlugin *p, const char *name, TcoreHal *hal)
+{
+ CoreObject *o = NULL;
+
+ if (!p)
+ return NULL;
+
+ o = tcore_object_clone_template_object(p, name, CORE_OBJECT_TYPE_SAP);
+ if (!o)
+ return NULL;
+
+ tcore_object_set_hal(o, hal);
+
+ return o;
+}
+
void tcore_sap_free(CoreObject *o)
{
struct private_object_data *po = NULL;
gboolean b_comprehensive = FALSE;
+static void _clone_sat_operations(struct private_object_data *po, struct tcore_sat_operations *sat_ops)
+{
+ if(sat_ops->envelope) {
+ po->ops->envelope = sat_ops->envelope;
+ }
+ if(sat_ops->terminal_response) {
+ po->ops->terminal_response = sat_ops->terminal_response;
+ }
+
+ return;
+}
+
static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
{
enum tcore_request_command command;
return tr_len;
}
+void tcore_sat_override_ops(CoreObject *o, struct tcore_sat_operations *sat_ops)
+{
+ struct private_object_data *po = NULL;
+
+ CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SAT);
+
+ po = (struct private_object_data *)tcore_object_ref_object(o);
+ if (!po) {
+ return;
+ }
+
+ if(sat_ops) {
+ _clone_sat_operations(po, sat_ops);
+ }
+
+ return;
+}
+
CoreObject *tcore_sat_new(TcorePlugin *p, const char *name,
struct tcore_sat_operations *ops, TcoreHal *hal)
{
return o;
}
+CoreObject *tcore_sat_clone(TcorePlugin *p, const char *name, TcoreHal *hal)
+{
+ CoreObject *o = NULL;
+
+ if (!p)
+ return NULL;
+
+ o = tcore_object_clone_template_object(p, name, CORE_OBJECT_TYPE_SAT);
+ if (!o)
+ return NULL;
+
+ tcore_object_set_hal(o, hal);
+
+ return o;
+}
+
void tcore_sat_free(CoreObject *o)
{
struct private_object_data *po = NULL;
void *userdata; /**< free use data*/
};
+static void _clone_sim_operations(struct private_object_data *po, struct tcore_sim_operations *sim_ops)
+{
+ if(sim_ops->verify_pins) {
+ po->ops->verify_pins = sim_ops->verify_pins;
+ }
+ if(sim_ops->verify_puks) {
+ po->ops->verify_puks = sim_ops->verify_puks;
+ }
+ if(sim_ops->change_pins) {
+ po->ops->change_pins = sim_ops->change_pins;
+ }
+ if(sim_ops->get_facility_status) {
+ po->ops->get_facility_status = sim_ops->get_facility_status;
+ }
+ if(sim_ops->enable_facility) {
+ po->ops->enable_facility = sim_ops->enable_facility;
+ }
+ if(sim_ops->disable_facility) {
+ po->ops->disable_facility = sim_ops->disable_facility;
+ }
+ if(sim_ops->get_lock_info) {
+ po->ops->get_lock_info = sim_ops->get_lock_info;
+ }
+ if(sim_ops->read_file) {
+ po->ops->read_file = sim_ops->read_file;
+ }
+ if(sim_ops->update_file) {
+ po->ops->update_file = sim_ops->update_file;
+ }
+ if(sim_ops->transmit_apdu) {
+ po->ops->transmit_apdu = sim_ops->transmit_apdu;
+ }
+ if(sim_ops->get_atr) {
+ po->ops->get_atr = sim_ops->get_atr;
+ }
+ if(sim_ops->req_authentication) {
+ po->ops->req_authentication = sim_ops->req_authentication;
+ }
+
+ return;
+}
static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
{
po->sim_status = SIM_STATUS_UNKNOWN;
}
+void tcore_sim_override_ops(CoreObject *o, struct tcore_sim_operations *sim_ops)
+{
+ struct private_object_data *po = NULL;
+
+ CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SIM);
+
+ po = (struct private_object_data *)tcore_object_ref_object(o);
+ if (!po) {
+ return;
+ }
+
+ if(sim_ops) {
+ _clone_sim_operations(po, sim_ops);
+ }
+
+ return;
+}
+
CoreObject *tcore_sim_new(TcorePlugin *p, const char *name,
struct tcore_sim_operations *ops, TcoreHal *hal)
{
return o;
}
+CoreObject *tcore_sim_clone(TcorePlugin *p, const char *name, TcoreHal *hal)
+{
+ CoreObject *o = NULL;
+
+ if (!p)
+ return NULL;
+
+ o = tcore_object_clone_template_object(p, name, CORE_OBJECT_TYPE_SIM);
+ if (!o)
+ return NULL;
+
+ tcore_object_set_hal(o, hal);
+
+ return o;
+}
+
void tcore_sim_free(CoreObject *o)
{
struct private_object_data *po = NULL;
}
+static void _clone_sms_operations(struct private_object_data *po, struct tcore_sms_operations *sms_ops)
+{
+ if(sms_ops->send_umts_msg) {
+ po->ops->send_umts_msg = sms_ops->send_umts_msg;
+ }
+ if(sms_ops->read_msg) {
+ po->ops->read_msg = sms_ops->read_msg;
+ }
+ if(sms_ops->save_msg) {
+ po->ops->save_msg = sms_ops->save_msg;
+ }
+ if(sms_ops->delete_msg) {
+ po->ops->delete_msg = sms_ops->delete_msg;
+ }
+ if(sms_ops->get_storedMsgCnt) {
+ po->ops->get_storedMsgCnt = sms_ops->get_storedMsgCnt;
+ }
+ if(sms_ops->get_sca) {
+ po->ops->get_sca = sms_ops->get_sca;
+ }
+ if(sms_ops->set_sca) {
+ po->ops->set_sca = sms_ops->set_sca;
+ }
+ if(sms_ops->get_cb_config) {
+ po->ops->get_cb_config = sms_ops->get_cb_config;
+ }
+ if(sms_ops->set_cb_config) {
+ po->ops->set_cb_config = sms_ops->set_cb_config;
+ }
+ if(sms_ops->set_mem_status) {
+ po->ops->set_mem_status = sms_ops->set_mem_status;
+ }
+ if(sms_ops->get_pref_brearer) {
+ po->ops->get_pref_brearer = sms_ops->get_pref_brearer;
+ }
+ if(sms_ops->set_pref_brearer) {
+ po->ops->set_pref_brearer = sms_ops->set_pref_brearer;
+ }
+ if(sms_ops->set_delivery_report) {
+ po->ops->set_delivery_report = sms_ops->set_delivery_report;
+ }
+ if(sms_ops->set_msg_status) {
+ po->ops->set_msg_status = sms_ops->set_msg_status;
+ }
+ if(sms_ops->get_sms_params) {
+ po->ops->get_sms_params = sms_ops->get_sms_params;
+ }
+ if(sms_ops->set_sms_params) {
+ po->ops->set_sms_params = sms_ops->set_sms_params;
+ }
+ if(sms_ops->get_paramcnt) {
+ po->ops->get_paramcnt = sms_ops->get_paramcnt;
+ }
+ if(sms_ops->send_cdma_msg) {
+ po->ops->send_cdma_msg = sms_ops->send_cdma_msg;
+ }
+
+ return;
+}
+
static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
{
enum tcore_request_command command;
return TRUE;
}
+void tcore_sms_override_ops(CoreObject *o, struct tcore_sms_operations *sms_ops)
+{
+ struct private_object_data *po = NULL;
+
+ CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SMS);
+
+ po = (struct private_object_data *)tcore_object_ref_object(o);
+ if (!po) {
+ return;
+ }
+
+ if(sms_ops) {
+ _clone_sms_operations(po, sms_ops);
+ }
+
+ return;
+}
+
CoreObject *tcore_sms_new(TcorePlugin *p, const char *name,
struct tcore_sms_operations *ops, TcoreHal *hal)
{
return o;
}
+CoreObject *tcore_sms_clone(TcorePlugin *p, const char *name, TcoreHal *hal)
+{
+ CoreObject *o = NULL;
+
+ if (!p)
+ return NULL;
+
+ o = tcore_object_clone_template_object(p, name, CORE_OBJECT_TYPE_SMS);
+ if (!o)
+ return NULL;
+
+ tcore_object_set_hal(o, hal);
+
+ return o;
+}
+
void tcore_sms_free(CoreObject *o)
{
struct private_object_data *po = NULL;
struct tcore_ss_operations *ops;
};
+static void _clone_ss_operations(struct private_object_data *po, struct tcore_ss_operations *ss_ops)
+{
+ if(ss_ops->barring_activate) {
+ po->ops->barring_activate = ss_ops->barring_activate;
+ }
+ if(ss_ops->barring_deactivate) {
+ po->ops->barring_deactivate = ss_ops->barring_deactivate;
+ }
+ if(ss_ops->barring_change_password) {
+ po->ops->barring_change_password = ss_ops->barring_change_password;
+ }
+ if(ss_ops->barring_get_status) {
+ po->ops->barring_get_status = ss_ops->barring_get_status;
+ }
+ if(ss_ops->forwarding_activate) {
+ po->ops->forwarding_activate = ss_ops->forwarding_activate;
+ }
+ if(ss_ops->forwarding_deactivate) {
+ po->ops->forwarding_deactivate = ss_ops->forwarding_deactivate;
+ }
+ if(ss_ops->forwarding_register) {
+ po->ops->forwarding_register = ss_ops->forwarding_register;
+ }
+ if(ss_ops->forwarding_deregister) {
+ po->ops->forwarding_deregister = ss_ops->forwarding_deregister;
+ }
+ if(ss_ops->forwarding_get_status) {
+ po->ops->forwarding_get_status = ss_ops->forwarding_get_status;
+ }
+ if(ss_ops->waiting_activate) {
+ po->ops->waiting_activate = ss_ops->waiting_activate;
+ }
+ if(ss_ops->waiting_deactivate) {
+ po->ops->waiting_deactivate = ss_ops->waiting_deactivate;
+ }
+ if(ss_ops->waiting_get_status) {
+ po->ops->waiting_get_status = ss_ops->waiting_get_status;
+ }
+ if(ss_ops->cli_activate) {
+ po->ops->cli_activate = ss_ops->cli_activate;
+ }
+ if(ss_ops->cli_deactivate) {
+ po->ops->cli_deactivate = ss_ops->cli_deactivate;
+ }
+ if(ss_ops->cli_get_status) {
+ po->ops->cli_get_status = ss_ops->cli_get_status;
+ }
+ if(ss_ops->send_ussd) {
+ po->ops->send_ussd = ss_ops->send_ussd;
+ }
+ if(ss_ops->set_aoc) {
+ po->ops->set_aoc = ss_ops->set_aoc;
+ }
+ if(ss_ops->get_aoc) {
+ po->ops->get_aoc = ss_ops->get_aoc;
+ }
+
+ return;
+}
+
static TReturn _dispatcher(CoreObject *o, UserRequest *ur)
{
enum tcore_request_command command;
}
}
+void tcore_ss_override_ops(CoreObject *o, struct tcore_ss_operations *ss_ops)
+{
+ struct private_object_data *po = NULL;
+
+ CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SS);
+
+ po = (struct private_object_data *)tcore_object_ref_object(o);
+ if (!po) {
+ return;
+ }
+
+ if(ss_ops) {
+ _clone_ss_operations(po, ss_ops);
+ }
+
+ return;
+}
CoreObject *tcore_ss_new(TcorePlugin *p, const char *name,
struct tcore_ss_operations *ops, TcoreHal *hal)
return o;
}
+CoreObject *tcore_ss_clone(TcorePlugin *p, const char *name, TcoreHal *hal)
+{
+ CoreObject *o = NULL;
+
+ if (!p)
+ return NULL;
+
+ o = tcore_object_clone_template_object(p, name, CORE_OBJECT_TYPE_SS);
+ if (!o)
+ return NULL;
+
+ tcore_object_set_hal(o, hal);
+
+ return o;
+}
+
void tcore_ss_free(CoreObject *o)
{
CORE_OBJECT_CHECK(o, CORE_OBJECT_TYPE_SS);
#include <glib.h>
#include "tcore.h"
+#include "server.h"
#include "plugin.h"
#include "core_object.h"
#include "hal.h"
return dest;
}
+CoreObject *tcore_object_clone_template_object(TcorePlugin *p, const char *co_name, unsigned int co_type)
+{
+ CoreObject *co = NULL;
+ CoreObject *template_co = NULL;
+
+ template_co = tcore_server_find_template_object(tcore_plugin_ref_server(p), co_type);
+ if(!template_co) {
+ return NULL;
+ }
+ co = tcore_object_clone(template_co, p, co_name);
+ if(!co) {
+ return NULL;
+ }
+
+ return co;
+}
+
const char *tcore_object_ref_name(CoreObject *co)
{
if (!co)
GSList *communicators;
GSList *storages;
GSList *hals;
+ GSList *template_co;
GSList *hook_list_request;
GSList *hook_list_notification;
TcorePlugin *default_plugin;
return NULL;
}
+TReturn tcore_server_add_template_object(Server *s, CoreObject *template_co)
+{
+ GSList *list;
+ CoreObject *temp;
+
+ if (!s || !template_co)
+ return TCORE_RETURN_EINVAL;
+
+ for (list = s->template_co; list; list = list->next) {
+ temp = list->data;
+ if (!temp) {
+ continue;
+ }
+
+ if (tcore_object_get_type(temp) == tcore_object_get_type(template_co)) {
+ return TCORE_RETURN_EALREADY;
+ }
+ }
+
+ s->template_co = g_slist_insert(s->template_co, template_co, 0);
+
+ return TCORE_RETURN_SUCCESS;
+}
+
+GSList *tcore_server_ref_template_object(Server *s)
+{
+ if (!s)
+ return NULL;
+
+ return s->template_co;
+}
+
+CoreObject *tcore_server_find_template_object(Server *s, unsigned int type)
+{
+ GSList *list;
+ CoreObject *template_co;
+
+ for (list = s->template_co; list; list = list->next) {
+ template_co = list->data;
+ if (!template_co) {
+ continue;
+ }
+
+ if (type == tcore_object_get_type(template_co)) {
+ return template_co;
+ }
+ }
+
+ return NULL;
+}
+
TReturn tcore_server_link_udev(Server *s, TcoreUdev *udev)
{
if (!s || !udev)