适配AOD默认表盘 1894/1 1894/head 1895/target/1
authorCaisking <Casiking@zhihuishixun.com>
Fri, 27 Jun 2025 06:57:40 +0000 (14:57 +0800)
committerCaisking <Casiking@zhihuishixun.com>
Fri, 27 Jun 2025 06:57:40 +0000 (14:57 +0800)
13 files changed:
code/sdk/application/wearable/fd230/nativeapp/nativeui/aod_view/src/AodView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/clock/include/AmbientClockView.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/clock/src/AmbientClockView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/clock/src/MainClockView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbModel.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/dial/DialViewGroup.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/MainModel.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dial/DialViewGroup.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/set_dial/include/SetDialInfo.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/set_dial/include/SetDialModel.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/set_dial/src/SetDialModel.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/set_dial/src/SetDialPresenter.cpp

index 9040519..7943c5a 100644 (file)
@@ -25,13 +25,17 @@ AodView::~AodView()
 
 void AodView::OnStart()
 {
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AodView::OnStart: Start to generate the AOD watch face.\n");
     DialSetting &setting = MainModel::GetInstance().GetDialSetting();
     if (setting.dialFlag == 0) { // 在线表盘
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "online dial");
         clockDial_ = InitAodDial(setting);
     } else {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "offline dial");
         clockDial_ = InitAodOffDial(setting);
     }
     if (clockDial_ == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clockDial_ init failed.");
         clockDial_ = InitDefaultAod();
     }
     if (clockDial_ == nullptr) {
@@ -80,13 +84,16 @@ UIViewGroup *AodView::InitAodOffDial(DialSetting &setting)
 {
     DialPreviewInfo preview;
     memset_s(&preview, sizeof(preview), 0, sizeof(preview));
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dialFullName: %s", setting.dialFullName.c_str());
     FILE *fp = fopen(setting.dialFullName.c_str(), "rb");
     if (fp == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AodView::InitAodOffDial: Failed to open the dial file.\n");
         return nullptr;
     }
     bool ret = DialBinParserManager::GetInstance()->GetDialPreviewInfo(fp, &preview);
     fclose(fp);
     if (!ret) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AodView::InitAodOffDial: Failed to get the dial preview info.\n");
         return nullptr;
     }
     if (preview.capability == DIAL_DISPLAY_CAPABILITY_AMBITIENT_ONLY ||
@@ -94,7 +101,8 @@ UIViewGroup *AodView::InitAodOffDial(DialSetting &setting)
         DialViewGroup *dial = new DialViewGroup;
         dial->SetDial(setting.dialFullName, DisplayState::AOD);
         return dial;
-    }
+    } 
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AodView::InitAodOffDial: The dial does not support AOD.\n");
     return nullptr;
 }
 
index 2d02ca4..44e9f36 100644 (file)
@@ -58,6 +58,7 @@ private:
     Image *bigCircle_{nullptr};
     Image *medCircle_{nullptr};
     Image *smallCircle_{nullptr};
+    UILabel *timerlabel{nullptr};
     bool viewiInitStatus_{false};
 }; // class AmbientClockView
 } // namespace OHOS
index d9aaac6..0a64ad0 100644 (file)
 #include "wearable_log.h"
 #include "ui_resource_image.h"
 #include "common/image_cache_manager.h"
-
+#include "uicomponents/UIComponents.h"
+#include "ui_resource_image.h"
+#include <sstream>
+#include <sys/time.h>
 namespace OHOS {
 static constexpr uint16_t POINT_POSITION_X = 202;
 static constexpr uint16_t POINT_POSITION_Y = 16;
@@ -40,24 +43,27 @@ AmbientClockView::~AmbientClockView()
 {
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AmbientClockView::~AmbientClockView");
     if (viewiInitStatus_) {
-        mainSweepClock_->RemoveAll();
-        delete secondHand_;
-        secondHand_ = nullptr;
-        delete minuteHand_;
-        minuteHand_ = nullptr;
-        delete hourHand_;
-        hourHand_ = nullptr;
-        delete hand24Hour_;
-        hand24Hour_ = nullptr;
-        delete bigCircle_;
-        bigCircle_ = nullptr;
-        delete medCircle_;
-        medCircle_ = nullptr;
-        delete smallCircle_;
-        smallCircle_ = nullptr;
-        Remove(mainSweepClock_);
-        delete mainSweepClock_;
-        mainSweepClock_ = nullptr;
+        // mainSweepClock_->RemoveAll();
+        // delete secondHand_;
+        // secondHand_ = nullptr;
+        // delete minuteHand_;
+        // minuteHand_ = nullptr;
+        // delete hourHand_;
+        // hourHand_ = nullptr;
+        // delete hand24Hour_;
+        // hand24Hour_ = nullptr;
+        // delete bigCircle_;
+        // bigCircle_ = nullptr;
+        // delete medCircle_;
+        // medCircle_ = nullptr;
+        // delete smallCircle_;
+        // smallCircle_ = nullptr;
+        // Remove(mainSweepClock_);
+        // delete mainSweepClock_;
+        // mainSweepClock_ = nullptr;
+
+        delete timerlabel;
+        timerlabel = nullptr;
     }
 }
 
@@ -172,40 +178,27 @@ void AmbientClockView::PreLoad(void)
 
 bool AmbientClockView::InitView(void)
 {
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AmbientClockView::InitView");
-
-    mainSweepClock_ = new UISweepClock();
-    if (mainSweepClock_ == nullptr) {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "mainSweepClock new fail");
-        return false;
+    //只显示时间 使用数字
+    if (timerlabel == nullptr) {
+        timerlabel = new UILabel();
     }
-    if (!InitSweepClock()) {
-        return false;
-    }
-
-    Add(mainSweepClock_);
+    timerlabel->SetPosition(58, 108);         // widget's left position and top position
+    timerlabel->Resize(350, 250);          // widget's width and height
+    timerlabel->SetViewId("label1");// Set style
+    timerlabel->SetStyle(STYLE_TEXT_FONT, 130);
 
-    mainSweepClock_->SetDragParentInstead(true);
-    mainSweepClock_->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+    // Set additional property
+    timerlabel->SetText("12:00");
+    timerlabel->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);
+    timerlabel->SetTextColor(Color::GetColorFromRGBA(0x69, 0x69, 0x69, 0xff));
+    timerlabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+    timerlabel->SetRollSpeed(0);
+    timerlabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 130);
 
-    // {214, 3}: position x, y {14, 223}: center x, y
-    mainSweepClock_->SetHandImage(UISweepClock::HandType::SECOND_HAND, *secondHand_,
-        { POINT_POSITION_X, SECOND_POINT_POSITION_Y }, { POINT_CENTER_X, POINT_CENTER_Y });
-    mainSweepClock_->SetHandImage(UISweepClock::HandType::MINUTE_HAND, *minuteHand_,
-        { POINT_POSITION_X, POINT_POSITION_Y }, { POINT_CENTER_X, POINT_CENTER_Y });
-    mainSweepClock_->SetHandImage(UISweepClock::HandType::HOUR_HAND, *hourHand_, { POINT_POSITION_X, POINT_POSITION_Y },
-        { POINT_CENTER_X, POINT_CENTER_Y });
-    mainSweepClock_->SetHandCircleImage(UISweepClock::HandType::SECOND_HAND, *smallCircle_,
-        { SMALLCIRCLE_POSITION_X, SMALLCIRCLE_POSITION_Y });
-    mainSweepClock_->SetHandCircleImage(UISweepClock::HandType::MINUTE_HAND, *medCircle_,
-        { MEDCIRCLE_POSITION_X, MEDCIRCLE_POSITION_Y });
-    mainSweepClock_->SetHandCircleImage(UISweepClock::HandType::HOUR_HAND, *bigCircle_,
-        { BIGCIRCLE_POSITION_X, BIGCIRCLE_POSITION_Y });
+    Add(timerlabel);
 
-    mainSweepClock_->SetInitTime24Hour(0, 0, 0);
-    mainSweepClock_->SetWorkMode(UISweepClock::WorkMode::NORMAL);
-    InitDateTime();
     SetCoverable(true);
+
     return true;
 }
 
@@ -215,7 +208,7 @@ void AmbientClockView::InitDateTime(void)
     time_t seconds;
     time(&seconds);
     localtime_r(&seconds, &pTM);
-    mainSweepClock_->SetTime24Hour(pTM.tm_hour, pTM.tm_min, pTM.tm_sec);
+    // mainSweepClock_->SetTime24Hour(pTM.tm_hour, pTM.tm_min, pTM.tm_sec);
 }
 
 void AmbientClockView::UpdateTime(void)
@@ -230,7 +223,20 @@ void AmbientClockView::UpdateTime(void)
     uint8_t realMinute = static_cast<uint8_t>(minute % MIN_TO_HOUR);
     uint16_t realMilliSecond = static_cast<uint16_t>((second % MIN_TO_HOUR) *
         SEC_TO_MILLI + uSecond / USEC_TO_MILLI);
-    mainSweepClock_->SetSweepTime12Hour(realHour, realMinute, realMilliSecond, 1);
+
+    // if (timerlabel != nullptr) {
+    //     std::stringstream ss;
+    //     ss.fill('0');
+        
+    //     ss << std::setw(2) << realHour << ":";
+    //     ss << std::setw(2) << realMinute;
+        
+    //     timerlabel->SetText(ss.str().c_str());
+    // }
+    if(timerlabel == nullptr)
+        return;
+    
+    timerlabel->SetText((std::to_string(realHour) + ":" + std::to_string(realMinute)).c_str());
 }
 }
 
index 4138c95..7ac83e0 100644 (file)
  
      void MainClockView::UpdateBatteryColor(void)
      {
-#ifdef FD230_650
          bool isCharging = get_charge_stat(); // 获取充电状态
  
          if (isCharging)
                  }
              }
          }
-#endif
      }
  
      void MainClockView::SetViewColor(int64_t color)
index d8728a0..ed646ea 100644 (file)
@@ -28,10 +28,8 @@ namespace OHOS
     void DnotDisturbModel::SetDoNotDisturbModeEnabled(bool enabled)
     {
         ConfigModel::GetInstance()->SetDnotdisturb(enabled);
-        #ifdef FD230_650
         /*更新主界面配置*/
         MainModel::GetInstance().setDialState(DialState::DO_NOT_DISTURB, enabled);
-        #endif
     }
 
     bool DnotDisturbModel::GetDoNotDisturbModeEnabled() const
@@ -56,10 +54,8 @@ namespace OHOS
                 DropDownCardPage1::GetInstance()->UpdateDnotdisturbState(GetDoNotDisturbModeEnabled());
             }
             PullUpDownView::GetInstance()->UpdateDnotDisturbStatus(GetDoNotDisturbModeEnabled());
-            #ifdef FD230_650
             /*更新主界面配置*/
             MainModel::GetInstance().setDialState(DialState::DO_NOT_DISTURB, GetDoNotDisturbModeEnabled());
-            #endif
         }
         return;
     }
index c39fb43..c9943f4 100644 (file)
@@ -85,7 +85,9 @@ namespace OHOS
         {DialState::SLEEP, false},\r
         {DialState::LOCK, false},\r
     }};\r
-    MainModel::MainModel() {}\r
+    MainModel::MainModel() {\r
+        power_display_gui_enable_aod(IsAodEnabled());\r
+    }\r
     MainModel::~MainModel() {}\r
     MainModel &MainModel::GetInstance()\r
     {\r
index 9225077..f172246 100644 (file)
@@ -261,6 +261,46 @@ void DialViewGroup::DoPause(void)
         video_->PausePlay();
     }
 }
+void DialViewGroup::StopDial()
+{
+    if(videoPlaying_ == false)
+        return;
+
+    SetLableAnimatorState(Animator::PAUSE);
+    SetImgAnimatorState(Animator::PAUSE);
+    if (kaleidoscope_ != nullptr) {
+        kaleidoscope_->StopRotateAnimator();
+        kaleidoscope_->ClearFocus();
+    }
+    if (video_ != nullptr) {
+        video_->PausePlay();
+    }
+
+    videoPlaying_ = false;
+}
+void DialViewGroup::StartDial()
+{
+    if(videoPlaying_ == true)
+        return;
+
+    SetLableAnimatorState(Animator::START);
+    if (isSeqImgLoaded_) {
+        SetImgAnimatorState(Animator::START);
+    }
+    if (video_ != nullptr) {
+        if (video_->IsPaused()) {
+            video_->ResumePlay();
+        } else if (!video_->IsPlayed()) {
+            video_->StartPlay();
+        }
+    }
+    if (kaleidoscope_ != nullptr) {
+        kaleidoscope_->RequestFocus();
+        kaleidoscope_->StartRotateAnimator();
+    }
+
+    videoPlaying_ = true;
+}
 
 void DialViewGroup::RecordSpecial(UIView *view)
 {
@@ -403,15 +443,15 @@ void DialViewGroup::AddView(DialDataType type, DialView* view, bool isPeriodic)
             Invalidate();
         }
         // ota进行视频暂停
-        if (uapi_dev_runtime_get_transmitting_status() == 1 || uapi_dev_runtime_get_restore_factory_status() == 1)
+        if (uapi_dev_runtime_get_transmitting_status()|| uapi_dev_runtime_get_restore_factory_status())
         {
             // 暂停视频
-            DoPause();
+            StopDial();
         }
         else
         {
             // 获取视频
-            DoStart();
+            StartDial();
         }
     }
 
index fe79bf6..784c4c4 100644 (file)
@@ -72,8 +72,10 @@ static void GuiEnterAod(bool entry)
     }
     if (NativeAbility::GetInstance().GetNativeAbilityState() == STATE_ACTIVE) {
         if (newState == DisplayState::AOD) {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "enter aod");
             NativeAbility::GetInstance().ChangeSlice(VIEW_AOD);
         } else {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "exit aod");
             NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN);
         }
     }
index 158370c..9b16a4d 100644 (file)
@@ -17,11 +17,13 @@ namespace OHOS
     {\r
         uint8_t dialFlag;          // 表盘标志 1:离线表盘 0:预制表盘\r
         uint8_t id;                // 表盘Id 仅预制表盘使用\r
+        uint32_t resId;    /* 仅离线表盘使用 */\r
         std::string dialFullName;  // 表盘路径 仅离线表盘使用\r
         std::string imageFullName; // 表盘缩约图 仅预制表盘使用\r
         std::string dialName;      // 表盘名\r
         std::string description;   // 表盘描述 仅离线表盘使用\r
         ImageInfo *preImageInfo;\r
+        uint8_t capability;\r
     } SetDialInfo;\r
 }\r
 #endif
\ No newline at end of file
index 043f27d..d7d55a7 100644 (file)
@@ -65,6 +65,7 @@ namespace OHOS
         void LoadAllDial(void);
         size_t GetDialCount(void);
         std::vector<SetDialInfo> &GetDialInfo(void);
+        std::vector<SetDialInfo>& GetAmbientDialInfo(void);
         void SaveDialSetting(uint8_t pageIndex);
         uint8_t GetPageIndex(void);
         void RegisterDial(uint16_t ID, const char *dialname);
@@ -102,7 +103,7 @@ namespace OHOS
         //判断是否可以继续下载表盘
         bool CheckDialDownload(uint16_t ID,uint32_t dial_size);
         void CheckDialSpace();
-
+        void ClearDialInfo(void);
     private:
         void LoadAllDialFromRam(void);
         void LoadAllDialFromFs(void);
@@ -112,9 +113,11 @@ namespace OHOS
         SetDialModel &operator=(const SetDialModel &);
         virtual ~SetDialModel();
         int32_t ParseDialHeader(int type, const std::string &dialFileName, SetDialInfo &dialInfo);
+
         std::vector<SetDialInfo> dialInfoList;
-        uint16_t currentDialID = 114; // 设置表盘默认值
+        std::vector<SetDialInfo> aodDialInfoList;
 
+        uint16_t currentDialID = 114; // 设置表盘默认值
         uint16_t download_DialID = 1028;
         uint32_t download_dialSize = 0;
         bool downloadstate = false;
index 17be629..b4a31e5 100644 (file)
@@ -14,6 +14,7 @@
 #include "securec.h"
 #include "set_dial/include/SetDialModelC.h"
 // #include "system/include/SystemLogModel.h"
+#include "graphic_service.h"
 #include "wearable_log.h"
 #include <algorithm>
 #include <array>
@@ -27,7 +28,6 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <unordered_set>
-#include "graphic_service.h"
 extern "C" {
 void check_dial_space() { OHOS::SetDialModel::GetInstance().CheckDialSpace(); }
 }
@@ -493,6 +493,7 @@ void SetDialModel::UpdateDialSetting(uint16_t ID) {
 void SetDialModel::LoadAllDial() {
   dialInfoList.clear();
   size_t dialSize = dialInfoList.size();
+  size_t aodSize = aodDialInfoList.size();
   // 加载默认表盘
   LoadAllDialFromDefult();
   // 加载自定义表盘
@@ -509,6 +510,10 @@ void SetDialModel::LoadAllDial() {
   char dialId[128];
   GetAllDialIDs(dialId, 128);
   PrintRegisteredDials(registeredDials);
+
+  std::sort(aodDialInfoList.begin() + aodSize,
+          aodDialInfoList.end(),
+          [](const SetDialInfo &f, const SetDialInfo &n) { return f.dialName < n.dialName; });
 }
 /*加载离线表盘*/
 void SetDialModel::LoadAllDialFromFs() {
@@ -523,7 +528,15 @@ void SetDialModel::LoadAllDialFromFs() {
       SetDialInfo dialInfo{0};
       int ret = ParseDialHeader(DOWNLOADDIAL, direntp->d_name, dialInfo);
       if (ret == 0) {
-        dialInfoList.push_back(dialInfo);
+        if (dialInfo.capability == DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY) {
+          dialInfoList.push_back(dialInfo);
+        } else if (dialInfo.capability ==
+                    DIAL_DISPLAY_CAPABILITY_AMBITIENT_ONLY) {
+          aodDialInfoList.push_back(dialInfo);
+        } else {
+          dialInfoList.push_back(dialInfo);
+          aodDialInfoList.push_back(dialInfo);
+        }
         downloadnum++;
       }
     }
@@ -571,7 +584,15 @@ void SetDialModel::LoadAllDialFromDefult(void) {
       if (ret == 0) {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Adding dial %s",
                       fullDialName.c_str());
-        dialInfoList.push_back(dialInfo);
+        if (dialInfo.capability == DIAL_DISPLAY_CAPABILITY_NORMAL_ONLY) {
+          dialInfoList.push_back(dialInfo);
+        } else if (dialInfo.capability ==
+                   DIAL_DISPLAY_CAPABILITY_AMBITIENT_ONLY) {
+          aodDialInfoList.push_back(dialInfo);
+        } else {
+          dialInfoList.push_back(dialInfo);
+          aodDialInfoList.push_back(dialInfo);
+        }
       } else {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
                       "ParseDialHeader is error for file %s",
@@ -630,10 +651,12 @@ int32_t SetDialModel::ParseDialHeader(int type, const std::string &dialFileName,
 
   dialInfo.dialFlag = 1;
   dialInfo.id = 0;
+  dialInfo.resId = preInfo.imgId;
   dialInfo.dialFullName = dialFullName;
   dialInfo.dialName = preInfo.dialName;
   dialInfo.description = preInfo.description;
   dialInfo.preImageInfo = info;
+  dialInfo.capability = preInfo.capability;
 
   fclose(fp);
   return 0;
@@ -684,6 +707,22 @@ size_t SetDialModel::GetDialCount(void) {
 std::vector<SetDialInfo> &SetDialModel::GetDialInfo(void) {
   return dialInfoList;
 }
+std::vector<SetDialInfo>& SetDialModel::GetAmbientDialInfo(void)
+{
+  return aodDialInfoList;
+}
+void SetDialModel::ClearDialInfo(void)
+{
+    for (auto iter : dialInfoList) {
+        if (iter.dialFlag) {
+            ImageCacheManager::GetInstance().UnloadOneInMultiRes(iter.resId, iter.dialFullName);
+        } else {
+            ImageCacheManager::GetInstance().UnloadSingleRes(iter.imageFullName);
+        }
+    }
+    dialInfoList.clear();
+    aodDialInfoList.clear();
+}
 
 uint8_t SetDialModel::GetPageIndex(void) {
   uint8_t index = 0;
@@ -752,7 +791,6 @@ void SetDialModel::LoadAllDialFromRam() {
     // 设置图像信息
     dialInfo.preImageInfo = imageInfo;
 
-    // 添加到表盘列表
     dialInfoList.push_back(dialInfo);
 
     // 注册到map
@@ -1013,145 +1051,123 @@ extern "C" {
 #endif /* __cplusplus */
 #endif /* __cplusplus */
 
-
-uint8_t get_dial_num_()
-{
-    return OHOS::SetDialModel::GetInstance().GetDialCount();
+uint8_t get_dial_num_() {
+  return OHOS::SetDialModel::GetInstance().GetDialCount();
 }
 
-bool check_dial_freespace_(uint16_t id,uint32_t dial_size) {
-  return OHOS::SetDialModel::GetInstance().CheckDialDownload(id,dial_size);
+bool check_dial_freespace_(uint16_t id, uint32_t dial_size) {
+  return OHOS::SetDialModel::GetInstance().CheckDialDownload(id, dial_size);
 }
 
-void ble_get_dial_path_(char * buf,uint16_t id)
-{
-    char *path= (char*)OHOS::SetDialModel::GetInstance().GetSaveDir(id,0).c_str();
-    memcpy(buf,path,strlen(path)+1);
-    return;
+void ble_get_dial_path_(char *buf, uint16_t id) {
+  char *path =
+      (char *)OHOS::SetDialModel::GetInstance().GetSaveDir(id, 0).c_str();
+  memcpy(buf, path, strlen(path) + 1);
+  return;
 }
 
-void ble_save_dial_custom_(msg_recv_custom_dial_info_t *data)
-{
-    OHOS:: DialLayout info;
-    info.dialId=data->dial_uid;
-    info.batteryDisplay=data->battery;
-    info.timeDisplay=data->time;
-    info.colorTypeSet=data->time_font;
-    OHOS::SetDialModel::GetInstance().saveDialConfig(info);
+void ble_save_dial_custom_(msg_recv_custom_dial_info_t *data) {
+  OHOS::DialLayout info;
+  info.dialId = data->dial_uid;
+  info.batteryDisplay = data->battery;
+  info.timeDisplay = data->time;
+  info.colorTypeSet = data->time_font;
+  OHOS::SetDialModel::GetInstance().saveDialConfig(info);
 }
 
-void ble_set_dial_by_id__(uint16_t id)
-{
-    // printf("ble_set_dial_by_id_ %d\n",id);
-    OHOS::SetDialModel::GetInstance().UpdateDialSetting(id);
-   
+void ble_set_dial_by_id__(uint16_t id) {
+  // printf("ble_set_dial_by_id_ %d\n",id);
+  OHOS::SetDialModel::GetInstance().UpdateDialSetting(id);
 }
-void ble_set_dial_by_id_(uint16_t id)
-{
-    // printf("ble_set_dial_by_id %d\n",id);
-    GraphicService::GetInstance()->PostGraphicEvent(
-                std::bind(ble_set_dial_by_id__ ,id));
+void ble_set_dial_by_id_(uint16_t id) {
+  // printf("ble_set_dial_by_id %d\n",id);
+  GraphicService::GetInstance()->PostGraphicEvent(
+      std::bind(ble_set_dial_by_id__, id));
 }
 
-void ble_get_custom_dial_(uint16_t id,char *buf)
-{
-    const char *name=OHOS::SetDialModel::GetInstance().GetCustomName(id).c_str();
-    memset_s(buf,32,0,32);
-    memcpy_s(buf,32,name,strlen(name));
+void ble_get_custom_dial_(uint16_t id, char *buf) {
+  const char *name =
+      OHOS::SetDialModel::GetInstance().GetCustomName(id).c_str();
+  memset_s(buf, 32, 0, 32);
+  memcpy_s(buf, 32, name, strlen(name));
 }
-uint16_t ble_get_dial_id_(void)
-{
-   uint16_t id= OHOS::SetDialModel::GetInstance().GetCurrentDialID();
-   return id;
+uint16_t ble_get_dial_id_(void) {
+  uint16_t id = OHOS::SetDialModel::GetInstance().GetCurrentDialID();
+  return id;
 }
 
-bool ble_is_dial_install_by_id_(uint16_t id)
-{
-   return OHOS::SetDialModel::GetInstance().IsDialInstalled(id);
+bool ble_is_dial_install_by_id_(uint16_t id) {
+  return OHOS::SetDialModel::GetInstance().IsDialInstalled(id);
 }
 
 ////////////////////////////////////////////////////////
 
-int ble_get_dial_num_(void)
-{
-   return OHOS::SetDialModel::GetInstance().GetDialCount();
+int ble_get_dial_num_(void) {
+  return OHOS::SetDialModel::GetInstance().GetDialCount();
 }
 
-void ble_delete_dial__(uint16_t id)
-{
-    OHOS::SetDialModel::GetInstance().UninstallDial(id);
+void ble_delete_dial__(uint16_t id) {
+  OHOS::SetDialModel::GetInstance().UninstallDial(id);
 }
 
-bool ble_delete_dial_(uint16_t id)
-{
+bool ble_delete_dial_(uint16_t id) {
 
-    if(id==OHOS::SetDialModel::GetInstance().GetCurrentDialID())
+  if (id == OHOS::SetDialModel::GetInstance().GetCurrentDialID())
     return false;
-    else
-    {
-        switch (id) {
-        case OHOS::DEFAULT_DIAL_ID:
-        case OHOS::MAX_DEFAULT_DIAL_ID:
-        case OHOS::DEFAULT_DIAL_ID_0:
-        case OHOS::DEFAULT_DIAL_ID_1:
-        case OHOS::DEFAULT_DIAL_ID_2:
-        case OHOS::DEFAULT_DIAL_ID_3:
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
-                        "UninstallDial: Default dial %d cannot be uninstalled", id);
-        return false;
-        }
-        GraphicService::GetInstance()->PostGraphicEvent(
-                std::bind(ble_delete_dial__,id));
-        return true;
+  else {
+    switch (id) {
+    case OHOS::DEFAULT_DIAL_ID:
+    case OHOS::MAX_DEFAULT_DIAL_ID:
+    case OHOS::DEFAULT_DIAL_ID_0:
+    case OHOS::DEFAULT_DIAL_ID_1:
+    case OHOS::DEFAULT_DIAL_ID_2:
+    case OHOS::DEFAULT_DIAL_ID_3:
+      WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+                    "UninstallDial: Default dial %d cannot be uninstalled", id);
+      return false;
     }
-    
+    GraphicService::GetInstance()->PostGraphicEvent(
+        std::bind(ble_delete_dial__, id));
+    return true;
+  }
 }
 
-int get_all_dial_id_( char * buf,uint16_t MAX_LEN)
-{
-    return OHOS::SetDialModel::GetInstance().GetAllDialIDs(buf,MAX_LEN);
+int get_all_dial_id_(char *buf, uint16_t MAX_LEN) {
+  return OHOS::SetDialModel::GetInstance().GetAllDialIDs(buf, MAX_LEN);
 }
 
-bool dial_file_save_(void )
-{
-    return OHOS::SetDialModel::GetInstance().saveDialfile();
+bool dial_file_save_(void) {
+  return OHOS::SetDialModel::GetInstance().saveDialfile();
 }
 
-void install_Register_dial__( char * name,uint16_t id)
-{
-    OHOS::SetDialModel::GetInstance().RegisterDial(id,name,0);
-
+void install_Register_dial__(char *name, uint16_t id) {
+  OHOS::SetDialModel::GetInstance().RegisterDial(id, name, 0);
 }
-void install_Register_dial_( char * name,uint16_t id)
-{
-    GraphicService::GetInstance()->PostGraphicEvent(
-                std::bind(install_Register_dial__,name ,id));
-    return ;
-
+void install_Register_dial_(char *name, uint16_t id) {
+  GraphicService::GetInstance()->PostGraphicEvent(
+      std::bind(install_Register_dial__, name, id));
+  return;
 }
 
 extern bleInstruct_t_ bleInstruct_t;
 
-void ble_dial_init(void)
-{
-  bleInstruct_t.get_dial_num_cb= get_dial_num_;
-  bleInstruct_t.check_dial_freespace= check_dial_freespace_;
-  bleInstruct_t.ble_get_dial_path= ble_get_dial_path_;
-  bleInstruct_t. ble_save_dial_custom=ble_save_dial_custom_;
-
-  bleInstruct_t. ble_set_dial_by_id=ble_set_dial_by_id_;
+void ble_dial_init(void) {
+  bleInstruct_t.get_dial_num_cb = get_dial_num_;
+  bleInstruct_t.check_dial_freespace = check_dial_freespace_;
+  bleInstruct_t.ble_get_dial_path = ble_get_dial_path_;
+  bleInstruct_t.ble_save_dial_custom = ble_save_dial_custom_;
 
+  bleInstruct_t.ble_set_dial_by_id = ble_set_dial_by_id_;
 
-  bleInstruct_t. ble_get_custom_dial= ble_get_custom_dial_;
-  bleInstruct_t. ble_get_dial_id = ble_get_dial_id_;
-  bleInstruct_t. ble_is_dial_install_by_id =ble_is_dial_install_by_id_;
+  bleInstruct_t.ble_get_custom_dial = ble_get_custom_dial_;
+  bleInstruct_t.ble_get_dial_id = ble_get_dial_id_;
+  bleInstruct_t.ble_is_dial_install_by_id = ble_is_dial_install_by_id_;
   ////////////////////////////////////////////////////////
-  bleInstruct_t. ble_get_dial_num=ble_get_dial_num_;
-  bleInstruct_t. ble_delete_dial=ble_delete_dial_;
-  bleInstruct_t. get_all_dial_id=get_all_dial_id_;
-  bleInstruct_t. dial_file_save=dial_file_save_;
-  bleInstruct_t.install_Register_dial= install_Register_dial_;
-
+  bleInstruct_t.ble_get_dial_num = ble_get_dial_num_;
+  bleInstruct_t.ble_delete_dial = ble_delete_dial_;
+  bleInstruct_t.get_all_dial_id = get_all_dial_id_;
+  bleInstruct_t.dial_file_save = dial_file_save_;
+  bleInstruct_t.install_Register_dial = install_Register_dial_;
 }
 
 #ifdef __cplusplus
@@ -1160,7 +1176,6 @@ void ble_dial_init(void)
 #endif /* __cplusplus */
 #endif /* __cplusplus */
 
-
 #endif
 
 } // namespace OHOS