summaryrefslogtreecommitdiff
path: root/src/controller/controller_connect_to_car.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/controller/controller_connect_to_car.c')
-rw-r--r--src/controller/controller_connect_to_car.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/controller/controller_connect_to_car.c b/src/controller/controller_connect_to_car.c
index 1799389..11b3f0c 100644
--- a/src/controller/controller_connect_to_car.c
+++ b/src/controller/controller_connect_to_car.c
@@ -14,14 +14,26 @@
* limitations under the License.
*/
-#include <controller/controller_base.h>
#include <assert.h>
+#include <controller/controller_base.h>
+#include "model/model_connection.h"
#include "gear-racing-controller.h"
#include "controller/controller_connect_to_car.h"
#include "view_manager/view_manager.h"
static s_controller *controller = NULL;
+static void controller_connect_to_car_destroy(void)
+{
+ free(controller);
+}
+
+static void _connected_cb(void *is_connected)
+{
+ view_manager_set_view(VIEW_CAR_SELECTION);
+ controller_connect_to_car_destroy();
+}
+
void controller_connect_to_car_init(t_view_update_cb view_update_cb)
{
controller = calloc(1, sizeof(s_controller));
@@ -30,11 +42,8 @@ void controller_connect_to_car_init(t_view_update_cb view_update_cb)
}
controller->view_update_cb = view_update_cb;
-}
-void controller_connect_to_car_destroy(void)
-{
- free(controller);
+ model_connection_subscribe_event(_connected_cb);
}
void controller_connect_to_car_back_btn(void)
{
@@ -44,7 +53,5 @@ void controller_connect_to_car_back_btn(void)
void controller_connect_to_car_next_page()
{
- //TODO model
- view_manager_set_view(VIEW_CAR_SELECTION);
- controller_connect_to_car_destroy();
+ model_connection_connect();
}