#include "testchanging.h"
#include "testcat1.h"
#include "testhrsenson.h"
+#include "power_display_service.h"
namespace OHOS {
#ifdef __cplusplus
{TOPIC_EVENT_GRAYCARD_UPDATA, PRIORITY_TWO},
{TOPIC_EVENT_LEAKLIGHT_UPDATA, PRIORITY_TWO},
#endif
+#ifdef SUPPORT_DEVICE_PAIRING_NOTIFICATION //如果支持设备配对通知
+ {TOPIC_EVENT_DEVICE_BIND, PRIORITY_TWO},
+ {TOPIC_EVENT_DEVICE_UNBIND, PRIORITY_TWO},
+#endif
};
static bool CheckPriority(const Topic topic)
MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_POWER_ON);
MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_POWER_OFF);
#endif
+#ifdef SUPPORT_DEVICE_PAIRING_NOTIFICATION //如果支持设备配对通知
+ MsgCenterSubscribeTopic(TOPIC_EVENT_DEVICE_BIND);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_DEVICE_UNBIND);
+#endif
}
static OHOS::UIViewGroup* showAlarmNotify(void)
return OHOS::CreateCalldialView();
}
+/*显示绑定通知*/
+static OHOS::UIViewGroup* showDeviceBindingNotify(void)
+{
+ return OHOS::CreateDeviceBindingView();
+}
+
+/*显示解绑通知*/
+static OHOS::UIViewGroup* showDeviceUnBindingNotify(void)
+{
+ return OHOS::CreateDeviceUnBindingView();
+}
+
void MsgCenterNotifyAlarmProc(const Topic topic, Request* req)
{
unused(req);
void MsgCenterNotifyChargePlugProc(const Topic topic, Request* req)
{
unused(req);
- unused(topic);
+ //unused(topic);
WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger Plug !");
+
+ const power_display_svr_api_t *display_api = power_display_svr_get_api();
+ if (display_api->get_screen_state() != SCREEN_ON)
+ {
+ display_api->turn_on_screen();
+ }
DialModelCharge::GetInstance()->UpdateChargeStuaut(1);
testCHANINGView *t=testCHANINGView::GetInstance();
#endif
+
#ifdef SUPPORT_CAT1_MODEM
void MsgCenterNotifyCatIncomingCallProc(const Topic topic, Request* req)
{
unused(req);
}
#endif
+
+
+#ifdef SUPPORT_DEVICE_PAIRING_NOTIFICATION //如果支持设备配对通知
+//设备绑定通知
+void MsgCenterNotifyDeviceBindProc(const Topic topic, Request* req)
+{
+ unused(req);
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyBindProc Bind!");
+ const power_display_svr_api_t *display_api = power_display_svr_get_api();
+ if (display_api->get_screen_state() != SCREEN_ON)
+ {
+ display_api->turn_on_screen();
+ }
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(showDeviceBindingNotify, (uint16_t)topic, true);
+}
+
+//设备解绑通知
+void MsgCenterNotifyDeviceUnBindProc(const Topic topic, Request* req)
+{
+ unused(req);
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyUnBindProc Unbind !");
+ const power_display_svr_api_t *display_api = power_display_svr_get_api();
+ if (display_api->get_screen_state() != SCREEN_ON)
+ {
+ display_api->turn_on_screen();
+ }
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+ NotificationManager::GetInstance()->ShowNotify(showDeviceUnBindingNotify, (uint16_t)topic, true);
+
+}
+#endif
+
/* 订阅事件通知逻辑可定制 */
static msg_center_notify_table_t g_msg_center_notify_table[] = {
{TOPIC_EVENT_ALARM_RING, MsgCenterNotifyAlarmProc},
{TOPIC_EVENT_CAT1_POWER_ON, MsgCenterNotifyCat1PowerOnProc},
{TOPIC_EVENT_CAT1_POWER_OFF, MsgCenterNotifyCat1PowerOffProc},
#endif
+#ifdef SUPPORT_DEVICE_PAIRING_NOTIFICATION
+ {TOPIC_EVENT_DEVICE_BIND, MsgCenterNotifyDeviceBindProc},
+ {TOPIC_EVENT_DEVICE_UNBIND, MsgCenterNotifyDeviceUnBindProc},
+#endif
};
static msg_center_notify_table_t *MsgCenterGetNotifyTblCb(uint8_t idx)
--- /dev/null
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-03-22 10:04:36
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-03-22 19:02:16
+ * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp
+ */
+#include "notification_manager.h"
+#include "wearable_log.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_image_animator.h"
+#include "components/ui_button.h"
+namespace OHOS
+{
+ UIViewGroup *DeviceBindingView{nullptr};
+ UILabelExt *DeviceBindingViewTitleLabel{nullptr}; // 标题 :设备绑定
+ UILabelExt *DeviceBindingName{nullptr}; // 绑定的设备名称
+ UILabelExt *DeviceBindingViewLabel{nullptr}; // 标签内容:“想要进行连接是否同意”
+ UIButton *DeviceBindingButtonOK{nullptr}; // 设备绑定确认
+ UIButton *DeviceBindingButtonCancel{nullptr}; // 设备绑定取消
+
+ UIViewGroup *DeviceUnBindingView{nullptr};
+ UILabelExt *DeviceUnBindingViewTitleLabel{nullptr}; // 标题 :设备解绑
+ UILabelExt *DeviceUnBindingName{nullptr}; // 解绑的设备名称
+ UILabelExt *DeviceUnBindingViewLabel{nullptr}; // 标签内容:“想要进行解绑是否同意”
+ UIButton *DeviceUnBindingButtonOK{nullptr}; // 设备解绑定确认
+ UIButton *DeviceUnBindingButtonCancel{nullptr}; // 设备解绑取消
+
+ UIImageAnimatorView *DeviceUnBindingAnimatorView{nullptr}; // 设备解绑动画
+ static constexpr int UNBIND_IMAGE_ANIMATOR_VIEW_X = 193;
+ static constexpr int UNBIND_IMAGE_ANIMATOR_VIEW_Y = 110;
+ static constexpr int UNBIND_IMAGE_ANIMATOR_VIEW_W = 80;
+ static constexpr int UNBIND_IMAGE_ANIMATOR_VIEW_H = 80;
+ static constexpr int UNBIND_IMAGE_ANIMATOR_VIEW_TIMEOFUPDATE = 100;
+ static constexpr int UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 25; // 解绑动画帧数
+ const char **UnBindPathsArray{nullptr};
+ ImageAnimatorInfo UnBindImageInfo[UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES];
+
+ PairingViewEventListener::PairingViewEventListener()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener::PairingViewEventListener");
+ }
+
+ PairingViewEventListener::~PairingViewEventListener()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener::~PairingViewEventListener");
+ }
+
+ PairingViewEventListener &PairingViewEventListener::GetInstance(void)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener::GetInstance");
+ static PairingViewEventListener instance;
+ return instance;
+ }
+
+ bool PairingViewEventListener::OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener::OnClick");
+ UNUSED(event);
+ if (&view == DeviceBindingButtonCancel) // 设备绑定取消按钮
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener:: DeviceBindingButtonCancel OnClick");
+ // 终止当前的绑定流程并关闭相关的通知界面。
+ NotificationManager::GetInstance()->StopNotify();
+ }
+ else if (&view == DeviceBindingButtonOK) // 设备绑定确认按钮
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener:: DeviceBindingButtonOK OnClick");
+ /*
+ * 可能会执行的绑定流程:
+ * 1.启动绑定过程.
+ * 2.更新设备绑定状态.
+ * 3.发送绑定请求到设备或服务器等.
+ */
+
+ // 关闭通知界面
+ NotificationManager::GetInstance()->StopNotify();
+ }
+ else if (&view == DeviceUnBindingButtonCancel) // 设备解绑取消按钮
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener:: DeviceUnBindingButtonCancel OnClick");
+ // 不想执行解绑动作,并关闭解绑的通知界面。
+ NotificationManager::GetInstance()->StopNotify();
+ }
+ else if (&view == DeviceUnBindingButtonOK) // 设备解绑确认按钮
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener:: DeviceUnBindingButtonOK OnClick");
+ /*
+ * 可能会执行的解绑流程:
+ * 1.通知设备或服务器执行解绑操作.
+ * 2.从绑定设备列表移除设备.
+ * 3.更新UI状态.
+ */
+
+ // 关闭通知界面
+ NotificationManager::GetInstance()->StopNotify();
+ }
+ return true;
+ }
+
+ const char **PairingViewEventListener::CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages)
+ {
+ const char **imagePaths = new const char *[numImages];
+ char buffer[256];
+ for (int i = 0; i < numImages; i++)
+ {
+ snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, i + 1, fileExtension);
+ imagePaths[i] = strdup(buffer);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " imagePaths[%d] = %s", i, imagePaths[i]);
+ }
+ return imagePaths;
+ }
+
+ void PairingViewEventListener::FreeImagePathsArray(const char **imagePaths, const int numImages)
+ {
+ for (int i = 0; i < numImages; i++)
+ {
+ delete imagePaths[i];
+ imagePaths[i] = nullptr;
+ }
+ }
+
+ static UIButton *CreateButton(unsigned int x, unsigned int y, unsigned int w, unsigned int h, const char *imageSrc)
+ {
+ UIButton *button = new UIButton();
+ if (button == nullptr)
+ {
+ return nullptr;
+ }
+ button->SetPosition(x, y, w, h);
+ button->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+ button->SetStyle(STYLE_BACKGROUND_OPA, 0x2d);
+ button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff4fc34c, UIButton::PRESSED);
+ button->SetImageSrc(imageSrc, imageSrc);
+ return button;
+ }
+
+ /*
+ * @brief 创建设备绑定视图
+ */
+ UIViewGroup *CreateDeviceBindingView(void)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateDeviceBindingView]");
+ /* ---------------------------- DeviceBindingView --------------------------- */
+ if (DeviceBindingView == nullptr)
+ {
+ DeviceBindingView = new UIViewGroup();
+ if (nullptr == DeviceBindingView)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateDeviceBindingView] DeviceBindingView new fail!!");
+ return nullptr;
+ }
+ DeviceBindingView->SetPosition(0, 0, 466, 466);
+ DeviceBindingView->SetDraggable(true);
+ DeviceBindingView->SetTouchable(true);
+ /* ----------------------- DeviceBindingViewTitleLabel ---------------------- */
+ DeviceBindingViewTitleLabel = new UILabelExt();
+ if (DeviceBindingViewTitleLabel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateDeviceBindingView] DeviceBindingViewTitleLabel new fail!!");
+ return nullptr;
+ }
+ DeviceBindingViewTitleLabel->SetPosition(173, 52, 120, 35);
+ DeviceBindingViewTitleLabel->SetStyle(STYLE_TEXT_FONT, 30);
+ DeviceBindingViewTitleLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+ DeviceBindingViewTitleLabel->SetText("设备绑定");
+ DeviceBindingViewTitleLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ DeviceBindingViewTitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ DeviceBindingViewTitleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ /* ---------------------------- DeviceBindingName --------------------------- */
+ DeviceBindingName = new UILabelExt();
+ if (DeviceBindingName == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateDeviceBindingView] DeviceBindingName new fail!!");
+ return nullptr;
+ }
+ DeviceBindingName->SetPosition(33, 180, 400, 40);
+ DeviceBindingName->SetStyle(STYLE_TEXT_FONT, 30);
+ DeviceBindingName->SetStyle(STYLE_LINE_HEIGHT, 35);
+ DeviceBindingName->SetText("Iphone 14 Pro\n");
+ DeviceBindingName->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+ DeviceBindingName->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ DeviceBindingName->SetRollSpeed(60);
+ DeviceBindingName->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ /* ------------------------- DeviceBindingViewLabel ------------------------- */
+ DeviceBindingViewLabel = new UILabelExt();
+ if (DeviceBindingViewLabel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateDeviceBindingView] DeviceBindingViewLabel new fail!!");
+ return nullptr;
+ }
+ DeviceBindingViewLabel->SetPosition(33, 240, 400, 40);
+ DeviceBindingViewLabel->SetStyle(STYLE_TEXT_FONT, 30);
+ DeviceBindingViewLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+ DeviceBindingViewLabel->SetText("想要进行连接是否同意");
+ DeviceBindingViewLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+ DeviceBindingViewLabel->SetTextColor(Color::GetColorFromRGBA(0xAA, 0xAA, 0xAA, 0xff));
+ DeviceBindingViewLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ DeviceBindingViewLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ /* ------------------------------ DeviceBindingButtonCancel ------------------------------ */
+ DeviceBindingButtonCancel = CreateButton(111, 320, 100, 100, "/user/res/SYSTEM_CheckOff.bin");
+ if (DeviceBindingButtonCancel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateDeviceBindingView] DeviceBindingButtonCancel new fail!!");
+ return nullptr;
+ }
+ /* -------------------------------- DeviceBindingButtonOK -------------------------------- */
+ DeviceBindingButtonOK = CreateButton(256, 320, 100, 100, "/user/res/SYSTEM_CheckOn.bin");
+ if (DeviceBindingButtonOK == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateDeviceBindingView] DeviceBindingButtonOK new fail!!");
+ return nullptr;
+ }
+
+ UIView::OnClickListener *listener = static_cast<UIView::OnClickListener *>(&PairingViewEventListener::GetInstance());
+ DeviceBindingButtonCancel->SetOnClickListener(listener);
+ DeviceBindingButtonOK->SetOnClickListener(listener);
+ /* ----------------------------------- Add ---------------------------------- */
+ DeviceBindingView->Add(DeviceBindingViewTitleLabel);
+ DeviceBindingView->Add(DeviceBindingName);
+ DeviceBindingView->Add(DeviceBindingViewLabel);
+ DeviceBindingView->Add(DeviceBindingButtonCancel);
+ DeviceBindingView->Add(DeviceBindingButtonOK);
+ }
+ return DeviceBindingView;
+ }
+
+ /*
+ * @brief 创建设备解绑视图
+ */
+ UIViewGroup *CreateDeviceUnBindingView(void)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateDeviceUnBindingView]");
+ /* ---------------------------- DeviceUnBindingView --------------------------- */
+ if (DeviceUnBindingView == nullptr)
+ {
+ DeviceUnBindingView = new UIViewGroup();
+ if (nullptr == DeviceUnBindingView)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateDeviceUnBindingView] DeviceUnBindingView new fail!!");
+ return nullptr;
+ }
+ DeviceUnBindingView->SetPosition(0, 0, 466, 466);
+ DeviceUnBindingView->SetDraggable(true);
+ DeviceUnBindingView->SetTouchable(true);
+ /* ----------------------- DeviceUnBindingAnimatorView ---------------------- */
+ UnBindPathsArray = PairingViewEventListener::GetInstance().CreateImagePathsArray("/user/res/remind/unbind/", "bin", UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+ if (DeviceUnBindingAnimatorView == nullptr)
+ {
+ DeviceUnBindingAnimatorView = new UIImageAnimatorView();
+ if (DeviceUnBindingAnimatorView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateDeviceUnBindingView]DeviceUnBindingAnimatorView new fail");
+ return nullptr;
+ }
+ for (uint8_t i = 0; i < UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++)
+ {
+ UnBindImageInfo[i].imagePath = (UnBindPathsArray[i]);
+ UnBindImageInfo[i].imageType = IMG_SRC_FILE_PATH;
+ UnBindImageInfo[i].pos.x = UNBIND_IMAGE_ANIMATOR_VIEW_X;
+ UnBindImageInfo[i].pos.y = UNBIND_IMAGE_ANIMATOR_VIEW_Y;
+ UnBindImageInfo[i].width = UNBIND_IMAGE_ANIMATOR_VIEW_W;
+ UnBindImageInfo[i].height = UNBIND_IMAGE_ANIMATOR_VIEW_H;
+ }
+ DeviceUnBindingAnimatorView->SetPosition(UNBIND_IMAGE_ANIMATOR_VIEW_X, UNBIND_IMAGE_ANIMATOR_VIEW_Y, UNBIND_IMAGE_ANIMATOR_VIEW_W, UNBIND_IMAGE_ANIMATOR_VIEW_H);
+ DeviceUnBindingAnimatorView->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+ DeviceUnBindingAnimatorView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ DeviceUnBindingAnimatorView->SetImageAnimatorSrc(UnBindImageInfo, UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES, UNBIND_IMAGE_ANIMATOR_VIEW_TIMEOFUPDATE);
+ DeviceUnBindingAnimatorView->SetRepeat(true);
+ DeviceUnBindingAnimatorView->Start();
+ }
+ /* ----------------------- DeviceUnBindingViewTitleLabel ---------------------- */
+ DeviceUnBindingViewTitleLabel = new UILabelExt();
+ if (DeviceUnBindingViewTitleLabel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateDeviceUnBindingView] DeviceUnBindingViewTitleLabel new fail!!");
+ return nullptr;
+ }
+ DeviceUnBindingViewTitleLabel->SetPosition(173, 52, 120, 35);
+ DeviceUnBindingViewTitleLabel->SetStyle(STYLE_TEXT_FONT, 30);
+ DeviceUnBindingViewTitleLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+ DeviceUnBindingViewTitleLabel->SetText("设备解绑");
+ DeviceUnBindingViewTitleLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ DeviceUnBindingViewTitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ DeviceUnBindingViewTitleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ /* ---------------------------- DeviceUnBindingName --------------------------- */
+ DeviceUnBindingName = new UILabelExt();
+ if (DeviceUnBindingName == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateDeviceUnBindingView] DeviceUnBindingName new fail!!");
+ return nullptr;
+ }
+ DeviceUnBindingName->SetPosition(33, 200, 400, 40);
+ DeviceUnBindingName->SetStyle(STYLE_TEXT_FONT, 30);
+ DeviceUnBindingName->SetStyle(STYLE_LINE_HEIGHT, 35);
+ DeviceUnBindingName->SetText("小米5\n");
+ DeviceUnBindingName->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+ DeviceUnBindingName->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ DeviceUnBindingName->SetRollSpeed(60);
+ DeviceUnBindingName->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ /* ------------------------- DeviceUnBindingViewLabel ------------------------- */
+ DeviceUnBindingViewLabel = new UILabelExt();
+ if (DeviceUnBindingViewLabel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateDeviceUnBindingView] DeviceUnBindingViewLabel new fail!!");
+ return nullptr;
+ }
+ DeviceUnBindingViewLabel->SetPosition(33, 250, 400, 40);
+ DeviceUnBindingViewLabel->SetStyle(STYLE_TEXT_FONT, 30);
+ DeviceUnBindingViewLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+ DeviceUnBindingViewLabel->SetText("想要进行解绑是否同意");
+ DeviceUnBindingViewLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+ DeviceUnBindingViewLabel->SetTextColor(Color::GetColorFromRGBA(0xAA, 0xAA, 0xAA, 0xff));
+ DeviceUnBindingViewLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ DeviceUnBindingViewLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ /* ------------------------------ DeviceBindingButtonCancel ------------------------------ */
+ DeviceUnBindingButtonCancel = CreateButton(111, 320, 100, 100, "/user/res/SYSTEM_CheckOff.bin");
+ if (DeviceUnBindingButtonCancel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateDeviceUnBindingView] DeviceUnBindingButtonCancel new fail!!");
+ return nullptr;
+ }
+ /* -------------------------------- DeviceUnBindingButtonOK -------------------------------- */
+ DeviceUnBindingButtonOK = CreateButton(256, 320, 100, 100, "/user/res/SYSTEM_CheckOn.bin");
+ if (DeviceUnBindingButtonOK == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateDeviceUnBindingView] DeviceUnBindingButtonOK new fail!!");
+ return nullptr;
+ }
+ /* ------------------------- button OnClickListener ------------------------- */
+ UIView::OnClickListener *listener = static_cast<UIView::OnClickListener *>(&PairingViewEventListener::GetInstance());
+ DeviceUnBindingButtonCancel->SetOnClickListener(listener);
+ DeviceUnBindingButtonOK->SetOnClickListener(listener);
+ /* ----------------------------------- Add ---------------------------------- */
+ DeviceUnBindingView->Add(DeviceUnBindingViewTitleLabel);
+ DeviceUnBindingView->Add(DeviceUnBindingAnimatorView);
+ DeviceUnBindingView->Add(DeviceUnBindingName);
+ DeviceUnBindingView->Add(DeviceUnBindingViewLabel);
+ DeviceUnBindingView->Add(DeviceUnBindingButtonCancel);
+ DeviceUnBindingView->Add(DeviceUnBindingButtonOK);
+ }
+ return DeviceUnBindingView;
+ }
+
+ /*
+ * @brief 销毁设备绑定视图
+ */
+ void FreeDeviceBindingView(void)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[FreeDeviceBindingView]");
+ if (DeviceBindingView != nullptr)
+ {
+ DeviceBindingView->RemoveAll();
+
+ delete DeviceBindingViewTitleLabel;
+ DeviceBindingViewTitleLabel = nullptr;
+
+ delete DeviceBindingName;
+ DeviceBindingName = nullptr;
+
+ delete DeviceBindingViewLabel;
+ DeviceBindingViewLabel = nullptr;
+
+ delete DeviceBindingButtonCancel;
+ DeviceBindingButtonCancel = nullptr;
+
+ delete DeviceBindingButtonOK;
+ DeviceBindingButtonOK = nullptr;
+
+ RootView::GetInstance()->Remove(DeviceBindingView);
+
+ delete DeviceBindingView;
+ DeviceBindingView = nullptr;
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[FreeDeviceBindingView] success");
+ }
+ }
+
+ /*
+ * @brief 销毁设备解绑视图
+ */
+ void FreeDeviceUnBindingView(void)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[FreeDeviceUnBindingView]");
+ if (DeviceUnBindingView != nullptr)
+ {
+ DeviceUnBindingView->RemoveAll();
+
+ delete DeviceUnBindingViewTitleLabel;
+ DeviceUnBindingViewTitleLabel = nullptr;
+
+ PairingViewEventListener::GetInstance().FreeImagePathsArray(UnBindPathsArray, UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+
+ delete DeviceUnBindingAnimatorView;
+ DeviceUnBindingAnimatorView = nullptr;
+
+ delete DeviceUnBindingName;
+ DeviceUnBindingName = nullptr;
+
+ delete DeviceUnBindingViewLabel;
+ DeviceUnBindingViewLabel = nullptr;
+
+ delete DeviceUnBindingButtonCancel;
+ DeviceUnBindingButtonCancel = nullptr;
+
+ delete DeviceUnBindingButtonOK;
+ DeviceUnBindingButtonOK = nullptr;
+
+ RootView::GetInstance()->Remove(DeviceUnBindingView);
+
+ delete DeviceUnBindingView;
+ DeviceUnBindingView = nullptr;
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[FreeDeviceUnBindingView] success");
+ }
+ }
+
+}
\ No newline at end of file