INCLUDE(FindPkgConfig)
pkg_check_modules(AUTO_PRGM_UG_PKGS REQUIRED
- eina
- edje
- evas
- elementary
- capi-appfw-application
- capi-system-info
- aul
- ui-gadget-1
)
#tv-service
#tv-player-core
SET(SRCS
src/ug_auto_program.cpp
src/util.cpp
- src/viewmgr_auto_program.cpp
- src/view_scan_start.cpp
- src/view_search_page.cpp
- src/view_result_page.cpp
- src/tv_scan.cpp
+ src/ChannelMainView.cpp
+ src/ChannelResultView.cpp
+ src/ChannelSearchView.cpp
+ ../src/TVServiceMgr.cpp
)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../include)
ADD_DEFINITIONS("-DPKGNAME=\"${PROJECT_NAME}\"")
--- /dev/null
+#ifndef __CHANNEL_MAIN_VIEW_H__
+#define __CHANNEL_MAIN_VIEW_H__
+
+
+class CChannelMainView : public CBaseView, public IMouseClickedListener, public IFocusedListener, public IUnfocusedListener {
+private :
+ struct SChannelMainView *m;
+ bool m_CreateBox(void);
+ bool m_UpdateAntennaList(void);
+ void m_UpdateFocus(void);
+
+
+protected :
+ virtual void t_OnShow(void);
+ virtual void t_OnUpdate(void *data);
+ virtual void t_OnHide(void);
+
+public :
+ CChannelMainView(const char *szViewId) : CBaseView(szViewId), IMouseClickedListener(this), IFocusedListener(this), IUnfocusedListener(this), m(0) {}
+ virtual ~CChannelMainView() {}
+
+ virtual bool Create(void *data);
+ virtual void Destroy(void);
+ virtual Evas_Object* Base(void);
+
+ virtual void OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev);
+ virtual void OnMouseClicked(int id, Evas_Object *obj);
+ virtual void OnFocused(int id, Evas_Object *obj, Elm_Object_Item *item);
+ virtual void OnUnfocused(int id, Evas_Object *obj, Elm_Object_Item *item);
+};
+
+#endif /* __CHANNEL_MAIN_VIEW_H__ */
+
+
--- /dev/null
+#ifndef __CHANNEL_RESULT_VIEW_H__
+#define __CHANNEL_RESULT_VIEW_H__
+
+
+class CChannelResultView : public CBaseView, public IMouseClickedListener{
+private :
+ struct SChannelResultView *m;
+
+protected :
+ virtual void t_OnShow(void);
+ virtual void t_OnUpdate(void *data);
+ virtual void t_OnHide(void);
+
+public :
+ CChannelResultView(const char *szViewId) : CBaseView(szViewId), IMouseClickedListener(this), m(0) {}
+ virtual ~CChannelResultView() {}
+
+ virtual bool Create(void *data);
+ virtual void Destroy(void);
+ virtual Evas_Object* Base(void);
+
+ virtual void OnMouseClicked(int id, Evas_Object *obj);
+};
+
+#endif /* __CHANNEL_RESULT_VIEW_H__ */
--- /dev/null
+#ifndef __CHANNEL_SEARCH_VIEW_H__
+#define __CHANNEL_SEARCH_VIEW_H__
+
+
+class CChannelSearchView : public CBaseView, public IMouseClickedListener{
+private :
+ struct SChannelSearchView *m;
+ bool m_StartScan(void);
+
+protected :
+ virtual void t_OnShow(void);
+ virtual void t_OnUpdate(void *data);
+ virtual void t_OnHide(void);
+
+public :
+ CChannelSearchView(const char *szViewId) : CBaseView(szViewId), IMouseClickedListener(this), m(0) {}
+ virtual ~CChannelSearchView() {}
+
+ virtual bool Create(void *data);
+ virtual void Destroy(void);
+ virtual Evas_Object* Base(void);
+
+ virtual void OnMouseClicked(int id, Evas_Object *obj);
+};
+
+#endif /* __CHANNEL_SEARCH_VIEW_H__ */
#ifndef __DEFS_H__
#define __DEFS_H__
+/* View */
+#define CHANNEL_MAINVIEW "CHANNEL_MAINVIEW"
+
#define VIEW_START "scanstart"
#define VIEW_SEARCH "searchpage"
#define VIEW_RESULT "resultpage"
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 __TV_SCAN_H__
-#define __TV_SCAN_H__
-
-struct tv_scan;
-
-enum local_mode {
- INVALID_LOCAL = -1,
- KR_MODE,
- US_MODE,
- MAX_LOCAL
-};
-
-enum antenna_mode {
- SCAN_TYPE_INVALID = -1,
- SCAN_TYPE_ALL,
- SCAN_TYPE_CABLE,
- SCAN_TYPE_AIR
-};
-
-struct tv_scan_result {
- unsigned int air_dtv;
- unsigned int cable_dtv;
- unsigned int air_atv;
- unsigned int cable_atv;
-};
-
-struct tv_scan_cbs {
- void (*progress_cb)(struct tv_scan *tvs, enum antenna_mode mode,
- int count, int num, void *arg);
- void (*found_cb)(struct tv_scan *tvs, int count, int num,
- const struct tv_scan_result *result, void *arg);
- void (*done_cb)(struct tv_scan *tvs,
- const struct tv_scan_result *result, void *arg);
-
- void *data;
-};
-
-struct tv_scan *tv_scan_init(enum antenna_mode scan_mode);
-int tv_scan_fini(struct tv_scan *tvs);
-int tv_scan_set_callbacks(struct tv_scan *tvs, struct tv_scan_cbs *cbs);
-int tv_scan_start(struct tv_scan *tvs);
-int tv_scan_pause(struct tv_scan *tvs);
-int tv_scan_resume(struct tv_scan *tvs);
-int tv_scan_stop(struct tv_scan *tvs);
-int tv_scan_get_total_channel(struct tv_scan *tvs);
-struct tv_scan_result *tv_scan_get_result(struct tv_scan *tvs);
-int tv_scan_is_stopped(struct tv_scan *tvs);
-
-#endif /* __TV_SCAN_H__ */
#define __UG_CHANNEL_SEARCH_VIEW_H_
#include <ui-gadget-module.h>
-#include "tv_scan.h"
-
-struct _ugdata {
- Evas_Object *win;
- Evas_Object *ugd_base;
- ui_gadget_h ug;
- struct viewmgr *vmgr;
- enum antenna_mode scan_type;
- int find_chs;
-};
#endif/*__UG_CHANNEL_SEARCH_VIEW_H_*/
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 __VIEW_RESULT_PAGE_H__
-#define __VIEW_RESULT_PAGE_H__
-
-#include "ug_auto_program.h"
-#include "viewmgr_auto_program.h"
-
-struct view_class *view_resultpage_get_vclass(void);
-
-#endif /* __VIEW_RESULT_PAGE_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 __VIEW_SCAN_START_H__
-#define __VIEW_SCAN_START_H__
-
-#include "ug_auto_program.h"
-#include "viewmgr_auto_program.h"
-
-struct view_class *view_scanstart_get_vclass(void);
-
-#endif /* __VIEW_SCAN_START_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 __VIEW_SEARCHPAGE_H__
-#define __VIEW_SEARCHPAGE_H__
-
-#include "ug_auto_program.h"
-#include "viewmgr_auto_program.h"
-
-struct view_class *view_searchpage_get_vclass(void);
-
-#endif /* __VIEW_SEARCHPAGE_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 __VIEWMGR_AUTO_PROGRAM_H__
-#define __VIEWMGR_AUTO_PROGRAM_H__
-
-#include <Elementary.h>
-#include <Evas.h>
-
-struct viewmgr {
- Eina_List *vlist;
- Evas_Object *win;
- int count;
-};
-
-struct view_class {
- char *title;
- Evas_Object* (*create)(struct viewmgr *vmgr, void *data);
- void (*update)(Evas_Object *base);
- void (*resume)(Evas_Object *base);
- void (*pause)(Evas_Object *base);
- void (*terminate)(Evas_Object *base);
-};
-
-struct viewmgr *viewmgr_init(Evas_Object *win);
-void viewmgr_fini(struct viewmgr *vmgr);
-int viewmgr_push(struct viewmgr *vmgr, struct view_class *vclass, void *data);
-int viewmgr_pop(struct viewmgr *vmgr);
-int viewmgr_resume(struct viewmgr *vmgr);
-int viewmgr_pause(struct viewmgr *vmgr);
-Evas_Object *viewmgr_get_win(struct viewmgr *vmgr);
-
-#endif /* __VIEWMGR_AUTO_PROGRAM_H__ */
--- /dev/null
+#include <Elementary.h>
+#include <app.h>
+#include <ui-gadget-module.h>
+#include "AppCommon.h"
+#include "dbg.h"
+#include "util.h"
+#include "defs.h"
+#include "TVServiceMgr.h"
+
+#include "BaseView.h"
+#include "ViewMgr.h"
+#include "ChannelMainView.h"
+
+#define HORIZONTAL_ALIGN 0.5
+#define VERTICAL_ALIGN 0.0
+#define MAX_ITEMS 3
+#define ALL "All"
+#define CABLE "Cable"
+#define AIR "Air"
+
+enum antenna_type {
+ ALL_ITEM,
+ CABLE_ITEM,
+ AIR_ITEM
+};
+
+struct SChannelMainView {
+ ui_gadget_h ug;
+
+ Evas_Object *win;
+ Evas_Object *base;
+ Evas_Object *start_btn;
+ Evas_Object *cancel_btn;
+ Evas_Object *box;
+ Evas_Object *last_focus_item;
+ Evas_Object *selected_item;
+ Evas_Object *atn_btn[MAX_ITEMS];
+ enum antenna_mode scan_type;
+
+ CViewMgr *pViewMgr;
+};
+
+bool CChannelMainView::m_CreateBox(void)
+{
+ m->box = util_add_box(m->base, HORIZONTAL_ALIGN, VERTICAL_ALIGN);
+ if (!m->box) {
+ _ERR("box add failed");
+ return false;
+ }
+
+ elm_object_part_content_set(m->base, PART_ANTENNA_LIST, m->box);
+ evas_object_size_hint_weight_set(m->box, EVAS_HINT_EXPAND, 0);
+
+ return true;
+}
+
+
+bool CChannelMainView::m_UpdateAntennaList(void)
+{
+ Evas_Object *btn;
+ int i;
+ const char *temp[MAX_ITEMS] = { ALL, CABLE, AIR };
+
+ elm_box_clear(m->box);
+ m->last_focus_item = NULL;
+ m->selected_item = NULL;
+
+ for (i = 0; i < MAX_ITEMS; i++) {
+ btn = util_add_button(m->box, (char *) ITEM_STYLE, NULL, temp[i], EINA_TRUE);
+ if (!btn) {
+ _ERR("Fail to add button");
+ return false;
+ }
+ elm_box_pack_end(m->box, btn);
+ //evas_object_smart_callback_add(btn, SIGNAL_CLICKED, atninfo[i].cb, data);
+ //elm_object_signal_callback_add(btn, SIGNAL_FOCUSED, ELM_SOURCE, _btn_focused_cb, data);
+ //elm_object_signal_callback_add(btn, SIGNAL_UNFOCUSED, ELM_SOURCE, _btn_unfocused_cb, data);
+ Connect(btn, 100+i);
+
+ m->atn_btn[i] = btn;
+
+ if (i == 0) {
+ elm_object_focus_set(btn, EINA_TRUE);
+ elm_object_signal_emit(btn, SIGNAL_SELECTED, CHANNEL_SOURCE);
+ m->selected_item = btn;
+ }
+ }
+
+ m_UpdateFocus();
+ return true;
+}
+
+
+void CChannelMainView::m_UpdateFocus(void)
+{
+ elm_object_focus_next_object_set(m->atn_btn[ALL_ITEM], m->start_btn, ELM_FOCUS_RIGHT);
+ elm_object_focus_next_object_set(m->atn_btn[CABLE_ITEM], m->start_btn, ELM_FOCUS_RIGHT);
+ elm_object_focus_next_object_set(m->atn_btn[AIR_ITEM], m->start_btn, ELM_FOCUS_RIGHT);
+ elm_object_focus_next_object_set(m->atn_btn[ALL_ITEM], m->atn_btn[ALL_ITEM], ELM_FOCUS_LEFT);
+ elm_object_focus_next_object_set(m->atn_btn[CABLE_ITEM], m->atn_btn[CABLE_ITEM], ELM_FOCUS_LEFT);
+ elm_object_focus_next_object_set(m->atn_btn[AIR_ITEM], m->atn_btn[AIR_ITEM], ELM_FOCUS_LEFT);
+
+ if (m->selected_item) {
+ elm_object_focus_next_object_set(m->start_btn, m->selected_item, ELM_FOCUS_LEFT);
+ elm_object_focus_next_object_set(m->cancel_btn, m->selected_item, ELM_FOCUS_LEFT);
+ } else {
+ elm_object_focus_next_object_set(m->start_btn, m->atn_btn[ALL_ITEM], ELM_FOCUS_LEFT);
+ elm_object_focus_next_object_set(m->cancel_btn, m->atn_btn[ALL_ITEM], ELM_FOCUS_LEFT);
+ }
+
+ elm_object_focus_next_object_set(m->start_btn, m->cancel_btn, ELM_FOCUS_UP);
+ elm_object_focus_next_object_set(m->cancel_btn, m->start_btn, ELM_FOCUS_DOWN);
+ elm_object_focus_next_object_set(m->cancel_btn, m->start_btn, ELM_FOCUS_UP);
+}
+
+
+void CChannelMainView::t_OnShow(void)
+{
+ _DBG();
+
+ evas_object_show(m->base);
+
+ CBaseView::t_OnShow();
+}
+
+
+void CChannelMainView::t_OnUpdate(void *data)
+{
+ _DBG();
+
+ evas_object_show(m->base);
+}
+
+
+void CChannelMainView::t_OnHide(void)
+{
+ _DBG();
+
+ evas_object_hide(m->base);
+
+ CBaseView::t_OnHide();
+}
+
+
+bool CChannelMainView::Create(void *data)
+{
+ _DBG();
+ ASSERT(!m);
+
+ ui_gadget_h ug;
+ if (!data) {
+ _ERR("Invalid argument");
+ return false;
+ }
+ ug = (ui_gadget_h)data;
+
+ _CREATE_BEGIN{
+ _CHECK(m = new SChannelMainView)
+ _CHECK(m->win = CViewMgr::GetInstance()->Window())
+ _CHECK(m->base = util_add_layout(m->win, AUTO_PRGM_EDJ_FILE, GRP_SCAN_START))
+ _COMMAND{
+ //evas_object_event_callback_add(base, EVAS_CALLBACK_KEY_DOWN, _key_pressed_cb, priv);
+ Connect(m->base, 0);
+ elm_object_part_text_set(m->base, PART_STAR_MAIN_TITLE_BLOCK, START_MAIN_TITLE);
+ }
+ _CHECK(m->start_btn = util_add_button(m->base, BTN_STYLE, PART_START_BTN, TEXT_BTN_START, EINA_TRUE))
+ _CHECK(m->cancel_btn = util_add_button(m->base, BTN_STYLE, PART_CANCEL_BTN, TEXT_BTN_CANCEL, EINA_TRUE))
+ _COMMAND{
+#if 0
+ evas_object_data_set(m->base, "SCANSTARTDATA", m);
+#endif
+ //evas_object_smart_callback_add(start_btn, SIGNAL_CLICKED, _start_btn_clicked_cb, priv);
+ //evas_object_smart_callback_add(cancel_btn, SIGNAL_CLICKED, _cancel_btn_clicked_cb, priv);
+ Connect(m->start_btn, 1);
+ Connect(m->cancel_btn, 2);
+ evas_object_raise(m->base);
+ }
+ _CHECK(m_CreateBox())
+ _CHECK(m_UpdateAntennaList())
+ _WHEN_SUCCESS {
+ m->ug = ug;
+ m->pViewMgr = CViewMgr::GetInstance();
+ }
+ _CHECK_FAIL{for(int i = 0; i < MAX_ITEMS ; i++) evas_object_del(m->atn_btn[i]);}
+ _CHECK_FAIL{evas_object_del(m->box);}
+ _CHECK_FAIL{evas_object_del(m->cancel_btn);}
+ _CHECK_FAIL{evas_object_del(m->start_btn);}
+ _CHECK_FAIL{evas_object_del(m->base);}
+ _CHECK_FAIL{/* m->win = CViewMgr::GetInstance()->Window() */}
+ _CHECK_FAIL{ delete m; m = NULL; }
+ } _CREATE_END_AND_CATCH{ return false; }
+
+ return true;
+}
+
+
+void CChannelMainView::Destroy(void)
+{
+ ASSERT(m);
+
+ if(m->atn_btn[0]) {
+ for(int i = 0; i < MAX_ITEMS ; i++) evas_object_del(m->atn_btn[i]);
+ }
+
+ if(m->box)
+ evas_object_del(m->box);
+ if(m->cancel_btn)
+ evas_object_del(m->cancel_btn);
+ if(m->start_btn)
+ evas_object_del(m->start_btn);
+ if(m->base)
+ evas_object_del(m->base);
+
+ delete m;
+ m = NULL;
+}
+
+
+Evas_Object* CChannelMainView::Base(void)
+{
+ ASSERT(m);
+
+ return m->base;
+}
+
+
+
+void CChannelMainView::OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
+{
+ if (!ev->keyname) {
+ _ERR("ev->keyname NULL!");
+ return;
+ }
+
+ switch(id) {
+ case 0:
+ if (!strcmp(ev->keyname, KEY_BACK) || !strcmp(ev->keyname, KEY_BACK_REMOTE))
+ ug_destroy_me(m->ug);
+ break;
+ default:
+ break;
+ }
+
+}
+
+
+void CChannelMainView::OnMouseClicked(int id, Evas_Object *obj)
+{
+ switch(id) {
+ case 1:
+ {
+ Eina_Bool tuner_exist;
+
+ /*
+ * TODO: add the interface when TV service provider the related API.
+ * Here is a pseudo-data.
+ */
+ tuner_exist = EINA_TRUE;
+ if (!tuner_exist) {
+ /*
+ * TODO: popup the notification iniformation:
+ * there is no tuner
+ */
+ return;
+ }
+
+#if 0
+ if (viewmgr_push(m->vmgr, view_searchpage_get_vclass(), m->ugd) == -1) {
+ _ERR("search view push failed");
+ return;
+ }
+#endif
+ }
+ break;
+ case 2:
+ {
+ ug_destroy_me(m->ug);
+ }
+ break;
+ case 100:
+ case 101:
+ case 102:
+ {
+ const char *text;
+
+ if (!m->selected_item) {
+ elm_object_focus_set(obj, EINA_TRUE);
+ elm_object_signal_emit(obj, SIGNAL_SELECTED, CHANNEL_SOURCE);
+ m->selected_item = obj;
+ } else {
+ if (m->selected_item != obj) {
+ elm_object_signal_emit(m->selected_item, SIGNAL_UNSELECTED, CHANNEL_SOURCE);
+ elm_object_signal_emit(obj, SIGNAL_SELECTED, CHANNEL_SOURCE);
+ m->selected_item = obj;
+ }
+ }
+
+ text = elm_object_text_get(m->selected_item);
+ if (text && !strcmp(text, ALL))
+ m->scan_type = SCAN_TYPE_ALL;
+ else if (text && !strcmp(text, CABLE))
+ m->scan_type = SCAN_TYPE_CABLE;
+ else if (text && !strcmp(text, AIR))
+ m->scan_type = SCAN_TYPE_AIR;
+ else
+ m->scan_type = SCAN_TYPE_INVALID;
+
+#if 0
+ m->ugd->scan_type = m->scan_type;
+#endif
+
+ m_UpdateFocus();
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+
+void CChannelMainView::OnFocused(int id, Evas_Object *obj, Elm_Object_Item *item)
+{
+ switch(id) {
+ case 100:
+ case 101:
+ case 102:
+ {
+ if (m->last_focus_item) {
+ elm_object_signal_emit(m->last_focus_item,
+ SIGNAL_SHOWLINE, CHANNEL_SOURCE);
+ elm_object_signal_emit(obj, SIGNAL_HIDELINE, CHANNEL_SOURCE);
+ } else {
+ elm_object_signal_emit(obj, SIGNAL_SHOWLINE, CHANNEL_SOURCE);
+ }
+
+ m->last_focus_item = obj;
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+
+void CChannelMainView::OnUnfocused(int id, Evas_Object *obj, Elm_Object_Item *item)
+{
+ switch(id) {
+ case 100:
+ case 101:
+ case 102:
+ {
+ elm_object_signal_emit(m->last_focus_item, SIGNAL_SHOWLINE, CHANNEL_SOURCE);
+ }
+ break;
+ default:
+ break;
+ }
+
+}
+
+
--- /dev/null
+#include <Elementary.h>
+#include <app.h>
+#include <ui-gadget-module.h>
+#include "AppCommon.h"
+#include <system_info.h>
+#include "dbg.h"
+#include "defs.h"
+#include "util.h"
+
+#include "BaseView.h"
+#include "ViewMgr.h"
+#include "ChannelResultView.h"
+
+#define RESULT_MSG_SIZE 60
+
+struct SChannelResultView {
+ ui_gadget_h ug;
+
+ Evas_Object *win;
+ Evas_Object *base;
+ Evas_Object *ok_btn;
+
+ CViewMgr *pViewMgr;
+};
+
+void CChannelResultView::t_OnShow(void)
+{
+ _DBG();
+
+ evas_object_show(m->base);
+
+ CBaseView::t_OnShow();
+}
+
+
+void CChannelResultView::t_OnUpdate(void *data)
+{
+ _DBG();
+ Evas_Object *ok_btn;
+ char msg[RESULT_MSG_SIZE];
+ int chs = -1;
+
+#if 0
+ chs = m->ugd->find_chs;
+#endif
+
+ snprintf(msg, sizeof(msg), "%s<br>%d %s", COMPLETE_MAIN_TITLE, chs, TEXT_CH_MEMORIZED);
+ elm_object_part_text_set(m->base, PART_RES_MAIN_TITLE, msg);
+
+ ok_btn = util_add_button(m->base, BTN_STYLE, PART_OK_BTN, TEXT_BUTTON_OK, EINA_TRUE);
+ if (!ok_btn) {
+ _ERR("ok_btn is NULL");
+ return;
+ }
+
+ m->ok_btn = ok_btn;
+ elm_object_focus_set(ok_btn, EINA_TRUE);
+ //evas_object_smart_callback_add(ok_btn, SIGNAL_CLICKED, _ok_btn_clicked_cb, priv);
+ Connect(ok_btn,1);
+
+ util_focus_next_set(ok_btn);
+
+ evas_object_show(m->base);
+}
+
+
+void CChannelResultView::t_OnHide(void)
+{
+ _DBG();
+
+ evas_object_hide(m->base);
+
+ CBaseView::t_OnHide();
+}
+
+
+
+bool CChannelResultView::Create(void *data)
+{
+ _DBG();
+ ASSERT(!m);
+
+ ui_gadget_h ug;
+ if (!data) {
+ _ERR("Invalid argument");
+ return false;
+ }
+ ug = (ui_gadget_h)data;
+
+ _CREATE_BEGIN{
+ _CHECK(m = new SChannelResultView)
+ _CHECK(m->win = CViewMgr::GetInstance()->Window())
+ _CHECK(m->base = util_add_layout(m->win, AUTO_PRGM_EDJ_FILE, GROUP_RES))
+
+ _WHEN_SUCCESS {
+ elm_win_resize_object_add(m->win, m->base);
+#if 0
+ evas_object_data_set(m->base, "RESDATA", m);
+#endif
+ m->ug = ug;
+ m->pViewMgr = CViewMgr::GetInstance();
+ }
+
+ _CHECK_FAIL{evas_object_del(m->base);}
+ _CHECK_FAIL{/* m->win = CViewMgr::GetInstance()->Window() */}
+ _CHECK_FAIL{ delete m; m = NULL; }
+ } _CREATE_END_AND_CATCH{ return false; }
+
+ return true;
+}
+
+
+void CChannelResultView::Destroy(void)
+{
+ ASSERT(m);
+
+ if(m->base)
+ evas_object_del(m->base);
+
+ delete m;
+ m = NULL;
+}
+
+
+Evas_Object* CChannelResultView::Base(void)
+{
+ ASSERT(m);
+
+ return m->base;
+}
+
+void CChannelResultView::OnMouseClicked(int id, Evas_Object *obj)
+{
+ switch(id) {
+ case 1:
+ ug_destroy_me(m->ug);
+ break;
+ default:
+ break;
+ }
+}
--- /dev/null
+#include <Elementary.h>
+#include <app.h>
+#include <ui-gadget-module.h>
+#include "AppCommon.h"
+#include <system_info.h>
+#include "dbg.h"
+#include "defs.h"
+#include "util.h"
+
+#include "TVServiceMgr.h"
+#include "BaseView.h"
+#include "ViewMgr.h"
+#include "ChannelSearchView.h"
+
+#define MAX_BUF_SIZE 30
+#define CH_NAME_SIZE 30
+#define INITIAL_CH_NUMS 0
+#define PERCENT 100
+#define INITIAL_TEXT "0%"
+#define INITIAL_VALUE 0.0
+
+struct SChannelSearchView {
+ ui_gadget_h ug;
+
+ Evas_Object *win;
+ Evas_Object *base;
+ Evas_Object *pb;
+ Evas_Object *stop_btn;
+ Evas_Object *exit_btn;
+ Evas_Object *cancel_btn;
+
+ CTVServiceMgr *pTVServiceMgr;
+ CViewMgr *pViewMgr;
+};
+
+#if 0
+static void _progress_cb(struct tv_scan *tvs, enum antenna_mode mode,
+ int count, int num, void *arg)
+{
+ struct _data *priv;
+ char buf[CH_NAME_SIZE];
+ int total;
+ int ratio;
+
+ if (!tvs || !arg) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ priv = (struct _data *) arg;
+
+ snprintf(buf, sizeof(buf), "CH. %d", count);
+ elm_object_part_text_set(m->base, PART_CH_NAME, buf);
+ elm_object_signal_emit(m->base, SEARCHCHANNEL, SUBTEXT_SOURCE);
+
+ total = tv_scan_get_total_channel(tvs);
+ if (total <= 0) {
+ _ERR("Invalid Total value");
+ return;
+ }
+
+ ratio = count * PERCENT / total;
+ snprintf(buf, sizeof(buf), "%d%%", ratio);
+ elm_object_part_text_set(m->base, PART_PGBAR_NUM, buf);
+ elm_progressbar_value_set(m->pb, (float)ratio / PERCENT);
+}
+
+/**
+ * Dealing with the scanning result.
+ *
+ * When finishing scanning, the total found channels will be calculated and the
+ * scan result view will be invoked in this function.
+ *
+ * @param[in] tvs: The tv service structure for managering the scanning
+ * @param[in] res: The structure for saving the number of ATV air, DTV air,
+ * ATV cable and DTV cable channel.
+ * @param[in] arg: A pointer to current data structure.
+ */
+static void _done_cb(struct tv_scan *tvs,
+ const struct tv_scan_result *res, void *arg)
+{
+ struct _data *priv;
+ struct _ugdata *ugd;
+ struct viewmgr *vmgr;
+
+ if (!arg) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ priv = (struct _data *)arg;
+
+ if (!m->tvs || !m->vmgr || !m->ugd) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ vmgr = m->vmgr;
+ ugd = m->ugd;
+
+ ugd->find_chs = res->air_dtv + res->cable_dtv +
+ res->air_atv + res->cable_atv;
+
+ if (viewmgr_push(vmgr, view_resultpage_get_vclass(), ugd) == -1)
+ _ERR("result view push failed");
+}
+
+/**
+ * Deal with the found channel signal.
+ *
+ * @param[in] tvs: The tv service structure for managering the scanning
+ * @param[in] count: The number of channel signal received up to now
+ * @param[in] num: The physical channel number
+ * @param[in] res: The structure for saving the number of ATV air, DTV air,
+ * ATV cable and DTV cable channel.
+ * @param[in] arg: A pointer to the current data structure.
+ * @return 0 on success, and -1 on fail
+ */
+static void _found_cb(struct tv_scan *tvs, int count, int num,
+ const struct tv_scan_result *res, void *arg)
+{
+ struct _data *priv;
+ char buf[CH_NAME_SIZE];
+ int found;
+
+ if (!arg) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ priv = (struct _data *)arg;
+ snprintf(buf, sizeof(buf), "CH. %d", count);
+
+ elm_object_part_text_set(m->base, PART_CH_NAME, buf);
+ elm_object_signal_emit(m->base, CHANNELFOUND, SUBTEXT_SOURCE);
+
+ found = res->air_dtv + res->cable_dtv + res->air_atv + res->cable_atv;
+ snprintf(buf, sizeof(buf), "%d %s", found, TEXT_CH_FOUND);
+ elm_object_part_text_set(m->base, PART_SRCH_SEARCH_RESULT, buf);
+
+ m->ugd->find_chs = found;
+}
+#endif
+
+bool CChannelSearchView::m_StartScan(void)
+{
+
+#if 0
+ if(!m->pTVServiceMgr->SetCallback(&cbs)) {
+ _ERR("tv_scan_set_callbacks failed");
+ return -1;
+ }
+#endif
+
+ if(!m->pTVServiceMgr->Start()) {
+ _ERR("tv_scan_start failed.");
+ return -1;
+ }
+
+ return false;
+}
+
+
+void CChannelSearchView::t_OnShow(void)
+{
+ _DBG();
+
+ evas_object_show(m->base);
+
+ CBaseView::t_OnShow();
+}
+
+
+void CChannelSearchView::t_OnUpdate(void *data)
+{
+ _DBG();
+
+ m->stop_btn = util_add_button(m->base, BTN_STYLE, PART_STOP_BTN, TEXT_BTN_STOP, EINA_TRUE);
+ if (!m->stop_btn) {
+ _ERR("stop_btn is NULL");
+ return;
+ }
+
+ elm_object_focus_set(m->stop_btn, EINA_TRUE);
+ //evas_object_smart_callback_add(m->stop_btn, SIGNAL_CLICKED, _stop_btn_clicked_cb, priv);
+ Connect(m->stop_btn, 1);
+ util_focus_next_set(m->stop_btn);
+
+ m->pb = elm_progressbar_add(m->base);
+ if (!m->pb) {
+ _ERR("pb is NULL");
+ evas_object_del(m->stop_btn);
+ return;
+ }
+
+ elm_object_style_set(m->pb, PRGBAR_STYLE);
+ elm_object_part_text_set(m->base, PART_PGBAR_NUM, INITIAL_TEXT);
+ elm_progressbar_value_set(m->pb, INITIAL_VALUE);
+ elm_object_part_content_set(m->base, PART_PROGRESSBAR, m->pb);
+ evas_object_show(m->pb);
+
+ if (m_StartScan() != true) {
+ _ERR("start scan failed");
+ return;
+ }
+
+ evas_object_show(m->base);
+}
+
+
+void CChannelSearchView::t_OnHide(void)
+{
+ _DBG();
+
+ evas_object_hide(m->base);
+
+ CBaseView::t_OnHide();
+}
+
+
+
+bool CChannelSearchView::Create(void *data)
+{
+ _DBG();
+ ASSERT(!m);
+ char buf[MAX_BUF_SIZE];
+
+ ui_gadget_h ug;
+ if (!data) {
+ _ERR("Invalid argument");
+ return false;
+ }
+ ug = (ui_gadget_h)data;
+
+ _CREATE_BEGIN{
+ _CHECK(m = new SChannelSearchView)
+ _CHECK(m->win = CViewMgr::GetInstance()->Window())
+ _CHECK(CTVServiceMgr::Initialize())
+ _CHECK(m->pTVServiceMgr = CTVServiceMgr::GetInstance())
+ _CHECK(m->base = util_add_layout(m->win, AUTO_PRGM_EDJ_FILE, GROUP_SRCH))
+
+ _WHEN_SUCCESS {
+ elm_win_resize_object_add(m->win, m->base);
+ elm_object_part_text_set(m->base, PART_SRCH_MAIN_TITLE, SEARCH_MAIN_TITLE);
+ elm_object_part_text_set(m->base, PART_CH_NAME, SCAN_CH_NAME);
+ snprintf(buf, sizeof(buf), "%d %s", INITIAL_CH_NUMS, TEXT_CH_FOUND);
+ elm_object_part_text_set(m->base, PART_SRCH_SEARCH_RESULT, buf);
+#if 0
+ evas_object_data_set(m->base, "SRCHDATA", m);
+#endif
+ m->ug = ug;
+ m->pViewMgr = CViewMgr::GetInstance();
+ }
+
+ _CHECK_FAIL{evas_object_del(m->base);}
+ _CHECK_FAIL{/* m->pTVServiceMgr = CTVServiceMgr::GetInstance() */}
+ _CHECK_FAIL{CTVServiceMgr::Finalize();}
+ _CHECK_FAIL{/* m->win = CViewMgr::GetInstance()->Window() */}
+ _CHECK_FAIL{ delete m; m = NULL; }
+ } _CREATE_END_AND_CATCH{ return false; }
+
+ return true;
+}
+
+
+void CChannelSearchView::Destroy(void)
+{
+ ASSERT(m);
+
+ if(m->base)
+ evas_object_del(m->base);
+
+ CTVServiceMgr::Finalize();
+
+ delete m;
+ m = NULL;
+}
+
+
+Evas_Object* CChannelSearchView::Base(void)
+{
+ ASSERT(m);
+
+ return m->base;
+}
+
+void CChannelSearchView::OnMouseClicked(int id, Evas_Object *obj)
+{
+ switch(id) {
+ case 1:
+ case 4:
+ {
+ if(!m->pTVServiceMgr->Pause()) {
+ _ERR("tv_scan_pause failed");
+ return;
+ }
+
+ elm_object_part_text_set(m->base, PART_SRCH_MAIN_TITLE, PAUSE_MAIN_TITLE);
+
+ m->exit_btn = util_add_button(m->base, BTN_STYLE, PART_EXIT_BTN, TEXT_BTN_STOP, EINA_TRUE);
+ if (!m->exit_btn) {
+ _ERR("exit_btn is NULL");
+ return;
+ }
+
+ //evas_object_smart_callback_add(m->exit_btn, SIGNAL_CLICKED, _destroy_search_page_cb, priv);
+ Connect(m->exit_btn, 2);
+
+ m->cancel_btn = util_add_button(m->base, BTN_STYLE, PART_SRCH_CANCEL_BTN, TEXT_BTN_CANCEL, EINA_TRUE);
+ if (!m->cancel_btn) {
+ _ERR("cancel_btn is NULL");
+ evas_object_del(m->exit_btn);
+ m->exit_btn = NULL;
+ return;
+ }
+
+ //evas_object_smart_callback_add(m->cancel_btn, SIGNAL_CLICKED, _cancel_btn_clicked_cb, priv);
+ Connect(m->cancel_btn, 3);
+
+ elm_object_focus_allow_set(m->exit_btn, EINA_TRUE);
+ elm_object_focus_set(m->exit_btn, EINA_TRUE);
+ util_focus_next_set(m->exit_btn);
+
+ evas_object_del(m->stop_btn);
+ m->stop_btn = NULL;
+ }
+ break;
+ case 2:
+ {
+ if(!m->pTVServiceMgr->Stop()) {
+ _ERR("tv_scan_stop failed");
+ return;
+ }
+
+ ug_destroy_me(m->ug);
+ }
+ break;
+ case 3:
+ {
+ elm_object_part_text_set(m->base, PART_SRCH_MAIN_TITLE, SEARCH_MAIN_TITLE);
+
+ if(!m->pTVServiceMgr->Resume()) {
+ _ERR("resume tv scan failed.");
+ return;
+ }
+
+ m->stop_btn = util_add_button(m->base, BTN_STYLE, PART_STOP_BTN, TEXT_BTN_STOP, EINA_TRUE);
+ if (!m->stop_btn) {
+ _ERR("stop_btn is NULL");
+ return;
+ }
+
+ elm_object_focus_allow_set(m->stop_btn, EINA_TRUE);
+ elm_object_focus_set(m->stop_btn, EINA_TRUE);
+ //evas_object_smart_callback_add(m->stop_btn, SIGNAL_CLICKED, _stop_btn_clicked_cb, priv);
+ Connect(m->stop_btn, 4);
+
+ util_focus_next_set(m->stop_btn);
+
+ evas_object_del(m->exit_btn);
+ evas_object_del(m->cancel_btn);
+ m->exit_btn = NULL;
+ m->cancel_btn = NULL;
+ }
+ break;
+ default:
+ break;
+ }
+}
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 <stdlib.h>
-#include <Ecore.h>
-#include "dbg.h"
-//#include "tv_service_proxy.h"
-#include "tv_scan.h"
-
-#define SIGNAL_HANDLER_INTERVAL 0.1
-
-enum tv_scan_state {
- SCAN_STATE_READY,
- SCAN_STATE_SEARCHING,
- SCAN_STATE_PAUSED,
- SCAN_STATE_STOPPING,
- SCAN_STATE_MAX
-};
-
-struct tv_scan {
- struct tv_scan_cbs cbs;
- enum tv_scan_state state;
- enum antenna_mode set_mode;
-#if 0
- TvServiceScan service_scan;
- TvServiceScanType scan_type;
-#endif
- int ch_count;
- int ch_num;
- int total_ch;
- struct tv_scan_result res;
- int is_stopped;
- Eina_List *signal_queue;
- Ecore_Timer *signal_timer;
-};
-
-struct _signal_info {
-#if 0
- TvServiceScanType scan_type;
- TvServiceScanEvent signal;
- TvServiceScanEventData signal_data;
-#endif
-};
-
-/**
- * Get the scan type according to the setting of scanning mode in the beginning
- *
- * In this function, it will find the scan state the tv service provided
- * accordding to the setting of scanning mode by user
- *
- * @param[in] mode: The setting of scanning mode in view_scan_start
- * @param[out] type: The corresponding scan type provided by tv service
- * @return 0 on success otherwise -1
- */
-#if 0
-static int _get_scan_mode(enum antenna_mode mode, TvServiceScanType *type)
-{
- switch (mode) {
- case SCAN_TYPE_ALL:
- *type = TVS_SCAN_ALL_ANALOG_DIGITAL;
- break;
- case SCAN_TYPE_CABLE:
- *type = TVS_SCAN_CABLE_ANALOG_DIGITAL;
- break;
- case SCAN_TYPE_AIR:
- *type = TVS_SCAN_AIR_ANALOG_DIGITAL;
- break;
- default:
- _ERR("Invalid scan mode: %d", mode);
- return -1;
- }
-
- return 0;
-}
-#endif
-
-/**
- * Handling the beginning signal.
- *
- * When user press the button "start", it will begin scanning, and the tv
- * service will return the total number of channels in the first for
- * calculating the progress of the progressbar
- *
- * In this function, it will find the total number of channel signal according
- * to the scanning type.
- *
- * @param[in] tvs: Data handler for tv scan manager.
- * @param[in] sinfo: The channel signal information.
- */
-static void _handle_begin_signal(struct tv_scan *tvs,
- struct _signal_info *sinfo)
-{
-#if 0
- if (!tvs || !sinfo) {
- _ERR("Invalid argument");
- return;
- }
-
- switch (sinfo->scan_type) {
- case TVS_SCAN_ALL_ANALOG_DIGITAL:
- tvs->total_ch = sinfo->signal_data.data.l[0] +
- sinfo->signal_data.data.l[1];
- break;
- case TVS_SCAN_AIR_ANALOG_DIGITAL:
- tvs->total_ch = sinfo->signal_data.data.l[0];
- break;
- case TVS_SCAN_CABLE_ANALOG_DIGITAL:
- tvs->total_ch = sinfo->signal_data.data.l[1];
- break;
- default:
- _ERR("Invalid scan type");
- break;
- }
-#endif
-}
-
-/**
- * Handle the receiving channel signal.
- *
- * @param[in] tvs: Data handler for tv scan manager.
- * @param[in] sinfo: The channel signal information.
- */
-static void _handle_progress_signal(struct tv_scan *tvs,
- struct _signal_info *sinfo)
-{
-#if 0
- if (!tvs || !sinfo) {
- _ERR("Invalid argument");
- return;
- }
-
- tvs->ch_count++;
- tvs->ch_num = sinfo->signal_data.data.l[0];
-
- if (tvs->cbs.progress_cb)
- tvs->cbs.progress_cb(tvs, tvs->set_mode, tvs->ch_count,
- tvs->ch_num, tvs->cbs.data);
-#endif
-}
-
-/**
- * Calculating the number of ATV channle signal or DTV channel signal.
- *
- * @param[in] atv: A pointer for saving the number of ATV channel signal.
- * @param[in] dtv: A pointer for saving the number of DTV channel signal.
- * @param[in] sinfo: The channel signal information.
- */
-static void _channel_count(unsigned int *atv, unsigned int *dtv,
- struct _signal_info *sinfo)
-{
-#if 0
- if (!sinfo || !atv || !dtv) {
- _ERR("Invalid argument");
- return;
- }
-
- switch (sinfo->signal_data.data.s[1]) {
- case TVS_CHANNEL_TYPE_ATV:
- *atv += sinfo->signal_data.data.s[2];
- break;
- case TVS_CHANNEL_TYPE_DTV:
- *dtv += sinfo->signal_data.data.s[3];
- break;
- default:
- _ERR("Invalid TVS_CHANNEL_TYPE");
- break;
- }
-#endif
-}
-
-/**
- * Handle the found channel signal when tune lock success.
- *
- * @param[in] tvs: Data handler for tv scan manager.
- * @param[in] sinfo: The channel signal information.
- */
-static void _handle_found_signal(struct tv_scan *tvs,
- struct _signal_info *sinfo)
-{
-#if 0
- if (!tvs || !sinfo) {
- _ERR("Invalid argument");
- return;
- }
-
- /* judge *param.s[0]: antenna type */
- switch (sinfo->signal_data.data.s[0]) {
- case TV_SERVICE_ANTENNA_TYPE_AIR:
- _channel_count(&tvs->res.air_atv,
- &tvs->res.air_dtv, sinfo);
- break;
- case TV_SERVICE_ANTENNA_TYPE_CABLE:
- _channel_count(&tvs->res.cable_atv,
- &tvs->res.cable_dtv, sinfo);
- break;
- default:
- _ERR("Invalid channel type");
- return;
- }
-
- if ((sinfo->signal_data.data.s[2] > 0 ||
- sinfo->signal_data.data.s[3] > 0) && tvs->cbs.found_cb)
- tvs->cbs.found_cb(tvs, tvs->ch_count, tvs->ch_num, &tvs->res,
- tvs->cbs.data);
-#endif
-}
-
-/**
- * Handle the result when scanning is finished.
- *
- * @param[in] tvs: Data handler for tv scan manager.
- * @param[in] sinfo: The channel signal information.
- */
-static void _handle_done_signal(struct tv_scan *tvs,
- struct _signal_info *sinfo)
-{
-#if 0
- if (!tvs || !sinfo) {
- _ERR("Invalid argument");
- return;
- }
-
- if (sinfo->signal_data.data.l[0] == TVS_SCAN_SEARCH_FINISH_COMPLETE) {
- tvs->state = SCAN_STATE_READY;
-
- if (tvs->cbs.done_cb)
- tvs->cbs.done_cb(tvs, &tvs->res, tvs->cbs.data);
- }
-#endif
-}
-
-/**
- * Handle the receiving signal saved in tvs->signal_queue.
- *
- * @param[in] data: Data handler for tv scan manager.
- */
-static Eina_Bool _handle_signal(void *data)
-{
-#if 0
- struct tv_scan *tvs;
- struct _signal_info *sinfo;
-
- if (!data)
- return ECORE_CALLBACK_CANCEL;
-
- tvs = data;
-
- if (!tvs->signal_queue)
- goto stop;
-
- sinfo = eina_list_data_get(tvs->signal_queue);
- if (!sinfo)
- goto stop;
-
- tvs->signal_queue = eina_list_remove_list(
- tvs->signal_queue, tvs->signal_queue);
-
- switch (sinfo->signal) {
- case TVS_SCAN_EVENT_SEARCH_BEGIN:
- _handle_begin_signal(tvs, sinfo);
- break;
- case TVS_SCAN_EVENT_SEARCH_CHANNEL:
- _handle_progress_signal(tvs, sinfo);
- break;
- case TVS_SCAN_EVENT_CHANNEL_FOUND:
- _handle_found_signal(tvs, sinfo);
- break;
- case TVS_SCAN_EVENT_SEARCH_FINISH:
- _handle_done_signal(tvs, sinfo);
- break;
- default:
- _ERR("Invalid signal");
- break;
- }
-
- free(sinfo);
-
- if (!tvs->signal_queue)
- goto stop;
-
- return ECORE_CALLBACK_RENEW;
-
-stop:
- tvs->signal_timer = NULL;
- return ECORE_CALLBACK_CANCEL;
-#endif
- return EINA_TRUE;
-}
-
-/**
- * Handle the receiving signal from tv service.
- *
- * Tv service will send the signal one by one, and the variable Ecore_Timer:
- * signal_timer is set for setting the time for dealing with the signal in
- * signal_queue at regular intervals.
- *
- * @param[in] signal: Signal from Tv service.
- * @param[in] signal_data: Data handler for tv service sacn event.
- * @param[in] data: Data handler for tv scan manager.
- */
-#if 0
-static void _signal_received(TvServiceScanEvent signal,
- TvServiceScanEventData *signal_data, gpointer data)
-{
- struct tv_scan *tvs;
- struct _signal_info *sinfo;
-
- if (!data) {
- _ERR("Invalid argument");
- return;
- }
-
- tvs = data;
-
- sinfo = calloc(1, sizeof(*sinfo));
- if (!sinfo) {
- _ERR("calloc failed");
- return;
- }
-
- sinfo->signal = signal;
- sinfo->signal_data = *signal_data;
- sinfo->scan_type = tvs->scan_type;
-
- tvs->signal_queue = eina_list_append(
- tvs->signal_queue, sinfo);
-
- if (!tvs->signal_timer) {
- tvs->signal_timer = ecore_timer_add(SIGNAL_HANDLER_INTERVAL,
- _handle_signal, tvs);
- if (!tvs->signal_timer) {
- _ERR("add timer failed.");
- tvs->signal_queue = eina_list_remove(tvs->signal_queue,
- sinfo);
- free(sinfo);
- return;
- }
- }
-}
-#endif
-
-/**
- * Initialize the tv scan manager object
- *
- * In this function, it will create tv_scan struct object, and get the related
- * scan mode (one of TVS_SCAN_ALL_ANALOG_DIGITAL /
- * TVS_SCAN_CABLE_ANALOG_DIGITAL / TVS_SCAN_AIR_ANALOG_DIGITAL)
- * fron tv service according to the optional setting mode
- * (one of AIR / CABLE / ALL) in scan_start view,
- * and register TvServiceScan object and set it for variable service_scan,
- * and set the initial scan state SCAN_STATE_READY.
- *
- * @param[in] mode: the setting mode (one of AIR / CABLE / ALL) in
- * view_scan_start
- * @return The struct tvs or NULL if initialize failed
- */
-struct tv_scan *tv_scan_init(enum antenna_mode mode)
-{
-#if 0
- struct tv_scan *tvs;
- TvServiceScan scan;
- TvServiceScanType type;
- gint result;
- int r;
-
- tvs = calloc(1, sizeof(*tvs));
- if (!tvs) {
- _ERR("calloc failed");
- return NULL;
- }
-
- r = _get_scan_mode(mode, &type);
- if (r == -1) {
- _ERR("Get scan mode failed");
- free(tvs);
- return NULL;
- }
-
- result = tv_service_scan_create(&scan, type);
- if (result != TVS_ERROR_OK) {
- _ERR("Create Scan failed");
- free(tvs);
- return NULL;
- }
-
- tvs->service_scan = scan;
- tvs->scan_type = type;
- tvs->set_mode = mode;
- tvs->state = SCAN_STATE_READY;
-
- return tvs;
-#endif
- return NULL;
-}
-
-/**
- * Release tv_scan struct resource
- *
- * In this function, it will release the object in tv_scan struct object,
- * include channel information saved in signal_queue and the Ecore_Timer object
- * and so on.
- *
- * @param[in] tvs: Data handler for tv scan manager.
- * @return 0 on success otherwise -1
- */
-int tv_scan_fini(struct tv_scan *tvs)
-{
-#if 0
- struct _signal_info *sinfo;
-
- if (!tvs) {
- _ERR("Invalid argument");
- return -1;
- }
-
- if (tvs->state != SCAN_STATE_READY)
- tv_scan_stop(tvs);
-
- if (tvs->signal_timer)
- ecore_timer_del(tvs->signal_timer);
-
- EINA_LIST_FREE(tvs->signal_queue, sinfo)
- free(sinfo);
-
- tv_service_scan_destroy(tvs->service_scan);
- free(tvs);
-
-#endif
- return 0;
-}
-
-/**
- * Register callbacks for tvs struct
- *
- * @param[in] tvs: Data handler for tv scan manager.
- * @param[in] cbs: The registered callbacks for control the scan state
- * @return 0 on success otherwise -1
- */
-int tv_scan_set_callbacks(struct tv_scan *tvs, struct tv_scan_cbs *cbs)
-{
- if (!tvs || !cbs) {
- _ERR("Invalid argument");
- return -1;
- }
-
- tvs->cbs = *cbs;
-
- return 0;
-}
-
-/**
- * Start scanning channels
- *
- * @param[in] tvs: Data handler for tv scan manager.
- * @return 0 on success otherwise -1
- */
-int tv_scan_start(struct tv_scan *tvs)
-{
-#if 0
- gint result;
-
- if (!tvs || !tvs->service_scan) {
- _ERR("Invalid argument");
- return -1;
- }
-
- if (tvs->state != SCAN_STATE_READY) {
- _ERR("unable state to start scan");
- return -1;
- }
-
- result = tv_service_scan_register_callback(tvs->service_scan,
- _signal_received, (gpointer)tvs);
- if (result != TVS_ERROR_OK) {
- _ERR("register callback failed");
- return -1;
- }
-
- result = tv_service_scan_start(tvs->service_scan);
- if (result != TVS_ERROR_OK) {
- _ERR("scan start failed");
- return -1;
- }
-
- tvs->state = SCAN_STATE_SEARCHING;
- tvs->is_stopped = 0;
- tvs->ch_count = 0;
- memset(&tvs->res, 0x00, sizeof(tvs->res));
-
- return 0;
-#endif
- return -1;
-}
-
-/**
- * Pause the scanning of channels
- *
- * In this function, it will invoke the pausing function from tv service
- * for pausing the scaning and stop sending channel signals.
- *
- * @param[in] tvs: Data handler for tv scan manager.
- * @return 0 on success otherwise -1
- */
-int tv_scan_pause(struct tv_scan *tvs)
-{
-#if 0
- gint result;
-
- if (!tvs || !tvs->service_scan) {
- _ERR("Invalid argument");
- return -1;
- }
-
- if (tvs->state != SCAN_STATE_SEARCHING) {
- _ERR("unable state to pause scan");
- return -1;
- }
-
- result = tv_service_scan_pause(tvs->service_scan);
- if (result != TVS_ERROR_OK) {
- _ERR("Pause Scan failed");
- return -1;
- }
-
- tvs->state = SCAN_STATE_PAUSED;
-
-#endif
- return 0;
-}
-
-
-/**
- * Resume the paused scanning of channels
- *
- * @param[in] tvs: Data handler for tv scan manager.
- * @return 0 on success otherwise -1
- */
-int tv_scan_resume(struct tv_scan *tvs)
-{
-#if 0
- gint result;
-
- if (!tvs || !tvs->service_scan) {
- _ERR("Invalid argument");
- return -1;
- }
-
- if (tvs->state != SCAN_STATE_PAUSED) {
- _ERR("unable state to resume scan");
- return -1;
- }
-
- result = tv_service_scan_resume(tvs->service_scan);
- if (result != TVS_ERROR_OK) {
- _ERR("resume Scan failed");
- return -1;
- }
-
- tvs->state = SCAN_STATE_SEARCHING;
-
-#endif
- return 0;
-}
-
-/**
- * Stop the scanning of channels
- *
- * Stop the scanning and stop receiving channel signal
- *
- * @param[in] tvs: Data handler for tv scan manager.
- * @return 0 on success otherwise -1
- */
-int tv_scan_stop(struct tv_scan *tvs)
-{
-#if 0
- gint result;
-
- if (!tvs) {
- _ERR("Invalid argument");
- return -1;
- }
-
- if (tvs->state == SCAN_STATE_READY) {
- _ERR("unable state to stop scan");
- return -1;
- }
-
- result = tv_service_scan_stop(tvs->service_scan);
- if (result != TVS_ERROR_OK) {
- _ERR("Create Scan failed");
- return -1;
- }
-
- tvs->state = SCAN_STATE_STOPPING;
- tvs->is_stopped = 1;
-
-#endif
- return 0;
-}
-
-/**
- * Get the total number of channel signals saved in
- * data handler for tv scan manager
- *
- * @param[in] tvs: Data handler for tv scan manager.
- * @return 0 on success otherwise -1
- */
-int tv_scan_get_total_channel(struct tv_scan *tvs)
-{
- if (!tvs) {
- _ERR("Invalid argument");
- return -1;
- }
-
- return tvs->total_ch;
-}
-
-/**
- * Get the scanning result of channel signals
- *
- * There are four kinds of channel signals: ATV air, ATV cable, DTV air and
- * DTV cable, and the numner of the channel signal is saved in variable
- * tvs->res.
- *
- * @param[in] tvs: Data handler for tv scan manager.
- * @return The tv_scan_result struct
- */
-struct tv_scan_result *tv_scan_get_result(struct tv_scan *tvs)
-{
- if (!tvs) {
- _ERR("Invalid argument");
- return NULL;
- }
-
- return &tvs->res;
-}
-
-/**
- * Get the state of scanning of channels
- *
- * Get the state of scanning of channels to judge whether the scanning
- * is stopped.
- *
- * @param[in] tvs: Data handler for tv scan manager.
- * @return 0 on success otherwise -1
- */
-int tv_scan_is_stopped(struct tv_scan *tvs)
-{
- if (!tvs) {
- _ERR("Invalid argument");
- return -1;
- }
-
- return tvs->is_stopped;
-}
#include <app.h>
#include "defs.h"
#include "dbg.h"
-#include "viewmgr_auto_program.h"
#include "ug_auto_program.h"
-#include "view_scan_start.h"
-#include "view_search_page.h"
-#include "view_result_page.h"
#include "util.h"
+#include "TVServiceMgr.h"
+#include <ViewMgr.h>
+#include "BaseView.h"
+#include "ChannelMainView.h"
#if defined (__cplusplus)
extern "C" {
#endif
+struct _ug_data {
+ ui_gadget_h ug;
+
+ Evas_Object *win;
+ Evas_Object *base;
+
+ enum antenna_mode scan_type;
+ int find_chs;
+
+ CViewMgr *pViewMgr;
+ CChannelMainView *pChannelMainView;
+};
+
/**
* Creates the base layout for channel UI gadget
*
static void *_on_create(ui_gadget_h ug, enum ug_mode mode,
service_h service, void *priv)
{
+ struct _ug_data *ugd;
Evas_Object *win;
- struct _ugdata *ugd;
- struct viewmgr *vmgr;
if (!ug || !priv) {
- _ERR("ug: %p , priv: %p ", ug, priv);
+ _ERR("Parameter error!");
return NULL;
}
- ugd = (struct _ugdata *) priv;
+ ugd = (struct _ug_data *) priv;
+ ugd->ug = ug;
elm_theme_extension_add(NULL, AUTO_PRGM_EDJ_THEME);
return NULL;
}
+ ugd->win = win;
+
elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
elm_win_focus_highlight_style_set(win, INVISIBLE);
- vmgr = viewmgr_init(win);
- if (!vmgr) {
- _ERR("viewmgr init failed");
+ CViewMgr::Initialize(ugd->win, NULL);
+ ugd->pViewMgr = CViewMgr::GetInstance();
+ if(!ugd->pViewMgr) {
+ CViewMgr::Finalize();
+ _ERR("Fail to get CViewMgr instance");
return NULL;
}
-
- ugd->ug = ug;
- ugd->win = win;
- ugd->vmgr = vmgr;
-
- if (viewmgr_push(vmgr, view_scanstart_get_vclass(), ugd) == -1) {
- _ERR("scan view push failed");
- viewmgr_fini(vmgr);
- return NULL;
+ ugd->pChannelMainView = new CChannelMainView(CHANNEL_MAINVIEW);
+ if(!ugd->pViewMgr->AddView(ugd->pChannelMainView)) {
+ _ERR("Fail to add pFbBaseView");
+ CViewMgr::Finalize();
+ return false;
}
- return ugd->ugd_base;
+ ugd->pViewMgr->PushView(CHANNEL_MAINVIEW, ugd->ug);
+ ugd->base = ugd->pChannelMainView->Base();
+
+ return ugd->base;
}
/**
*/
static void _on_destroy(ui_gadget_h ug, service_h service, void *priv)
{
- struct _ugdata *ugd;
-
- if (!ug || !priv) {
- _ERR("Invalid parameter.");
- return;
- }
-
- ugd = (struct _ugdata *) priv;
-
- viewmgr_fini(ugd->vmgr);
-
- return;
+ CViewMgr::Finalize();
}
/**
*/
UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
{
- struct _ugdata *ugd;
+ struct _ug_data *ugd;
if (!ops)
return -1;
- ugd = (struct _ugdata *) calloc(1, sizeof(*ugd));
+ ugd = (struct _ug_data *) calloc(1, sizeof(*ugd));
if (!ugd)
return -1;
*/
UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
{
- struct _ugdata *ugd;
+ struct _ug_data *ugd;
if (!ops)
return;
- ugd = (struct _ugdata *)ops->priv;
+ ugd = (struct _ug_data *)ops->priv;
free(ugd);
}
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 <Elementary.h>
-#include <app.h>
-#include <system_info.h>
-#include "dbg.h"
-#include "defs.h"
-#include "util.h"
-#include "viewmgr_auto_program.h"
-#include "ug_auto_program.h"
-#include "view_search_page.h"
-#include "view_result_page.h"
-
-#define RESULT_MSG_SIZE 60
-
-
-struct _data {
- Evas_Object *win;
- Evas_Object *base;
- Evas_Object *ok_btn;
- struct viewmgr *vmgr;
- struct _ugdata *ugd;
-};
-
-#define _GET_PRIV(o) (struct _data *) evas_object_data_get(o, "RESDATA")
-#define _SET_PRIV(o, data) evas_object_data_set(o, "RESDATA", data)
-
-/**
- * @Evas_Smart_Cb type callback for handling the click callback event for
- * "OK" button.
- *
- * When "OK" button is clicked, channel ug will exit.
- *
- * @param[in] data: the user data related to current view
- * @param[in] obj: the corresponding object on which the button click event
- * occurred
- *
- * @param[in] ev: event information
- */
-static void _ok_btn_clicked_cb(void *data, Evas_Object *obj, void *ev)
-{
- struct _ugdata *ugd;
- struct _data *priv;
-
- if (!data) {
- _ERR("Invalid argument");
- return;
- }
-
- priv = (struct _data *) data;
- ugd = priv->ugd;
-
- if (!ugd || !ugd->ug) {
- _ERR("ugd->ug is NULL");
- return;
- }
-
- ug_destroy_me(ugd->ug);
-}
-
-/**
- * Initializes the base layout for scanning result view.
- *
- * Create the layout of scanning result view.
- *
- * @param[in] vmgr: the handler to the struct object for managing the view
- * @param[in] data: the user data related to current view
- * @return The base or NULL if creatting failed
- */
-static Evas_Object *_create(struct viewmgr *vmgr, void *data)
-{
- Evas_Object *base;
- Evas_Object *win;
- struct _data *priv;
- struct _ugdata *ugd;
-
- if (!vmgr || !data) {
- _ERR("Invalid argument");
- return NULL;
- }
-
- ugd = (struct _ugdata *) data;
-
- win = viewmgr_get_win(vmgr);
- if (!win)
- return NULL;
-
- priv = (struct _data *) calloc(1, sizeof(*priv));
- if (!priv)
- return NULL;
-
- base = util_add_layout(win, AUTO_PRGM_EDJ_FILE, GROUP_RES);
- if (!base) {
- free(priv);
- return NULL;
- }
-
- elm_win_resize_object_add(win, base);
-
- priv->win = win;
- priv->base = base;
- priv->ugd = ugd;
- priv->vmgr = vmgr;
-
- _SET_PRIV(base, priv);
-
- return base;
-}
-
-/**
- * Invoked after _create() function as defined in viewmgr_push().
- *
- * Create the button in result view, and show the information about the
- * number of found channels.
- *
- * @param[in] base: the layout of the view
- */
-static void _update(Evas_Object *base)
-{
- Evas_Object *ok_btn;
- struct _data *priv;
- char msg[RESULT_MSG_SIZE];
- int chs;
-
- if (!base) {
- _ERR("Invalid argument");
- return;
- }
-
- priv = _GET_PRIV(base);
- if (!priv) {
- _ERR("Data get failed");
- return;
- }
-
- chs = priv->ugd->find_chs;
-
- snprintf(msg, sizeof(msg), "%s<br>%d %s", COMPLETE_MAIN_TITLE,
- chs, TEXT_CH_MEMORIZED);
- elm_object_part_text_set(priv->base, PART_RES_MAIN_TITLE, msg);
-
- ok_btn = util_add_button(priv->base, BTN_STYLE,
- PART_OK_BTN, TEXT_BUTTON_OK, EINA_TRUE);
- if (!ok_btn) {
- _ERR("ok_btn is NULL");
- return;
- }
-
- priv->ok_btn = ok_btn;
- elm_object_focus_set(ok_btn, EINA_TRUE);
- evas_object_smart_callback_add(ok_btn, SIGNAL_CLICKED,
- _ok_btn_clicked_cb, priv);
-
- util_focus_next_set(ok_btn);
-}
-
-/**
- * Resume the application.
- *
- * @param[in] base: the layout of the view
- */
-static void _resume(Evas_Object *base)
-{
- evas_object_show(base);
-}
-
-/**
- * Pause the application.
- *
- * Hide the layout
- *
- * @param[in] base: the layout of the view
- */
-static void _pause(Evas_Object *base)
-{
- evas_object_hide(base);
-}
-
-/**
- * Called after the main loop of the view exits.
- *
- * Delete the layout and release the resourse
- *
- * @param[in] base: the layout of the view
- */
-static void _terminate(Evas_Object *base)
-{
- struct _data *priv;
-
- if (!base) {
- _ERR("Invalid argument");
- return;
- }
-
- priv = _GET_PRIV(base);
- if (!priv) {
- _ERR("Data get failed");
- return;
- }
-
- if (priv->base)
- evas_object_del(priv->base);
-
- free(priv);
-}
-
-/**
- * This struct is for registering the callbacks for the view
- */
-static struct view_class _vclass = {
- VIEW_RESULT,
- _create,
- _update,
- _resume,
- _pause,
- _terminate,
-};
-
- /**
- * Returns current view_class which implements the result view's life cycle
- *
- * @return view_class
- */
-struct view_class *view_resultpage_get_vclass(void)
-{
- return &_vclass;
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co. Ltd All Rights Reserved
- *
- * 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 <Elementary.h>
-#include <Ecore_Evas.h>
-#include <system_info.h>
-#include <app.h>
-#include "ug_auto_program.h"
-#include "view_scan_start.h"
-#include "view_search_page.h"
-#include "view_result_page.h"
-#include "viewmgr_auto_program.h"
-#include "dbg.h"
-#include "defs.h"
-#include "tv_scan.h"
-#include "util.h"
-
-#define HORIZONTAL_ALIGN 0.5
-#define VERTICAL_ALIGN 0.0
-#define MAX_ITEMS 3
-#define ALL "All"
-#define CABLE "Cable"
-#define AIR "Air"
-
-
-enum antenna_type {
- ALL_ITEM,
- CABLE_ITEM,
- AIR_ITEM
-};
-
-struct _data {
- Evas_Object *win;
- Evas_Object *base;
- Evas_Object *start_btn;
- Evas_Object *cancel_btn;
- Evas_Object *box;
- Evas_Object *last_focus_item;
- Evas_Object *selected_item;
- Evas_Object *atn_btn[MAX_ITEMS];
- struct viewmgr *vmgr;
- struct _ugdata *ugd;
- enum antenna_mode scan_type;
-};
-
-struct _antenna_info {
- char *style;
- Evas_Smart_Cb cb;
- char *text;
-};
-
-#define _GET_PRIV(o) (struct _data *) evas_object_data_get(o, "SCANSTARTDATA")
-#define _SET_PRIV(o, data) evas_object_data_set(o, "SCANSTARTDATA", data)
-
-/**
- * @EVAS_CALLBACK_KEY_DOWN type callback for handling key pressed callback
- * event
- *
- * @param[in] data: user data related to current view
- * @param[in] e: evas handler
- * @param[in] obj: the corresponding object on which the key pressed event
- * occurred
- * @param[in] ei: event information
- */
-static void _key_pressed_cb(void *data, Evas *e, Evas_Object *obj, void *ei)
-{
- Evas_Event_Key_Down *ev;
- struct _data *priv;
- struct _ugdata *ugd;
-
- if (!data || !ei) {
- _ERR("Parameter error!");
- return;
- }
-
- priv = (struct _data *) data;
- ev = (Evas_Event_Key_Down *) ei;
-
- if (!priv->ugd) {
- _ERR("priv->ugd is NULL");
- return;
- }
-
- ugd = priv->ugd;
-
- if (!ugd->ug) {
- _ERR("ugd->ug is NULL");
- return;
- }
-
- if (!ev->keyname) {
- _ERR("ev->keyname NULL!");
- return;
- }
-
- if (!strcmp(ev->keyname, KEY_BACK) || !strcmp(ev->keyname, KEY_BACK_REMOTE))
- ug_destroy_me(ugd->ug);
-}
-
-/**
- * @Evas_Smart_Cb type callback for handling the click callback event for
- * "start" button.
- *
- * @param[in] data: user data related to current view
- * @param[in] obj: the corresponding object on which the button click event
- * occurred
- * @param[in] ev: event information
- */
-static void _start_btn_clicked_cb(void *data, Evas_Object *obj, void *ev)
-{
- struct _data *priv;
- Eina_Bool tuner_exist;
-
- if (!data) {
- _ERR("data is NULL");
- return;
- }
-
- priv = (struct _data *) data;
-
- if (!priv->ugd || !priv->vmgr) {
- _ERR("parameter is NULL");
- return;
- }
-
- /*
- * TODO: add the interface when TV service provider the related API.
- * Here is a pseudo-data.
- */
- tuner_exist = EINA_TRUE;
- if (!tuner_exist) {
- /*
- * TODO: popup the notification iniformation:
- * there is no tuner
- */
- return;
- }
-
- if (viewmgr_push(priv->vmgr, view_searchpage_get_vclass(),
- priv->ugd) == -1) {
- _ERR("search view push failed");
- return;
- }
-}
-
- /**
- * @Evas_Smart_Cb type callback for handling the click callback event for
- * "cancel" button.
- *
- * @param[in] data: user data related to current view
- * @param[in] obj: the corresponding object on which the button click event
- * occurred
- * @param[in] ev: event information
- */
-static void _cancel_btn_clicked_cb(void *data, Evas_Object *obj, void *ev)
-{
- struct _data *priv;
- struct _ugdata *ugd;
-
- if (!data) {
- _ERR("data is NULL");
- return;
- }
-
- priv = (struct _data *) data;
-
- if (!priv->ugd) {
- _ERR("priv->ugd is NULL");
- return;
- }
-
- ugd = priv->ugd;
-
- if (!ugd->ug) {
- _ERR("ugd->ug is NULL");
- return;
- }
-
- ug_destroy_me(ugd->ug);
-}
-
-/**
- * Callback function for button focus event.
- *
- * @param[in] data: user data related to current view
- * @param[in] obj: the corresponding object on which the button focus event
- * occurred
- * @param[in] emission: the signal's name.
- * @param[in] source: the signal's source.
- */
-static void _btn_focused_cb(void *data, Evas_Object *obj,
- const char *emission, const char *source)
-{
- struct _data *priv;
-
- if (!obj || !data) {
- _ERR("Invalid parameter");
- return;
- }
-
- priv = (struct _data *) data;
-
- if (priv->last_focus_item) {
- elm_object_signal_emit(priv->last_focus_item,
- SIGNAL_SHOWLINE, CHANNEL_SOURCE);
- elm_object_signal_emit(obj, SIGNAL_HIDELINE, CHANNEL_SOURCE);
- } else {
- elm_object_signal_emit(obj, SIGNAL_SHOWLINE, CHANNEL_SOURCE);
- }
-
- priv->last_focus_item = obj;
-}
-
-/**
- * Callback function for button unfocus event.
- *
- * @param[in] data: user data related to current view
- * @param[in] obj: the corresponding object on which the button focus event
- * occurred
- * @param[in] emission: the signal's name.
- * @param[in] source: the signal's source.
- */
-static void _btn_unfocused_cb(void *data, Evas_Object *obj,
- const char *emission, const char *source)
-{
- struct _data *priv;
-
- if (!obj || !data) {
- _ERR("Invalid parameter");
- return;
- }
-
- priv = (struct _data *) data;
- elm_object_signal_emit(priv->last_focus_item,
- SIGNAL_SHOWLINE, CHANNEL_SOURCE);
-}
-
-/**
- * Set the focus sequence for the objects in the layout.
- *
- * @param[in] data: user data related to current view
- */
-static void _update_focus_sequence(struct _data *priv)
-{
- if (!priv) {
- _ERR("Invalid parameter");
- return;
- }
-
- elm_object_focus_next_object_set(priv->atn_btn[ALL_ITEM],
- priv->start_btn, ELM_FOCUS_RIGHT);
- elm_object_focus_next_object_set(priv->atn_btn[CABLE_ITEM],
- priv->start_btn, ELM_FOCUS_RIGHT);
- elm_object_focus_next_object_set(priv->atn_btn[AIR_ITEM],
- priv->start_btn, ELM_FOCUS_RIGHT);
- elm_object_focus_next_object_set(priv->atn_btn[ALL_ITEM],
- priv->atn_btn[ALL_ITEM], ELM_FOCUS_LEFT);
- elm_object_focus_next_object_set(priv->atn_btn[CABLE_ITEM],
- priv->atn_btn[CABLE_ITEM], ELM_FOCUS_LEFT);
- elm_object_focus_next_object_set(priv->atn_btn[AIR_ITEM],
- priv->atn_btn[AIR_ITEM], ELM_FOCUS_LEFT);
-
- if (priv->selected_item) {
- elm_object_focus_next_object_set(priv->start_btn,
- priv->selected_item, ELM_FOCUS_LEFT);
- elm_object_focus_next_object_set(priv->cancel_btn,
- priv->selected_item, ELM_FOCUS_LEFT);
- } else {
- elm_object_focus_next_object_set(priv->start_btn,
- priv->atn_btn[ALL_ITEM], ELM_FOCUS_LEFT);
- elm_object_focus_next_object_set(priv->cancel_btn,
- priv->atn_btn[ALL_ITEM], ELM_FOCUS_LEFT);
- }
-
- elm_object_focus_next_object_set(priv->start_btn,
- priv->cancel_btn, ELM_FOCUS_UP);
- elm_object_focus_next_object_set(priv->cancel_btn,
- priv->start_btn, ELM_FOCUS_DOWN);
- elm_object_focus_next_object_set(priv->cancel_btn,
- priv->start_btn, ELM_FOCUS_UP);
-}
-
-/**
- * @Evas_Smart_Cb type callback for handling the click callback event.
- *
- * @param[in] data: user data related to current view
- * @param[in] obj: the corresponding object on which the button click event
- * occurred
- * @param[in] ev: event information
- */
-static void _item_clicked_cb(void *data, Evas_Object *obj, void *ev)
-{
- struct _data *priv;
- const char *text;
-
- if (!data || !obj) {
- _ERR("Invalid parameter");
- return;
- }
-
- priv = (struct _data *) data;
-
- if (!priv->selected_item) {
- elm_object_focus_set(obj, EINA_TRUE);
- elm_object_signal_emit(obj, SIGNAL_SELECTED, CHANNEL_SOURCE);
- priv->selected_item = obj;
- } else {
- if (priv->selected_item != obj) {
- elm_object_signal_emit(priv->selected_item,
- SIGNAL_UNSELECTED, CHANNEL_SOURCE);
- elm_object_signal_emit(obj, SIGNAL_SELECTED,
- CHANNEL_SOURCE);
- priv->selected_item = obj;
- }
- }
-
- text = elm_object_text_get(priv->selected_item);
- if (text && !strcmp(text, ALL))
- priv->scan_type = SCAN_TYPE_ALL;
- else if (text && !strcmp(text, CABLE))
- priv->scan_type = SCAN_TYPE_CABLE;
- else if (text && !strcmp(text, AIR))
- priv->scan_type = SCAN_TYPE_AIR;
- else
- priv->scan_type = SCAN_TYPE_INVALID;
-
- priv->ugd->scan_type = priv->scan_type;
-
- _update_focus_sequence(priv);
-}
-
-/**
- * Clear the content of the box.
- *
- * @param[in] data: user data related to current view
- */
-static void _clear_box(struct _data *data)
-{
- if (!data) {
- _ERR("Invalid parameter.");
- return;
- }
-
- if (!data->box) {
- _ERR("data->box is NULL");
- return;
- }
-
- elm_box_clear(data->box);
-
- data->last_focus_item = NULL;
- data->selected_item = NULL;
-}
-
-/**
- * Add items in the box of the layout.
- *
- * @param[in] parent: the box created in the layout.
- * @param[in] btnstyle: the style of the button
- * @param[in] btntext: the text shown in button
- * @param[in] fun_cb: the click callback function for the button
- * @param[in] data: user data related to current view
- * @return Button or NULL if creatting failed
- */
-static Evas_Object *_add_exit_item(Evas_Object *parent, const char *btnstyle,
- const char *btntext, Evas_Smart_Cb fun_cb, struct _data *data)
-{
- Evas_Object *btn;
-
- if (!data) {
- _ERR("Invalid parameter.");
- return NULL;
- }
-
- if (!parent || !btnstyle || !btntext || !fun_cb) {
- _ERR("Invalid parameter.");
- return NULL;
- }
-
- btn = util_add_button(parent, btnstyle, NULL, btntext, EINA_TRUE);
- if (!btn) {
- _ERR("add item failed");
- return NULL;
- }
-
- elm_box_pack_end(parent, btn);
- evas_object_smart_callback_add(btn, SIGNAL_CLICKED,
- fun_cb, data);
- elm_object_signal_callback_add(btn, SIGNAL_FOCUSED,
- ELM_SOURCE, _btn_focused_cb, data);
- elm_object_signal_callback_add(btn, SIGNAL_UNFOCUSED,
- ELM_SOURCE, _btn_unfocused_cb, data);
-
- return btn;
-}
-
-/**
- * Create the item list of antenna type .
- *
- * @param[in] data: user data related to current view
- */
-static void _update_antenna_list(struct _data *data)
-{
- Evas_Object *btn;
- int i;
- struct _antenna_info atninfo[] = {
- {
- (char *) ITEM_STYLE,
- _item_clicked_cb,
- ALL
- },
- {
- (char *) ITEM_STYLE,
- _item_clicked_cb,
- CABLE
- },
- {
- (char *) ITEM_STYLE,
- _item_clicked_cb,
- AIR
- }
- };
-
- if (!data) {
- _ERR("Invalid parameter.");
- return;
- }
-
- if (!data->base || !data->box) {
- _ERR("Invalid parameter.");
- return;
- }
-
- _clear_box(data);
-
- for (i = 0; i < MAX_ITEMS; i++) {
- btn = _add_exit_item(data->box, atninfo[i].style,
- atninfo[i].text, atninfo[i].cb, data);
- if (!btn) {
- _ERR("add exist item failed.");
- return;
- }
-
- data->atn_btn[i] = btn;
-
- if (i == 0) {
- elm_object_focus_set(btn, EINA_TRUE);
- elm_object_signal_emit(btn,
- SIGNAL_SELECTED, CHANNEL_SOURCE);
- data->selected_item = btn;
- }
- }
-
- _update_focus_sequence(data);
-}
-
-/**
- * Create box in the layout for adding item in it.
- *
- * @param[in] base: the layout created in _creat() of current view
- * @return The box or NULL if creatting failed
- */
-static Evas_Object *_create_box(Evas_Object *base)
-{
- Evas_Object *box;
- struct _data *priv;
-
- if (!base) {
- _ERR("base is NULL");
- return NULL;
- }
-
- priv = _GET_PRIV(base);
- if (!priv) {
- _ERR("Data get failed");
- return NULL;
- }
-
- box = util_add_box(base, HORIZONTAL_ALIGN, VERTICAL_ALIGN);
- if (!box) {
- _ERR("box add failed");
- return NULL;
- }
-
- elm_object_part_content_set(base, PART_ANTENNA_LIST, box);
- evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0);
-
- return box;
-}
-
-/**
- * Initializes the base layout for scanning start view.
- *
- * Create the beginning view layout based on window
- *
- * @param[in] vmgr: the handler to the struct object for managing the view
- * @param[in] data: the user data related to current view
- * @return The base or NULL if creatting failed
- */
-static Evas_Object *_create(struct viewmgr *vmgr, void *data)
-{
- Evas_Object *base;
- Evas_Object *win;
- Evas_Object *start_btn;
- Evas_Object *cancel_btn;
- Evas_Object *box;
- struct _data *priv;
- struct _ugdata *ugd;
-
- if (!vmgr || !data) {
- _ERR("Invalid argument");
- return NULL;
- }
-
- ugd = (struct _ugdata *)data;
-
- win = viewmgr_get_win(vmgr);
- if (!win) {
- _ERR("get win failed.");
- return NULL;
- }
-
- priv = (struct _data *) calloc(1, sizeof(*priv));
- if (!priv) {
- _ERR("calloc memory failed.");
- return NULL;
- }
-
- base = util_add_layout(win, AUTO_PRGM_EDJ_FILE, GRP_SCAN_START);
- if (!base) {
- _ERR("scan start layout creat failed!");
- free(priv);
- return NULL;
- }
-
- //elm_win_resize_object_add(win, base);
- evas_object_event_callback_add(base, EVAS_CALLBACK_KEY_DOWN,
- _key_pressed_cb, priv);
- elm_object_part_text_set(base, PART_STAR_MAIN_TITLE_BLOCK,
- START_MAIN_TITLE);
-
- start_btn = util_add_button(base, BTN_STYLE,
- PART_START_BTN, TEXT_BTN_START, EINA_TRUE);
- if (!start_btn) {
- _ERR("create start_btn failed");
- goto aborting;
- }
-
- cancel_btn = util_add_button(base, BTN_STYLE,
- PART_CANCEL_BTN, TEXT_BTN_CANCEL, EINA_TRUE);
- if (!cancel_btn) {
- _ERR("create cancel_btn failed");
- goto aborting;
- }
-
- priv->base = base;
- priv->start_btn = start_btn;
- priv->cancel_btn = cancel_btn;
- priv->ugd = ugd;
- priv->ugd->ugd_base = base;
- priv->vmgr = vmgr;
- priv->win = win;
-
- _SET_PRIV(base, priv);
-
- evas_object_smart_callback_add(start_btn, SIGNAL_CLICKED,
- _start_btn_clicked_cb, priv);
- evas_object_smart_callback_add(cancel_btn, SIGNAL_CLICKED,
- _cancel_btn_clicked_cb, priv);
-
- evas_object_raise(base);
-
- box = _create_box(base);
- if (!box) {
- _ERR("create box failed.");
- goto aborting;
- }
-
- priv->box = box;
-
- _update_antenna_list(priv);
-
- return base;
-
-aborting:
- evas_object_del(base);
- free(priv);
- return NULL;
-}
-
-/**
- * Invoked when refresh the window of application.
- *
- * @param[in] base: the layout of the view
- *
- * There is no action in this application.
- */
-static void _update(Evas_Object *base)
-{
-}
-
-/**
- * Resume the application.
- *
- * @param[in] base: the layout of the view
- */
-static void _resume(Evas_Object *base)
-{
- if (!base) {
- _ERR("Invalid argument");
- return;
- }
-
- evas_object_show(base);
-}
-
-/**
- * Pause the view.
- *
- * Hide the layout
- *
- * @param[in] base: the layout of the view
- */
-static void _pause(Evas_Object *base)
-{
- if (!base) {
- _ERR("Invalid argument");
- return;
- }
-
- evas_object_hide(base);
-}
-
-/**
- * Called after the main loop of the view exits.
- *
- * Delete the layout and release the resourse
- *
- * @param[in] base: the layout of the view
- */
-static void _terminate(Evas_Object *base)
-{
- struct _data *priv;
-
- if (!base) {
- _ERR("Invalid argument");
- return;
- }
-
- priv = _GET_PRIV(base);
- if (!priv) {
- _ERR("Data get failed");
- return;
- }
-
- if (priv->base)
- evas_object_del(priv->base);
-
- free(priv);
-}
-
-/**
- * This struct is for registering the callbacks for the view
- */
-static struct view_class _vclass = {
- VIEW_START,
- _create,
- _update,
- _resume,
- _pause,
- _terminate,
-};
-
- /**
- * Returns current view_class which implements the scan start view's life cycle
- *
- * @return view_class
- */
-struct view_class *view_scanstart_get_vclass(void)
-{
- return &_vclass;
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 <Elementary.h>
-#include <Ecore_Evas.h>
-#include <system_info.h>
-#include <app.h>
-#include "ug_auto_program.h"
-#include "view_search_page.h"
-#include "view_result_page.h"
-#include "viewmgr_auto_program.h"
-#include "dbg.h"
-#include "defs.h"
-#include "tv_scan.h"
-#include "util.h"
-
-#define MAX_BUF_SIZE 30
-#define CH_NAME_SIZE 30
-#define INITIAL_CH_NUMS 0
-#define PERCENT 100
-#define INITIAL_TEXT "0%"
-#define INITIAL_VALUE 0.0
-
-struct _data {
- Evas_Object *win;
- Evas_Object *base;
- Evas_Object *pb;
- Evas_Object *stop_btn;
- Evas_Object *exit_btn;
- Evas_Object *cancel_btn;
- struct viewmgr *vmgr;
- struct tv_scan *tvs;
- struct _ugdata *ugd;
-};
-
-#define _GET_PRIV(o) (struct _data *) evas_object_data_get(o, "SRCHDATA")
-#define _SET_PRIV(o, data) evas_object_data_set(o, "SRCHDATA", data)
-
-/**
- * The statement for "stop" button for clicking callback event, for
- * there are two buttons with the same text "stop".
- */
-static void _stop_btn_clicked_cb(void *data, Evas_Object *obj, void *ev);
-
-/**
- * The click callback event for the "cancel" button.
- *
- * When "cancel" button is clicked, the scanning will be resumed.
- *
- * @param[in] data: user data related to current view
- * @param[in] obj: a pointer to the object on which click event occurred
- * @param[in] ev: event information
- */
-static void _cancel_btn_clicked_cb(void *data, Evas_Object *obj, void *ev)
-{
- struct _data *priv;
- int r;
-
- if (!data) {
- _ERR("Invalid argument");
- return;
- }
-
- priv = (struct _data *) data;
-
- if (!priv->cancel_btn || !priv->exit_btn) {
- _ERR("priv->cancel_btn or priv->exit_btn is NULL");
- return;
- }
-
- elm_object_part_text_set(priv->base, PART_SRCH_MAIN_TITLE,
- SEARCH_MAIN_TITLE);
-
- r = tv_scan_resume(priv->tvs);
- if (r != 0) {
- _ERR("resume tv scan failed.");
- return;
- }
-
- priv->stop_btn = util_add_button(priv->base, BTN_STYLE,
- PART_STOP_BTN, TEXT_BTN_STOP, EINA_TRUE);
- if (!priv->stop_btn) {
- _ERR("stop_btn is NULL");
- return;
- }
-
- elm_object_focus_allow_set(priv->stop_btn, EINA_TRUE);
- elm_object_focus_set(priv->stop_btn, EINA_TRUE);
- evas_object_smart_callback_add(priv->stop_btn, SIGNAL_CLICKED,
- _stop_btn_clicked_cb, priv);
-
- util_focus_next_set(priv->stop_btn);
-
- evas_object_del(priv->exit_btn);
- evas_object_del(priv->cancel_btn);
- priv->exit_btn = NULL;
- priv->cancel_btn = NULL;
-}
-
-/**
- * @Evas_Smart_Cb type callback for handling the click callback event for
- * "stop" button.
- *
- * The click callback event for the "stop" button in paused view.
- * When the "stop" button in paused view is clicked, the scanning will
- * be stopped, and channel ug will be exited.
- *
- * @param[in] data: user data related to current view
- * @param[in] obj: a pointer to the object on which click event occurred
- * @param[in] ev: event information
- */
-static void _destroy_search_page_cb(void *data, Evas_Object *obj,
- void *ev)
-{
- struct _ugdata *ugd;
- struct _data *priv;
- int r;
-
- if (!data) {
- _ERR("Invalid argument");
- return;
- }
-
- priv = (struct _data *)data;
-
- if (!priv->ugd || !priv->tvs) {
- _ERR("priv->ugd or priv->tvs is NULL");
- return;
- }
-
- ugd = priv->ugd;
-
- r = tv_scan_stop(priv->tvs);
- if (r != 0) {
- _ERR("tv_scan_stop failed");
- return;
- }
-
- if (!ugd->ug) {
- _ERR("ugd->ug is NULL");
- return;
- }
-
- ug_destroy_me(ugd->ug);
-}
-
-/**
- * @Evas_Smart_Cb type callback for handling the click callback event for
- * "stop" button.
- *
- * When the "stop" button is clicked, the scanning will be paused, the view
- * will be changed into paused state.
- *
- * @param[in] data: user data related to current view
- * @param[in] obj: a pointer to the object on which click event occurred
- * @param[in] ev: event information
- */
-static void _stop_btn_clicked_cb(void *data, Evas_Object *obj, void *ev)
-{
- struct _data *priv;
- int r;
-
- if (!data || !obj) {
- _ERR("Invalid argument");
- return;
- }
-
- priv = (struct _data *)data;
-
- if (!priv->base || !priv->tvs) {
- _ERR("priv->base or priv->tvs is NULL");
- return;
- }
-
- r = tv_scan_pause(priv->tvs);
- if (r != 0) {
- _ERR("tv_scan_pause failed");
- return;
- }
-
- elm_object_part_text_set(priv->base, PART_SRCH_MAIN_TITLE,
- PAUSE_MAIN_TITLE);
-
- priv->exit_btn = util_add_button(priv->base, BTN_STYLE,
- PART_EXIT_BTN, TEXT_BTN_STOP, EINA_TRUE);
- if (!priv->exit_btn) {
- _ERR("exit_btn is NULL");
- return;
- }
-
- evas_object_smart_callback_add(priv->exit_btn, SIGNAL_CLICKED,
- _destroy_search_page_cb, priv);
-
- priv->cancel_btn = util_add_button(priv->base, BTN_STYLE,
- PART_SRCH_CANCEL_BTN, TEXT_BTN_CANCEL, EINA_TRUE);
- if (!priv->cancel_btn) {
- _ERR("cancel_btn is NULL");
- evas_object_del(priv->exit_btn);
- priv->exit_btn = NULL;
- return;
- }
-
- evas_object_smart_callback_add(priv->cancel_btn, SIGNAL_CLICKED,
- _cancel_btn_clicked_cb, priv);
-
- elm_object_focus_allow_set(priv->exit_btn, EINA_TRUE);
- elm_object_focus_set(priv->exit_btn, EINA_TRUE);
- util_focus_next_set(priv->exit_btn);
-
- evas_object_del(priv->stop_btn);
- priv->stop_btn = NULL;
-}
-
-/**
- * Dealing with the receving signal.
- *
- * When receiving a channel signal, update the progress of the progressbar
- * and the number of channel signal.
- *
- * @param[in] tvs: The tv service data structure
- * @param[in] mode: The setting scan mode in view_scan_start.c
- * @param[in] count: The number of channel signal received up to now
- * @param[in] num: The physical channel number of current channel
- * @param[in] arg: A pointer to current data structure.
- */
-static void _progress_cb(struct tv_scan *tvs, enum antenna_mode mode,
- int count, int num, void *arg)
-{
- struct _data *priv;
- char buf[CH_NAME_SIZE];
- int total;
- int ratio;
-
- if (!tvs || !arg) {
- _ERR("Invalid argument");
- return;
- }
-
- priv = (struct _data *) arg;
-
- snprintf(buf, sizeof(buf), "CH. %d", count);
- elm_object_part_text_set(priv->base, PART_CH_NAME, buf);
- elm_object_signal_emit(priv->base, SEARCHCHANNEL, SUBTEXT_SOURCE);
-
- total = tv_scan_get_total_channel(tvs);
- if (total <= 0) {
- _ERR("Invalid Total value");
- return;
- }
-
- ratio = count * PERCENT / total;
- snprintf(buf, sizeof(buf), "%d%%", ratio);
- elm_object_part_text_set(priv->base, PART_PGBAR_NUM, buf);
- elm_progressbar_value_set(priv->pb, (float)ratio / PERCENT);
-}
-
-/**
- * Dealing with the scanning result.
- *
- * When finishing scanning, the total found channels will be calculated and the
- * scan result view will be invoked in this function.
- *
- * @param[in] tvs: The tv service structure for managering the scanning
- * @param[in] res: The structure for saving the number of ATV air, DTV air,
- * ATV cable and DTV cable channel.
- * @param[in] arg: A pointer to current data structure.
- */
-static void _done_cb(struct tv_scan *tvs,
- const struct tv_scan_result *res, void *arg)
-{
- struct _data *priv;
- struct _ugdata *ugd;
- struct viewmgr *vmgr;
-
- if (!arg) {
- _ERR("Invalid argument");
- return;
- }
-
- priv = (struct _data *)arg;
-
- if (!priv->tvs || !priv->vmgr || !priv->ugd) {
- _ERR("Invalid argument");
- return;
- }
-
- vmgr = priv->vmgr;
- ugd = priv->ugd;
-
- ugd->find_chs = res->air_dtv + res->cable_dtv +
- res->air_atv + res->cable_atv;
-
- if (viewmgr_push(vmgr, view_resultpage_get_vclass(), ugd) == -1)
- _ERR("result view push failed");
-}
-
-/**
- * Deal with the found channel signal.
- *
- * @param[in] tvs: The tv service structure for managering the scanning
- * @param[in] count: The number of channel signal received up to now
- * @param[in] num: The physical channel number
- * @param[in] res: The structure for saving the number of ATV air, DTV air,
- * ATV cable and DTV cable channel.
- * @param[in] arg: A pointer to the current data structure.
- * @return 0 on success, and -1 on fail
- */
-static void _found_cb(struct tv_scan *tvs, int count, int num,
- const struct tv_scan_result *res, void *arg)
-{
- struct _data *priv;
- char buf[CH_NAME_SIZE];
- int found;
-
- if (!arg) {
- _ERR("Invalid argument");
- return;
- }
-
- priv = (struct _data *)arg;
- snprintf(buf, sizeof(buf), "CH. %d", count);
-
- elm_object_part_text_set(priv->base, PART_CH_NAME, buf);
- elm_object_signal_emit(priv->base, CHANNELFOUND, SUBTEXT_SOURCE);
-
- found = res->air_dtv + res->cable_dtv + res->air_atv + res->cable_atv;
- snprintf(buf, sizeof(buf), "%d %s", found, TEXT_CH_FOUND);
- elm_object_part_text_set(priv->base, PART_SRCH_SEARCH_RESULT, buf);
-
- priv->ugd->find_chs = found;
-}
-
-/**
- * Register callback functions for tvs scan manager and begin scanning.
- *
- * It registers the callback functions and private data.
- * _progress_cb When receiving a channle signal, _progress_cb will be invoked;
- * _found_cb When finding a channel, _found_cb will be invoked.
- * _done_cb When finishing scanning, _done_cb will be invoked.
- *
- * @param[in] data: user data related to current view
- * @return 0 on success, and -1 on fail
- */
-static int _start_scan(struct _data *data)
-{
- struct tv_scan_cbs cbs;
- int r;
-
- if (!data) {
- _ERR("Invalid argument data: %p", data);
- return -1;
- }
-
- if (!data->tvs) {
- _ERR("Invalid argumentdata->tvs: %p", data->tvs);
- return -1;
- }
-
- cbs.data = data;
- cbs.progress_cb = _progress_cb;
- cbs.found_cb = _found_cb;
- cbs.done_cb = _done_cb;
-
- r = tv_scan_set_callbacks(data->tvs, &cbs);
- if (r != 0) {
- _ERR("tv_scan_set_callbacks failed");
- return -1;
- }
-
- r = tv_scan_start(data->tvs);
- if (r != 0) {
- _ERR("tv_scan_start failed.");
- return -1;
- }
-
- return 0;
-}
-
-/**
- * Initializes the base layout for searching view.
- *
- * Invoked as soon as "start" button is clicked in view_scan_start
- *
- * @param[in] vmgr: the handler to the struct object for managing the view
- * @param[in] data: user data related to current view
- * @return The base or NULL if creatting failed
- */
-static Evas_Object *_create(struct viewmgr *vmgr, void *data)
-{
- Evas_Object *base;
- Evas_Object *win;
- struct _data *priv;
- struct _ugdata *ugd;
- struct tv_scan *tvs;
- char buf[MAX_BUF_SIZE];
-
- if (!vmgr) {
- _ERR("Invalid argument");
- return NULL;
- }
-
- if (!data) {
- _ERR("Invalid argument.");
- return NULL;
- }
-
- ugd = (struct _ugdata *)data;
-
- win = viewmgr_get_win(vmgr);
- if (!win) {
- _ERR("get win failed.");
- return NULL;
- }
-
- priv = (struct _data *) calloc(1, sizeof(*priv));
- if (!priv) {
- _ERR("calloc memory failed");
- return NULL;
- }
-
- tvs = tv_scan_init(ugd->scan_type);
- if (!tvs) {
- _ERR("tvs init failed, set scan_type: %d", ugd->scan_type);
- free(priv);
- return NULL;
- }
-
- base = util_add_layout(win, AUTO_PRGM_EDJ_FILE, GROUP_SRCH);
- if (!base) {
- _ERR("base is NULL");
- tv_scan_fini(tvs);
- free(priv);
- return NULL;
- }
-
- elm_win_resize_object_add(win, base);
- elm_object_part_text_set(base, PART_SRCH_MAIN_TITLE,
- SEARCH_MAIN_TITLE);
- elm_object_part_text_set(base, PART_CH_NAME, SCAN_CH_NAME);
-
- snprintf(buf, sizeof(buf), "%d %s", INITIAL_CH_NUMS, TEXT_CH_FOUND);
- elm_object_part_text_set(base, PART_SRCH_SEARCH_RESULT, buf);
-
- priv->vmgr = vmgr;
- priv->win = win;
- priv->ugd = ugd;
- priv->tvs = tvs;
- priv->base = base;
-
- _SET_PRIV(base, priv);
-
- return base;
-}
-
-/**
- * Invoked when refresh the window of application.
- *
- * @param[in] base: the layout of the view
- *
- * There is no action in this application.
- */
-static void _update(Evas_Object *base)
-{
- Evas_Object *stop_btn;
- Evas_Object *pb;
- struct _data *priv;
- int r;
-
- if (!base) {
- _ERR("Invalid argument");
- return;
- }
-
- priv = _GET_PRIV(base);
- if (!priv) {
- _ERR("Data get failed");
- return;
- }
-
- stop_btn = util_add_button(base, BTN_STYLE,
- PART_STOP_BTN, TEXT_BTN_STOP, EINA_TRUE);
- if (!stop_btn) {
- _ERR("stop_btn is NULL");
- evas_object_del(base);
- free(priv);
- return;
- }
-
- priv->stop_btn = stop_btn;
- elm_object_focus_set(stop_btn, EINA_TRUE);
- evas_object_smart_callback_add(stop_btn, SIGNAL_CLICKED,
- _stop_btn_clicked_cb, priv);
- util_focus_next_set(stop_btn);
-
- pb = elm_progressbar_add(base);
- if (!pb) {
- _ERR("pb is NULL");
- evas_object_del(base);
- free(priv);
- return;
- }
-
- priv->pb = pb;
- elm_object_style_set(pb, PRGBAR_STYLE);
- elm_object_part_text_set(base, PART_PGBAR_NUM, INITIAL_TEXT);
- elm_progressbar_value_set(pb, INITIAL_VALUE);
- elm_object_part_content_set(base, PART_PROGRESSBAR, pb);
- evas_object_show(pb);
-
- r = _start_scan(priv);
- if (r != 0) {
- _ERR("start scan failed");
- return;
- }
-}
-
-/**
- * Resume the application.
- *
- * @param[in] base: the layout of the view
- */
-static void _resume(Evas_Object *base)
-{
- if (!base) {
- _ERR("Invalid argument");
- return;
- }
-
- evas_object_show(base);
-}
-
-/**
- * Pause the view.
- *
- * Hide the layout
- *
- * @param[in] base: the layout of the view
- */
-static void _pause(Evas_Object *base)
-{
- if (!base) {
- _ERR("Invalid argument");
- return;
- }
-
- evas_object_hide(base);
-}
-
-/**
- * Called after the main loop of the view exits.
- *
- * Delete the layout and release the resourse
- *
- * @param[in] base: the layout of the view
- */
-static void _terminate(Evas_Object *base)
-{
- struct _data *priv;
- int r;
-
- if (!base) {
- _ERR("Invalid argument");
- return;
- }
-
- priv = _GET_PRIV(base);
- if (!priv) {
- _ERR("Data get failed");
- return;
- }
-
- r = tv_scan_fini(priv->tvs);
- if (r != 0)
- _ERR("tv_scan_fini failed");
-
- if (priv->base)
- evas_object_del(priv->base);
-
- free(priv);
-}
-
-/**
- * This struct is for registering the callbacks for the view
- */
-static struct view_class _vclass = {
- VIEW_SEARCH,
- _create,
- _update,
- _resume,
- _pause,
- _terminate,
-};
-
- /**
- * Returns current view_class which implements the search view's life cycle
- *
- * @return view_class
- */
-struct view_class *view_searchpage_get_vclass(void)
-{
- return &_vclass;
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 <Elementary.h>
-#include <Eina.h>
-#include "ug_auto_program.h"
-#include "viewmgr_auto_program.h"
-#include "dbg.h"
-#include "defs.h"
-
-struct _viewinfo {
- struct view_class *vclass;
- Evas_Object *base;
-};
-
-/**
- * Initialize the data handler view manager
- *
- * Viewmgr struct will be created.
- *
- * @param[in] win: window object
- * @return The handler to the struct object of managing the view.
- */
-struct viewmgr *viewmgr_init(Evas_Object *win)
-{
- struct viewmgr *vmgr;
-
- if (!win) {
- _ERR("Invalid argument");
- return NULL;
- }
-
- vmgr = (struct viewmgr *) calloc(1, sizeof(*vmgr));
- if (!vmgr) {
- _ERR("calloc vmgr failed.");
- return NULL;
- }
-
- vmgr->win = win;
-
- return vmgr;
-}
-
-/**
- * Invoked before channel ug is terminated
- * Each view will be poped, and the related info about each view will be
- * released in this function, and the viewmgr struct will be released.
- *
- * @param[in] vmgr: the handler to the struct object of managing the view
- */
-void viewmgr_fini(struct viewmgr *vmgr)
-{
- int i;
- int count;
-
- if (!vmgr) {
- _ERR("Invalid argument");
- return;
- }
-
- count = eina_list_count(vmgr->vlist);
- for (i = count; i > 0; i--)
- viewmgr_pop(vmgr);
-
- free(vmgr);
-}
-
-/**
- * Evas_Object_Event_Cb type callback for handling deletion event
- *
- * Delete the layout and release the resouse
- *
- * @param[in] data: the data handler for view
- * @param[in] e: evas handler
- * @param[in] obj: the corresponding object which the deletion event occurred
- * @param[in] ev : event information
- */
-static void _view_deleted(void *data, Evas *e, Evas_Object *obj, void *ev)
-{
- struct view_class *vclass;
-
- if (!data || !obj) {
- _ERR("Invalid argument");
- return;
- }
-
- vclass = (struct view_class *) data;
-
- if (vclass->terminate)
- vclass->terminate(obj);
-}
-
-/**
- * Push the view in the top
- *
- * In push function, layout of current view will be deleted,
- * and the related info will be released in this channel ug,
- * and a new view will be created.
- *
- * @param[in] vmgr: the handler to the struct object of managing the view
- * @param[in] vclass: the basic struct for managing each view, it contains both
- * functions and variables requried in each view. It has basic functions like
- * create/show/hide/terminate
- * @param[in] data: data handler of each view
- * @return 0 on success otherwise -1
- */
-int viewmgr_push(struct viewmgr *vmgr, struct view_class *vclass, void *data)
-{
- Evas_Object *base;
- struct _viewinfo *vinfo;
-
- if (!vmgr || !vmgr->win ||
- !vclass || !vclass->create || !data) {
- _ERR("Invalid argument");
- return -1;
- }
-
- base = vclass->create(vmgr, data);
- if (!base) {
- _ERR("create base failed");
- return -1;
- }
-
- evas_object_event_callback_add(base, EVAS_CALLBACK_DEL,
- _view_deleted, vclass);
-
- if (vclass->update)
- vclass->update(base);
-
- vinfo = (struct _viewinfo *) eina_list_data_get(vmgr->vlist);
- if (vinfo && vinfo->base)
- vinfo->vclass->pause(vinfo->base);
-
- vinfo = (struct _viewinfo *) calloc(1, sizeof(*vinfo));
- if (!vinfo) {
- _ERR("calloc failed.");
- return -1;
- }
-
- vinfo->base = base;
- vinfo->vclass = vclass;
-
- vmgr->vlist = eina_list_prepend(vmgr->vlist, vinfo);
-
- return 0;
-}
-
-/**
- * Pop the view and remove the view information of the popped item in Eina_List
- *
- * In pop function, current view layout will be deleted,
- * and the related resource will be released in this channel ug.
- *
- * @param[in] vmgr: the handler to the struct object of managing the view
- * @return 0 on success otherwise -1
- */
-int viewmgr_pop(struct viewmgr *vmgr)
-{
- struct _viewinfo *vinfo;
-
- if (!vmgr || !vmgr->vlist) {
- _ERR("Invalid argument");
- return -1;
- }
-
- vinfo = (struct _viewinfo *) eina_list_data_get(vmgr->vlist);
- if (!vinfo || !vinfo->base)
- return -1;
-
- evas_object_del(vinfo->base);
- vinfo->base = NULL;
-
- vmgr->vlist = eina_list_remove_list(vmgr->vlist, vmgr->vlist);
- free(vinfo);
-
- viewmgr_resume(vmgr);
-
- return 0;
-}
-
-/**
- * Resume the paused view
- *
- * @param[in] vmgr: the handler to the struct object of managing the view
- * @return 0 on success otherwise -1
- */
-int viewmgr_resume(struct viewmgr *vmgr)
-{
- struct _viewinfo *vinfo;
- struct view_class *vclass;
-
- if (!vmgr || !vmgr->vlist) {
- _ERR("Invalid argument");
- return -1;
- }
-
- vinfo = (struct _viewinfo *) eina_list_data_get(vmgr->vlist);
- if (!vinfo || !vinfo->vclass || !vinfo->base)
- return -1;
-
- vclass = vinfo->vclass;
- if (vclass->resume)
- vclass->resume(vinfo->base);
-
- return 0;
-}
-
-/**
- * Pause the view
- *
- * @param[in] vmgr: the handler to the struct object of managing the view
- * @return 0 on success otherwise -1
- */
-int viewmgr_pause(struct viewmgr *vmgr)
-{
- struct _viewinfo *vinfo;
- struct view_class *vclass;
-
- if (!vmgr || !vmgr->vlist) {
- _ERR("Invalid argument");
- return -1;
- }
-
- vinfo = (struct _viewinfo *) eina_list_data_get(vmgr->vlist);
-
- if (!vinfo || !vinfo->vclass || !vinfo->base)
- return -1;
-
- vclass = vinfo->vclass;
- if (vclass->pause)
- vclass->pause(vinfo->base);
-
- return 0;
-}
-
-/**
- * Get the eina list from viewmgr
- *
- * @param[in] vmgr: the handler to the struct object of managing the view
- * @return The eina list in viewmgr
- */
-Eina_List *viewmgr_get_list(struct viewmgr *vmgr)
-{
- if (!vmgr) {
- _ERR("Invalid argument");
- return NULL;
- }
-
- return vmgr->vlist;
-}
-
-/**
- * Get the window object from viewmgr struct
- *
- * @param[in] vmgr: the handler to the struct object of managing the view
- * @return The window object on success otherwise NULL
- */
-Evas_Object *viewmgr_get_win(struct viewmgr *vmgr)
-{
- if (!vmgr) {
- _ERR("Invalid argument");
- return NULL;
- }
-
- return vmgr->win;
-}
--- /dev/null
+#ifndef __TVSERVICEMGR_H__
+#define __TVSERVICEMGR_H__
+
+enum antenna_mode {
+ SCAN_TYPE_INVALID = -1,
+ SCAN_TYPE_ALL,
+ SCAN_TYPE_CABLE,
+ SCAN_TYPE_AIR
+};
+
+class CTVServiceMgr {
+private:
+ static CTVServiceMgr *instance;
+ struct STVServiceMgr *m;
+
+private:
+ CTVServiceMgr(void) : m(0) {}
+ virtual ~CTVServiceMgr() {}
+
+public:
+ static bool Initialize(void);
+ static void Finalize(void);
+ static CTVServiceMgr *GetInstance(void);
+
+ bool Start(void);
+ bool Pause(void);
+ bool Resume(void);
+ bool Stop(void);
+ bool GetAllChannel(void);
+ unsigned int GetServiceType(void);
+ bool IsStopped(void);
+};
+
+#endif /* __TVSERVICEMGR_H__ */
INCLUDE(FindPkgConfig)
pkg_check_modules(UG_NETWORK_PKGS REQUIRED
- eina
- edje
- evas
- elementary
- aul
- glib-2.0
- ui-gadget-1
- vconf
- capi-appfw-application
- capi-network-wifi
- capi-network-connection
- application-common
)
SET(PKGS_LDFLAGS "${PKGS_LDFLAGS} ${UG_NETWORK_PKGS_LDFLAGS}")
INCLUDE(FindPkgConfig)
pkg_check_modules(UG_PROXY_PKGS REQUIRED
- eina
- edje
- evas
- elementary
- aul
- glib-2.0
- ui-gadget-1
- vconf
- capi-appfw-application
- capi-network-wifi
- capi-network-connection
)
SET(PKGS_LDFLAGS "${PKGS_LDFLAGS} ${UG_PROXY_PKGS_LDFLAGS}")
#endif
struct _ug_data {
+ ui_gadget_h ug;
+
Evas_Object *win;
Evas_Object *base;
- ui_gadget_h ug;
+
CViewMgr *pViewMgr;
CProxyMainView *pProxyMainView;
};
--- /dev/null
+#include <stdlib.h>
+#include <Ecore.h>
+#include "dbg.h"
+//#include "tv_service_proxy.h"
+#include "AppCommon.h"
+
+#include "TVServiceMgr.h"
+
+#define SIGNAL_HANDLER_INTERVAL 0.1
+
+CTVServiceMgr *CTVServiceMgr::instance = NULL;
+
+enum tv_scan_state {
+ SCAN_STATE_READY,
+ SCAN_STATE_SEARCHING,
+ SCAN_STATE_PAUSED,
+ SCAN_STATE_STOPPING,
+ SCAN_STATE_MAX
+};
+
+
+struct tv_scan_result {
+ unsigned int air_dtv;
+ unsigned int cable_dtv;
+ unsigned int air_atv;
+ unsigned int cable_atv;
+};
+
+
+struct STVServiceMgr {
+ //struct tv_scan_cbs cbs;
+ enum tv_scan_state state;
+ enum antenna_mode set_mode;
+#if 0
+ TvServiceScan service_scan;
+ TvServiceScanType scan_type;
+#endif
+ int ch_count;
+ int ch_num;
+ int total_ch;
+ struct tv_scan_result res;
+ int is_stopped;
+ Eina_List *signal_queue;
+ Ecore_Timer *signal_timer;
+};
+
+struct _signal_info {
+#if 0
+ TvServiceScanType scan_type;
+ TvServiceScanEvent signal;
+ TvServiceScanEventData signal_data;
+#endif
+};
+
+
+bool CTVServiceMgr::Initialize(void)
+{
+ ASSERT(!instance);
+
+ instance = new CTVServiceMgr;
+ if(!instance)
+ return false;
+
+ instance->m = new STVServiceMgr;
+ if(instance->m == NULL) return false;
+
+#if 0
+ struct tv_scan *tvs;
+ TvServiceScan scan;
+ TvServiceScanType type;
+ gint result;
+ int r;
+
+ tvs = calloc(1, sizeof(*tvs));
+ if (!tvs) {
+ _ERR("calloc failed");
+ return NULL;
+ }
+
+ r = _get_scan_mode(mode, &type);
+ if (r == -1) {
+ _ERR("Get scan mode failed");
+ free(tvs);
+ return NULL;
+ }
+
+ result = tv_service_scan_create(&scan, type);
+ if (result != TVS_ERROR_OK) {
+ _ERR("Create Scan failed");
+ free(tvs);
+ return NULL;
+ }
+
+ tvs->service_scan = scan;
+ tvs->scan_type = type;
+ tvs->set_mode = mode;
+ tvs->state = SCAN_STATE_READY;
+
+ return tvs;
+#endif
+ return NULL;
+
+}
+
+
+void CTVServiceMgr::Finalize(void)
+{
+ if(!instance)
+ return;
+ ASSERT(instance->m);
+#if 0
+ struct _signal_info *sinfo;
+
+ if (!tvs) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ if (tvs->state != SCAN_STATE_READY)
+ tv_scan_stop(tvs);
+
+ if (tvs->signal_timer)
+ ecore_timer_del(tvs->signal_timer);
+
+ EINA_LIST_FREE(tvs->signal_queue, sinfo)
+ free(sinfo);
+
+ tv_service_scan_destroy(tvs->service_scan);
+ free(tvs);
+
+#endif
+ delete instance->m;
+ delete instance;
+ instance = NULL;
+}
+
+
+CTVServiceMgr *CTVServiceMgr::GetInstance(void)
+{
+ return instance;
+}
+
+
+bool CTVServiceMgr::Start(void)
+{
+ ASSERT(m);
+#if 0
+ gint result;
+
+ if (!tvs || !tvs->service_scan) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ if (tvs->state != SCAN_STATE_READY) {
+ _ERR("unable state to start scan");
+ return -1;
+ }
+
+ result = tv_service_scan_register_callback(tvs->service_scan,
+ _signal_received, (gpointer)tvs);
+ if (result != TVS_ERROR_OK) {
+ _ERR("register callback failed");
+ return -1;
+ }
+
+ result = tv_service_scan_start(tvs->service_scan);
+ if (result != TVS_ERROR_OK) {
+ _ERR("scan start failed");
+ return -1;
+ }
+
+ tvs->state = SCAN_STATE_SEARCHING;
+ tvs->is_stopped = 0;
+ tvs->ch_count = 0;
+ memset(&tvs->res, 0x00, sizeof(tvs->res));
+
+ return 0;
+#endif
+ return false;
+}
+
+
+bool CTVServiceMgr::Pause(void)
+{
+ ASSERT(m);
+#if 0
+ gint result;
+
+ if (!tvs || !tvs->service_scan) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ if (tvs->state != SCAN_STATE_SEARCHING) {
+ _ERR("unable state to pause scan");
+ return -1;
+ }
+
+ result = tv_service_scan_pause(tvs->service_scan);
+ if (result != TVS_ERROR_OK) {
+ _ERR("Pause Scan failed");
+ return -1;
+ }
+
+ tvs->state = SCAN_STATE_PAUSED;
+
+#endif
+ return false;
+}
+
+
+bool CTVServiceMgr::Resume(void)
+{
+ ASSERT(m);
+#if 0
+ gint result;
+
+ if (!tvs || !tvs->service_scan) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ if (tvs->state != SCAN_STATE_PAUSED) {
+ _ERR("unable state to resume scan");
+ return -1;
+ }
+
+ result = tv_service_scan_resume(tvs->service_scan);
+ if (result != TVS_ERROR_OK) {
+ _ERR("resume Scan failed");
+ return -1;
+ }
+
+ tvs->state = SCAN_STATE_SEARCHING;
+
+#endif
+ return false;
+}
+
+
+bool CTVServiceMgr::Stop(void)
+{
+ ASSERT(m);
+#if 0
+ gint result;
+
+ if (!tvs) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ if (tvs->state == SCAN_STATE_READY) {
+ _ERR("unable state to stop scan");
+ return -1;
+ }
+
+ result = tv_service_scan_stop(tvs->service_scan);
+ if (result != TVS_ERROR_OK) {
+ _ERR("Create Scan failed");
+ return -1;
+ }
+
+ tvs->state = SCAN_STATE_STOPPING;
+ tvs->is_stopped = 1;
+
+#endif
+ return false;
+}
+
+
+bool CTVServiceMgr::GetAllChannel(void)
+{
+ ASSERT(m);
+
+ return m->total_ch;
+}
+
+
+unsigned int CTVServiceMgr::GetServiceType(void)
+{
+ ASSERT(m);
+
+#if 0
+ return &tvs->res;
+#endif
+ return -1;
+}
+
+
+bool CTVServiceMgr::IsStopped(void)
+{
+ ASSERT(m);
+
+ return m->is_stopped;
+}
INCLUDE(FindPkgConfig)
pkg_check_modules(UG_CLOCK_PKGS REQUIRED
- eina
- edje
- evas
- elementary
- aul
- ui-gadget-1
sysman
)
INCLUDE(FindPkgConfig)
pkg_check_modules(UG_WIFI_DIRECT_PKGS REQUIRED
- eina
- edje
- evas
- elementary
- aul
- glib-2.0
- ui-gadget-1
- vconf
- capi-appfw-application
- capi-network-wifi
- capi-network-connection
wifi-direct
)
SET(PKGS_LDFLAGS "${PKGS_LDFLAGS} ${UG_WIFI_DIRECT_PKGS_LDFLAGS}")
//evas_object_event_callback_add(layout, EVAS_CALLBACK_KEY_DOWN, _popup_back_pressed_cb, priv);
Connect(layout, 15);
- elm_object_focus_set(btn[0], true);
+ elm_object_focus_set(btn[0], EINA_TRUE);
}
return false;
}
- elm_object_focus_allow_set(on_btn, true);
- elm_object_focus_set(on_btn, true);
+ elm_object_focus_allow_set(on_btn, EINA_TRUE);
+ elm_object_focus_set(on_btn, EINA_TRUE);
elm_object_focus_next_object_set(on_btn, on_btn, ELM_FOCUS_UP);
elm_object_focus_next_object_set(on_btn, on_btn, ELM_FOCUS_LEFT);
m_FillContentPart(m->genlist);
- elm_object_focus_set(m->btn_refresh, true);
+ elm_object_focus_set(m->btn_refresh, EINA_TRUE);
return true;
}
m->scan_pb = pb;
m->btn_stop = btn;
- elm_object_focus_set(m->btn_stop, true);
+ elm_object_focus_set(m->btn_stop, EINA_TRUE);
#if 0
evas_object_event_callback_add(m->btn_stop, EVAS_CALLBACK_MOUSE_IN, _list_btn_mouse_in_cb, priv);
#endif
bool CWifiDirectMainView::m_UpdateGenlistItem(device_info *info)
{
- Eina_Bool exist;
+ bool exist;
if (!info) {
_ERR("The param is invalid.");
m->req_popup = layout;
- elm_object_focus_set(btn[DIRECT_ON], true);
+ elm_object_focus_set(btn[DIRECT_ON], EINA_TRUE);
//evas_object_event_callback_add(layout, EVAS_CALLBACK_KEY_DOWN, _popup_back_pressed_cb, priv);
Connect(layout, 12);
return;
}
- elm_object_focus_allow_set(layout, true);
+ elm_object_focus_allow_set(layout, EINA_TRUE);
box = util_add_box(layout, PART_SWALLOW_CONTENT);
if (!box) {
//evas_object_event_callback_add(layout, EVAS_CALLBACK_KEY_DOWN, _popup_back_pressed_cb, priv);
Connect(layout, 16);
- elm_object_focus_set(btn[0], true);
+ elm_object_focus_set(btn[0], EINA_TRUE);
}
break;
case 2: