From 2b91dc0f82b09c863c3dc5996a6b6a2d9c1aead0 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Tue, 8 Sep 2015 14:36:23 +0900 Subject: Delays to call tune after tv service resume Change-Id: Id9c9c4c10f5955ff2d70c48eba804cc09c9dd3df Signed-off-by: jinwoo.shin --- src/main.c | 47 +++++++++++++++++++++++++---------------------- src/view_pin.c | 2 +- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/main.c b/src/main.c index b400730..324e5d3 100644 --- a/src/main.c +++ b/src/main.c @@ -41,6 +41,7 @@ struct _appdata { tzsh_h tzsh; tzsh_tvsrv_h ta; Ecore_Timer *pause_timer; + int service_id; int is_signal; int is_channel; @@ -273,14 +274,30 @@ static void _resume(void *data) r = tv_resume(); if (r < 0) { _ERR("Resume tv service failed"); + ui_app_exit(); + return; - } else if (r > 0) { - r = tv_channel_tune(); - if (r < 0) { - _ERR("Tune channel failed"); + } + + /* Try to tune with service id if supplied from app control */ + if (ad->service_id > 0) { + r = tv_channel_tune_with_service_id(ad->service_id); + ad->service_id = 0; + + if (!r) { + ad->is_channel = true; return; } } + + r = tv_channel_tune(); + if (r < 0) { + ad->is_channel = false; + viewmgr_show_view(VIEW_ERROR); + viewmgr_update_view(VIEW_ERROR, UPDATE_TYPE_NOCHANNEL, NULL); + } else { + ad->is_channel = true; + } } static bool _create(void *data) @@ -409,25 +426,11 @@ static void _control(app_control_h control, void *data) ad = data; r = app_control_get_extra_data(control, KEY_SVCID, &svcid); - if (r == SERVICE_ERROR_NONE) { - r = tv_channel_tune_with_service_id(atoll(svcid)); - free(svcid); - if (!r) { - ad->is_channel = true; - viewmgr_show_view(VIEW_CHANNELINFO); - return; - } - } - - r = tv_channel_tune(); + if (r != SERVICE_ERROR_NONE) + return; - if (r < 0) { - ad->is_channel = false; - viewmgr_show_view(VIEW_ERROR); - viewmgr_update_view(VIEW_ERROR, UPDATE_TYPE_NOCHANNEL, NULL); - } else { - ad->is_channel = true; - } + ad->service_id = atoll(svcid); + free(svcid); } int main(int argc, char *argv[]) diff --git a/src/view_pin.c b/src/view_pin.c index bab97bc..b91800e 100644 --- a/src/view_pin.c +++ b/src/view_pin.c @@ -53,7 +53,7 @@ static void _send_message(struct _priv *priv, const char *result) service_destroy(service); } -static void _check_pincode(struct _priv *priv, const char *pincode) +static void _check_pincode(struct _priv *priv, char *pincode) { const struct tv_channel_info *channel_info; int r; -- cgit v1.2.3