Renaming
This commit is contained in:
parent
dba1a5182d
commit
0d74cf001c
187
src/lvgl_win_sim/lv_port_win_codeblocks/find_my_phone_screen.c
Normal file
187
src/lvgl_win_sim/lv_port_win_codeblocks/find_my_phone_screen.c
Normal file
@ -0,0 +1,187 @@
|
||||
#include "find_my_phone_screen.h"
|
||||
#include "menu_screen.h"
|
||||
|
||||
static void gesture_event_cb(lv_event_t *e)
|
||||
{
|
||||
FindMyPhoneScreen_t *findMyPhoneScreen = e->user_data;
|
||||
|
||||
lv_dir_t gesture;
|
||||
switch(gesture = lv_indev_get_gesture_dir(lv_indev_get_act()))
|
||||
{
|
||||
case LV_DIR_LEFT:
|
||||
LV_LOG_USER("GESTURE : LEFT");
|
||||
break;
|
||||
case LV_DIR_RIGHT:
|
||||
LV_LOG_USER("GESTURE : RIGHT");
|
||||
// We create the menu screen and switch to it
|
||||
extern MenuScreen_t menuScreen;
|
||||
menu_screen_create(&menuScreen);
|
||||
lv_scr_load_anim(menuScreen.display, LV_SCR_LOAD_ANIM_MOVE_RIGHT, 400, 0, true);
|
||||
break;
|
||||
case LV_DIR_TOP:
|
||||
LV_LOG_USER("GESTURE : TOP");
|
||||
break;
|
||||
case LV_DIR_BOTTOM:
|
||||
LV_LOG_USER("GESTURE : BOTTOM");
|
||||
break;
|
||||
default:
|
||||
LV_LOG_USER("GESTURE : %u", gesture);
|
||||
}
|
||||
}
|
||||
|
||||
static void cleanup_event_cb(lv_event_t *e)
|
||||
{
|
||||
FindMyPhoneScreen_t *findMyPhoneScreen = e->user_data;
|
||||
find_my_phone_screen_destroy(findMyPhoneScreen);
|
||||
LV_LOG_USER("cleanup");
|
||||
}
|
||||
|
||||
static void button_click_event_cb(lv_event_t *e)
|
||||
{
|
||||
FindMyPhoneScreen_t *findMyPhoneScreen = e->user_data;
|
||||
|
||||
if(!findMyPhoneScreen->finding_phone)
|
||||
{
|
||||
lv_obj_set_style_border_color(findMyPhoneScreen->innerCircle, lv_color_make(238, 17, 133), LV_PART_MAIN);
|
||||
lv_label_set_text_static(findMyPhoneScreen->findMyPhoneButton.label, "Found\nIt !");
|
||||
if(findMyPhoneScreen->sendFindMyPhoneBLECommandCb)findMyPhoneScreen->sendFindMyPhoneBLECommandCb(true);
|
||||
findMyPhoneScreen->finding_phone = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
lv_obj_set_style_border_color(findMyPhoneScreen->innerCircle, lv_color_make(67, 160, 71), LV_PART_MAIN);
|
||||
lv_label_set_text_static(findMyPhoneScreen->findMyPhoneButton.label, "Find\nMy\nPhone !");
|
||||
if(findMyPhoneScreen->sendFindMyPhoneBLECommandCb)findMyPhoneScreen->sendFindMyPhoneBLECommandCb(false);
|
||||
findMyPhoneScreen->finding_phone = false;
|
||||
}
|
||||
|
||||
LV_LOG_USER("find my phone button clicked");
|
||||
}
|
||||
|
||||
static void _disable_btn_no_ble_connection(FindMyPhoneScreen_t * const findMyPhoneScreen, bool connected)
|
||||
{
|
||||
if(connected)
|
||||
{
|
||||
lv_obj_set_style_border_color(findMyPhoneScreen->innerCircle, lv_color_make(67, 160, 71), LV_PART_MAIN);
|
||||
lv_label_set_text_static(findMyPhoneScreen->findMyPhoneButton.label, "Find\nMy\nPhone !");
|
||||
lv_obj_clear_state(findMyPhoneScreen->findMyPhoneButton.button, LV_STATE_DISABLED);
|
||||
}
|
||||
else
|
||||
{
|
||||
lv_obj_set_style_border_color(findMyPhoneScreen->innerCircle, lv_color_make(96, 125, 139), LV_PART_MAIN);
|
||||
lv_label_set_text_static(findMyPhoneScreen->findMyPhoneButton.label, "Phone\nnot\ncon-\nnected !");
|
||||
lv_obj_add_state(findMyPhoneScreen->findMyPhoneButton.button, LV_STATE_DISABLED);
|
||||
}
|
||||
}
|
||||
|
||||
void find_my_phone_screen_init(FindMyPhoneScreen_t * const findMyPhoneScreen)
|
||||
{
|
||||
if(!findMyPhoneScreen)
|
||||
{
|
||||
LV_LOG_ERROR("NULL pointer given !");
|
||||
return;
|
||||
}
|
||||
|
||||
memset(findMyPhoneScreen, 0, sizeof(FindMyPhoneScreen_t));
|
||||
}
|
||||
|
||||
void find_my_phone_screen_register_BLE_command_send_cb(FindMyPhoneScreen_t * const findMyPhoneScreen, SendFindMyPhoneBLECommandCb_t sendFindMyPhoneBLECommandCb)
|
||||
{
|
||||
if(!findMyPhoneScreen)
|
||||
{
|
||||
LV_LOG_ERROR("NULL pointer given !");
|
||||
return;
|
||||
}
|
||||
|
||||
findMyPhoneScreen->sendFindMyPhoneBLECommandCb = sendFindMyPhoneBLECommandCb;
|
||||
}
|
||||
|
||||
void find_my_phone_screen_notify_BLE_connection_state(FindMyPhoneScreen_t * const findMyPhoneScreen, bool connected)
|
||||
{
|
||||
if(!findMyPhoneScreen)
|
||||
{
|
||||
LV_LOG_ERROR("NULL pointer given !");
|
||||
return;
|
||||
}
|
||||
|
||||
if(findMyPhoneScreen->ble_connection_state != connected)
|
||||
{
|
||||
findMyPhoneScreen->ble_connection_state = connected;
|
||||
if(findMyPhoneScreen->display != NULL)
|
||||
_disable_btn_no_ble_connection(findMyPhoneScreen, findMyPhoneScreen->ble_connection_state);
|
||||
}
|
||||
}
|
||||
|
||||
void find_my_phone_screen_create(FindMyPhoneScreen_t * const findMyPhoneScreen)
|
||||
{
|
||||
if(!findMyPhoneScreen)
|
||||
{
|
||||
LV_LOG_ERROR("NULL pointer given !");
|
||||
return;
|
||||
}
|
||||
|
||||
if(findMyPhoneScreen->display)
|
||||
{
|
||||
LV_LOG_ERROR("display should be NULL here !");
|
||||
lv_obj_del(findMyPhoneScreen->display);
|
||||
findMyPhoneScreen->display = NULL;
|
||||
}
|
||||
findMyPhoneScreen->display = lv_obj_create(NULL);
|
||||
lv_obj_set_style_bg_color(findMyPhoneScreen->display, lv_color_make(0xFF,0xFF,0xFF), LV_PART_MAIN);
|
||||
|
||||
if(findMyPhoneScreen->innerCircle)
|
||||
{
|
||||
LV_LOG_ERROR("innerCircle should be NULL here !");
|
||||
lv_obj_del(findMyPhoneScreen->innerCircle);
|
||||
findMyPhoneScreen->innerCircle = NULL;
|
||||
}
|
||||
findMyPhoneScreen->innerCircle = lv_obj_create(findMyPhoneScreen->display);
|
||||
lv_obj_center(findMyPhoneScreen->innerCircle);
|
||||
lv_obj_set_size(findMyPhoneScreen->innerCircle, 240, 240);
|
||||
lv_obj_set_style_bg_color(findMyPhoneScreen->innerCircle, lv_color_make(0xFF,0xFF,0xFF), LV_PART_MAIN);
|
||||
lv_obj_set_style_radius(findMyPhoneScreen->innerCircle, LV_RADIUS_CIRCLE, LV_PART_MAIN);
|
||||
lv_obj_set_style_border_width(findMyPhoneScreen->innerCircle, 15, LV_PART_MAIN);
|
||||
|
||||
if(findMyPhoneScreen->findMyPhoneButton.button)
|
||||
{
|
||||
LV_LOG_ERROR("button should be NULL here !");
|
||||
lv_obj_del(findMyPhoneScreen->findMyPhoneButton.button);
|
||||
findMyPhoneScreen->findMyPhoneButton.button = NULL;
|
||||
}
|
||||
findMyPhoneScreen->findMyPhoneButton.button = lv_btn_create(findMyPhoneScreen->innerCircle);
|
||||
lv_obj_center(findMyPhoneScreen->findMyPhoneButton.button);
|
||||
lv_obj_set_size(findMyPhoneScreen->findMyPhoneButton.button, 155, 155);
|
||||
lv_obj_set_style_radius(findMyPhoneScreen->findMyPhoneButton.button, LV_RADIUS_CIRCLE, LV_PART_MAIN);
|
||||
lv_obj_set_style_shadow_spread(findMyPhoneScreen->findMyPhoneButton.button, 2, LV_PART_MAIN);
|
||||
lv_obj_add_event_cb(findMyPhoneScreen->findMyPhoneButton.button, &(button_click_event_cb), LV_EVENT_CLICKED, findMyPhoneScreen);
|
||||
|
||||
if(findMyPhoneScreen->findMyPhoneButton.label)
|
||||
{
|
||||
LV_LOG_ERROR("label should be NULL here !");
|
||||
lv_obj_del(findMyPhoneScreen->findMyPhoneButton.label);
|
||||
findMyPhoneScreen->findMyPhoneButton.label = NULL;
|
||||
}
|
||||
findMyPhoneScreen->findMyPhoneButton.label = lv_label_create(findMyPhoneScreen->findMyPhoneButton.button);
|
||||
lv_obj_center(findMyPhoneScreen->findMyPhoneButton.label);
|
||||
lv_obj_set_style_text_align(findMyPhoneScreen->findMyPhoneButton.label, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_font(findMyPhoneScreen->findMyPhoneButton.label, &lv_font_montserrat_28, LV_PART_MAIN);
|
||||
|
||||
_disable_btn_no_ble_connection(findMyPhoneScreen, findMyPhoneScreen->ble_connection_state);
|
||||
|
||||
|
||||
//We register the event callback to handle gestures
|
||||
lv_obj_add_event_cb(findMyPhoneScreen->display, &(gesture_event_cb), LV_EVENT_GESTURE, findMyPhoneScreen);
|
||||
//We register the event callback to handle the cleanup
|
||||
lv_obj_add_event_cb(findMyPhoneScreen->display, &(cleanup_event_cb), LV_EVENT_DELETE, findMyPhoneScreen);
|
||||
}
|
||||
|
||||
void find_my_phone_screen_destroy(FindMyPhoneScreen_t * const findMyPhoneScreen)
|
||||
{
|
||||
if(!findMyPhoneScreen)
|
||||
{
|
||||
LV_LOG_ERROR("NULL pointer given !");
|
||||
return;
|
||||
}
|
||||
|
||||
memset(findMyPhoneScreen, 0, offsetof(FindMyPhoneScreen_t, sendFindMyPhoneBLECommandCb));
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
#ifndef FIND_MY_PHONE_SCREEN_H
|
||||
#define FIND_MY_PHONE_SCREEN_H
|
||||
|
||||
#include "lvgl.h"
|
||||
|
||||
typedef void (*SendFindMyPhoneBLECommandCb_t)(bool findMyPhone);
|
||||
|
||||
typedef struct FindMyPhoneButton
|
||||
{
|
||||
lv_obj_t *button;
|
||||
lv_obj_t *label;
|
||||
} FindMyPhoneButton_t;
|
||||
|
||||
typedef struct FindMyPhoneScreen
|
||||
{
|
||||
//Can be erased attributes
|
||||
lv_obj_t *display;
|
||||
lv_obj_t *innerCircle;
|
||||
FindMyPhoneButton_t findMyPhoneButton;
|
||||
bool finding_phone;
|
||||
//Should not be erased attributes
|
||||
SendFindMyPhoneBLECommandCb_t sendFindMyPhoneBLECommandCb;
|
||||
bool ble_connection_state;
|
||||
} FindMyPhoneScreen_t;
|
||||
|
||||
void find_my_phone_screen_init(FindMyPhoneScreen_t * const findMyPhoneScreen);
|
||||
|
||||
void find_my_phone_screen_register_BLE_command_send_cb(FindMyPhoneScreen_t * const findMyPhoneScreen, SendFindMyPhoneBLECommandCb_t sendFindMyPhoneBLECommandCb);
|
||||
|
||||
void find_my_phone_screen_notify_BLE_connection_state(FindMyPhoneScreen_t * const findMyPhoneScreen, bool connected);
|
||||
|
||||
void find_my_phone_screen_create(FindMyPhoneScreen_t * const findMyPhoneScreen);
|
||||
|
||||
void find_my__phone_screen_destroy(FindMyPhoneScreen_t * const findMyPhoneScreen);
|
||||
|
||||
#endif //FIND_PHONE_SCREEN_H
|
@ -1,187 +0,0 @@
|
||||
#include "find_phone_screen.h"
|
||||
#include "menu_screen.h"
|
||||
|
||||
static void gesture_event_cb(lv_event_t *e)
|
||||
{
|
||||
FindPhoneScreen_t *findPhoneScreen = e->user_data;
|
||||
|
||||
lv_dir_t gesture;
|
||||
switch(gesture = lv_indev_get_gesture_dir(lv_indev_get_act()))
|
||||
{
|
||||
case LV_DIR_LEFT:
|
||||
LV_LOG_USER("GESTURE : LEFT");
|
||||
break;
|
||||
case LV_DIR_RIGHT:
|
||||
LV_LOG_USER("GESTURE : RIGHT");
|
||||
// We create the menu screen and switch to it
|
||||
extern MenuScreen_t menuScreen;
|
||||
menu_screen_create(&menuScreen);
|
||||
lv_scr_load_anim(menuScreen.display, LV_SCR_LOAD_ANIM_MOVE_RIGHT, 400, 0, true);
|
||||
break;
|
||||
case LV_DIR_TOP:
|
||||
LV_LOG_USER("GESTURE : TOP");
|
||||
break;
|
||||
case LV_DIR_BOTTOM:
|
||||
LV_LOG_USER("GESTURE : BOTTOM");
|
||||
break;
|
||||
default:
|
||||
LV_LOG_USER("GESTURE : %u", gesture);
|
||||
}
|
||||
}
|
||||
|
||||
static void cleanup_event_cb(lv_event_t *e)
|
||||
{
|
||||
FindPhoneScreen_t *findPhoneScreen = e->user_data;
|
||||
find_phone_screen_destroy(findPhoneScreen);
|
||||
LV_LOG_USER("cleanup");
|
||||
}
|
||||
|
||||
static void button_click_event_cb(lv_event_t *e)
|
||||
{
|
||||
FindPhoneScreen_t *findPhoneScreen = e->user_data;
|
||||
|
||||
if(!findPhoneScreen->finding_phone)
|
||||
{
|
||||
lv_obj_set_style_border_color(findPhoneScreen->innerCircle, lv_color_make(238, 17, 133), LV_PART_MAIN);
|
||||
lv_label_set_text_static(findPhoneScreen->findPhoneButton.label, "Found\nIt !");
|
||||
if(findPhoneScreen->sendFindPhoneBLECommandCb)findPhoneScreen->sendFindPhoneBLECommandCb(true);
|
||||
findPhoneScreen->finding_phone = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
lv_obj_set_style_border_color(findPhoneScreen->innerCircle, lv_color_make(67, 160, 71), LV_PART_MAIN);
|
||||
lv_label_set_text_static(findPhoneScreen->findPhoneButton.label, "Find\nMy\nPhone !");
|
||||
if(findPhoneScreen->sendFindPhoneBLECommandCb)findPhoneScreen->sendFindPhoneBLECommandCb(false);
|
||||
findPhoneScreen->finding_phone = false;
|
||||
}
|
||||
|
||||
LV_LOG_USER("find my phone button clicked");
|
||||
}
|
||||
|
||||
static void _disable_btn_no_ble_connection(FindPhoneScreen_t * const findPhoneScreen, bool connected)
|
||||
{
|
||||
if(connected)
|
||||
{
|
||||
lv_obj_set_style_border_color(findPhoneScreen->innerCircle, lv_color_make(67, 160, 71), LV_PART_MAIN);
|
||||
lv_label_set_text_static(findPhoneScreen->findPhoneButton.label, "Find\nMy\nPhone !");
|
||||
lv_obj_clear_state(findPhoneScreen->findPhoneButton.button, LV_STATE_DISABLED);
|
||||
}
|
||||
else
|
||||
{
|
||||
lv_obj_set_style_border_color(findPhoneScreen->innerCircle, lv_color_make(96, 125, 139), LV_PART_MAIN);
|
||||
lv_label_set_text_static(findPhoneScreen->findPhoneButton.label, "Phone\nnot\ncon-\nnected !");
|
||||
lv_obj_add_state(findPhoneScreen->findPhoneButton.button, LV_STATE_DISABLED);
|
||||
}
|
||||
}
|
||||
|
||||
void find_phone_screen_init(FindPhoneScreen_t * const findPhoneScreen)
|
||||
{
|
||||
if(!findPhoneScreen)
|
||||
{
|
||||
LV_LOG_ERROR("NULL pointer given !");
|
||||
return;
|
||||
}
|
||||
|
||||
memset(findPhoneScreen, 0, sizeof(FindPhoneScreen_t));
|
||||
}
|
||||
|
||||
void find_phone_screen_register_BLE_command_send_cb(FindPhoneScreen_t * const findPhoneScreen, SendFindPhoneBLECommandCb_t sendFindPhoneBLECommandCb)
|
||||
{
|
||||
if(!findPhoneScreen)
|
||||
{
|
||||
LV_LOG_ERROR("NULL pointer given !");
|
||||
return;
|
||||
}
|
||||
|
||||
findPhoneScreen->sendFindPhoneBLECommandCb = sendFindPhoneBLECommandCb;
|
||||
}
|
||||
|
||||
void find_phone_screen_notify_BLE_connection_state(FindPhoneScreen_t * const findPhoneScreen, bool connected)
|
||||
{
|
||||
if(!findPhoneScreen)
|
||||
{
|
||||
LV_LOG_ERROR("NULL pointer given !");
|
||||
return;
|
||||
}
|
||||
|
||||
if(findPhoneScreen->ble_connection_state != connected)
|
||||
{
|
||||
findPhoneScreen->ble_connection_state = connected;
|
||||
if(findPhoneScreen->display != NULL)
|
||||
_disable_btn_no_ble_connection(findPhoneScreen, findPhoneScreen->ble_connection_state);
|
||||
}
|
||||
}
|
||||
|
||||
void find_phone_screen_create(FindPhoneScreen_t * const findPhoneScreen)
|
||||
{
|
||||
if(!findPhoneScreen)
|
||||
{
|
||||
LV_LOG_ERROR("NULL pointer given !");
|
||||
return;
|
||||
}
|
||||
|
||||
if(findPhoneScreen->display)
|
||||
{
|
||||
LV_LOG_ERROR("display should be NULL here !");
|
||||
lv_obj_del(findPhoneScreen->display);
|
||||
findPhoneScreen->display = NULL;
|
||||
}
|
||||
findPhoneScreen->display = lv_obj_create(NULL);
|
||||
lv_obj_set_style_bg_color(findPhoneScreen->display, lv_color_make(0xFF,0xFF,0xFF), LV_PART_MAIN);
|
||||
|
||||
if(findPhoneScreen->innerCircle)
|
||||
{
|
||||
LV_LOG_ERROR("innerCircle should be NULL here !");
|
||||
lv_obj_del(findPhoneScreen->innerCircle);
|
||||
findPhoneScreen->innerCircle = NULL;
|
||||
}
|
||||
findPhoneScreen->innerCircle = lv_obj_create(findPhoneScreen->display);
|
||||
lv_obj_center(findPhoneScreen->innerCircle);
|
||||
lv_obj_set_size(findPhoneScreen->innerCircle, 240, 240);
|
||||
lv_obj_set_style_bg_color(findPhoneScreen->innerCircle, lv_color_make(0xFF,0xFF,0xFF), LV_PART_MAIN);
|
||||
lv_obj_set_style_radius(findPhoneScreen->innerCircle, LV_RADIUS_CIRCLE, LV_PART_MAIN);
|
||||
lv_obj_set_style_border_width(findPhoneScreen->innerCircle, 15, LV_PART_MAIN);
|
||||
|
||||
if(findPhoneScreen->findPhoneButton.button)
|
||||
{
|
||||
LV_LOG_ERROR("button should be NULL here !");
|
||||
lv_obj_del(findPhoneScreen->findPhoneButton.button);
|
||||
findPhoneScreen->findPhoneButton.button = NULL;
|
||||
}
|
||||
findPhoneScreen->findPhoneButton.button = lv_btn_create(findPhoneScreen->innerCircle);
|
||||
lv_obj_center(findPhoneScreen->findPhoneButton.button);
|
||||
lv_obj_set_size(findPhoneScreen->findPhoneButton.button, 155, 155);
|
||||
lv_obj_set_style_radius(findPhoneScreen->findPhoneButton.button, LV_RADIUS_CIRCLE, LV_PART_MAIN);
|
||||
lv_obj_set_style_shadow_spread(findPhoneScreen->findPhoneButton.button, 2, LV_PART_MAIN);
|
||||
lv_obj_add_event_cb(findPhoneScreen->findPhoneButton.button, &(button_click_event_cb), LV_EVENT_CLICKED, findPhoneScreen);
|
||||
|
||||
if(findPhoneScreen->findPhoneButton.label)
|
||||
{
|
||||
LV_LOG_ERROR("label should be NULL here !");
|
||||
lv_obj_del(findPhoneScreen->findPhoneButton.label);
|
||||
findPhoneScreen->findPhoneButton.label = NULL;
|
||||
}
|
||||
findPhoneScreen->findPhoneButton.label = lv_label_create(findPhoneScreen->findPhoneButton.button);
|
||||
lv_obj_center(findPhoneScreen->findPhoneButton.label);
|
||||
lv_obj_set_style_text_align(findPhoneScreen->findPhoneButton.label, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_font(findPhoneScreen->findPhoneButton.label, &lv_font_montserrat_28, LV_PART_MAIN);
|
||||
|
||||
_disable_btn_no_ble_connection(findPhoneScreen, findPhoneScreen->ble_connection_state);
|
||||
|
||||
|
||||
//We register the event callback to handle gestures
|
||||
lv_obj_add_event_cb(findPhoneScreen->display, &(gesture_event_cb), LV_EVENT_GESTURE, findPhoneScreen);
|
||||
//We register the event callback to handle the cleanup
|
||||
lv_obj_add_event_cb(findPhoneScreen->display, &(cleanup_event_cb), LV_EVENT_DELETE, findPhoneScreen);
|
||||
}
|
||||
|
||||
void find_phone_screen_destroy(FindPhoneScreen_t * const findPhoneScreen)
|
||||
{
|
||||
if(!findPhoneScreen)
|
||||
{
|
||||
LV_LOG_ERROR("NULL pointer given !");
|
||||
return;
|
||||
}
|
||||
|
||||
memset(findPhoneScreen, 0, offsetof(FindPhoneScreen_t, sendFindPhoneBLECommandCb));
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
#ifndef FIND_PHONE_SCREEN_H
|
||||
#define FIND_PHONE_SCREEN_H
|
||||
|
||||
#include "lvgl.h"
|
||||
|
||||
typedef void (*SendFindPhoneBLECommandCb_t)(bool findPhone);
|
||||
|
||||
typedef struct FindPhoneButton
|
||||
{
|
||||
lv_obj_t *button;
|
||||
lv_obj_t *label;
|
||||
} FindPhoneButton_t;
|
||||
|
||||
typedef struct FindPhoneScreen
|
||||
{
|
||||
//Can be erased attributes
|
||||
lv_obj_t *display;
|
||||
lv_obj_t *innerCircle;
|
||||
FindPhoneButton_t findPhoneButton;
|
||||
bool finding_phone;
|
||||
//Should not be erased attributes
|
||||
SendFindPhoneBLECommandCb_t sendFindPhoneBLECommandCb;
|
||||
bool ble_connection_state;
|
||||
} FindPhoneScreen_t;
|
||||
|
||||
void find_phone_screen_init(FindPhoneScreen_t * const findPhoneScreen);
|
||||
|
||||
void find_phone_screen_register_BLE_command_send_cb(FindPhoneScreen_t * const findPhoneScreen, SendFindPhoneBLECommandCb_t sendFindPhoneBLECommandCb);
|
||||
|
||||
void find_phone_screen_notify_BLE_connection_state(FindPhoneScreen_t * const findPhoneScreen, bool connected);
|
||||
|
||||
void find_phone_screen_create(FindPhoneScreen_t * const findPhoneScreen);
|
||||
|
||||
void find_phone_screen_destroy(FindPhoneScreen_t * const findPhoneScreen);
|
||||
|
||||
#endif //FIND_PHONE_SCREEN_H
|
@ -20,7 +20,7 @@
|
||||
#include "menu_screen.h"
|
||||
#include "compass_screen.h"
|
||||
#include "altimeter_screen.h"
|
||||
#include "find_phone_screen.h"
|
||||
#include "find_my_phone_screen.h"
|
||||
|
||||
|
||||
/*********************
|
||||
@ -68,7 +68,7 @@ static void alti_meas_cb(float * const temperature, float * const pressure, floa
|
||||
*altitude = a;//(rand() % 700) + 10.2;
|
||||
}
|
||||
|
||||
static void sendFindPhoneBLECommandCb(bool findPhone)
|
||||
static void sendMyFindPhoneBLECommandCb(bool findPhone)
|
||||
{
|
||||
LV_LOG_USER("Send command to find phone with value : %d", findPhone);
|
||||
}
|
||||
@ -78,7 +78,7 @@ MenuScreen_t menuScreen;
|
||||
CompassScreen_t compassScreen;
|
||||
SettingsScreen_t settingsScreen;
|
||||
AltimeterScreen_t altimeterScreen;
|
||||
FindPhoneScreen_t findPhoneScreen;
|
||||
FindMyPhoneScreen_t findMyPhoneScreen;
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int nCmdShow)
|
||||
{
|
||||
@ -105,9 +105,9 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLi
|
||||
compass_screen_init(&compassScreen);
|
||||
settings_screen_init(&settingsScreen);
|
||||
altimeter_screen_init(&altimeterScreen);
|
||||
find_phone_screen_init(&findPhoneScreen);
|
||||
find_phone_screen_register_BLE_command_send_cb(&findPhoneScreen, &(sendFindPhoneBLECommandCb));
|
||||
find_phone_screen_notify_BLE_connection_state(&findPhoneScreen, true);
|
||||
find_my_phone_screen_init(&findMyPhoneScreen);
|
||||
find_my_phone_screen_register_BLE_command_send_cb(&findMyPhoneScreen, &(sendMyFindPhoneBLECommandCb));
|
||||
find_my_phone_screen_notify_BLE_connection_state(&findMyPhoneScreen, true);
|
||||
|
||||
altimeter_screen_register_measurement_cb(&altimeterScreen, &(alti_meas_cb));
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "watch_face.h"
|
||||
#include "compass_screen.h"
|
||||
#include "altimeter_screen.h"
|
||||
#include "find_phone_screen.h"
|
||||
#include "find_my_phone_screen.h"
|
||||
|
||||
#define array_size(array) (sizeof(array)/sizeof(array[0]))
|
||||
|
||||
@ -42,9 +42,9 @@ static void menu_item_cb(lv_event_t *e)
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
extern FindPhoneScreen_t findPhoneScreen;
|
||||
find_phone_screen_create(&findPhoneScreen);
|
||||
lv_scr_load_anim(findPhoneScreen.display, LV_SCR_LOAD_ANIM_MOVE_LEFT, 400, 0, true);
|
||||
extern FindMyPhoneScreen_t findMyPhoneScreen;
|
||||
find_my_phone_screen_create(&findMyPhoneScreen);
|
||||
lv_scr_load_anim(findMyPhoneScreen.display, LV_SCR_LOAD_ANIM_MOVE_LEFT, 400, 0, true);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
|
Loading…
Reference in New Issue
Block a user