/* * 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_cloud_connection.h" #include "controller/controller_network_failure.h" #include "view_manager/view_manager.h" static s_controller s_info = { 0, }; void controller_network_failure_destroy(void) { model_cloud_connection_unsubscirbe_event(); } static void _connected_cb(s_model_cloud_connection_cb_data *model_data) { view_manager_set_view(VIEW_CONNECT_TO_CAR); } static void _reconnected_cb(s_model_cloud_connection_cb_data *model_data) { view_manager_set_view(VIEW_CONNECT_TO_CAR); controller_network_failure_destroy(); } void controller_network_failure_init(t_view_update_cb view_update_cb) { s_info.view_update_cb = view_update_cb; model_cloud_connection_subscribe_event(_connected_cb); model_cloud_connection_subscribe_reconnect(_reconnected_cb); } void controller_network_failure_back(void) { controller_network_failure_destroy(); } void controller_network_failure_next() { model_cloud_connection_model_state_change(); } void controller_network_failure_try_reconnect(void) { model_cloud_connection_try_reconnect(); }