diff options
author | Michal Skorupinski <m.skorupinsk@samsung.com> | 2018-07-04 17:19:47 +0200 |
---|---|---|
committer | Michal Skorupinski <m.skorupinsk@samsung.com> | 2018-07-12 12:53:51 +0200 |
commit | 4537b188224c97ba521fca8086dfea4a6b66420d (patch) | |
tree | 7110dcd4542f52c9bf570fe7f60ea467fe32625e | |
parent | e07813531cd5ff389b35f66a4be39d48bee043b3 (diff) | |
download | gear-racing-controller-4537b188224c97ba521fca8086dfea4a6b66420d.tar.gz gear-racing-controller-4537b188224c97ba521fca8086dfea4a6b66420d.tar.bz2 gear-racing-controller-4537b188224c97ba521fca8086dfea4a6b66420d.zip |
Stubs for all views added
Change-Id: Ia3f5e4d562bf9ac0d58d32dad3ffad264563336f
Signed-off-by: Michal Skorupinski <m.skorupinsk@samsung.com>
35 files changed, 1163 insertions, 9 deletions
diff --git a/inc/controller/controller_connection_successed.h b/inc/controller/controller_connection_successed.h new file mode 100644 index 0000000..f8394d9 --- /dev/null +++ b/inc/controller/controller_connection_successed.h @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 CONTROLLER_CONTROLLER_CONNECTION_SUCCESSED_H_ +#define CONTROLLER_CONTROLLER_CONNECTION_SUCCESSED_H_ + +#include "controller/controller_base.h" + +void controller_connection_successed_init(t_view_update_cb view_update_cb); +void controller_connection_successed_back_btn(void); +void controller_connection_successed_next_page(); + +#endif /* CONTROLLER_CONTROLLER_CONNECTION_SUCCESSED_H_ */ diff --git a/inc/controller/controller_emergency_stop.h b/inc/controller/controller_emergency_stop.h new file mode 100644 index 0000000..38e5cf7 --- /dev/null +++ b/inc/controller/controller_emergency_stop.h @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 CONTROLLER_CONTROLLER_EMERGENCY_STOP_H_ +#define CONTROLLER_CONTROLLER_EMERGENCY_STOP_H_ + +#include "controller/controller_base.h" + +void controller_emergency_stop_init(t_view_update_cb view_update_cb); +void controller_emergency_stop_back_btn(void); +void controller_emergency_stop_next_page(); + +#endif /* CONTROLLER_CONTROLLER_EMERGENCY_STOP_H_ */ diff --git a/inc/controller/controller_help.h b/inc/controller/controller_help.h new file mode 100644 index 0000000..5a655f1 --- /dev/null +++ b/inc/controller/controller_help.h @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 CONTROLLER_CONTROLLER_HELP_H_ +#define CONTROLLER_CONTROLLER_HELP_H_ + +#include "controller/controller_base.h" + +void controller_help_init(t_view_update_cb view_update_cb); +void controller_help_back_btn(void); +void controller_help_next_page(); + +#endif /* CONTROLLER_CONTROLLER_HELP_H_ */ diff --git a/inc/controller/controller_name_input.h b/inc/controller/controller_name_input.h new file mode 100644 index 0000000..0f16812 --- /dev/null +++ b/inc/controller/controller_name_input.h @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 CONTROLLER_CONTROLLER_NAME_INPUT_H_ +#define CONTROLLER_CONTROLLER_NAME_INPUT_H_ + +#include "controller/controller_base.h" + +void controller_name_input_init(t_view_update_cb view_update_cb); +void controller_name_input_back_btn(void); +void controller_name_input_next_page(); + +#endif /* CONTROLLER_CONTROLLER_NAME_INPUT_H_ */ diff --git a/inc/controller/controller_network_failure.h b/inc/controller/controller_network_failure.h new file mode 100644 index 0000000..5c3b437 --- /dev/null +++ b/inc/controller/controller_network_failure.h @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 CONTROLLER_CONTROLLER_NETWORK_FAILURE_H_ +#define CONTROLLER_CONTROLLER_NETWORK_FAILURE_H_ + +#include "controller/controller_base.h" + +void controller_network_failure_init(t_view_update_cb view_update_cb); +void controller_network_failure_back_btn(void); +void controller_network_failure_next_page(); + +#endif /* CONTROLLER_CONTROLLER_NETWORK_FAILURE_H_ */ diff --git a/inc/controller/controller_racing.h b/inc/controller/controller_racing.h new file mode 100644 index 0000000..f9b6eca --- /dev/null +++ b/inc/controller/controller_racing.h @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 CONTROLLER_CONTROLLER_RACING_H_ +#define CONTROLLER_CONTROLLER_RACING_H_ + +#include "controller/controller_base.h" + +void controller_racing_init(t_view_update_cb view_update_cb); +void controller_racing_back_btn(void); +void controller_racing_next_page(); + +#endif /* CONTROLLER_CONTROLLER_RACING_H_ */ diff --git a/inc/controller/controller_reset.h b/inc/controller/controller_reset.h new file mode 100644 index 0000000..4b5b975 --- /dev/null +++ b/inc/controller/controller_reset.h @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 CONTROLLER_CONTROLLER_RESET_H_ +#define CONTROLLER_CONTROLLER_RESET_H_ + +#include "controller/controller_base.h" + +void controller_reset_init(t_view_update_cb view_update_cb); +void controller_reset_back_btn(void); +void controller_reset_next_page(); + +#endif /* CONTROLLER_CONTROLLER_RESET_H_ */ diff --git a/inc/view/view_car_selection.h b/inc/view/view_car_selection.h index 1acbe44..a453b59 100644 --- a/inc/view/view_car_selection.h +++ b/inc/view/view_car_selection.h @@ -18,6 +18,6 @@ #ifndef VIEW_VIEW_CAR_SELECTION_H_ #define VIEW_VIEW_CAR_SELECTION_H_ -void car_selection_init(Evas_Object *parent); +void view_car_selection_init(Evas_Object *parent); #endif /* VIEW_VIEW_CAR_SELECTION_H_ */ diff --git a/inc/view/view_connect_to_car.h b/inc/view/view_connect_to_car.h index e713063..7dfd538 100644 --- a/inc/view/view_connect_to_car.h +++ b/inc/view/view_connect_to_car.h @@ -16,9 +16,8 @@ #ifndef VIEW_VIEW_CONNECT_TO_CAR_H_ #define VIEW_VIEW_CONNECT_TO_CAR_H_ - #include "gear-racing-controller.h" -void connect_to_car_init(Evas_Object *parent); +void view_connect_to_car_init(Evas_Object *parent); #endif /* VIEW_VIEW_CONNECT_TO_CAR_H_ */ diff --git a/inc/view/view_connection_successed.h b/inc/view/view_connection_successed.h new file mode 100644 index 0000000..79f61e7 --- /dev/null +++ b/inc/view/view_connection_successed.h @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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_VIEW_CONNECTION_SUCCESSED_H_ +#define VIEW_VIEW_CONNECTION_SUCCESSED_H_ + +void view_connection_successed_init(Evas_Object *parent); + +#endif /* VIEW_VIEW_CONNECTION_SUCCESSED_H_ */ diff --git a/inc/view/view_emergency_stop.h b/inc/view/view_emergency_stop.h new file mode 100644 index 0000000..32c9541 --- /dev/null +++ b/inc/view/view_emergency_stop.h @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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_VIEW_EMERGENCY_STOP_H_ +#define VIEW_VIEW_EMERGENCY_STOP_H_ + + +void view_emergency_stop_init(Evas_Object *parent); + +#endif /* VIEW_VIEW_EMERGENCY_STOP_H_ */ diff --git a/inc/view/view_help.h b/inc/view/view_help.h new file mode 100644 index 0000000..880ff4a --- /dev/null +++ b/inc/view/view_help.h @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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_VIEW_HELP_H_ +#define VIEW_VIEW_HELP_H_ + + +void view_help_init(Evas_Object *parent); + +#endif /* VIEW_VIEW_HELP_H_ */ diff --git a/inc/view/view_name_input.h b/inc/view/view_name_input.h new file mode 100644 index 0000000..4ec9183 --- /dev/null +++ b/inc/view/view_name_input.h @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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_VIEW_NAME_INPUT_H_ +#define VIEW_VIEW_NAME_INPUT_H_ + + +void view_name_input_init(Evas_Object *parent); + +#endif /* VIEW_VIEW_NAME_INPUT_H_ */ diff --git a/inc/view/view_network_failure.h b/inc/view/view_network_failure.h new file mode 100644 index 0000000..ce63b25 --- /dev/null +++ b/inc/view/view_network_failure.h @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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_VIEW_NETWORK_FAILURE_H_ +#define VIEW_VIEW_NETWORK_FAILURE_H_ + + +void view_network_failure_init(Evas_Object *parent); + +#endif /* VIEW_VIEW_NETWORK_FAILURE_H_ */ diff --git a/inc/view/view_racing.h b/inc/view/view_racing.h new file mode 100644 index 0000000..22d121f --- /dev/null +++ b/inc/view/view_racing.h @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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_VIEW_RACING_H_ +#define VIEW_VIEW_RACING_H_ + + +void view_racing_init(Evas_Object *parent); + +#endif /* VIEW_VIEW_RACING_H_ */ diff --git a/inc/view/view_reset.h b/inc/view/view_reset.h new file mode 100644 index 0000000..ed264b1 --- /dev/null +++ b/inc/view/view_reset.h @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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_VIEW_RESET_H_ +#define VIEW_VIEW_RESET_H_ + + +void view_reset_init(Evas_Object *parent); + +#endif /* VIEW_VIEW_RESET_H_ */ diff --git a/inc/view_manager/view_manager.h b/inc/view_manager/view_manager.h index aaedfd1..662bc3a 100644 --- a/inc/view_manager/view_manager.h +++ b/inc/view_manager/view_manager.h @@ -23,6 +23,13 @@ typedef enum _e_view_id { VIEW_CONNECT_TO_CAR, VIEW_CAR_SELECTION, + VIEW_CONNECTION_SUCCESSED, + VIEW_NAME_INPUT, + VIEW_HELP, + VIEW_RACING, + VIEW_EMERGENCY_STOP, + VIEW_RESET, + VIEW_NETWORK_FAILURE, } view_id; void view_manager_set_view(view_id id); diff --git a/src/controller/controller_car_selection.c b/src/controller/controller_car_selection.c index 58aa987..0987f7f 100644 --- a/src/controller/controller_car_selection.c +++ b/src/controller/controller_car_selection.c @@ -27,7 +27,7 @@ static void controller_car_selection_destroy(void) static void _connected_cb(void *is_connected) { - view_manager_set_view(VIEW_CONNECT_TO_CAR); + view_manager_set_view(VIEW_CONNECTION_SUCCESSED); controller_car_selection_destroy(); } diff --git a/src/controller/controller_connection_successed.c b/src/controller/controller_connection_successed.c new file mode 100644 index 0000000..fc6f874 --- /dev/null +++ b/src/controller/controller_connection_successed.c @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 "gear-racing-controller.h" +#include "model/model_connection.h" +#include "controller/controller_connection_successed.h" +#include "view_manager/view_manager.h" + +static s_controller *controller = NULL; + +static void _connection_successed_destroy(void) +{ + free(controller); +} + +static void _connected_cb(void *is_connected) +{ + view_manager_set_view(VIEW_NAME_INPUT); + _connection_successed_destroy(); +} + +void controller_connection_successed_init(t_view_update_cb view_update_cb) +{ + controller = calloc(1, sizeof(s_controller)); + controller->view_update_cb = view_update_cb; + + model_connection_subscribe_event(_connected_cb); +} + +void controller_connection_successed_back_btn(void) +{ + _connection_successed_destroy(); +} + +void controller_connection_successed_next_page() +{ + model_connection_connect(); +} + diff --git a/src/controller/controller_emergency_stop.c b/src/controller/controller_emergency_stop.c new file mode 100644 index 0000000..d8f9f54 --- /dev/null +++ b/src/controller/controller_emergency_stop.c @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 "gear-racing-controller.h" +#include "model/model_connection.h" +#include "controller/controller_emergency_stop.h" +#include "view_manager/view_manager.h" + +static s_controller *controller = NULL; + +static void controller_emergency_stop_destroy(void) +{ + free(controller); +} + +static void _connected_cb(void *is_connected) +{ + view_manager_set_view(VIEW_RESET); + controller_emergency_stop_destroy(); +} + +void controller_emergency_stop_init(t_view_update_cb view_update_cb) +{ + controller = calloc(1, sizeof(s_controller)); + controller->view_update_cb = view_update_cb; + + model_connection_subscribe_event(_connected_cb); +} + +void controller_emergency_stop_back_btn(void) +{ + controller_emergency_stop_destroy(); +} + +void controller_emergency_stop_next_page() +{ + model_connection_connect(); +} + diff --git a/src/controller/controller_help.c b/src/controller/controller_help.c new file mode 100644 index 0000000..8af51f2 --- /dev/null +++ b/src/controller/controller_help.c @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 "gear-racing-controller.h" +#include "model/model_connection.h" +#include "controller/controller_help.h" +#include "view_manager/view_manager.h" + +static s_controller *controller = NULL; + +static void controller_help_destroy(void) +{ + free(controller); +} + +static void _connected_cb(void *is_connected) +{ + view_manager_set_view(VIEW_RACING); + controller_help_destroy(); +} + +void controller_help_init(t_view_update_cb view_update_cb) +{ + controller = calloc(1, sizeof(s_controller)); + controller->view_update_cb = view_update_cb; + + model_connection_subscribe_event(_connected_cb); +} + +void controller_help_back_btn(void) +{ + controller_help_destroy(); +} + +void controller_help_next_page() +{ + model_connection_connect(); +} + diff --git a/src/controller/controller_name_input.c b/src/controller/controller_name_input.c new file mode 100644 index 0000000..414bd9f --- /dev/null +++ b/src/controller/controller_name_input.c @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 "gear-racing-controller.h" +#include "model/model_connection.h" +#include "controller/controller_name_input.h" +#include "view_manager/view_manager.h" + +static s_controller *controller = NULL; + +static void controller_name_input_destroy(void) +{ + free(controller); +} + +static void _connected_cb(void *is_connected) +{ + view_manager_set_view(VIEW_HELP); + controller_name_input_destroy(); +} + +void controller_name_input_init(t_view_update_cb view_update_cb) +{ + controller = calloc(1, sizeof(s_controller)); + controller->view_update_cb = view_update_cb; + + model_connection_subscribe_event(_connected_cb); +} + +void controller_name_input_back_btn(void) +{ + controller_name_input_destroy(); +} + +void controller_name_input_next_page() +{ + model_connection_connect(); +} + diff --git a/src/controller/controller_network_failure.c b/src/controller/controller_network_failure.c new file mode 100644 index 0000000..bc6b57f --- /dev/null +++ b/src/controller/controller_network_failure.c @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 "gear-racing-controller.h" +#include "model/model_connection.h" +#include "controller/controller_network_failure.h" +#include "view_manager/view_manager.h" + +static s_controller *controller = NULL; + +static void controller_network_failure_destroy(void) +{ + free(controller); +} + +static void _connected_cb(void *is_connected) +{ + view_manager_set_view(VIEW_CONNECT_TO_CAR); + controller_network_failure_destroy(); +} + +void controller_network_failure_init(t_view_update_cb view_update_cb) +{ + controller = calloc(1, sizeof(s_controller)); + controller->view_update_cb = view_update_cb; + + model_connection_subscribe_event(_connected_cb); +} + +void controller_network_failure_back_btn(void) +{ + controller_network_failure_destroy(); +} + +void controller_network_failure_next_page() +{ + model_connection_connect(); +} + diff --git a/src/controller/controller_racing.c b/src/controller/controller_racing.c new file mode 100644 index 0000000..209da30 --- /dev/null +++ b/src/controller/controller_racing.c @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 "gear-racing-controller.h" +#include "model/model_connection.h" +#include "controller/controller_racing.h" +#include "view_manager/view_manager.h" + +static s_controller *controller = NULL; + +static void controller_racing_destroy(void) +{ + free(controller); +} + +static void _connected_cb(void *is_connected) +{ + view_manager_set_view(VIEW_EMERGENCY_STOP); + controller_racing_destroy(); +} + +void controller_racing_init(t_view_update_cb view_update_cb) +{ + controller = calloc(1, sizeof(s_controller)); + controller->view_update_cb = view_update_cb; + + model_connection_subscribe_event(_connected_cb); +} + +void controller_racing_back_btn(void) +{ + controller_racing_destroy(); +} + +void controller_racing_next_page() +{ + model_connection_connect(); +} + diff --git a/src/controller/controller_reset.c b/src/controller/controller_reset.c new file mode 100644 index 0000000..f0ef37a --- /dev/null +++ b/src/controller/controller_reset.c @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 "gear-racing-controller.h" +#include "model/model_connection.h" +#include "controller/controller_reset.h" +#include "view_manager/view_manager.h" + +static s_controller *controller = NULL; + +static void controller_reset_destroy(void) +{ + free(controller); +} + +static void _connected_cb(void *is_connected) +{ + view_manager_set_view(VIEW_NAME_INPUT); + controller_reset_destroy(); +} + +void controller_reset_init(t_view_update_cb view_update_cb) +{ + controller = calloc(1, sizeof(s_controller)); + controller->view_update_cb = view_update_cb; + + model_connection_subscribe_event(_connected_cb); +} + +void controller_reset_back_btn(void) +{ + controller_reset_destroy(); +} + +void controller_reset_next_page() +{ + model_connection_connect(); +} + diff --git a/src/view/view_car_selection.c b/src/view/view_car_selection.c index eef1ac6..3fe7659 100644 --- a/src/view/view_car_selection.c +++ b/src/view/view_car_selection.c @@ -15,8 +15,10 @@ */ #include "gear-racing-controller.h" +#include "view/view_car_selection.h" #include "view/view_base.h" #include "view/view_car_selection.h" +#include "controller/controller_car_selection.h" #include "controller/controller_connect_to_car.h" #include "controller/controller_car_selection.h" #include "view_manager/view_manager.h" @@ -48,7 +50,7 @@ static void _car_selection_create_gui(Evas_Object *parent) view_base_create_button(s_info.layout, "Button_Cancel", "Cancel", NULL, NULL); } -void car_selection_init(Evas_Object *parent) +void view_car_selection_init(Evas_Object *parent) { controller_car_selection_init(NULL); _car_selection_create_gui(parent); diff --git a/src/view/view_connect_to_car.c b/src/view/view_connect_to_car.c index 6ff425a..2d9027c 100644 --- a/src/view/view_connect_to_car.c +++ b/src/view/view_connect_to_car.c @@ -18,6 +18,7 @@ #include "gear-racing-controller.h" #include "view/view_base.h" #include "view_manager/view_manager.h" +#include "view/view_connect_to_car.h" typedef struct _s_connect_to_car { Evas_Object *layout; @@ -48,7 +49,7 @@ static void connect_to_car_create_gui(Evas_Object *parent) } -void connect_to_car_init(Evas_Object *parent) +void view_connect_to_car_init(Evas_Object *parent) { connect_to_car_create_gui(parent); controller_connect_to_car_init(NULL); diff --git a/src/view/view_connection_successed.c b/src/view/view_connection_successed.c new file mode 100644 index 0000000..d3c5641 --- /dev/null +++ b/src/view/view_connection_successed.c @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 "gear-racing-controller.h" +#include "view/view_base.h" +#include "view/view_connection_successed.h" +#include "view_manager/view_manager.h" +#include "controller/controller_connection_successed.h" + +typedef struct s_view_connection_successed { + Evas_Object *layout; +} s_view_connection_successed; + +static s_view_connection_successed s_info = { 0,}; + +static void _layout_back_cb(void *data, Evas_Object *obj, void *event_info) +{ + elm_win_lower(view_manager_get_win()); + controller_connection_successed_back_btn(); +} + +static void _ok_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + controller_connection_successed_next_page(); +} + +static void _view_connection_successed_create_gui(Evas_Object *parent) +{ + s_info.layout = view_base_create_layout(parent); + eext_object_event_callback_add(s_info.layout, EEXT_CALLBACK_BACK, _layout_back_cb, NULL); + elm_layout_text_set(s_info.layout, "txt_title", "Connection successed"); + + view_base_create_button(s_info.layout, "Button_Ok", "Ok", _ok_button_clicked_cb, NULL); + view_base_create_button(s_info.layout, "Button_Cancel", "Cancel", NULL, NULL); +} + +void view_connection_successed_init(Evas_Object *parent) +{ + controller_connection_successed_init(NULL); + _view_connection_successed_create_gui(parent); +} diff --git a/src/view/view_emergency_stop.c b/src/view/view_emergency_stop.c new file mode 100644 index 0000000..1ecfaec --- /dev/null +++ b/src/view/view_emergency_stop.c @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 "gear-racing-controller.h" +#include "view/view_base.h" +#include "view/view_emergency_stop.h" +#include "view_manager/view_manager.h" +#include "controller/controller_emergency_stop.h" + +typedef struct _s_view_emergency_stop { + Evas_Object *layout; +} s_view_emergency_stop; + +static s_view_emergency_stop s_info = { 0,}; + +static void _layout_back_cb(void *data, Evas_Object *obj, void *event_info) +{ + elm_win_lower(view_manager_get_win()); + controller_emergency_stop_back_btn(); +} + +static void _ok_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + controller_emergency_stop_next_page(); +} + +static void _view_emergency_stop_create_gui(Evas_Object *parent) +{ + s_info.layout = view_base_create_layout(parent); + eext_object_event_callback_add(s_info.layout, EEXT_CALLBACK_BACK, _layout_back_cb, NULL); + elm_layout_text_set(s_info.layout, "txt_title", "Emergency Stop"); + + view_base_create_button(s_info.layout, "Button_Ok", "Ok", _ok_button_clicked_cb, NULL); + view_base_create_button(s_info.layout, "Button_Cancel", "Cancel", NULL, NULL); +} + +void view_emergency_stop_init(Evas_Object *parent) +{ + controller_emergency_stop_init(NULL); + _view_emergency_stop_create_gui(parent); +} diff --git a/src/view/view_help.c b/src/view/view_help.c new file mode 100644 index 0000000..76b2d28 --- /dev/null +++ b/src/view/view_help.c @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 "gear-racing-controller.h" +#include "view/view_base.h" +#include "view/view_help.h" +#include "view_manager/view_manager.h" +#include "controller/controller_help.h" + +typedef struct _s_view_help { + Evas_Object *layout; +} s_view_help; + +static s_view_help s_info = { 0,}; + +static void _layout_back_cb(void *data, Evas_Object *obj, void *event_info) +{ + elm_win_lower(view_manager_get_win()); + controller_help_back_btn(); +} + +static void _ok_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + controller_help_next_page(); +} + +static void _view_help_create_gui(Evas_Object *parent) +{ + s_info.layout = view_base_create_layout(parent); + eext_object_event_callback_add(s_info.layout, EEXT_CALLBACK_BACK, _layout_back_cb, NULL); + elm_layout_text_set(s_info.layout, "txt_title", "Help"); + + view_base_create_button(s_info.layout, "Button_Ok", "Ok", _ok_button_clicked_cb, NULL); + view_base_create_button(s_info.layout, "Button_Cancel", "Cancel", NULL, NULL); +} + +void view_help_init(Evas_Object *parent) +{ + controller_help_init(NULL); + _view_help_create_gui(parent); +} diff --git a/src/view/view_name_input.c b/src/view/view_name_input.c new file mode 100644 index 0000000..fbb131b --- /dev/null +++ b/src/view/view_name_input.c @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 "gear-racing-controller.h" +#include "view/view_base.h" +#include "view/view_name_input.h" +#include "view_manager/view_manager.h" +#include "controller/controller_name_input.h" + +typedef struct _ss_view_name_input { + Evas_Object *layout; +} s_view_name_input; + +static s_view_name_input s_info = { 0,}; + +static void _layout_back_cb(void *data, Evas_Object *obj, void *event_info) +{ + elm_win_lower(view_manager_get_win()); + controller_name_input_back_btn(); +} + +static void _ok_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + controller_name_input_next_page(); +} + +static void _view_name_input_create_gui(Evas_Object *parent) +{ + s_info.layout = view_base_create_layout(parent); + eext_object_event_callback_add(s_info.layout, EEXT_CALLBACK_BACK, _layout_back_cb, NULL); + elm_layout_text_set(s_info.layout, "txt_title", "Name input"); + + view_base_create_button(s_info.layout, "Button_Ok", "Ok", _ok_button_clicked_cb, NULL); + view_base_create_button(s_info.layout, "Button_Cancel", "Cancel", NULL, NULL); +} + +void view_name_input_init(Evas_Object *parent) +{ + controller_name_input_init(NULL); + _view_name_input_create_gui(parent); +} diff --git a/src/view/view_network_failure.c b/src/view/view_network_failure.c new file mode 100644 index 0000000..52e61c1 --- /dev/null +++ b/src/view/view_network_failure.c @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 "gear-racing-controller.h" +#include "view/view_base.h" +#include "view/view_network_failure.h" +#include "view_manager/view_manager.h" +#include "controller/controller_network_failure.h" + +typedef struct _s_view_network_failure { + Evas_Object *layout; +} 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()); + controller_network_failure_back_btn(); +} + +static void _ok_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + controller_network_failure_next_page(); +} + +static void _view_network_failure_create_gui(Evas_Object *parent) +{ + s_info.layout = view_base_create_layout(parent); + eext_object_event_callback_add(s_info.layout, EEXT_CALLBACK_BACK, _layout_back_cb, NULL); + elm_layout_text_set(s_info.layout, "txt_title", "Network failure"); + + view_base_create_button(s_info.layout, "Button_Ok", "Ok", _ok_button_clicked_cb, NULL); + view_base_create_button(s_info.layout, "Button_Cancel", "Cancel", NULL, NULL); +} + +void view_network_failure_init(Evas_Object *parent) +{ + controller_network_failure_init(NULL); + _view_network_failure_create_gui(parent); +} diff --git a/src/view/view_racing.c b/src/view/view_racing.c new file mode 100644 index 0000000..fc6d32b --- /dev/null +++ b/src/view/view_racing.c @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 "gear-racing-controller.h" +#include "view/view_base.h" +#include "view/view_racing.h" +#include "view_manager/view_manager.h" +#include "controller/controller_racing.h" + +typedef struct _s_view_racing { + Evas_Object *layout; +} s_view_racing; + +static s_view_racing s_info = { 0,}; + +static void _layout_back_cb(void *data, Evas_Object *obj, void *event_info) +{ + elm_win_lower(view_manager_get_win()); + controller_racing_back_btn(); +} + +static void _ok_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + controller_racing_next_page(); +} + +static void _view_racing_create_gui(Evas_Object *parent) +{ + s_info.layout = view_base_create_layout(parent); + eext_object_event_callback_add(s_info.layout, EEXT_CALLBACK_BACK, _layout_back_cb, NULL); + elm_layout_text_set(s_info.layout, "txt_title", "Racing"); + + view_base_create_button(s_info.layout, "Button_Ok", "Ok", _ok_button_clicked_cb, NULL); + view_base_create_button(s_info.layout, "Button_Cancel", "Cancel", NULL, NULL); +} + +void view_racing_init(Evas_Object *parent) +{ + controller_racing_init(NULL); + _view_racing_create_gui(parent); +} diff --git a/src/view/view_reset.c b/src/view/view_reset.c new file mode 100644 index 0000000..887e520 --- /dev/null +++ b/src/view/view_reset.c @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Flora License, Version 1.1 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://floralicense.org/license/ +* +* 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 "gear-racing-controller.h" +#include "view/view_base.h" +#include "view/view_reset.h" +#include "view_manager/view_manager.h" +#include "controller/controller_reset.h" + +typedef struct _s_view_reset { + Evas_Object *layout; +} s_view_reset; + +static s_view_reset s_info = { 0,}; + +static void _layout_back_cb(void *data, Evas_Object *obj, void *event_info) +{ + elm_win_lower(view_manager_get_win()); + controller_reset_back_btn(); +} + +static void _ok_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + controller_reset_next_page(); +} + +static void _view_reset_create_gui(Evas_Object *parent) +{ + s_info.layout = view_base_create_layout(parent); + eext_object_event_callback_add(s_info.layout, EEXT_CALLBACK_BACK, _layout_back_cb, NULL); + elm_layout_text_set(s_info.layout, "txt_title", "Reset"); + + view_base_create_button(s_info.layout, "Button_Ok", "Ok", _ok_button_clicked_cb, NULL); + view_base_create_button(s_info.layout, "Button_Cancel", "Cancel", NULL, NULL); +} + +void view_reset_init(Evas_Object *parent) +{ + controller_reset_init(NULL); + _view_reset_create_gui(parent); +} diff --git a/src/viewmanager/view_manager.c b/src/viewmanager/view_manager.c index c59220f..d91fc6c 100644 --- a/src/viewmanager/view_manager.c +++ b/src/viewmanager/view_manager.c @@ -15,9 +15,17 @@ */ #include <assert.h> +#include <view_manager/view_manager.h> #include <view/view_connect_to_car.h> #include <view/view_car_selection.h> -#include <view_manager/view_manager.h> +#include "view/view_connection_successed.h" +#include "view/view_emergency_stop.h" +#include "view/view_help.h" +#include "view/view_name_input.h" +#include "view/view_network_failure.h" +#include "view/view_racing.h" +#include "view/view_reset.h" + typedef struct _s_ui { Evas_Object *win; Evas_Object *conform; @@ -58,10 +66,32 @@ void view_manager_set_view(view_id id) { switch (id) { case VIEW_CONNECT_TO_CAR: - connect_to_car_init(s_info.conform); + view_connect_to_car_init(s_info.conform); break; case VIEW_CAR_SELECTION: - car_selection_init(s_info.conform); + view_car_selection_init(s_info.conform); + break; + case VIEW_CONNECTION_SUCCESSED: + view_connection_successed_init(s_info.conform); + break; + case VIEW_NAME_INPUT: + view_name_input_init(s_info.conform); + break; + case VIEW_HELP: + view_help_init(s_info.conform); + break; + case VIEW_RACING: + view_racing_init(s_info.conform); + break; + case VIEW_EMERGENCY_STOP: + view_emergency_stop_init(s_info.conform); + break; + case VIEW_RESET: + view_reset_init(s_info.conform); + break; + case VIEW_NETWORK_FAILURE: + view_network_failure_init(s_info.conform); + break; break; default: break; |