增加绑定信息的kv存储
authorCaisking <Casiking@zhihuishixun.com>
Sat, 20 Sep 2025 12:59:46 +0000 (20:59 +0800)
committerCaisking <Casiking@zhihuishixun.com>
Sat, 20 Sep 2025 12:59:46 +0000 (20:59 +0800)
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp

index 45b0375..ca5d761 100644 (file)
@@ -29,6 +29,7 @@
  #include <ctime>
  #include "custom_runtime.h"
  #include "ln_api.h"
+ #include "kv_store.h"
  namespace OHOS
  {
      enum OTA_STATUS
      {
          // 初始化时加载提醒数据
          // LoadRemindersFromFile();
+         // 读取绑定状态
+         char temp[10] = { 0 };
+         (void)UtilsGetValue("bind_status", temp, 10);
+         if(strcmp(temp, "1") == 0)
+         {
+             m_imeiValid = true;
+             m_imeiChecked = true;
+         }
+         else
+         {
+             m_imeiValid = false;
+             m_imeiChecked = true;
+         }
+         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "目前绑定状态 %s", temp);
      }
      
      ThunderBirdModel::~ThunderBirdModel() 
         
         // 检查IMEI有效性
         m_imeiValid = IsDeviceIdValid();
-        m_imeiChecked = true;
+
+        if(m_imeiValid){
+            //有效 设置标志位为true
+            m_imeiChecked = true;
+            //存储kv
+            (void)UtilsSetValue("bind_status", "1");
+            return;
+        }
         
         WEARABLE_LOGD("IMEI status checked: valid=%d", m_imeiValid);
     }