summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Skorupinski <m.skorupinsk@samsung.com>2018-08-17 17:27:29 +0200
committerMichal Skorupinski <m.skorupinsk@samsung.com>2018-08-30 15:34:36 +0200
commit315643a97a05cf6227497ba8dda75f5711096654 (patch)
tree2f738313f449be036683b71fe20b3e1f2bde59bb
parent4e68c88d6fe6c747f7fdfeba5542a446ffc5c691 (diff)
downloadgear-racing-controller-315643a97a05cf6227497ba8dda75f5711096654.tar.gz
gear-racing-controller-315643a97a05cf6227497ba8dda75f5711096654.tar.bz2
gear-racing-controller-315643a97a05cf6227497ba8dda75f5711096654.zip
Network failure view switches to the Connect to car view
Change-Id: I0d513e73501d1ee91643acfd9c5fb77ddfe0f804 Signed-off-by: Michal Skorupinski <m.skorupinsk@samsung.com>
-rw-r--r--inc/view_manager/view_factory.h2
-rw-r--r--res/edje/view_network_failure.edc1
-rw-r--r--src/controller/controller_car_selection.c2
-rw-r--r--src/model/model_car_connection.c17
-rw-r--r--src/view/view_network_failure.c33
-rw-r--r--src/view_manager/view_factory.c6
6 files changed, 34 insertions, 27 deletions
diff --git a/inc/view_manager/view_factory.h b/inc/view_manager/view_factory.h
index 73cee82..29e36a9 100644
--- a/inc/view_manager/view_factory.h
+++ b/inc/view_manager/view_factory.h
@@ -27,11 +27,11 @@ typedef enum _e_view_id {
VIEW_HELP,
VIEW_RACING,
VIEW_RESET,
+ VIEW_NETWORK_FAILURE,
} view_id;
typedef enum e_popup_id {
VIEW_POPUP_PROGRESS,
- VIEW_POPUP_NETWORK_FAILURE,
} popup_id;
s_view_base *view_factory_create_view(Evas_Object *parent, Eext_Circle_Surface *circle_surface, view_id id);
diff --git a/res/edje/view_network_failure.edc b/res/edje/view_network_failure.edc
index 8a7e07c..d942a61 100644
--- a/res/edje/view_network_failure.edc
+++ b/res/edje/view_network_failure.edc
@@ -10,7 +10,6 @@ collections{
type: IMAGE;
desc{
state: "default" 0.0;
- min: 360 360;
image.normal: "bg_dark.png";
}
}
diff --git a/src/controller/controller_car_selection.c b/src/controller/controller_car_selection.c
index bb854ab..c399da7 100644
--- a/src/controller/controller_car_selection.c
+++ b/src/controller/controller_car_selection.c
@@ -34,7 +34,7 @@ static void _car_connected_cb(s_model_car_connection_cb_data *model_data)
view_manager_set_view(VIEW_CONNECTION_SUCCESSED);
break;
case MODEL_TYPE_FAIL:
- view_manager_show_popup(VIEW_POPUP_NETWORK_FAILURE);
+ view_manager_set_view(VIEW_NETWORK_FAILURE);
break;
case MODEL_TYPE_WAIT:
view_manager_show_popup(VIEW_POPUP_PROGRESS);
diff --git a/src/model/model_car_connection.c b/src/model/model_car_connection.c
index dd5b261..660a326 100644
--- a/src/model/model_car_connection.c
+++ b/src/model/model_car_connection.c
@@ -26,7 +26,7 @@
#include "log.h"
#define BASE_VALUE 100
-#define HELLO_TIMER_WAIT 15.0
+#define HELLO_TIMER_WAIT 3.0
typedef enum _e_message_type {
MESSAGE_HELLO,
@@ -105,25 +105,12 @@ static void _send_data(int command, int servo, int speed)
static Eina_Bool _connection_wait_timer_cb(void *data)
{
- static bool test = false;
-
-
static s_model_car_connection_cb_data model_data = {
.type = MODEL_TYPE_FAIL,
};
- if (test == false) {
- model_data.type = MODEL_TYPE_FAIL;
- } else {
- model_data.type = MODEL_TYPE_END;
- }
-
s_info.controller_update_cb(&model_data);
-
- if (test == false) {
- test = true;
- return ECORE_CALLBACK_RENEW;
- }
+ model_car_connection_end_connection();
bool renew = (bool)data;
return renew;
diff --git a/src/view/view_network_failure.c b/src/view/view_network_failure.c
index 72434e0..cf960c0 100644
--- a/src/view/view_network_failure.c
+++ b/src/view/view_network_failure.c
@@ -17,7 +17,7 @@
#include "view/view_base.h"
#include "view/view_network_failure.h"
#include "view_manager/view_manager.h"
-//#include "controller/controller_network_failure.h"
+#include "controller/controller_network_failure.h"
typedef struct _s_view_network_failure {
s_view_base view_base;
@@ -25,19 +25,40 @@ typedef struct _s_view_network_failure {
static s_view_network_failure s_info = { {0,}, };
+static void _layout_back_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ elm_win_lower(view_manager_get_win());
+}
+
+static void _ok_button_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ controller_network_failure_next();
+}
+
static void _view_network_failure_create_gui(Evas_Object *parent)
{
- s_info.view_base.view = elm_popup_add(parent);
+ s_info.view_base.view = view_base_create_layout(parent, "edje/view_button_ok.edj", GRP_MAIN);
+ eext_object_event_callback_add(s_info.view_base.view, EEXT_CALLBACK_BACK, _layout_back_cb, NULL);
+ elm_layout_text_set(s_info.view_base.view, "txt_title", "Network failure");
- Evas_Object *layout = view_base_create_layout(s_info.view_base.view, "edje/view_network_failure.edj", GRP_MAIN);
- elm_object_content_set(s_info.view_base.view, layout);
+ view_base_create_button(s_info.view_base.view, "Button_Ok", "", "images/yes.png", "racing_bottom", _ok_button_clicked_cb, NULL);
+}
+
+static void _show_cb(void)
+{
+ controller_network_failure_init(NULL);
+}
- elm_object_style_set(s_info.view_base.view, "circle");
- evas_object_show(s_info.view_base.view);
+static void _hide_cb(void)
+{
+ controller_network_failure_destroy();
}
s_view_base *view_network_failure_init(Evas_Object *parent)
{
+ s_info.view_base.show_cb = _show_cb;
+ s_info.view_base.hide_cb = _hide_cb;
+
_view_network_failure_create_gui(parent);
return &s_info.view_base;
}
diff --git a/src/view_manager/view_factory.c b/src/view_manager/view_factory.c
index 73ab466..693aa09 100644
--- a/src/view_manager/view_factory.c
+++ b/src/view_manager/view_factory.c
@@ -51,6 +51,9 @@ s_view_base *view_factory_create_view(Evas_Object *parent, Eext_Circle_Surface *
case VIEW_RESET:
view = view_reset_init(parent);
break;
+ case VIEW_NETWORK_FAILURE:
+ view = view_network_failure_init(parent);
+ break;
default:
break;
}
@@ -66,9 +69,6 @@ s_view_base *view_factory_create_popup(Evas_Object *parent, popup_id id)
case VIEW_POPUP_PROGRESS:
view = view_progress_init(parent);
break;
- case VIEW_POPUP_NETWORK_FAILURE:
- view = view_network_failure_init(parent);
- break;
default:
break;
}