void UpdateDialSetting(uint16_t ID);
uint16_t GetDialIdFromName(const std::string &dialName);
void PrintRegisteredDials(const std::unordered_map<uint16_t, std::string> &dials);
- int GetAllDialIDs(char *allidStr);
+ int GetAllDialIDs(char *allidStr,uint16_t MAX_LEN);
/*表盘map文件*/
return id;
}
/* 获取所有表盘Id 每个表盘Id 2个字节 拼接为字符串 */
-int SetDialModel::GetAllDialIDs(char *allidStr) {
+int SetDialModel::GetAllDialIDs(char *allidStr,uint16_t MAX_LEN) {
std::string allIDs;
int length = 0;
for (const auto &entry : registeredDials) {
if (id <= 5) {
id--;
}
+ if(length<MAX_LEN)
memcpy_s(allidStr + length, 512, &id, 2);
length += 2;
}
// 表盘Id以及表盘map打印
char dialId[128];
- GetAllDialIDs(dialId);
+ GetAllDialIDs(dialId,128);
PrintRegisteredDials(registeredDials);
}
/*加载离线表盘*/
#endif
}
-int get_all_dial_id( char * buf)
+int get_all_dial_id( char * buf,uint16_t MAX_LEN)
{
#ifdef FD230
- return OHOS::SetDialModel::GetInstance().GetAllDialIDs(buf);
+ return OHOS::SetDialModel::GetInstance().GetAllDialIDs(buf,MAX_LEN);
#else
return 0;
#endif
bool ble_delete_dial(uint16_t id);
-int get_all_dial_id( char * buf);
+int get_all_dial_id( char * buf,uint16_t MAX_LEN);
void install_Register_dial( char * name,uint16_t id);
char *dail_uid_buf=(char *)ym_malloc(data_size);\r
dail_uid_buf[0]=(uint8_t)dial_num;\r
\r
- if(dial_num *2 !=get_all_dial_id(dail_uid_buf+1))\r
+ if(dial_num *2 !=get_all_dial_id(dail_uid_buf+1,dial_num*2))\r
{\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GetAllDialUidCmd dial_num %d err\r\n",dial_num);\r
}\r