天气协议优化 表盘相关协议对接 290/1 290/head 291/target/1
authorhcj <1224667075@qq.com>
Sat, 15 Jun 2024 03:36:34 +0000 (11:36 +0800)
committerhcj <1224667075@qq.com>
Sat, 15 Jun 2024 03:36:34 +0000 (11:36 +0800)
code/sdk/application/brandy/brandy_standard/input_app.h
code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialModel.cpp
code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherModel.h
code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherModel.cpp
code/sdk/application/wearable/nativeapp/nativeui/set_dial/src/SetDialModel.cpp
code/sdk/application/wearable/service/ble_service/blemoder/CMakeLists.txt
code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp
code/sdk/application/wearable/service/ble_service/blemoder/bletest.h
code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c
mkota.sh [changed mode: 0644->0755]

index 918ec12..8cf2557 100755 (executable)
@@ -39,7 +39,7 @@
 #define BUTTON_PRESS_TIME_9S 9000
 #define BUTTON_INVALID_PRESS_TIME (BUTTON_PRESS_TIME_9S + BUTTON_APP_TIMER_INTERVAL)
 #define APP_BOARD_MSG_COUNT       16
-#define APP_BOARD_TASK_SIZE       0x800
+#define APP_BOARD_TASK_SIZE       0x900
 #define APP_BOARD_TASK_PRIO       5
 #define BUTTON_TASK_SIZE          0x800
 #define BUTTON_TASK_PRIO          3
index 9f28c15..2e0bd59 100644 (file)
@@ -35,11 +35,14 @@ namespace OHOS
         {DEFAULT_DIAL_ID_1, "KUMI"},
         {DEFAULT_DIAL_ID_2, "classic"},     // 经典表盘
         {101, "motiondial"},                // 运动表盘
-        {102, "kaleidoscope"},              // 万花筒表盘
+        {102, "kaleidoscope"},              // 万花筒表盘102
         {MAX_DEFAULT_DIAL_ID, "jellyfish"}, // 水母表盘
     };
 
-    SetDialModel::SetDialModel() {}
+    SetDialModel::SetDialModel() 
+    {
+        LoadAllDial();
+    }
 
     SetDialModel::~SetDialModel() {}
 
@@ -86,23 +89,26 @@ namespace OHOS
     int SetDialModel::GetAllDialIDs(char *allidStr)
     {
         std::string allIDs;
+        int length = 0;
         for (const auto &entry : registeredDials)
         {
-            // 格式化表盘ID为两个字节长度的字符串,不足两位则在前面补0
-            std::stringstream ss;
-            ss << std::setw(2) << std::setfill('0') << entry.first;
-            allIDs += ss.str();
+            memcpy_s(allidStr+length,512,&entry.first,2);
+            length+=2;
+            // // 格式化表盘ID为两个字节长度的字符串,不足两位则在前面补0
+            // std::stringstream ss;
+            // ss << std::setw(2) << std::setfill('0') << entry.first;
+            // allIDs += ss.str();
         }
 
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "allidStr is %s", allIDs.c_str());
 
-        // 将字符串拷贝到allidStr中
-        int length = allIDs.size();
-        if (length > 0)
-        {
-            strcpy(allidStr, allIDs.c_str());
-            allidStr[length] = '\0'; // 添加字符串结尾的空字符
-        }
+        // // 将字符串拷贝到allidStr中
+        // int length = allIDs.size();
+        // if (length > 0)
+        // {
+        //     strcpy(allidStr, allIDs.c_str());
+        //     allidStr[length] = '\0'; // 添加字符串结尾的空字符
+        // }
 
         return length;
     }
@@ -326,6 +332,7 @@ namespace OHOS
     /*获取表盘的总数*/
     size_t SetDialModel::GetDialCount(void)
     {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " %d ", dialInfoList.size());
         return dialInfoList.size();
     }
 
index c9f5a2d..e2f5c0f 100644 (file)
@@ -56,7 +56,7 @@ namespace OHOS
 
         void UI_set_weather_address_data(int lat, char *atm, char *city, char *subLocality, int lon);
 
-        void UI_set_weather_seven_day_data(struct ONE_DAY_DATA *t);
+        void UI_set_weather_seven_day_data(struct ONE_DAY_DATA t,int count);
 #if __cplusplus
     }
 #endif /* __cplusplus */
index 39cfd0b..72848d6 100644 (file)
@@ -17,6 +17,7 @@ namespace OHOS
         static Weather_data Weather_data_t_now;
         static Weather_data_address Weather_data_t_address;
         static ONE_DAY_DATA Weather_data_seven_data[7];
+        uint8_t  Weather_data_seven_count=0;
 
         /*
          * @brief 设置当前天气数据
@@ -64,18 +65,26 @@ namespace OHOS
         /*
          * @brief 设置七天天气数据
          */
-        void UI_set_weather_seven_day_data(struct ONE_DAY_DATA *t)
+        void UI_set_weather_seven_day_data(struct ONE_DAY_DATA t,int count)
         {
-            for (int i = 0; i < 7; i++)
+            if(count=0)
             {
-                Weather_data_seven_data[i].fxDate = t[i].fxDate;
-                Weather_data_seven_data[i].iconDay = t[i].iconDay;
-                Weather_data_seven_data[i].tempMax = t[i].tempMax;
-                Weather_data_seven_data[i].tempMin = t[i].tempMin;
-                Weather_data_seven_data[i].fxDate = t[i].fxDate;
-                memset((void *)Weather_data_seven_data[i].textDay, 0, 16);
-                strcpy(Weather_data_seven_data[i].textDay, t[i].textDay);
+                Weather_data_seven_count=0;
             }
+            if(count>=7)
+            {
+                return;
+            }
+            Weather_data_seven_data[count].fxDate = t.fxDate;
+            Weather_data_seven_data[count].iconDay = t.iconDay;
+            Weather_data_seven_data[count].tempMax = t.tempMax;
+            Weather_data_seven_data[count].tempMin = t.tempMin;
+            Weather_data_seven_data[count].fxDate = t.fxDate;
+            memset((void *)Weather_data_seven_data[count].textDay, 0, 16);
+            strcpy(Weather_data_seven_data[count].textDay, t.textDay);
+            
+            Weather_data_seven_count++;
+           
         }
 
 #if __cplusplus
index 93f3e83..ec2691d 100644 (file)
 #include "DialBinParser.h"
 #include "wearable_log.h"
 
-namespace OHOS {
-    SetDialModel::SetDialModel() {}
+namespace OHOS
+{
+    SetDialModel::SetDialModel()
+    {
+        LoadAllDial();
+    }
 
     SetDialModel::~SetDialModel() {}
 
@@ -30,23 +34,25 @@ namespace OHOS {
         size_t dialSize = dialInfoList.size();
         LoadAllDialFromFs();
         /* 只排序离线表盘 */
-        std::sort(dialInfoList.begin() + dialSize, dialInfoList.end(), [](const SetDialInfo& f, const SetDialInfo& n) {
-                    return f.dialName < n.dialName;
-                });
+        std::sort(dialInfoList.begin() + dialSize, dialInfoList.end(), [](const SetDialInfo &f, const SetDialInfo &n)
+                  { return f.dialName < n.dialName; });
     }
 
     void SetDialModel::LoadAllDialFromRam()
     {
-        for (uint8_t i = DIAL_CLOCK; i < DIAL_MAX; i++) {
+        for (uint8_t i = DIAL_CLOCK; i < DIAL_MAX; i++)
+        {
             const DialInfo *info = MainModel::GetInstance().GetDialInfo((DialId)i);
-            if (info != nullptr) {
+            if (info != nullptr)
+            {
                 SetDialInfo dialInfo{0};
                 dialInfo.dialFlag = 0;
                 dialInfo.id = i;
                 dialInfo.dialName = info->dialName;
                 dialInfo.imageFullName = info->dialImg;
-                ImageInfo* imageInfo = ImageCacheManager::GetInstance().LoadSingleRes(info->dialImg, false);
-                if (info == nullptr) {
+                ImageInfo *imageInfo = ImageCacheManager::GetInstance().LoadSingleRes(info->dialImg, false);
+                if (info == nullptr)
+                {
                     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "LoadAllDialFromRam loadimage %s fail",
                                   info->dialImg);
                     continue;
@@ -65,11 +71,14 @@ namespace OHOS {
         // 打开目录
         DIR *dirp = opendir(APP_DIAL_PATH);
         // 遍历文件
-        if (dirp != nullptr) {
-            while ((direntp = readdir(dirp)) != nullptr) {
+        if (dirp != nullptr)
+        {
+            while ((direntp = readdir(dirp)) != nullptr)
+            {
                 SetDialInfo dialInfo{0};
                 int ret = ParseDialHeader(direntp->d_name, dialInfo);
-                if (ret == 0) {
+                if (ret == 0)
+                {
                     dialInfoList.push_back(dialInfo);
                 }
             }
@@ -85,14 +94,16 @@ namespace OHOS {
         dialFullName += "/";
         dialFullName += dialFileName;
         FILE *fp = fopen(dialFullName.c_str(), "rb");
-        if (fp == nullptr) {
+        if (fp == nullptr)
+        {
             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ParseDialHeader cannot open file: %s",
                           dialFullName.c_str());
             return -1;
         }
         DialPreviewInfo preInfo{0};
         bool ret = DialBinParser::GetInstance()->GetDialPreviewInfo(fp, &preInfo);
-        if (!ret) {
+        if (!ret)
+        {
             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GetDialPreviewInfo %s fail",
                           dialFullName.c_str());
             return -1;
@@ -109,7 +120,8 @@ namespace OHOS {
                       preInfo.offset);
         ImageInfo *info = ImageCacheManager::GetInstance().LoadOneInMultiRes(
             preInfo.imgId, dialFullName, fp, false, preInfo.offset);
-        if (info == nullptr) {
+        if (info == nullptr)
+        {
             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ParseDialHeader loadimage fail");
             return -1;
         }
@@ -127,7 +139,8 @@ namespace OHOS {
 
     void SetDialModel::SaveDialSetting(uint8_t pageIndex)
     {
-        if (pageIndex >= dialInfoList.size()) {
+        if (pageIndex >= dialInfoList.size())
+        {
             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialModel SaveDialSetting [%u %u]",
                           pageIndex, dialInfoList.size());
             return;
@@ -145,7 +158,7 @@ namespace OHOS {
         return dialInfoList.size();
     }
 
-    std::vector<SetDialInfo>& SetDialModel::GetDialInfo(void)
+    std::vector<SetDialInfo> &SetDialModel::GetDialInfo(void)
     {
         return dialInfoList;
     }
@@ -154,13 +167,19 @@ namespace OHOS {
     {
         uint8_t index = 0;
         DialSetting dialSetting = MainModel::GetInstance().GetDialSetting();
-        for (auto iter : dialInfoList) {
-            if (dialSetting.dialFlag) {
-                if (strcmp(iter.dialFullName.c_str(), dialSetting.dialFullName.c_str()) == 0) {
+        for (auto iter : dialInfoList)
+        {
+            if (dialSetting.dialFlag)
+            {
+                if (strcmp(iter.dialFullName.c_str(), dialSetting.dialFullName.c_str()) == 0)
+                {
                     return index;
                 }
-            } else {
-                if ((!iter.dialFlag) && (iter.id == dialSetting.dialId)) {
+            }
+            else
+            {
+                if ((!iter.dialFlag) && (iter.id == dialSetting.dialId))
+                {
                     return index;
                 }
             }
index 93db442..b4c8693 100644 (file)
@@ -23,6 +23,15 @@ ${ROOT_DIR}/application/wearable/fd230app/nativeui/traing/include
 #${ROOT_DIR}/application/wearable/fd230app/nativeui/alarm/include 
 ${ROOT_DIR}/application/wearable/fd230app/nativeui/alarmclockmanage/include 
 ${ROOT_DIR}/application/wearable/fd230app/nativeui/alarmclocktimerconfig/include 
+#code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/gralloc_engines.h
+#/home/hcj/FD230/code/sdk/open_source/openharmony/drivers/peripheral/display/interfaces/include/display_gralloc.h
+${ROOT_DIR}/open_source/openharmony/drivers/peripheral/display/interfaces/include
+${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src
+${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/utils/innerkits
+${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include
+${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include/common
+${ROOT_DIR}/application/wearable/fd230app/nativeui/set_dial/include 
+#/home/hcj/FD230/code/sdk/middleware/services/gui/uikit/proprietary/include/common/image_cache_manager.h
 
 )
 
index 5858b7e..a4be6ce 100644 (file)
@@ -28,6 +28,7 @@
 #include "AlmmgrAlarmClockManage.h"
 #include "AlarmClockManage.h"
 
+#include "SetDialModel.h"
 
 //#include "AlarmClockModel.h"
 #ifdef __cplusplus
@@ -61,6 +62,46 @@ extern "C" {
 #include "bletest.h"
 #include <cywee_hal.h>
 
+void ble_set_dial_by_id(uint16_t id)
+{
+   return OHOS::SetDialModel::GetInstance().UpdateDialSetting(id);
+}
+
+uint8_t ble_get_dial_id(void)
+{
+   return OHOS::SetDialModel::GetInstance().GetCurrentDialID();
+}
+
+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();
+}
+
+bool ble_delete_dial(uint16_t id)
+{
+    if(id==OHOS::SetDialModel::GetInstance().GetCurrentDialID())
+    return false;
+    else
+    return OHOS::SetDialModel::GetInstance().UninstallDial(id);
+}
+
+int get_all_dial_id( char * buf)
+{
+    return OHOS::SetDialModel::GetInstance().GetAllDialIDs(buf);
+}
+
+void install_Register_dial( char * name,uint16_t id)
+{
+    return OHOS::SetDialModel::GetInstance().RegisterDial(id,name);
+}
+
+
+
 
 #define CWM_HISTORY_DATA_PATH "/user/userdata/step_"
 
@@ -99,7 +140,7 @@ char * ble_sywee_history(uint8_t day,uint16_t *len ,uint8_t type)
     FILE * fp = fopen(path_,"rb+");
     if(fp==NULL)
     {
-         printf("fopen fail\r\n");
+         printf(" fopen type  %d %s fail\r\n",type,path_);
         return NULL;
     }
     uint32_t size;
@@ -448,7 +489,7 @@ void set_languaage(uint32_t id)
 #ifdef FD230
     OHOS::language::GetInstance()->ChangeLanguage(id);
 #endif
-    
+
 }
 
 char *addressbook(void)//获取通讯录保存文件地址路径
@@ -814,18 +855,19 @@ void set_weather_address_data(int lat, char* atm, char* city,char* subLocality,i
 //     int tempMax;
 // };
 #ifdef FD230
-static OHOS::ONE_DAY_DATA data_t[7];
+
 void set_weather_one_data(int tempMin, int iconDay,int fxDate, int tempMax, char *textDay,int x) 
 {
-    data_t[x].tempMin=tempMin;
-    data_t[x].iconDay=iconDay;
-    data_t[x].fxDate=fxDate;
-    data_t[x].tempMax=tempMax;
-    memset((void*)data_t[x].textDay,0,16);
-    strcpy(data_t[x].textDay,textDay);
+    OHOS::ONE_DAY_DATA data_t;
 
-    if(x==6)
-    return UI_set_weather_seven_day_data(data_t);
+    data_t.tempMin=tempMin;
+    data_t.iconDay=iconDay;
+    data_t.fxDate=fxDate;
+    data_t.tempMax=tempMax;
+    memset((void*)data_t.textDay,0,16);
+    strcpy(data_t.textDay,textDay);
+    
+    return UI_set_weather_seven_day_data(data_t ,x);
 }
 #else
 void set_weather_one_data(int tempMin, int iconDay,int fxDate, int tempMax, char *textDay,int x) 
index 947ee0c..4d71ad9 100644 (file)
@@ -204,6 +204,23 @@ char * ble_sywee_history(uint8_t day,uint16_t *len,uint8_t type);
 void Set_DmpChangeMode(int state);
 int Get_DmpChangeMode(void);
 
+
+//////////////////////表盘相关////////////////////////////
+void ble_set_dial_by_id(uint16_t id);
+
+uint8_t ble_get_dial_id(void);
+
+bool ble_is_dial_install_by_id(uint16_t id);
+
+int ble_get_dial_num( void);
+
+bool ble_delete_dial(uint16_t id);
+
+int get_all_dial_id( char * buf);
+
+void install_Register_dial( char * name,uint16_t id);
+
+
 #ifdef __cplusplus
 #if __cplusplus
 }
index c12a974..5f43e35 100644 (file)
@@ -279,7 +279,7 @@ static uint8_t get_crc_from_lrc(uint8_t lrcValue)
     return crcbuf;\r
 }\r
 \r
-//#define USE_DEMO\r
+#define USE_DEMO\r
 static bool Check_CRC(uint8_t *data,uint16_t len,uint8_t crcvalue)//计算20byte的的校验位\r
 {\r
        uint8_t crcbuf  = 0;\r
@@ -1790,7 +1790,7 @@ void SetsleepSetParamCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalD
     }\r
 }\r
 \r
-void SetDrinkSetParamCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData,uint8_t crcvalue)//è\8e·å\8f\96喝水提醒s设置\r
+void SetDrinkSetParamCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData,uint8_t crcvalue)//设置喝水提醒s设置\r
 {\r
     uint32_t tmp = 1;\r
     uint16_t tmp_data = 1;\r
@@ -1890,7 +1890,6 @@ uint8_t jsonCheck_weather(uint8_t *buf,uint8_t *check)//json 格式解析 天气
     json = buf;\r
     // printf("jsonCheck_weather:len: json:%f jsonlen:%d\r\n",0.011,strlen((char *)json));\r
     #if 0\r
-\r
         FILE *fp=fopen("user/weather.json","wb+");\r
         printf("jsonCheck_weather len %d",strlen((char *)buf)+1);\r
         //fwrite((void*)buf,1,strlen((char *)buf)+1,fp);\r
@@ -1932,7 +1931,8 @@ uint8_t jsonCheck_weather(uint8_t *buf,uint8_t *check)//json 格式解析 天气
     set_weather_address_data(lat,atm,city,subLocality,lon);\r
 \r
     cJSON *daily = cJSON_GetObjectItem(root, "daily");\r
-    for(int i=0;i<7;i++)\r
+    int count= cJSON_GetArraySize(daily);\r
+    for(int i=0;i<count;i++)\r
     {   \r
         //{"tempMin":22,"iconDay":6,"fxDate":1712505600,"textDay":"阵雨","tempMax":29},\r
         cJSON *data=cJSON_GetArrayItem(daily,i);\r
@@ -1941,8 +1941,11 @@ uint8_t jsonCheck_weather(uint8_t *buf,uint8_t *check)//json 格式解析 天气
         int  fxDate=cJSON_GetObjectItem(data,"fxDate")->valueint;\r
         char *  textDay=cJSON_GetObjectItem(data,"textDay")->valuestring;\r
         int  tempMax=cJSON_GetObjectItem(data,"tempMax")->valueint;\r
+\r
         set_weather_one_data(tempMin,iconDay,fxDate,tempMax,textDay,i);\r
+\r
     }\r
+    \r
     cJSON_Delete(root);\r
     *check = 1;\r
     return 1;\r
@@ -1993,7 +1996,13 @@ void query_dial_installed(ble_read_data *buffer_handle,uint16_t cmd,uint8_t *dat
     {\r
         uint16_t dial_uid  = *(uint16_t*)data;\r
         printf("query dial 0x%04X installed !!!!!!!!\r\n",dial_uid);\r
+\r
+        if(!ble_is_dial_install_by_id(dial_uid))\r
         reply[0]=2; //该表盘是否已安装 0:指令校验失败 1:已安装 2:未安装\r
+        else\r
+        reply[0]=1; //该表盘是否已安装 0:指令校验失败 1:已安装 2:未安装\r
+        \r
+\r
         reply[1]=0; //表盘列表是否已满 0:未满 1:已满\r
         ble_reply_cmdarr(cmd,reply,2);\r
         \r
@@ -2219,7 +2228,7 @@ void type2AE4Data(ble_read_data *buffer_handle,uint8_t *buf_cmd,uint8_t *data,ui
             break;\r
         case SET_ALARM_DATA_CMD:\r
             SetAlarmDataCmd(typeID,data,datalen,totalData,crcvalue);\r
-            printf("alarm infor !!!!!!!!!!\r\n");\r
+          \r
             break;\r
         case SET_OTHER_TARGET_CMD:\r
             GetOtherTarget(typeID,data,datalen,totalData,crcvalue);\r
@@ -2282,6 +2291,9 @@ static void switchDialCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *total
     {\r
         uint16_t daila_type = 0;\r
         memcpy(&daila_type,&data[17],2);\r
+        printf("switchDialCmd %d !!!!!!!!!!\r\n",daila_type);\r
+\r
+        ble_set_dial_by_id(daila_type);\r
         value[17] = 1;//校验成功\r
         value[18] = Calculate_CRC(value,18);\r
         sendBleData(value,19);\r
@@ -2985,7 +2997,7 @@ static void SendDialToAppCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *to
     memcpy(value+15,&tmp_data,2);\r
     if(Check_CRC(data,len,crcvalue))//\r
     {\r
-        uint16_t dialNum = 450;//0 暂停 1恢复\r
+        uint16_t dialNum =ble_get_dial_id();\r
         memcpy(&value[17],&dialNum,2);\r
         value[19] = Calculate_CRC(value,19);\r
         sendBleData(value,20);\r
@@ -3086,7 +3098,12 @@ static void DeleteDialUidCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *to
     {\r
         uint16_t deleteDial = 0;//删除的表盘UID \r
         deleteDial=data[0]+data[1]*256;\r
+        \r
+        if(ble_delete_dial(deleteDial))\r
         value[17] = 1;// 1删除成功 2 没有改资源 0指令校验失败\r
+        else\r
+        value[17] = 2;// 1删除成功 2 没有改资源 0指令校验失败\r
+\r
         value[18] = Calculate_CRC(value,18);\r
         sendBleData(value,19);\r
     }else\r
@@ -3496,28 +3513,30 @@ static void GetSleepParamCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *to
 //app获取所有表盘UID\r
 static void GetAllDialUidCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totaldata,uint8_t crcvalue)\r
 {\r
-    uint8_t value[24];\r
-    memset(value,0,24);\r
-    uint32_t tmp = 1;\r
-    uint16_t tmp_data = 1;\r
-    value[0] = 0x72;\r
-    value[1] = 0x01;\r
-    value[2] = 0x2a;\r
-    memcpy(value+3,&tmp,4);\r
-    memcpy(value+7,&tmp,4);\r
-    memcpy(value+11,&tmp,4);\r
-    memcpy(value+15,&tmp_data,2);\r
-    if(1)\r
+   \r
+\r
+    if(Check_CRC(data,len,crcvalue))\r
     {\r
+        int dial_num=ble_get_dial_num();\r
+\r
+        uint8_t data_size=1+dial_num*2;\r
+        char *dail_uid_buf=(char *)ym_malloc(data_size);\r
+        dail_uid_buf[0]=(uint8_t)dial_num;\r
+        if(dial_num *2 !=get_all_dial_id(dail_uid_buf+1))\r
+        {\r
+            printf( "GetAllDialUidCmd  dial_num % err\r\n",dial_num);\r
+        }\r
+        else\r
+        {\r
+            printf( "GetAllDialUidCmd yes\r\n");\r
+        }\r
+\r
+        send_big_data(0,dail_uid_buf,data_size,data_size,1,1,0x2a,1);\r
+        free(dail_uid_buf);\r
         \r
-        value[17] = 0;\r
-        value[18] = Calculate_CRC(value,18);\r
-        sendBleData(value,19);\r
     }else\r
     {\r
-        value[17] = 0;\r
-        value[18] = Calculate_CRC(value,18);\r
-        sendBleData(value,19);\r
+        ble_reply_cmd(cmd,0);\r
     }\r
 }\r
 //app获取目标步数设置\r
@@ -4225,7 +4244,6 @@ void type2AE3Data(ble_read_data *buffer_handle,uint8_t *cmd_buf ,uint8_t *data,u
         case ALARM_CMD://获取手表闹钟//同步闹钟\r
             readDevDataBle(cmd,data,datalen,totaldata,crcvalue);\r
             break;\r
-\r
         case SET_DMP_MODE_CMD://0X0131\r
             SetDMPModeCmd(cmd,data,datalen,totaldata,crcvalue);\r
             break;\r
@@ -5237,7 +5255,7 @@ errcode_t decode_dial_info(ble_read_data *buffer_handle)
     return ERRCODE_SUCC;\r
 \r
 }\r
-\r
+static uint16_t  ble_dial_uid=0;\r
 errcode_t decode_single_dial_info(ble_read_data *buffer_handle)\r
 {\r
 \r
@@ -5285,6 +5303,10 @@ errcode_t decode_single_dial_info(ble_read_data *buffer_handle)
     filename[dialinfo.file_name_len] ='\0';\r
     //在runtime中备份一个安装文件名。\r
     uapi_dev_runtime_set_dialname(filename);\r
+    //存表盘id\r
+    ble_dial_uid = dialinfo.dial_uid;\r
+\r
+\r
     buffer_handle->file_recv_stat.file_name = filename;\r
     buffer_handle->file_recv_stat.file_size = file_size;\r
     buffer_handle->file_recv_stat.file_type = 3;//表盘\r
@@ -5334,8 +5356,13 @@ static errcode_t install_dial(void)
             return ERRCODE_FAIL;\r
         }\r
         printf("lzma_filepath %s\n",lzma_filepath);\r
+\r
         errcode_t ret = uapi_dial_pkg_decompress(lzma_filepath,dialbin_filepath);\r
+\r
         printf("decode %s to %s , ret %X \n",lzma_filepath,dialbin_filepath, ret);\r
+\r
+        install_Register_dial(lzmapkgname,ble_dial_uid);\r
+\r
         if ( ret == ERRCODE_SUCC)\r
             return ERRCODE_SUCC;\r
         else\r
@@ -5380,10 +5407,12 @@ void decode_file_checksum(ble_read_data *buffer_handle)
                     //TODO: 设置成当前下载的表盘\r
                     if (install_dial() == ERRCODE_SUCC)\r
                     {\r
-                        \r
+                        ble_set_dial_by_id(ble_dial_uid);\r
+\r
                         TRANSMIT_DATA= TRANS_DIAL_SUCC;\r
                         CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1);\r
 \r
+\r
                         ble_reply_cmd(DIAL_INSTALL_REPY_CMD,1);\r
                     }\r
                     else\r
@@ -5490,8 +5519,10 @@ void type2AE0Data(ble_read_data *buffer_handle)
                 if (decode_single_dial_info( buffer_handle) == ERRCODE_SUCC)\r
                 {\r
                     ble_reply_cmd(SINGLE_DIAL_FILE_RECV_CMD,1);\r
+\r
                 }else{\r
                     ble_reply_cmd(SINGLE_DIAL_FILE_RECV_CMD,2);\r
+\r
                 }         \r
                 break;\r
             case EPO_DATA_RECV_CMD:\r
old mode 100644 (file)
new mode 100755 (executable)