1 1 jaar geleden
bovenliggende
commit
a6e269328a
62 gewijzigde bestanden met toevoegingen van 1040 en 3111 verwijderingen
  1. 0 7
      vendor/bossay/CH2O_Monitoring/config.json
  2. 5 3
      vendor/bossay/CH2O_Monitoring/demo_CH2O_Monitoring/cloud_connect/inc/cloud_communicate.h
  3. 3 1
      vendor/bossay/CH2O_Monitoring/demo_CH2O_Monitoring/cloud_connect/src/cloud_communicate.c
  4. 107 13
      vendor/bossay/CH2O_Monitoring/demo_CH2O_Monitoring/main_entry.c
  5. 0 7
      vendor/bossay/PM2_5_Monitoring/config.json
  6. 5 3
      vendor/bossay/PM2_5_Monitoring/demo_PM2_5_Monitoring/cloud_connect/inc/cloud_communicate.h
  7. 3 1
      vendor/bossay/PM2_5_Monitoring/demo_PM2_5_Monitoring/cloud_connect/src/cloud_communicate.c
  8. 62 8
      vendor/bossay/PM2_5_Monitoring/demo_PM2_5_Monitoring/main_entry.c
  9. 8 0
      vendor/bossay/common/iot_cloud/iot_cloud.c
  10. BIN
      vendor/bossay/common/iot_wifi/libs/libHwKeystoreSDK.a
  11. 3 2
      vendor/bossay/hi3861_l0/config.json
  12. 0 7
      vendor/bossay/human_detect/config.json
  13. 5 3
      vendor/bossay/human_detect/demo_human_detect/cloud_connect/inc/cloud_communicate.h
  14. 3 1
      vendor/bossay/human_detect/demo_human_detect/cloud_connect/src/cloud_communicate.c
  15. 104 15
      vendor/bossay/human_detect/demo_human_detect/main_entry.c
  16. 21 24
      vendor/bossay/human_detect/demo_human_detect/sensor/BUILD.gn
  17. 0 32
      vendor/bossay/human_detect/demo_human_detect/sensor/inc/mlx90614.h
  18. 0 26
      vendor/bossay/human_detect/demo_human_detect/sensor/inc/smbus.h
  19. 0 246
      vendor/bossay/human_detect/demo_human_detect/sensor/src/mlx90614.c
  20. 0 158
      vendor/bossay/human_detect/demo_human_detect/sensor/src/smbus.c
  21. 0 7
      vendor/bossay/smart_agriculture/config.json
  22. 5 3
      vendor/bossay/smart_agriculture/demo_smart_agriculture/cloud_connect/inc/cloud_communicate.h
  23. 3 1
      vendor/bossay/smart_agriculture/demo_smart_agriculture/cloud_connect/src/cloud_communicate.c
  24. 171 37
      vendor/bossay/smart_agriculture/demo_smart_agriculture/main_entry.c
  25. 4 4
      vendor/bossay/smart_agriculture/demo_smart_agriculture/sensor/inc/BH1750.h
  26. 2 6
      vendor/bossay/smart_agriculture/demo_smart_agriculture/sensor/inc/DHT11.h
  27. 2 2
      vendor/bossay/smart_door/BUILD.gn
  28. 1 8
      vendor/bossay/smart_door/config.json
  29. 0 32
      vendor/bossay/smart_door/demo_smartdoor/BUILD.gn
  30. 0 20
      vendor/bossay/smart_door/demo_smartdoor/OLED/BUILD.gn
  31. 0 14
      vendor/bossay/smart_door/demo_smartdoor/OLED/OLED_DisplayTask.c
  32. 0 44
      vendor/bossay/smart_door/demo_smartdoor/OLED/include/OLED_I2C.h
  33. 0 281
      vendor/bossay/smart_door/demo_smartdoor/OLED/include/codetab.h
  34. 0 228
      vendor/bossay/smart_door/demo_smartdoor/OLED/include/iot_gpio.h
  35. 0 311
      vendor/bossay/smart_door/demo_smartdoor/OLED/src/OLED_I2C.c
  36. 0 25
      vendor/bossay/smart_door/demo_smartdoor/cloud_connect/BUILD.gn
  37. 0 170
      vendor/bossay/smart_door/demo_smartdoor/cloud_connect/inc/cloud_communicate.h
  38. 0 78
      vendor/bossay/smart_door/demo_smartdoor/cloud_connect/inc/cloud_schedule.h
  39. 0 525
      vendor/bossay/smart_door/demo_smartdoor/cloud_connect/src/cloud_communicate.c
  40. 0 300
      vendor/bossay/smart_door/demo_smartdoor/cloud_connect/src/cloud_schedule.c
  41. 0 166
      vendor/bossay/smart_door/demo_smartdoor/main_entry.c
  42. 0 23
      vendor/bossay/smart_door/demo_smartdoor/sensor/BUILD.gn
  43. 0 37
      vendor/bossay/smart_door/demo_smartdoor/sensor/inc/DOOR.h
  44. 0 113
      vendor/bossay/smart_door/demo_smartdoor/sensor/src/DOOR.c
  45. 1 7
      vendor/bossay/smart_lamp/config.json
  46. 4 0
      vendor/bossay/smart_lamp/demo_smart_lamp/cloud_connect/BUILD.gn
  47. 4 4
      vendor/bossay/smart_lamp/demo_smart_lamp/cloud_connect/inc/cloud_communicate.h
  48. 48 4
      vendor/bossay/smart_lamp/demo_smart_lamp/cloud_connect/src/cloud_communicate.c
  49. 90 26
      vendor/bossay/smart_lamp/demo_smart_lamp/main_entry.c
  50. 9 4
      vendor/bossay/smart_lamp/demo_smart_lamp/sensor/inc/BH1750.h
  51. 95 11
      vendor/bossay/smart_lamp/demo_smart_lamp/sensor/src/BH1750.c
  52. 0 7
      vendor/bossay/smart_smoke_detect/config.json
  53. 4 3
      vendor/bossay/smart_smoke_detect/demo_smoke_detect/cloud_connect/inc/cloud_communicate.h
  54. 10 9
      vendor/bossay/smart_smoke_detect/demo_smoke_detect/cloud_connect/src/cloud_communicate.c
  55. 85 15
      vendor/bossay/smart_smoke_detect/demo_smoke_detect/main_entry.c
  56. 2 1
      vendor/bossay/smart_smoke_detect/demo_smoke_detect/sensor/src/MQ2.c
  57. 2 2
      vendor/bossay/smart_weather/BUILD.gn
  58. 1 8
      vendor/bossay/smart_weather/config.json
  59. 1 1
      vendor/bossay/smart_weather/demo_smart_weather/BUILD.gn
  60. 3 3
      vendor/bossay/smart_weather/demo_smart_weather/cloud_connect/inc/cloud_communicate.h
  61. 3 1
      vendor/bossay/smart_weather/demo_smart_weather/cloud_connect/src/cloud_communicate.c
  62. 161 13
      vendor/bossay/smart_weather/demo_smart_weather/main_entry.c

+ 0 - 7
vendor/bossay/CH2O_Monitoring/config.json

@@ -88,13 +88,6 @@
           { "component": "kv_store", "features":[] },
           { "component": "os_dump", "features":[] }
         ]
-      },
-      {
-       "subsystem": "test",
-       "components": [
-         { "component": "xts_acts", "features":[] },
-         { "component": "xts_tools", "features":[] }
-        ]
       }
     ],
     "third_party_dir": "//device/bossay/hi3861_l0/sdk_liteos/third_party",

+ 5 - 3
vendor/bossay/CH2O_Monitoring/demo_CH2O_Monitoring/cloud_connect/inc/cloud_communicate.h

@@ -69,7 +69,9 @@
 #define WIFI_PWD_MAX_LEN_ 256
 #define KV_STORE_SSID_ID "ssid"
 #define KV_STORE_PWD_ID "pwd"
-#define NAN_WIFI_AP_SSID "bossay"
+#define NAN_WIFI_AP_SSID "CH20166"
+
+//#define NAN_WIFI_AP_SSID "bossay"
 
 #define MAX_STRING_VALUE_LEN 30
 #define MAX_CMD_NAME_LEN 30
@@ -123,8 +125,8 @@ typedef struct{
 
 
 
-//int getStoredWifiInfo(WIFI_ssid_pwd* wifi);
-//int setStoredWifiInfo(WIFI_ssid_pwd* wifi);
+int getStoredWifiInfo(WIFI_ssid_pwd* wifi);
+int setStoredWifiInfo(WIFI_ssid_pwd* wifi);
 int NanWifiConnect(bool restartNan);
 int cloud_CloudInit(const char *deviceID, const char *devicePwd, \
     const char *serverIP, const char *serverPort);

+ 3 - 1
vendor/bossay/CH2O_Monitoring/demo_CH2O_Monitoring/cloud_connect/src/cloud_communicate.c

@@ -102,7 +102,7 @@ int NanWifiConnect(bool restartNan)
     if(getStoredWifiInfo(&wifi) == 0){
         goto CLOUD_CONNECT_WIFI;
     }
-    
+    // goto CLOUD_CONNECT_WIFI;   //新增语句
 CLOUD_START_NAN:
 
     RaiseLog(LOG_LEVEL_INFO,"Try to get the wifi info by NAN network....");
@@ -121,6 +121,8 @@ CLOUD_CONNECT_WIFI:
 
     BOARD_InitWifi();
     ret = BOARD_ConnectWifi(wifi.ssid, wifi.pwd);
+    // ret = BOARD_ConnectWifi("Bossay", "Bossay@123");   //新增语句
+
     if (ret != 0) {
         RaiseLog(LOG_LEVEL_ERR, "Connect to wifi failed! \n");
         NotifyNetCfgResult(NETCFG_DEV_INFO_INVALID);

+ 107 - 13
vendor/bossay/CH2O_Monitoring/demo_CH2O_Monitoring/main_entry.c

@@ -46,7 +46,8 @@
 
 #define CONFIG_CLOUD_DEFAULT_SERVERIP "121.36.42.100"   // Huawei cloud service ip
 #define CONFIG_CLOUD_DEFAULT_SERVERPORT "1883"          // // Huawei cloud service port
-#define CLOUD_DEVICE_ID "62b6baa44c7c4e3646b781cb_Lamp01"   // user need to change it according to the device id in cloud
+//#define CLOUD_DEVICE_ID "62b6baa44c7c4e3646b781cb_Lamp01"   // user need to change it according to the device id in cloud
+#define CLOUD_DEVICE_ID "6380926de0dd6929d6d9ffd0_CH20166" 
 #define CLOUD_DEVICE_PWD "12345678"  // user need to change it according to the device pwd in cloud
 
 #define NFC_DEVICE_ID_LEN 50
@@ -61,6 +62,42 @@ typedef struct{
 
 
 static bool keyStatus = false;
+
+//新增开始
+static int cmdBeepStatus;
+static float threshold;
+static float CH2ODensity;
+int cmdBeepCallback(FuncValue_t ret)
+{
+    RaiseLog(LOG_LEVEL_INFO,"Beep Status Cmd:%s",ret.value.valueString); 
+    if((strcmp(ret.value.valueString,"ON"))==0){
+        cmdBeepStatus = ON;
+    }else{
+        cmdBeepStatus = OFF;
+        //CH2ODensity = 0;
+    }
+    return 0;
+}
+
+
+int cmdThresholdCallback(FuncValue_t ret)
+{   
+    RaiseLog(LOG_LEVEL_INFO,"Threshold is :%f",ret.value.valueDouble);
+    threshold=ret.value.valueDouble;
+    printf("$$$$$$$&&&&&&& threshold is :%f\r\n", threshold);
+    // if(cmdBeepStatus==OFF){
+    //     threshold=0;
+    // }
+    return 0;
+    
+    // RaiseLog(LOG_LEVEL_INFO,"Threshold:%d",ret.value.valueInt);
+    // threshold=ret.value.valueInt;
+    // printf("$$$$$$$&&&&&&& threshold is :%f\r\n", threshold);
+    // return 0;
+}
+//新增结束
+
+
 void keycallback(char* arg){
     keyStatus = true;
     return;
@@ -68,12 +105,17 @@ void keycallback(char* arg){
 
 void IotMainTaskEntry(void* argument)
 {
-    uint8_t ret;
-    float  ppm;
+    // uint8_t ret;
+    // float  ppm;
+
+    int ret;
+
     BoardInit();
-    usleep(1000000);   
+    usleep(1000000);
+    //usleep(100);
     MQ2PPMCalibration();  
-    LedSafeStatusSet(ON);
+    //LedSafeStatusSet(ON);
+
     initKey(keycallback);
     IOT_ScheduleInit();
     BOARD_InitWifi();
@@ -81,31 +123,83 @@ void IotMainTaskEntry(void* argument)
     NanWifiConnect(keyStatus);
     cloud_CloudInit(CLOUD_DEVICE_ID,CLOUD_DEVICE_PWD,CONFIG_CLOUD_DEFAULT_SERVERIP,CONFIG_CLOUD_DEFAULT_SERVERPORT);
 
-    Cloud_Servic* service = cloud_createService("CH2O_Monitoring",NULL);
-    cloud_createAndAppendProprety(service,"CH2O_status",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&ppm);
+    // Cloud_Servic* service = cloud_createService("CH2O_Monitoring",NULL);
+    // cloud_createAndAppendProprety(service,"CH2O_status",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&ppm);
+
+    Cloud_Servic* service = cloud_createService("CH2ODetection",NULL);
+    cloud_createAndAppendProprety(service,"CH2ODensity",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&CH2ODensity);   
+    cloud_createAndAppendProprety(service,"Threshold",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&threshold);   
+    cloud_createAndAppendProprety(service,"BeepStatus",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&cmdBeepStatus);  
+
+    CmdNode* cmdBeepCtrl = cloud_createCmd("SetBeepStatus");
+    CmdParam* paraBeep = cloud_createAndAppendPara(cmdBeepCtrl,"BeepStatus",Cloud_String,cmdBeepCallback);
+    printf("******----&&*******%s,%s*********--***\r\n",*cmdBeepCtrl,*paraBeep);
+
+
+    CmdNode* cmdThresholdCtrl = cloud_createCmd("SetThreshold");   
+    CmdParam* paraThreshold = cloud_createAndAppendPara(cmdThresholdCtrl,"Threshold",Cloud_Double,cmdThresholdCallback);   
+    printf("**********+++****%s,%s**********++***\r\n",*cmdThresholdCtrl,*paraThreshold);   
+
     printf("=================================================\r\n");
     printf("************* CH2O_Monitoring_example ***********\r\n");
     printf("=================================================\r\n");
     for(;;)
-    {
-        ret = GetMQ2PPM(&ppm);
+    // {
+    //     ret = GetMQ2PPM(&ppm);
+    //     if (ret != 0) {
+    //         printf("ADC Read Fail\n");
+    //         continue;
+    //     }
+    //     RaiseLog(LOG_LEVEL_INFO,"CH2O is  %d",ppm);
+    //     if (ppm > 20) {
+    //         BeepStatusSet(ON);
+    //         LedSafeStatusSet(OFF);
+    //         LedWarnStatusSet(ON);
+    //     } else {
+    //         BeepStatusSet(OFF);
+    //         LedSafeStatusSet(ON);
+    //         LedWarnStatusSet(OFF);
+    //     }
+    //     cloud_uploadService(service);
+    //     osDelay(100);
+    // }
+
+    {        
+
+        ret = GetMQ2PPM(&CH2ODensity);
         if (ret != 0) {
             printf("ADC Read Fail\n");
             continue;
+            //return ;
         }
-        RaiseLog(LOG_LEVEL_INFO,"CH2O is  %d",ppm);
-        if (ppm > 20) {
-            BeepStatusSet(ON);
+        printf("+++***@@@ CH2ODensity is :%.3f \n", CH2ODensity);
+        printf("+++***@@@ threshold is %f\r\n",threshold);
+
+        //if (CH2ODensity > 20) {
+        if (CH2ODensity > threshold) {
+            cmdBeepStatus = ON;
+            printf("cmdBeepStatusON is %d\r\n",cmdBeepStatus);
+            BeepStatusSet(cmdBeepStatus);
             LedSafeStatusSet(OFF);
             LedWarnStatusSet(ON);
         } else {
-            BeepStatusSet(OFF);
+            cmdBeepStatus = OFF;
+            printf("cmdBeepStatusOFF is %d\r\n",cmdBeepStatus);
+            BeepStatusSet(cmdBeepStatus);
             LedSafeStatusSet(ON);
             LedWarnStatusSet(OFF);
         }
+
+        printf("cmdBeepStatus is %d\r\n",cmdBeepStatus);
+        printf("threshold is %f\r\n",threshold);
+        osDelay(100);
+
         cloud_uploadService(service);
         osDelay(100);
     }
+
+
+
 }
 
 static void EntryMain(void)

+ 0 - 7
vendor/bossay/PM2_5_Monitoring/config.json

@@ -88,13 +88,6 @@
           { "component": "kv_store", "features":[] },
           { "component": "os_dump", "features":[] }
         ]
-      },
-      {
-       "subsystem": "test",
-       "components": [
-         { "component": "xts_acts", "features":[] },
-         { "component": "xts_tools", "features":[] }
-        ]
       }
     ],
     "third_party_dir": "//device/bossay/hi3861_l0/sdk_liteos/third_party",

+ 5 - 3
vendor/bossay/PM2_5_Monitoring/demo_PM2_5_Monitoring/cloud_connect/inc/cloud_communicate.h

@@ -69,7 +69,9 @@
 #define WIFI_PWD_MAX_LEN_ 256
 #define KV_STORE_SSID_ID "ssid"
 #define KV_STORE_PWD_ID "pwd"
-#define NAN_WIFI_AP_SSID "bossay"
+#define NAN_WIFI_AP_SSID "PM25167"
+
+//#define NAN_WIFI_AP_SSID "bossay"
 
 #define MAX_STRING_VALUE_LEN 30
 #define MAX_CMD_NAME_LEN 30
@@ -123,8 +125,8 @@ typedef struct{
 
 
 
-//int getStoredWifiInfo(WIFI_ssid_pwd* wifi);
-//int setStoredWifiInfo(WIFI_ssid_pwd* wifi);
+int getStoredWifiInfo(WIFI_ssid_pwd* wifi);
+int setStoredWifiInfo(WIFI_ssid_pwd* wifi);
 int NanWifiConnect(bool restartNan);
 int cloud_CloudInit(const char *deviceID, const char *devicePwd, \
     const char *serverIP, const char *serverPort);

+ 3 - 1
vendor/bossay/PM2_5_Monitoring/demo_PM2_5_Monitoring/cloud_connect/src/cloud_communicate.c

@@ -102,7 +102,7 @@ int NanWifiConnect(bool restartNan)
     if(getStoredWifiInfo(&wifi) == 0){
         goto CLOUD_CONNECT_WIFI;
     }
-    
+    // goto CLOUD_CONNECT_WIFI;   //新增语句
 CLOUD_START_NAN:
 
     RaiseLog(LOG_LEVEL_INFO,"Try to get the wifi info by NAN network....");
@@ -121,6 +121,8 @@ CLOUD_CONNECT_WIFI:
 
     BOARD_InitWifi();
     ret = BOARD_ConnectWifi(wifi.ssid, wifi.pwd);
+    // ret = BOARD_ConnectWifi("Bossay", "Bossay@123");   //新增语句
+
     if (ret != 0) {
         RaiseLog(LOG_LEVEL_ERR, "Connect to wifi failed! \n");
         NotifyNetCfgResult(NETCFG_DEV_INFO_INVALID);

+ 62 - 8
vendor/bossay/PM2_5_Monitoring/demo_PM2_5_Monitoring/main_entry.c

@@ -45,7 +45,8 @@
 
 #define CONFIG_CLOUD_DEFAULT_SERVERIP "121.36.42.100"   // Huawei cloud service ip
 #define CONFIG_CLOUD_DEFAULT_SERVERPORT "1883"          // // Huawei cloud service port
-#define CLOUD_DEVICE_ID "62b683556b9813541d4e3357_Lamp01"   // user need to change it according to the device id in cloud
+//#define CLOUD_DEVICE_ID "62b683556b9813541d4e3357_Lamp01"   // user need to change it according to the device id in cloud
+#define CLOUD_DEVICE_ID "637f10fd379b9f242471961f_PM25167"
 #define CLOUD_DEVICE_PWD "12345678"  // user need to change it according to the device pwd in cloud
 
 #define NFC_DEVICE_ID_LEN 50
@@ -83,6 +84,40 @@ void keycallback(char* arg){
     return;
 }
 
+//新增开始
+static int cmdBeepStatus;
+static int threshold;
+
+int cmdBeepCallback(FuncValue_t ret)
+{
+    RaiseLog(LOG_LEVEL_INFO,"Beep Status Cmd:%s",ret.value.valueString); 
+    if((strcmp(ret.value.valueString,"ON"))==0){
+        cmdBeepStatus = ON;
+    }else{
+        cmdBeepStatus = OFF;
+        //SmokeDensity = 0;
+    }
+    return 0;
+}
+
+
+int cmdThresholdCallback(FuncValue_t ret)
+{   
+    RaiseLog(LOG_LEVEL_INFO,"Threshold is :%d",ret.value.valueInt);
+    threshold=ret.value.valueInt;
+    printf("$$$$$$$&&&&&&& threshold is :%d\r\n", threshold);
+    // if(cmdBeepStatus==OFF){
+    //     threshold=0;
+    // }
+    return 0;
+    
+    // //RaiseLog(LOG_LEVEL_INFO,"Threshold:%d",ret.value.valueInt);
+    // threshold=ret.value.valueInt;
+    // return 0;
+}
+//新增结束
+
+
 void IotMainTaskEntry(void* argument)
 {
     PM2D5Data data;
@@ -95,17 +130,36 @@ void IotMainTaskEntry(void* argument)
     NanWifiConnect(keyStatus);
     cloud_CloudInit(CLOUD_DEVICE_ID,CLOUD_DEVICE_PWD,CONFIG_CLOUD_DEFAULT_SERVERIP,CONFIG_CLOUD_DEFAULT_SERVERPORT);
 
-    Cloud_Servic* service = cloud_createService("PM2_5_Service",NULL);
-    cloud_createAndAppendProprety(service,"pm1_0_status",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&data.pm1_0);
-    cloud_createAndAppendProprety(service,"pm2_5_status",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&data.pm2_5);
-    cloud_createAndAppendProprety(service,"pm10_status",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&data.pm10);
+    Cloud_Servic* service = cloud_createService("PM2_5Detection",NULL);
+    cloud_createAndAppendProprety(service,"Threshold",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&threshold);
+    cloud_createAndAppendProprety(service,"pm1_0_data",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&data.pm1_0);
+    cloud_createAndAppendProprety(service,"pm2_5_data",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&data.pm2_5);
+    cloud_createAndAppendProprety(service,"pm10_data",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&data.pm10);
+
+    CmdNode* cmdThresholdCtrl = cloud_createCmd("SetThreshold");   
+    CmdParam* paraThreshold = cloud_createAndAppendPara(cmdThresholdCtrl,"Threshold",Cloud_Int,cmdThresholdCallback);   
+    printf("**********+++****%s,%s**********++***\r\n",*cmdThresholdCtrl,*paraThreshold);   
 
     for(;;)
     {
         PM2DReadData(&data);
-        RaiseLog(LOG_LEVEL_INFO,"PM1.0 is  %d", data.pm1_0);
-        RaiseLog(LOG_LEVEL_INFO,"PM2.5 is  %d", data.pm2_5);
-        RaiseLog(LOG_LEVEL_INFO,"PM10 is  %d", data.pm10);
+        RaiseLog(LOG_LEVEL_INFO,"PM1.0 is %d", data.pm1_0);
+        RaiseLog(LOG_LEVEL_INFO,"PM2.5 is %d", data.pm2_5);
+        RaiseLog(LOG_LEVEL_INFO,"PM10 is %d", data.pm10);
+
+        printf("+++***@@@ threshold is %d\r\n",threshold);
+
+
+        if (data.pm2_5 > threshold) {
+        //if (data.pm2_5 > 200) {
+            LedWarnStatusSet(ON);
+            LedSafeStatusSet(OFF);
+        } else {
+            LedWarnStatusSet(OFF);
+            LedSafeStatusSet(ON);
+        }
+
+        osDelay(100);
         cloud_uploadService(service);
         osDelay(100);
     }

+ 8 - 0
vendor/bossay/common/iot_cloud/iot_cloud.c

@@ -143,6 +143,9 @@ static int CloudMsgRcvCallBack(oc_mqtt_profile_msgrcv_t *msg)
             applicationMsg->msg.cmd.requestID,  applicationMsg->msg.cmd.payload);
 
     ret = osMessageQueuePut(g_cloudController.applicationMsgQueue,(void**)&applicationMsg,NULL,CONFIG_QUEUE_PUSH_TIMEOUT);
+
+    //RaiseLog(LOG_LEVEL_INFO,"**********+++++++ret**********+++++++:%s\r\n",ret);
+
     if (ret != 0){
         free(applicationMsg);
         RaiseLog(LOG_LEVEL_ERR,"Push the message to the queue failed");
@@ -180,7 +183,9 @@ static int CloudMainTaskEntry(void *arg)
             RaiseLog(LOG_LEVEL_INFO,"GetMsgType:%d",applicationMsg->msgType);
             switch (applicationMsg->msgType){
                 case EN_MSG_TYPE_CMD:
+                    
                     DealCommandMsg(&applicationMsg->msg.cmd);
+                    
                     break;
                 case EN_MSG_TYPE_REPORT:
                     DealReportMsg(&applicationMsg->msg.report);
@@ -197,6 +202,7 @@ static int CloudMainTaskEntry(void *arg)
         }
         osDelay(CLOUD_TASK_DELAY);
     }
+    RaiseLog(LOG_LEVEL_INFO,"*********************CloudMainTaskEntry  complete************");
     return 0;
 }
 
@@ -272,6 +278,8 @@ int CLOUD_Connect(const char *deviceID, const char *devicePwd, \
 
 int CLOUD_Disconnect(void)
 {
+    printf("@@@@#### int CLOUD_Disconnect(void)\r\n");
+
     int ret;
     ret = oc_mqtt_profile_disconnect();
     if (ret == (int)en_oc_mqtt_err_ok) {

BIN
vendor/bossay/common/iot_wifi/libs/libHwKeystoreSDK.a


+ 3 - 2
vendor/bossay/hi3861_l0/config.json

@@ -1,5 +1,5 @@
 {
-    "product_name": "wifiiot_hi3861",
+    "product_name": "hi3861_l0",
     "ohos_version": "OpenHarmony 1.0",
     "device_company": "bossay",
     "board": "hi3861_l0",
@@ -9,7 +9,8 @@
       {
         "subsystem": "applications",
         "components": [
-          { "component": "wifi_iot_sample_app", "features":[] }
+          { "component": "wifi_iot_sample_app", "features":[] },
+          { "component": "bossay_sample_app", "features":[] }
         ]
       },
       {

+ 0 - 7
vendor/bossay/human_detect/config.json

@@ -88,13 +88,6 @@
           { "component": "kv_store", "features":[] },
           { "component": "os_dump", "features":[] }
         ]
-      },
-      {
-       "subsystem": "test",
-       "components": [
-         { "component": "xts_acts", "features":[] },
-         { "component": "xts_tools", "features":[] }
-        ]
       }
     ],
     "third_party_dir": "//device/bossay/hi3861_l0/sdk_liteos/third_party",

+ 5 - 3
vendor/bossay/human_detect/demo_human_detect/cloud_connect/inc/cloud_communicate.h

@@ -69,7 +69,9 @@
 #define WIFI_PWD_MAX_LEN_ 256
 #define KV_STORE_SSID_ID "ssid"
 #define KV_STORE_PWD_ID "pwd"
-#define NAN_WIFI_AP_SSID "bossay"
+#define NAN_WIFI_AP_SSID "human_detect166"
+
+//#define NAN_WIFI_AP_SSID "bossay"
 
 #define MAX_STRING_VALUE_LEN 30
 #define MAX_CMD_NAME_LEN 30
@@ -123,8 +125,8 @@ typedef struct{
 
 
 
-//int getStoredWifiInfo(WIFI_ssid_pwd* wifi);
-//int setStoredWifiInfo(WIFI_ssid_pwd* wifi);
+int getStoredWifiInfo(WIFI_ssid_pwd* wifi);
+int setStoredWifiInfo(WIFI_ssid_pwd* wifi);
 int NanWifiConnect(bool restartNan);
 int cloud_CloudInit(const char *deviceID, const char *devicePwd, \
     const char *serverIP, const char *serverPort);

+ 3 - 1
vendor/bossay/human_detect/demo_human_detect/cloud_connect/src/cloud_communicate.c

@@ -102,7 +102,7 @@ int NanWifiConnect(bool restartNan)
     if(getStoredWifiInfo(&wifi) == 0){
         goto CLOUD_CONNECT_WIFI;
     }
-    
+    // goto CLOUD_CONNECT_WIFI;   //新增语句
 CLOUD_START_NAN:
 
     RaiseLog(LOG_LEVEL_INFO,"Try to get the wifi info by NAN network....");
@@ -121,6 +121,8 @@ CLOUD_CONNECT_WIFI:
 
     BOARD_InitWifi();
     ret = BOARD_ConnectWifi(wifi.ssid, wifi.pwd);
+    // ret = BOARD_ConnectWifi("Bossay", "Bossay@123");   //新增语句
+
     if (ret != 0) {
         RaiseLog(LOG_LEVEL_ERR, "Connect to wifi failed! \n");
         NotifyNetCfgResult(NETCFG_DEV_INFO_INVALID);

+ 104 - 15
vendor/bossay/human_detect/demo_human_detect/main_entry.c

@@ -37,16 +37,23 @@
 #include "hi_reset.h"
 #include "cloud_communicate.h"
 #include "cloud_schedule.h"
-#include "mlx90614.h"
+#include "red.h"
 #include "OLED_I2C.h"
 
+#include <math.h>
+#include "iot_gpio.h"
+
+
 #define CONFIG_TASK_MAIN_STACKSIZE 0x2000
 #define CONFIG_TASK_MAIN_PRIOR 25
 
 #define CONFIG_CLOUD_DEFAULT_SERVERIP "121.36.42.100"   // Huawei cloud service ip
 #define CONFIG_CLOUD_DEFAULT_SERVERPORT "1883"          // // Huawei cloud service port
-#define CLOUD_DEVICE_ID "6221c7f2c4e6a958e354bb4b_BearPi_HM_Nano_ST1"   // user need to change it according to the device id in cloud
-#define CLOUD_DEVICE_PWD "bearpi12345"  // user need to change it according to the device pwd in cloud
+#define CLOUD_DEVICE_ID "6380929f379b9f242471bcfc_human_detect166"   // user need to change it according to the device id in cloud
+#define CLOUD_DEVICE_PWD "12345678"  // user need to change it according to the device pwd in cloud
+
+// #define CLOUD_DEVICE_ID "6221c7f2c4e6a958e354bb4b_BearPi_HM_Nano_ST1"   // user need to change it according to the device id in cloud
+// #define CLOUD_DEVICE_PWD "bearpi12345"  // user need to change it according to the device pwd in cloud
 
 #define NFC_DEVICE_ID_LEN 50
 #define NFC_DEVICE_PWD_LEN 50
@@ -65,12 +72,50 @@ void keycallback(char* arg){
     return;
 }
 
+
+//新增开始
+static int cmdBeepStatus;
+// static float threshold;
+// static float temperature;
+int cmdBeepCallback(FuncValue_t ret)
+{
+    RaiseLog(LOG_LEVEL_INFO,"Beep Status Cmd:%s",ret.value.valueString); 
+    if((strcmp(ret.value.valueString,"ON"))==0){
+        cmdBeepStatus = ON;
+    }else{
+        cmdBeepStatus = OFF;
+        //Temperature = 0;
+    }
+    return 0;
+}
+
+
+// int cmdThresholdCallback(FuncValue_t ret)
+// {   
+//     RaiseLog(LOG_LEVEL_INFO,"Threshold is :%f",ret.value.valueDouble);
+//     threshold=ret.value.valueDouble;
+//     printf("$$$$$$$&&&&&&& threshold is :%f\r\n", threshold);
+//     // if(cmdBeepStatus==OFF){
+//     //     threshold=0;
+//     // }
+//     return 0;
+    
+//     // RaiseLog(LOG_LEVEL_INFO,"Threshold:%d",ret.value.valueInt);
+//     // threshold=ret.value.valueInt;
+//     // printf("$$$$$$$&&&&&&& threshold is :%d\r\n", threshold);
+//     // return 0;
+// }
+//新增结束
+
+
 void IotMainTaskEntry(void* argument)
 {
-    float  sensorData_AMBIENT,sensorData_OBJECT;
-    uint8_t human_around = 0;
+    float ad_value1;
+    float ad_value2;
+    float tempNTC;	
+	float tempTP;
 
-    MLX90614_Init();
+    BoardInit();
 
     initKey(keycallback);
     IOT_ScheduleInit();
@@ -79,30 +124,74 @@ void IotMainTaskEntry(void* argument)
     NanWifiConnect(keyStatus);
     cloud_CloudInit(CLOUD_DEVICE_ID,CLOUD_DEVICE_PWD,CONFIG_CLOUD_DEFAULT_SERVERIP,CONFIG_CLOUD_DEFAULT_SERVERPORT);
 
-    Cloud_Servic* service = cloud_createService("human_detect_Service",NULL);
-    cloud_createAndAppendProprety(service,"human_around_status",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&human_around);
+    // Cloud_Servic* service = cloud_createService("human_detect_Service",NULL);
+    // cloud_createAndAppendProprety(service,"human_around_status",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&human_around);
+
+    Cloud_Servic* service = cloud_createService("TemperatureDetection",NULL);
+    // cloud_createAndAppendProprety(service,"Temperature",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&Temperature);   
+    // cloud_createAndAppendProprety(service,"Threshold",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&threshold);   
+    cloud_createAndAppendProprety(service,"BeepStatus",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&cmdBeepStatus);
+    cloud_createAndAppendProprety(service,"Temperature",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&tempTP); 
+
+    CmdNode* cmdBeepCtrl = cloud_createCmd("SetBeepStatus");
+    CmdParam* paraBeep = cloud_createAndAppendPara(cmdBeepCtrl,"BeepStatus",Cloud_String,cmdBeepCallback);
+    printf("******----&&*******%s,%s*********--***\r\n",*cmdBeepCtrl,*paraBeep);
+
+
+    // CmdNode* cmdThresholdCtrl = cloud_createCmd("SetThreshold");   
+    // CmdParam* paraThreshold = cloud_createAndAppendPara(cmdThresholdCtrl,"Threshold",Cloud_Double,cmdThresholdCallback);   
+    // printf("**********+++****%s,%s**********++***\r\n",*cmdThresholdCtrl,*paraThreshold); 
+
+
     printf("=================================================\r\n");
     printf("************* human_detect_example ***********\r\n");
     printf("=================================================\r\n");
     for(;;)
     {
-        sensorData_OBJECT = MLX90614_Read_TempData(MLX90614_RAM | OBJECT_TEMP);
-        sensorData_AMBIENT = MLX90614_Read_TempData(MLX90614_RAM | AMBIENT_TEMP);
-        if(sensorData_OBJECT>32){
-            human_around = 1;
+
+        IoTGpioSetOutputVal (12,1);
+        osDelay(50); 
+        ad_value1 = GetVoltage();
+        tempNTC = TEMP1();
+        printf("+++***@@@ ad_value is %fV\r\n",ad_value1);
+        
+        IoTGpioSetOutputVal (12,0);
+        osDelay(50); 
+        ad_value2 = GetVoltage();
+        tempTP = HUMAN();
+        printf("+++***@@@ ad_value2 is %fV\r\n",ad_value2);
+
+        printf("ntc temp = %f \n",tempNTC);
+	    printf("tp temp = %f \n",tempTP);
+
+
+        if (tempTP > 38) {
+
+            cmdBeepStatus = ON;
+            printf("cmdBeepStatusON is %d\r\n",cmdBeepStatus);
+            BeepStatusSet(cmdBeepStatus);
             LedSafeStatusSet(OFF);
             LedWarnStatusSet(ON);
-            BeepStatusSet(ON);
+            //BeepStatusSet(ON);
         }else{
-            human_around = 0;
+
+            cmdBeepStatus = OFF;
+            printf("cmdBeepStatusOFF is %d\r\n",cmdBeepStatus);
+            BeepStatusSet(cmdBeepStatus);
             LedSafeStatusSet(ON);
             LedWarnStatusSet(OFF);
-            BeepStatusSet(OFF);
+            //BeepStatusSet(OFF);
         }
 
+        printf("human temp is %d\r\n",tempTP); 
+        osDelay(100);
+
         cloud_uploadService(service);
         osDelay(100);
     }
+
+
+
 }
 
 static void EntryMain(void)

+ 21 - 24
vendor/bossay/human_detect/demo_human_detect/sensor/BUILD.gn

@@ -1,24 +1,21 @@
-static_library("bossay_hi3861_l0_sensor") {
-    sources = [
-        "src/mlx90614.c",
-        "src/smbus.c",
-    ]
-    
-    cflags = [ "-Wno-unused-variable" ]
-    cflags += [ "-Wno-unused-but-set-variable" ]
-    cflags += [ "-Wno-unused-parameter" ]
-    
-    include_dirs = [
-        "inc",
-        "//base/iot_hardware/peripheral/interfaces/kits",
-        "//device/bossay/hi3861_l0/iot_hardware_hals/include",
-        "//device/bossay/hi3861_l0/sdk_liteos/include",
-    ]
-
-    deps = [ 
-
-    ]
-
-}
-
-
+static_library("bossay_hi3861_l0_sensor") {
+    sources = [
+        "src/red.c",
+    ]
+    
+    cflags = [ "-Wno-unused-variable" ]
+    cflags += [ "-Wno-unused-but-set-variable" ]
+    cflags += [ "-Wno-unused-parameter" ]
+    
+    include_dirs = [
+        "inc",
+        "//base/iot_hardware/peripheral/interfaces/kits",
+        "//device/bossay/hi3861_l0/iot_hardware_hals/include",
+        "//device/bossay/hi3861_l0/sdk_liteos/include",
+    ]
+
+    deps = [ 
+
+    ]
+
+}

+ 0 - 32
vendor/bossay/human_detect/demo_human_detect/sensor/inc/mlx90614.h

@@ -1,32 +0,0 @@
-#ifndef __MLX90614_H
-#define __MLX90614_H
-
-
-#include <stdint.h>
-
-
-#define   MLX90614_ADDR_WRITE   0x00	
-#define   MLX90614_ADDR_READ    0x01
-
-#define   MLX90614_RAM    0x00
-
-#define   AMBIENT_TEMP    0x06
-#define   OBJECT_TEMP     0x07
-
-typedef enum
-{
-	OFF = 0,
-	ON
-} SwitchStatus;
-
-
-extern uint8_t  RxBuffer[3];
-void MLX90614_Init(void);
-float MLX90614_Read_TempData(uint8_t  ambient_or_object);
-void LedSafeStatusSet(SwitchStatus status);
-void LedWarnStatusSet(SwitchStatus status);	
-void BeepStatusSet(SwitchStatus status);
-
-#endif
-
-

+ 0 - 26
vendor/bossay/human_detect/demo_human_detect/sensor/inc/smbus.h

@@ -1,26 +0,0 @@
-#ifndef __SMBUS_H
-#define __SMBUS_H
-
-#include "iot_gpio.h"
-#include "iot_gpio_ex.h"
-
-#define ACK 0
-#define NACK 1
-#define WIFI_IOT_IO_NAME_GPIO_10 10
-#define WIFI_IOT_IO_NAME_GPIO_12 12
-
-
-#define    SMBUS_SCL_H()       IoTGpioSetOutputVal(WIFI_IOT_IO_NAME_GPIO_10, 1);
-#define    SMBUS_SCL_L()       IoTGpioSetOutputVal(WIFI_IOT_IO_NAME_GPIO_10, 0);
-#define    SMBUS_SDA_H()       IoTGpioSetOutputVal(WIFI_IOT_IO_NAME_GPIO_12, 1);
-#define    SMBUS_SDA_L()       IoTGpioSetOutputVal(WIFI_IOT_IO_NAME_GPIO_12, 0);
-
-void SMBus_Start(void);
-void SMBus_Stop(void);
-void SMBus_SendBit(uint8_t bit_out);
-uint8_t SMBus_ReceiveBit(void);
-uint8_t SMBus_SendByte(uint8_t Tx_buffer);
-uint8_t SMBus_ReceiveByte(uint8_t ack_nack);
-
-#endif
-

+ 0 - 246
vendor/bossay/human_detect/demo_human_detect/sensor/src/mlx90614.c

@@ -1,246 +0,0 @@
-#include "mlx90614.h"
-#include "smbus.h"
-#include "iot_gpio.h"
-#include "iot_gpio_ex.h"
-
-#define WIFI_IOT_IO_NAME_GPIO_7 7
-#define WIFI_IOT_IO_NAME_GPIO_14 14
-#define WIFI_IOT_IO_NAME_GPIO_10 10
-#define WIFI_IOT_IO_NAME_GPIO_12 12
-#define WIFI_IOT_I2C_IDX_1 1
-
-
-uint8_t     RxBuffer[3];
-#define BEEP_GPIO 8
-
-void MLX90614_Init(void)
-{   
-    IoTGpioInit(BEEP_GPIO);
-    IoTGpioSetFunc(BEEP_GPIO, IOT_GPIO_FUNC_GPIO_8_GPIO);
-    IoTGpioSetDir(BEEP_GPIO, IOT_GPIO_DIR_OUT); //设置为输出模式
-    
-    IoTGpioInit(WIFI_IOT_IO_NAME_GPIO_10);
-    IoTGpioSetFunc(WIFI_IOT_IO_NAME_GPIO_10, IOT_GPIO_FUNC_GPIO_10_GPIO);
-    IoTGpioSetDir(WIFI_IOT_IO_NAME_GPIO_10, IOT_GPIO_DIR_OUT); // 设置GPIO_8为输出模式
-    IoTGpioInit(WIFI_IOT_IO_NAME_GPIO_12);
-    IoTGpioSetFunc(WIFI_IOT_IO_NAME_GPIO_12, IOT_GPIO_FUNC_GPIO_12_GPIO);
-    IoTGpioSetDir(WIFI_IOT_IO_NAME_GPIO_12, IOT_GPIO_DIR_OUT); // 设置GPIO_8为输出模式
-
-    IoTGpioInit(WIFI_IOT_IO_NAME_GPIO_14);
-    IoTGpioSetFunc(WIFI_IOT_IO_NAME_GPIO_14, IOT_GPIO_FUNC_GPIO_14_GPIO);
-    IoTGpioSetDir(WIFI_IOT_IO_NAME_GPIO_14, IOT_GPIO_DIR_OUT); // 设置GPIO_14为输出模式
-
-    IoTGpioInit(WIFI_IOT_IO_NAME_GPIO_7);
-    IoTGpioSetFunc(WIFI_IOT_IO_NAME_GPIO_7, IOT_GPIO_FUNC_GPIO_7_GPIO);
-    IoTGpioSetDir(WIFI_IOT_IO_NAME_GPIO_7, IOT_GPIO_DIR_OUT); // 设置GPIO_7为输出模式
-}
-
-/*******************************************************************************
-* 函数名: PEC_calculation
-* 功能 : 数据校验
-* Input          : pec[]
-* Output         : None
-* Return         : pec[0]-this byte contains calculated crc value
-*******************************************************************************/
-uint8_t PEC_Calculation(uint8_t pec[])
-{
-    uint8_t         crc[6];
-    uint8_t        BitPosition=47;
-    uint8_t        shift;
-    uint8_t        i;
-    uint8_t        j;
-    uint8_t        temp;
-
-    do
-    {
-        /*Load pattern value 0x000000000107*/
-        crc[5]=0;
-        crc[4]=0;
-        crc[3]=0;
-        crc[2]=0;
-        crc[1]=0x01;
-        crc[0]=0x07;
-
-        /*Set maximum bit position at 47 ( six bytes byte5...byte0,MSbit=47)*/
-        BitPosition=47;
-
-        /*Set shift position at 0*/
-        shift=0;
-
-        /*Find first "1" in the transmited message beginning from the MSByte byte5*/
-        i=5;
-        j=0;
-        while((pec[i]&(0x80>>j))==0 && i>0)
-        {
-            BitPosition--;
-            if(j<7)
-            {
-                j++;
-            }
-            else
-            {
-                j=0x00;
-                i--;
-            }
-        }/*End of while */
-
-        /*Get shift value for pattern value*/
-        shift=BitPosition-8;
-
-        /*Shift pattern value */
-        while(shift)
-        {
-            for(i=5; i<0xFF; i--)
-            {
-                if((crc[i-1]&0x80) && (i>0))
-                {
-                    temp=1;
-                }
-                else
-                {
-                    temp=0;
-                }
-                crc[i]<<=1;
-                crc[i]+=temp;
-            }/*End of for*/
-            shift--;
-        }/*End of while*/
-
-        /*Exclusive OR between pec and crc*/
-        for(i=0; i<=5; i++)
-        {
-            pec[i] ^=crc[i];
-        }/*End of for*/
-    }
-    while(BitPosition>8); /*End of do-while*/
-
-    return pec[0];
-}
-/*******************************************************************************
-* 函数名: SMBus_ReadMemory
-* 功能: READ DATA FROM RAM/EEPROM
-* Input          : slaveAddress, command
-* Return         : Data
-*******************************************************************************/
-uint16_t SMBus_ReadMemory(uint8_t slaveAddress, uint8_t command)
-{
-    uint16_t data;                        // Data storage (DataH:DataL)
-    uint8_t Pec;                                // PEC byte storage
-    uint8_t DataL=0;                        // Low data byte storage
-    uint8_t DataH=0;                        // High data byte storage
-    uint8_t arr[6];                        // Buffer for the sent bytes
-    uint8_t PecReg;                        // Calculated PEC byte storage
-    uint8_t ErrorCounter;        // Defines the number of the attempts for communication with MLX90614
-
-    ErrorCounter=0x00;                                // Initialising of ErrorCounter
-        slaveAddress <<= 1;        //2-7位表示从机地址
-        
-    do
-    {
-repeat:
-        SMBus_Stop();                            //If slave send NACK stop comunication
-        --ErrorCounter;                                    //Pre-decrement ErrorCounter
-        if(!ErrorCounter)                             //ErrorCounter=0?
-        {
-            break;                                            //Yes,go out from do-while{}
-        }
-
-        SMBus_Start();                                //Start condition
-        if(SMBus_SendByte(slaveAddress))//Send SlaveAddress 最低位Wr=0表示接下来写命令
-        {
-            goto        repeat;                            //Repeat comunication again
-        }
-        if(SMBus_SendByte(command))            //Send command
-        {
-            goto        repeat;                            //Repeat comunication again
-        }
-
-        SMBus_Start();                                        //Repeated Start condition
-        if(SMBus_SendByte(slaveAddress+1))        //Send SlaveAddress 最低位Rd=1表示接下来读数据
-        {
-            goto        repeat;                     //Repeat comunication again
-        }
-
-        DataL = SMBus_ReceiveByte(ACK);        //Read low data,master must send ACK
-        DataH = SMBus_ReceiveByte(ACK); //Read high data,master must send ACK
-        Pec = SMBus_ReceiveByte(NACK);        //Read PEC byte, master must send NACK
-        SMBus_Stop();                                //Stop condition
-
-        arr[5] = slaveAddress;                //
-        arr[4] = command;                        //
-        arr[3] = slaveAddress+1;        //Load array arr
-        arr[2] = DataL;                                //
-        arr[1] = DataH;                                //
-        arr[0] = 0;                                        //
-        PecReg=PEC_Calculation(arr);//Calculate CRC
-    }
-    while(PecReg != Pec);                //If received and calculated CRC are equal go out from do-while{}
-
-        data = (DataH<<8) | DataL;        //data=DataH:DataL
-    return data;
-}
-
-/***************************************************************************
-* @brief      Read object temperature(Tobj) from  RAM registers of MLX90614
-* @param      ambient_or_object : Which temperature you want to get
-* @retval     Object temperature
-****************************************************************************/
-float   MLX90614_Read_TempData(uint8_t  ambient_or_object)
-{
-	return SMBus_ReadMemory(MLX90614_ADDR_WRITE, ambient_or_object)*0.02-273.15;
-}
-
-/***************************************************************
- * 函数名称: LedSafeStatusSet
- * 说    明: LED_Safe状态设置
- * 参    数: status,ENUM枚举的数据
- *									OFF,关
- *									ON,开
- * 返 回 值: 无
- ***************************************************************/
-void LedSafeStatusSet(SwitchStatus status)
-{
-    if (status == ON) {
-        IoTGpioSetOutputVal(7, 1); // 设置GPIO_7输出高电平点亮灯
-    }
-    if (status == OFF) {
-        IoTGpioSetOutputVal(7, 0); // 设置GPIO_7输出低电平关闭灯
-    }
-}
-
-/***************************************************************
- * 函数名称: LedWarnStatusSet
- * 说    明: LED_Warn状态设置
- * 参    数: status,ENUM枚举的数据
- *									OFF,关
- *									ON,开
- * 返 回 值: 无
- ***************************************************************/
-void LedWarnStatusSet(SwitchStatus status)
-{
-    if (status == ON) {
-        IoTGpioSetOutputVal(WIFI_IOT_IO_NAME_GPIO_14, 1); // 设置GPIO_14输出高电平点亮灯
-    }
-
-    if (status == OFF) {
-        IoTGpioSetOutputVal(WIFI_IOT_IO_NAME_GPIO_14, 0); // 设置GPIO_14输出低电平关闭灯
-    }
-}
-/***************************************************************
- * 函数名称: BeepStatusSet
- * 说    明: Beep状态设置
- * 参    数: status,ENUM枚举的数据
- *									OFF,关
- *									ON,开
- * 返 回 值: 无
- ***************************************************************/
-void BeepStatusSet(SwitchStatus status)
-{
-    if (status == ON) {
-        IoTGpioSetOutputVal(BEEP_GPIO, 1); // 设置GPIO_7输出高电平点亮灯
-    }
-    if (status == OFF) {
-        IoTGpioSetOutputVal(BEEP_GPIO, 0); // 设置GPIO_7输出低电平关闭灯
-    }
-}
-

+ 0 - 158
vendor/bossay/human_detect/demo_human_detect/sensor/src/smbus.c

@@ -1,158 +0,0 @@
-#include "mlx90614.h"
-#include "smbus.h"
-#include "hi_time.h"
-
-
-/***************************************************************************
-* @brief      SMBus start bit
-* @param      None
-* @retval     None
-****************************************************************************/
-void SMBus_Start(void)
-{
-	SMBUS_SDA_H();
-    hi_udelay(5);
-	SMBUS_SCL_H();
-	hi_udelay(5);
-	SMBUS_SDA_L();
-	hi_udelay(5);
-	SMBUS_SCL_L();
-	hi_udelay(5);
-}
-
-/***************************************************************************
-* @brief      SMBus stop bit
-* @param      None
-* @retval     None
-****************************************************************************/
-void SMBus_Stop(void)
-{
-    SMBUS_SCL_L();
-    hi_udelay(5);
-	SMBUS_SDA_L();
-	hi_udelay(5);
-	SMBUS_SCL_H();
-	hi_udelay(5);
-	SMBUS_SDA_H();
-}
-/*******************************************************************************
-* 函数名: SMBus_SendBit
-* 功能: Send a bit on SMBus 82.5kHz
-* Input          : bit_out
-* Output         : None
-* Return         : None
-*******************************************************************************/
-void SMBus_SendBit(uint8_t bit_out)
-{
-    if(bit_out==0)
-    {
-        SMBUS_SDA_L();
-    }
-    else
-    {
-        SMBUS_SDA_H();
-    }
-    hi_udelay(2);                                        // Tsu:dat = 250ns minimum
-    SMBUS_SCL_H();                                        // Set SCL line
-    hi_udelay(6);                                        // High Level of Clock Pulse
-    SMBUS_SCL_L();                                        // Clear SCL line
-    hi_udelay(3);                                        // Low Level of Clock Pulse
-    return;
-}
-static uint8_t SMBUS_SDA_READ(void)
-{
-	IotGpioValue temp = {0};
-    IoTGpioGetInputVal(WIFI_IOT_IO_NAME_GPIO_12,&temp);
-    return temp;
-}
-
-/*******************************************************************************
-* Function Name  : SMBus_ReceiveBit
-* Description    : Receive a bit on SMBus
-* Input          : None
-* Output         : None
-* Return         : Ack_bit
-*******************************************************************************/
-uint8_t SMBus_ReceiveBit(void)
-{
-    uint8_t Ack_bit;
-
-    SMBUS_SDA_H();          //引脚靠外部电阻上拉,当作输入
-    hi_udelay(2);                        // High Level of Clock Pulse
-    SMBUS_SCL_H();                        // Set SCL line
-    hi_udelay(5);                        // High Level of Clock Pulse
-    if (SMBUS_SDA_READ())
-    {
-        Ack_bit=1;
-    }
-    else
-    {
-        Ack_bit=0;
-    }
-    SMBUS_SCL_L();                        // Clear SCL line
-    hi_udelay(3);                        // Low Level of Clock Pulse
-
-    return        Ack_bit;
-}
-
-/*******************************************************************************
-* 函数名: SMBus_SendByte
-* 功能: Send a byte on SMBus
-* Input          : Tx_buffer
-* Output         : None
-* Return         : None
-*******************************************************************************/
-uint8_t SMBus_SendByte(uint8_t Tx_buffer)
-{
-    uint8_t        Bit_counter;
-    uint8_t        Ack_bit;
-    uint8_t        bit_out;
-
-    for(Bit_counter=8; Bit_counter; Bit_counter--)
-    {
-        if (Tx_buffer&0x80)
-        {
-            bit_out=1;   // If the current bit of Tx_buffer is 1 set bit_out
-        }
-        else
-        {
-            bit_out=0;  // else clear bit_out
-        }
-        SMBus_SendBit(bit_out);                // Send the current bit on SDA
-        Tx_buffer<<=1;                                // Get next bit for checking
-    }
-
-    Ack_bit=SMBus_ReceiveBit();                // Get acknowledgment bit
-    return        Ack_bit;
-}
-
-/*******************************************************************************
-* 函数名: SMBus_ReceiveByte
-* 功能: Receive a byte on SMBus
-* Input          : ack_nack
-* Output         : None
-* Return         : RX_buffer
-*******************************************************************************/
-uint8_t SMBus_ReceiveByte(uint8_t ack_nack)
-{
-    uint8_t         RX_buffer;
-    uint8_t        Bit_Counter;
-
-    for(Bit_Counter=8; Bit_Counter; Bit_Counter--)
-    {
-        if(SMBus_ReceiveBit())                        // Get a bit from the SDA line
-        {
-            RX_buffer <<= 1;                        // If the bit is HIGH save 1  in RX_buffer
-            RX_buffer |=0x01;
-        }
-        else
-        {
-            RX_buffer <<= 1;                        // If the bit is LOW save 0 in RX_buffer
-            RX_buffer &=0xfe;
-        }
-    }
-    SMBus_SendBit(ack_nack);                        // Sends acknowledgment bit
-    return RX_buffer;
-}
-
-

+ 0 - 7
vendor/bossay/smart_agriculture/config.json

@@ -88,13 +88,6 @@
           { "component": "kv_store", "features":[] },
           { "component": "os_dump", "features":[] }
         ]
-      },
-      {
-       "subsystem": "test",
-       "components": [
-         { "component": "xts_acts", "features":[] },
-         { "component": "xts_tools", "features":[] }
-        ]
       }
     ],
     "third_party_dir": "//device/bossay/hi3861_l0/sdk_liteos/third_party",

+ 5 - 3
vendor/bossay/smart_agriculture/demo_smart_agriculture/cloud_connect/inc/cloud_communicate.h

@@ -69,7 +69,9 @@
 #define WIFI_PWD_MAX_LEN_ 256
 #define KV_STORE_SSID_ID "ssid"
 #define KV_STORE_PWD_ID "pwd"
-#define NAN_WIFI_AP_SSID "bossay"
+#define NAN_WIFI_AP_SSID "Agriculture166"
+
+//#define NAN_WIFI_AP_SSID "bossay"
 
 #define MAX_STRING_VALUE_LEN 30
 #define MAX_CMD_NAME_LEN 30
@@ -123,8 +125,8 @@ typedef struct{
 
 
 
-//int getStoredWifiInfo(WIFI_ssid_pwd* wifi);
-//int setStoredWifiInfo(WIFI_ssid_pwd* wifi);
+int getStoredWifiInfo(WIFI_ssid_pwd* wifi);
+int setStoredWifiInfo(WIFI_ssid_pwd* wifi);
 int NanWifiConnect(bool restartNan);
 int cloud_CloudInit(const char *deviceID, const char *devicePwd, \
     const char *serverIP, const char *serverPort);

+ 3 - 1
vendor/bossay/smart_agriculture/demo_smart_agriculture/cloud_connect/src/cloud_communicate.c

@@ -102,7 +102,7 @@ int NanWifiConnect(bool restartNan)
     if(getStoredWifiInfo(&wifi) == 0){
         goto CLOUD_CONNECT_WIFI;
     }
-    
+    // goto CLOUD_CONNECT_WIFI;   //新增语句
 CLOUD_START_NAN:
 
     RaiseLog(LOG_LEVEL_INFO,"Try to get the wifi info by NAN network....");
@@ -121,6 +121,8 @@ CLOUD_CONNECT_WIFI:
 
     BOARD_InitWifi();
     ret = BOARD_ConnectWifi(wifi.ssid, wifi.pwd);
+    // ret = BOARD_ConnectWifi("Bossay", "Bossay@123");   //新增语句
+
     if (ret != 0) {
         RaiseLog(LOG_LEVEL_ERR, "Connect to wifi failed! \n");
         NotifyNetCfgResult(NETCFG_DEV_INFO_INVALID);

+ 171 - 37
vendor/bossay/smart_agriculture/demo_smart_agriculture/main_entry.c

@@ -46,37 +46,98 @@
 
 #define CONFIG_CLOUD_DEFAULT_SERVERIP "121.36.42.100"   // Huawei cloud service ip
 #define CONFIG_CLOUD_DEFAULT_SERVERPORT "1883"          // // Huawei cloud service port
-#define CLOUD_DEVICE_ID "62970e656c1cdc59a842551c_Lamp01"   // user need to change it according to the device id in cloud
+//#define CLOUD_DEVICE_ID "62970e656c1cdc59a842551c_Lamp01"   // user need to change it according to the device id in cloud
+#define CLOUD_DEVICE_ID "637ec122e0dd6929d6d9d14d_Agriculture166"
+
 #define CLOUD_DEVICE_PWD "12345678"  // user need to change it according to the device pwd in cloud
 
 #define NFC_DEVICE_ID_LEN 50
 #define NFC_DEVICE_PWD_LEN 50
 
 
-uint8_t fan_status;
-uint8_t led_status;
-uint8_t cmdLedStatus;
-int cmdFanCallback(FuncValue_t ret)
+
+static int cmdFanStatus;
+static int cmdLEDStatus;
+static int dht_temperature;
+static int dht_humidity;
+static int led_status;
+
+static int temperatureThreshold;
+static int humidityThreshold;
+static float luxThreshold;
+static int cmdGear;
+
+int cmdFanStatusCallback(FuncValue_t ret)
 {
-    RaiseLog(LOG_LEVEL_INFO,"Fan Cmd:%s",ret.value.valueString); 
-    if(strcmp(ret.value.valueString,"ON")){
-        fan_status = ON;
+    RaiseLog(LOG_LEVEL_INFO,"FanStatus Cmd:%s",ret.value.valueString); 
+    if((strcmp(ret.value.valueString,"ON"))==0){
+        cmdFanStatus = ON;
     }else{
-        fan_status = OFF;
+        cmdFanStatus = OFF;
+        //cmdGear = 0;
     }
     return 0;
 }
-int cmdLedCallback(FuncValue_t ret)
+int cmdLEDStatusCallback(FuncValue_t ret)
 {
-    RaiseLog(LOG_LEVEL_INFO,"Led Cmd:%s",ret.value.valueString); 
-    if(strcmp(ret.value.valueString,"ON")){
-        cmdLedStatus = ON;
+    RaiseLog(LOG_LEVEL_INFO,"LEDStatus Cmd:%s",ret.value.valueString); 
+    if((strcmp(ret.value.valueString,"ON"))==0){
+        cmdLEDStatus = ON;
     }else{
-        cmdLedStatus = OFF;
+        cmdLEDStatus = OFF;
+    }
+    return 0;
+}
+
+int cmdGearCallback(FuncValue_t ret)
+{
+    RaiseLog(LOG_LEVEL_INFO,"Gear Cmd:%s",ret.value.valueString); 
+    if((strcmp(ret.value.valueString,"1"))==0){
+        cmdGear = 1;
+    }
+    else if((strcmp(ret.value.valueString,"0"))==0)
+    {
+        cmdGear = 0;
+    }    
+    else{
+        cmdGear = 2;
     }
     return 0;
 }
 
+int cmdTemperatureThresholdCallback(FuncValue_t ret)
+{   
+    RaiseLog(LOG_LEVEL_INFO,"Temperature_Threshold is :%d",ret.value.valueDouble);
+    temperatureThreshold=ret.value.valueDouble;
+    printf("$$$$$$$&&&&&&& temperatureThreshold is :%d\r\n", temperatureThreshold);
+    // if(cmdBeepStatus==OFF){
+    //     temperatureThreshold=0;
+    // }
+    return 0;
+    
+    // RaiseLog(LOG_LEVEL_INFO,"Temperature_Threshold:%d",ret.value.valueInt);
+    // temperatureThreshold=ret.value.valueInt;
+    // printf("$$$$$$$&&&&&&& temperatureThreshold is :%d\r\n", temperatureThreshold);
+    // return 0;
+}
+
+int cmdHumidityThresholdCallback(FuncValue_t ret)
+{   
+    RaiseLog(LOG_LEVEL_INFO,"Humidity_Threshold is :%d",ret.value.valueDouble);
+    humidityThreshold=ret.value.valueDouble;
+    printf("$$$$$$$&&&&&&& humidityThreshold is :%d\r\n", humidityThreshold);
+    return 0;
+}
+
+int cmdLuxThresholdCallback(FuncValue_t ret)
+{   
+    RaiseLog(LOG_LEVEL_INFO,"Lux_Threshold is :%f",ret.value.valueDouble);
+    luxThreshold=ret.value.valueDouble;
+    printf("$$$$$$$&&&&&&& luxThreshold is :%f\r\n", luxThreshold);
+    return 0;
+}
+
+
 
 static bool keyStatus = false;
 void keycallback(char* arg){
@@ -87,15 +148,22 @@ void keycallback(char* arg){
 void IotMainTaskEntry(void* argument)
 {
     int ret;
-    uint8_t dht_temperature;
-	uint8_t dht_humidity;
+    int temp;
+    // uint8_t dht_temperature;
+	// uint8_t dht_humidity;
     float Lux;
-    int isLamp_ON = 0;
+    // int temperature_temp=0;
+    // int humidity_temp=0;
+    // // temperature_temp = dht_temperature;
+    // // humidity_temp = dht_humidity;
+
+
     ret = BoardInit();
     if (ret != 0) {
         RaiseLog(LOG_LEVEL_INFO,"Board Init failed!\r\n");
         return;
     }
+
     initKey(keycallback);
     IOT_ScheduleInit();
     BOARD_InitWifi();
@@ -103,41 +171,109 @@ void IotMainTaskEntry(void* argument)
     NanWifiConnect(keyStatus);
     cloud_CloudInit(CLOUD_DEVICE_ID,CLOUD_DEVICE_PWD,CONFIG_CLOUD_DEFAULT_SERVERIP,CONFIG_CLOUD_DEFAULT_SERVERPORT);
 
-    Cloud_Servic* service = cloud_createService("Agriculture_service",NULL);
-    cloud_createAndAppendProprety(service,"fan_status",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&fan_status);
-    cloud_createAndAppendProprety(service,"led_status",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&led_status);
-    cloud_createAndAppendProprety(service,"temperature_status",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&dht_temperature);
-    cloud_createAndAppendProprety(service,"humidity_status",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&dht_humidity);
-    cloud_createAndAppendProprety(service,"Lux_status",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&Lux);
 
-    CmdNode* cmdFanCtrl = cloud_createCmd("cmdFanCtrl");
-    CmdParam* paraFan = cloud_createAndAppendPara(cmdFanCtrl,"Fan",Cloud_String,cmdFanCallback);
+    Cloud_Servic* service = cloud_createService("SmartAgriculture",NULL);
+    cloud_createAndAppendProprety(service,"FanStatus",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&cmdFanStatus);
+    cloud_createAndAppendProprety(service,"LEDStatus",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&cmdLEDStatus);
+    cloud_createAndAppendProprety(service,"Temperature",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&dht_temperature);
+    cloud_createAndAppendProprety(service,"Humidity",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&dht_humidity);
+    cloud_createAndAppendProprety(service,"Lux",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&Lux);
+    cloud_createAndAppendProprety(service,"Temperature_Threshold",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&temperatureThreshold);   
+    cloud_createAndAppendProprety(service,"Humidity_Threshold",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&humidityThreshold);   
+    cloud_createAndAppendProprety(service,"Lux_Threshold",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&luxThreshold); 
+    cloud_createAndAppendProprety(service,"Gear",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&cmdGear);
+
+    CmdNode* cmdFanStatusCtrl = cloud_createCmd("SetFanStatus");
+    CmdParam* paraFanStatus = cloud_createAndAppendPara(cmdFanStatusCtrl,"FanStatus",Cloud_String,cmdFanStatusCallback);
+    printf("******+++******%s,******+++******%s\r\n",*paraFanStatus,*cmdFanStatusCtrl);
+    CmdNode* cmdLEDStatusCtrl = cloud_createCmd("SetLEDStatus");
+    CmdParam* paraLEDStatus = cloud_createAndAppendPara(cmdLEDStatusCtrl,"LEDStatus",Cloud_String,cmdLEDStatusCallback);
+    printf("******###******%s,******###******%s\r\n",*paraLEDStatus,*cmdLEDStatusCtrl);
+
+    CmdNode* cmdGearCtrl = cloud_createCmd("SetGear");
+    CmdParam* paraGear = cloud_createAndAppendPara(cmdGearCtrl,"Gear",Cloud_String,cmdGearCallback);
+    printf("******###******%s,******###******%s\r\n",*paraGear,*cmdGearCtrl);
+
+    CmdNode* cmdTemperatureThresholdCtrl = cloud_createCmd("SetTemperature_Threshold");   
+    CmdParam* paraTemperatureThreshold = cloud_createAndAppendPara(cmdTemperatureThresholdCtrl,"Temperature_Threshold",Cloud_Double,cmdTemperatureThresholdCallback);   
+    printf("**********+++****%s,%s**********++***\r\n",*cmdTemperatureThresholdCtrl,*paraTemperatureThreshold); 
 
-    CmdNode* cmdLedCtrl = cloud_createCmd("cmdLEDCtrl");
-    CmdParam* paraLed = cloud_createAndAppendPara(cmdLedCtrl,"Led",Cloud_String,cmdLedCallback);
+    CmdNode* cmdHumidityThresholdCtrl = cloud_createCmd("SetHumidity_Threshold");   
+    CmdParam* paraHumidityThreshold = cloud_createAndAppendPara(cmdHumidityThresholdCtrl,"Humidity_Threshold",Cloud_Double,cmdHumidityThresholdCallback);   
+    printf("**********+++****%s,%s**********++***\r\n",*cmdHumidityThresholdCtrl,*paraHumidityThreshold); 
+
+    CmdNode* cmdLuxThresholdCtrl = cloud_createCmd("SetLux_Threshold");   
+    CmdParam* paraLuxThreshold = cloud_createAndAppendPara(cmdLuxThresholdCtrl,"Lux_Threshold",Cloud_Double,cmdLuxThresholdCallback);   
+    printf("**********+++****%s,%s**********++***\r\n",*cmdLuxThresholdCtrl,*paraLuxThreshold); 
+    
 
     printf("=================================================\r\n");
     printf("************** smart agriculture demo ***********\r\n");
     printf("=================================================\r\n");
+
+
     for(;;)
     {
         DHT11_Read_Data(&dht_temperature,&dht_humidity);
-        ret = BH1750ReadData(&Lux);
-        if (ret != 0) {
+        temp = BH1750ReadData(&Lux);
+        if (temp != 0) {
             RaiseLog(LOG_LEVEL_INFO,"Board read data failed!\r\n");
             continue;
         }
         RaiseLog(LOG_LEVEL_INFO,"Lux data:%.2f\r\n", Lux);
-        RaiseLog(LOG_LEVEL_INFO,"temperature=%d \r\n",dht_temperature);
-		RaiseLog(LOG_LEVEL_INFO,"humidity=%d %%\r\n",dht_humidity);
-        if (Lux < 20) {
-            led_status = ON & cmdLedStatus;
+        RaiseLog(LOG_LEVEL_INFO,"temperature = %d\r\n",dht_temperature);
+		RaiseLog(LOG_LEVEL_INFO,"humidity = %d\r\n",dht_humidity);
+
+        //printf("******Lux data is %.2f,temperature is %.2f,humidity is %.2f\r\n",Lux,dht_temperature,dht_humidity);
+        printf("Lux data is %.2f,temperature is %d,humidity is %d\r\n",Lux,dht_temperature,dht_humidity);
+        
+        if((dht_humidity>humidityThreshold)||(dht_temperature>temperatureThreshold)||(Lux>luxThreshold))
+        {
+            led_status = ON & cmdLEDStatus;
             LightStatusSet(led_status);
+            printf("cmdLEDStatus is %d,ON is %d,led_status is %d\r\n",cmdLEDStatus,ON,led_status);
+
+            cmdFanStatus = ON;
+            cmdGear = 1;
+            FanStatusSet(cmdFanStatus,cmdGear);
+            printf("cmdFanStatus is %d,cmdGear is %d\r\n",cmdFanStatus,cmdGear);
         } else {
-            led_status = OFF | cmdLedStatus;
+            led_status = OFF | cmdLEDStatus;
             LightStatusSet(led_status);
+            printf("cmdLEDStatus is %d,OFF is %d,led_status is %d\r\n",cmdLEDStatus,OFF,led_status);
+
+            cmdFanStatus = OFF;
+            FanStatusSet(cmdFanStatus,cmdGear);
+            printf("cmdFanStatus is %d,cmdGear is %d\r\n",cmdFanStatus,cmdGear);
         }
-        FanStatusSet(fan_status,1);
+        
+        //printf("Lux data is %.2f,temperature is %d,humidity is %d\r\n",Lux,dht_temperature,dht_humidity);
+        // printf("cmdFanStatus is %d,cmdGear is %d\r\n",cmdFanStatus,cmdGear);
+        // FanStatusSet(cmdFanStatus,cmdGear);
+
+
+
+        // if (Lux < 20) 
+        // {
+        //     led_status = ON & cmdLEDStatus;
+        //     LightStatusSet(led_status);
+        //     printf("cmdLEDStatus is %d,ON is %d,led_status is %d\r\n",cmdLEDStatus,ON,led_status);
+        // } else {
+        //     led_status = OFF | cmdLEDStatus;
+        //     LightStatusSet(led_status);
+        //     printf("cmdLEDStatus is %d,OFF is %d,led_status is %d\r\n",cmdLEDStatus,OFF,led_status); 
+        // }
+        
+        // //printf("Lux data is %.2f,temperature is %d,humidity is %d\r\n",Lux,dht_temperature,dht_humidity);
+        // printf("cmdFanStatus is %d\r\n",cmdFanStatus);
+        // FanStatusSet(cmdFanStatus,1);
+
+
+        printf("Lux data is %.2f,temperature is %d,humidity is %d\r\n",Lux,dht_temperature,dht_humidity);
+
+        //printf("Lux data is %f,temperature is %f,humidity is %f\r\n",Lux,dht_temperature,dht_humidity);
+
+        osDelay(100);        
         cloud_uploadService(service);
         osDelay(100);
     }
@@ -161,5 +297,3 @@ static void EntryMain(void)
 }
 APP_FEATURE_INIT(EntryMain);
 
-
-

+ 4 - 4
vendor/bossay/smart_agriculture/demo_smart_agriculture/sensor/inc/BH1750.h

@@ -13,8 +13,8 @@
  * limitations under the License.
  */
 
-#ifndef __E53_SC1_H__
-#define __E53_SC1_H__
+#ifndef __BH1750_H__
+#define __BH1750_H__
 
 #include <stdint.h>
 
@@ -27,10 +27,10 @@ typedef enum
 } SwitchStatus;
 
 int BoardInit(void);
-int E53SC1ReadData(float *data);
+int BH1750ReadData(float* data);
 void LightStatusSet(SwitchStatus status);
 void FanStatusSet(SwitchStatus status, uint8_t gear);
 
 
-#endif /* __E53_SC1_H__ */
+#endif /* __BH1750_H__ */
 

+ 2 - 6
vendor/bossay/smart_agriculture/demo_smart_agriculture/sensor/inc/DHT11.h

@@ -1,9 +1,7 @@
 #ifndef __DHT11_H
 #define __DHT11_H 
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+
 	
 #include "iot_gpio.h"
 #include "iot_gpio_ex.h"
@@ -23,9 +21,7 @@ void DHT11_Rst(void);//Reset DHT11
 	
 	
 	
-#ifdef __cplusplus
-}
-#endif
+
 #endif /*__ GPIO_H__ */
 
 

+ 2 - 2
vendor/bossay/smart_door/BUILD.gn

@@ -1,10 +1,10 @@
 # Copyright (C) 2020 Hisilicon (Shanghai) Technologies Co., Ltd. All rights reserved.
 
-group("smart_door") {
+group("smart_DOOR") {
     deps = [
         "//device/bossay/hi3861_l0/sdk_liteos:wifiiot_sdk",
         "../common/iot_wifi:iot_wifi",
         # "//applications/sample/app:app",
-        "demo_smartdoor:bossay_hi3861_l0_smartDoor",
+        "demo_smart_DOOR:bossay_hi3861_l0_smart_DOOR",
     ]
 }

+ 1 - 8
vendor/bossay/smart_door/config.json

@@ -1,5 +1,5 @@
 {
-    "product_name": "smart_door",
+    "product_name": "smart_DOOR",
     "ohos_version": "OpenHarmony 1.0",
     "device_company": "bossay",
     "board": "hi3861_l0",
@@ -88,13 +88,6 @@
           { "component": "kv_store", "features":[] },
           { "component": "os_dump", "features":[] }
         ]
-      },
-      {
-       "subsystem": "test",
-       "components": [
-         { "component": "xts_acts", "features":[] },
-         { "component": "xts_tools", "features":[] }
-        ]
       }
     ],
     "third_party_dir": "//device/bossay/hi3861_l0/sdk_liteos/third_party",

+ 0 - 32
vendor/bossay/smart_door/demo_smartdoor/BUILD.gn

@@ -1,32 +0,0 @@
-static_library("bossay_hi3861_l0_smartDoor") {
-    sources = [
-        "main_entry.c",
-    ]
-    
-    cflags = [ "-Wno-unused-variable" ]
-    cflags += [ "-Wno-unused-but-set-variable" ]
-    cflags += [ "-Wno-unused-parameter" ]
-    
-    include_dirs = [
-        "./sensor/inc",
-        "../../common/inc",
-        "cloud_connect/inc",
-        "//third_party/cJSON",
-        "./OLED/include"
-        
-    ]
-
-    deps = [ 
-         "../../common/iot_sntp:iot_sntp",
-         "../../common/iot_wifi:iot_wifi",
-         "../../common/iot_schedule:iot_schedule",
-         #"../../common/iot_nfc:iot_nfc",
-         "../../common/iot_cloud:iot_cloud",
-         #"../../common/iot_boardled:iot_boardled",
-         #"../../common/iot_boardbutton:iot_boardbutton",
-         "cloud_connect:cloud_connect",
-         "sensor:bossay_hi3861_l0_sensor",
-         "OLED:bossay_hi3816l0_OLED",
-    ]
-
-}

+ 0 - 20
vendor/bossay/smart_door/demo_smartdoor/OLED/BUILD.gn

@@ -1,20 +0,0 @@
-static_library("bossay_hi3816l0_OLED"){
-
-    cflags = [ "-Wno-unused-variable" ]
-    cflags += [ "-Wno-unused-but-set-variable" ]
-    cflags += [ "-Wno-unused-parameter" ]
-
-    include_dirs = [
-        "//base/iot_hardware/peripheral/interfaces/kits",
-        "//base/iot_hardware/peripheral/interfaces/kits",
-        "//device/bossay/hi3861_l0/iot_hardware_hals/include",
-        "//device/bossay/hi3861_l0/sdk_liteos/include",
-        "include",
-    ]
-    sources = [
-        "src/OLED_I2C.c",
-        "OLED_DisplayTask.c",
-    ]
-}
-
-

+ 0 - 14
vendor/bossay/smart_door/demo_smartdoor/OLED/OLED_DisplayTask.c

@@ -1,14 +0,0 @@
-/*
- * Copyright (c) 2021 Jinan Bosai Network Intelligent Technology Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */

+ 0 - 44
vendor/bossay/smart_door/demo_smartdoor/OLED/include/OLED_I2C.h

@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2021 Jinan Bosai Network Intelligent Technology Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef __OLED_I2C_H
-#define	__OLED_I2C_H
-
-#include <stdint.h>
-#include <stdbool.h>
-#include "iot_gpio.h"
-
-#define OLED_ADDRESS	0x3D //通过调整0R电阻,屏可以0x3C和0x3D两个地址 -- 默认0x3C
-#define KEY_GPIO 11
-
-void initKey(GpioIsrCallbackFunc func);
-bool isKeyON(void);
-
-
-
-void OLED_BoardInit(void);
-void I2C_WriteByte(uint8_t addr,uint8_t data);
-void WriteCmd(unsigned char I2C_Command);
-void WriteDat(unsigned char I2C_Data);
-void OLED_Init(void);
-void OLED_SetPos(unsigned char x, unsigned char y);
-void OLED_Fill(unsigned char fill_Data);
-void OLED_CLS(void);
-void OLED_ON(void);
-void OLED_OFF(void);
-void OLED_ShowStr(unsigned char x, unsigned char y, unsigned char ch[], unsigned char TextSize);
-void OLED_ShowCN(unsigned char x, unsigned char y, unsigned char N);
-void OLED_DrawBMP(unsigned char x0,unsigned char y0,unsigned char x1,unsigned char y1,unsigned char BMP[]);
-
-#endif

+ 0 - 281
vendor/bossay/smart_door/demo_smartdoor/OLED/include/codetab.h

@@ -1,281 +0,0 @@
-#ifndef __CODETAB_H
-#define	__CODETAB_H
-
-
-/***************************16*16的点阵字体取模方式:共阴——列行式——逆向输出*********/
-unsigned char F16x16[] =
-
-{	0x24,0x24,0xA4,0xFE,0xA3,0x22,0x00,0x22,0xCC,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,
-	0x08,0x06,0x01,0xFF,0x00,0x01,0x04,0x04,0x04,0x04,0x04,0xFF,0x02,0x02,0x02,0x00,/*"科",0*/
-
-	0x10,0x10,0x10,0xFF,0x10,0x90,0x08,0x88,0x88,0x88,0xFF,0x88,0x88,0x88,0x08,0x00,
-	0x04,0x44,0x82,0x7F,0x01,0x80,0x80,0x40,0x43,0x2C,0x10,0x28,0x46,0x81,0x80,0x00/*"技",1*/
-};
-
-
-/************************************6*8的点阵************************************/
-const unsigned char F6x8[][6] =
-{
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00,// sp
-	0x00, 0x00, 0x00, 0x2f, 0x00, 0x00,// !
-	0x00, 0x00, 0x07, 0x00, 0x07, 0x00,// "
-	0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14,// #
-	0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12,// $
-	0x00, 0x62, 0x64, 0x08, 0x13, 0x23,// %
-	0x00, 0x36, 0x49, 0x55, 0x22, 0x50,// &
-	0x00, 0x00, 0x05, 0x03, 0x00, 0x00,// '
-	0x00, 0x00, 0x1c, 0x22, 0x41, 0x00,// (
-	0x00, 0x00, 0x41, 0x22, 0x1c, 0x00,// )
-	0x00, 0x14, 0x08, 0x3E, 0x08, 0x14,// *
-	0x00, 0x08, 0x08, 0x3E, 0x08, 0x08,// +
-	0x00, 0x00, 0x00, 0xA0, 0x60, 0x00,// ,
-	0x00, 0x08, 0x08, 0x08, 0x08, 0x08,// -
-	0x00, 0x00, 0x60, 0x60, 0x00, 0x00,// .
-	0x00, 0x20, 0x10, 0x08, 0x04, 0x02,// /
-	0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E,// 0
-	0x00, 0x00, 0x42, 0x7F, 0x40, 0x00,// 1
-	0x00, 0x42, 0x61, 0x51, 0x49, 0x46,// 2
-	0x00, 0x21, 0x41, 0x45, 0x4B, 0x31,// 3
-	0x00, 0x18, 0x14, 0x12, 0x7F, 0x10,// 4
-	0x00, 0x27, 0x45, 0x45, 0x45, 0x39,// 5
-	0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30,// 6
-	0x00, 0x01, 0x71, 0x09, 0x05, 0x03,// 7
-	0x00, 0x36, 0x49, 0x49, 0x49, 0x36,// 8
-	0x00, 0x06, 0x49, 0x49, 0x29, 0x1E,// 9
-	0x00, 0x00, 0x36, 0x36, 0x00, 0x00,// :
-	0x00, 0x00, 0x56, 0x36, 0x00, 0x00,// ;
-	0x00, 0x08, 0x14, 0x22, 0x41, 0x00,// <
-	0x00, 0x14, 0x14, 0x14, 0x14, 0x14,// =
-	0x00, 0x00, 0x41, 0x22, 0x14, 0x08,// >
-	0x00, 0x02, 0x01, 0x51, 0x09, 0x06,// ?
-	0x00, 0x32, 0x49, 0x59, 0x51, 0x3E,// @
-	0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C,// A
-	0x00, 0x7F, 0x49, 0x49, 0x49, 0x36,// B
-	0x00, 0x3E, 0x41, 0x41, 0x41, 0x22,// C
-	0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C,// D
-	0x00, 0x7F, 0x49, 0x49, 0x49, 0x41,// E
-	0x00, 0x7F, 0x09, 0x09, 0x09, 0x01,// F
-	0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A,// G
-	0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F,// H
-	0x00, 0x00, 0x41, 0x7F, 0x41, 0x00,// I
-	0x00, 0x20, 0x40, 0x41, 0x3F, 0x01,// J
-	0x00, 0x7F, 0x08, 0x14, 0x22, 0x41,// K
-	0x00, 0x7F, 0x40, 0x40, 0x40, 0x40,// L
-	0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F,// M
-	0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F,// N
-	0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E,// O
-	0x00, 0x7F, 0x09, 0x09, 0x09, 0x06,// P
-	0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E,// Q
-	0x00, 0x7F, 0x09, 0x19, 0x29, 0x46,// R
-	0x00, 0x46, 0x49, 0x49, 0x49, 0x31,// S
-	0x00, 0x01, 0x01, 0x7F, 0x01, 0x01,// T
-	0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F,// U
-	0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F,// V
-	0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F,// W
-	0x00, 0x63, 0x14, 0x08, 0x14, 0x63,// X
-	0x00, 0x07, 0x08, 0x70, 0x08, 0x07,// Y
-	0x00, 0x61, 0x51, 0x49, 0x45, 0x43,// Z
-	0x00, 0x00, 0x7F, 0x41, 0x41, 0x00,// [
-	0x00, 0x55, 0x2A, 0x55, 0x2A, 0x55,// 55
-	0x00, 0x00, 0x41, 0x41, 0x7F, 0x00,// ]
-	0x00, 0x04, 0x02, 0x01, 0x02, 0x04,// ^
-	0x00, 0x40, 0x40, 0x40, 0x40, 0x40,// _
-	0x00, 0x00, 0x01, 0x02, 0x04, 0x00,// '
-	0x00, 0x20, 0x54, 0x54, 0x54, 0x78,// a
-	0x00, 0x7F, 0x48, 0x44, 0x44, 0x38,// b
-	0x00, 0x38, 0x44, 0x44, 0x44, 0x20,// c
-	0x00, 0x38, 0x44, 0x44, 0x48, 0x7F,// d
-	0x00, 0x38, 0x54, 0x54, 0x54, 0x18,// e
-	0x00, 0x08, 0x7E, 0x09, 0x01, 0x02,// f
-	0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C,// g
-	0x00, 0x7F, 0x08, 0x04, 0x04, 0x78,// h
-	0x00, 0x00, 0x44, 0x7D, 0x40, 0x00,// i
-	0x00, 0x40, 0x80, 0x84, 0x7D, 0x00,// j
-	0x00, 0x7F, 0x10, 0x28, 0x44, 0x00,// k
-	0x00, 0x00, 0x41, 0x7F, 0x40, 0x00,// l
-	0x00, 0x7C, 0x04, 0x18, 0x04, 0x78,// m
-	0x00, 0x7C, 0x08, 0x04, 0x04, 0x78,// n
-	0x00, 0x38, 0x44, 0x44, 0x44, 0x38,// o
-	0x00, 0xFC, 0x24, 0x24, 0x24, 0x18,// p
-	0x00, 0x18, 0x24, 0x24, 0x18, 0xFC,// q
-	0x00, 0x7C, 0x08, 0x04, 0x04, 0x08,// r
-	0x00, 0x48, 0x54, 0x54, 0x54, 0x20,// s
-	0x00, 0x04, 0x3F, 0x44, 0x40, 0x20,// t
-	0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C,// u
-	0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C,// v
-	0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C,// w
-	0x00, 0x44, 0x28, 0x10, 0x28, 0x44,// x
-	0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C,// y
-	0x00, 0x44, 0x64, 0x54, 0x4C, 0x44,// z
-	0x14, 0x14, 0x14, 0x14, 0x14, 0x14,// horiz lines
-};
-/****************************************8*16的点阵************************************/
-const unsigned char F8X16[]=	  
-{
-  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,// 0
-  0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00,//! 1
-  0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//" 2
-  0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00,//# 3
-  0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00,//$ 4
-  0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00,//% 5
-  0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10,//& 6
-  0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//' 7
-  0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,//( 8
-  0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,//) 9
-  0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,//* 10
-  0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00,//+ 11
-  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,//, 12
-  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,//- 13
-  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,//. 14
-  0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,/// 15
-  0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,//0 16
-  0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//1 17
-  0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,//2 18
-  0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,//3 19
-  0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,//4 20
-  0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,//5 21
-  0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,//6 22
-  0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,//7 23
-  0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,//8 24
-  0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,//9 25
-  0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,//: 26
-  0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,//; 27
-  0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,//< 28
-  0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,//= 29
-  0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,//> 30
-  0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00,//? 31
-  0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00,//@ 32
-  0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,//A 33
-  0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,//B 34
-  0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,//C 35
-  0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,//D 36
-  0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,//E 37
-  0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,//F 38
-  0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,//G 39
-  0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,//H 40
-  0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//I 41
-  0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,//J 42
-  0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,//K 43
-  0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,//L 44
-  0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00,//M 45
-  0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,//N 46
-  0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,//O 47
-  0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,//P 48
-  0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00,//Q 49
-  0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,//R 50
-  0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,//S 51
-  0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//T 52
-  0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//U 53
-  0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,//V 54
-  0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00,//W 55
-  0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,//X 56
-  0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//Y 57
-  0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00,//Z 58
-  0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,//[ 59
-  0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,//\ 60
-  0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,//] 61
-  0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//^ 62
-  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,//_ 63
-  0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//` 64
-  0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,//a 65
-  0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,//b 66
-  0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,//c 67
-  0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,//d 68
-  0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,//e 69
-  0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//f 70
-  0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,//g 71
-  0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//h 72
-  0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//i 73
-  0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,//j 74
-  0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,//k 75
-  0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//l 76
-  0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,//m 77
-  0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//n 78
-  0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//o 79
-  0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,//p 80
-  0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,//q 81
-  0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,//r 82
-  0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,//s 83
-  0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,//t 84
-  0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,//u 85
-  0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,//v 86
-  0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00,//w 87
-  0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00,//x 88
-  0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,//y 89
-  0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,//z 90
-  0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40,//{ 91
-  0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,//| 92
-  0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00,//} 93
-  0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//~ 94
-};
-
-unsigned char BMP1[] =
-{
-	0x00,0x03,0x05,0x09,0x11,0xFF,0x11,0x89,0x05,0xC3,0x00,0xE0,0x00,0xF0,0x00,0xF8,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x28,0xFF,0x11,0xAA,0x44,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x83,0x01,0x38,0x44,0x82,0x92,
-	0x92,0x74,0x01,0x83,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x44,0xC7,0x01,0x7D,
-	0x7D,0x7D,0x7D,0x01,0x7D,0x7D,0x7D,0x7D,0x01,0x7D,0x7D,0x7D,0x7D,0x01,0xFF,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,
-	0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x00,0x00,
-	0x6D,0x6D,0x6D,0x6D,0x6D,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x40,0x40,
-	0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDB,0xDB,0xDB,0xDB,0xDB,0x00,0x00,
-	0xDB,0xDB,0xDB,0xDB,0xDB,0x00,0x00,0xDB,0xDB,0xDB,0xDB,0xDB,0x00,0x00,0xDB,0xDB,
-	0xDB,0xDB,0xDB,0x00,0x00,0xDA,0xDA,0xDA,0xDA,0xDA,0x00,0x00,0xD8,0xD8,0xD8,0xD8,
-	0xD8,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,
-	0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x80,
-	0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x00,0x00,
-	0x06,0x06,0x06,0x06,0x06,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x00,0x00,0x06,0x06,
-	0x06,0x06,0x06,0x00,0x00,0x06,0x06,0x06,0xE6,0x66,0x20,0x00,0x06,0x06,0x86,0x06,
-	0x06,0x00,0x00,0x06,0x06,0x06,0x06,0x86,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x00,
-	0x00,0x86,0x86,0x86,0x86,0x86,0x80,0x80,0x86,0x86,0x06,0x86,0x86,0xC0,0xC0,0x86,
-	0x86,0x86,0x06,0x06,0xD0,0x30,0x76,0x06,0x06,0x06,0x06,0x00,0x00,0x06,0x06,0x06,
-	0x06,0x06,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x00,0x00,0x06,0x06,0x06,0x06,0x06,
-	0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x1C,0x00,0xFE,0x00,0x01,
-	0x02,0x00,0xC4,0x18,0x20,0x02,0x9E,0x63,0xB2,0x0E,0x00,0xFF,0x81,0x81,0xFF,0x00,
-	0x00,0x80,0x40,0x30,0x0F,0x00,0x00,0x00,0x00,0xFF,0x00,0x23,0xEA,0xAA,0xBF,0xAA,
-	0xEA,0x03,0x3F,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x0C,0x08,0x00,0x00,0x01,0x01,0x01,
-	0x01,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x81,0x80,0x80,0x81,0x80,
-	0x81,0x80,0x80,0x80,0x80,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
-	0x01,0x00,0x01,0x01,0x09,0x0C,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
-	0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,
-	0x00,0x1E,0x21,0x40,0x40,0x50,0x21,0x5E,0x00,0x1E,0x21,0x40,0x40,0x50,0x21,0x5E,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xC1,0xC1,0xFF,
-	0xFF,0xC1,0xC1,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x80,0xFC,0xF3,0xEF,0xF3,0xFC,
-	0x80,0xFF,0x80,0xEE,0xEE,0xEE,0xF5,0xFB,0xFF,0x9C,0xBE,0xB6,0xB6,0x88,0xFF,0x00,/*"D:\DreamSpark\OLED\MP3_UI.bmp",0*/
-};
-
-
-#endif

+ 0 - 228
vendor/bossay/smart_door/demo_smartdoor/OLED/include/iot_gpio.h

@@ -1,228 +0,0 @@
-/*
- * Copyright (c) 2020 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @addtogroup IotHardware
- * @{
- *
- * @brief Provides APIs for operating devices,
- * including flash, GPIO, I2C, PWM, UART, and watchdog APIs.
- *
- *
- *
- * @since 2.2
- * @version 2.2
- */
-
-/**
- * @file iot_gpio.h
- *
- * @brief Declares functions for operating GPIO devices.
- *
- * These functions are used for GPIO initialization, input/output settings, and level settings. \n
- *
- * @since 2.2
- * @version 2.2
- */
-#ifndef IOT_GPIO_H
-#define IOT_GPIO_H
-
-/**
- * @brief Enumerates GPIO level values.
- */
-typedef enum {
-    /** Low GPIO level */
-    IOT_GPIO_VALUE0 = 0,
-    /** High GPIO level */
-    IOT_GPIO_VALUE1
-} IotGpioValue;
-
-/**
- * @brief Enumerates GPIO directions.
- */
-typedef enum {
-    /** Input */
-    IOT_GPIO_DIR_IN = 0,
-    /** Output */
-    IOT_GPIO_DIR_OUT
-} IotGpioDir;
-
-/**
- * @brief Enumerates GPIO interrupt trigger modes.
- */
-typedef enum {
-    /** Level-sensitive interrupt */
-    IOT_INT_TYPE_LEVEL = 0,
-    /** Edge-sensitive interrupt */
-    IOT_INT_TYPE_EDGE
-} IotGpioIntType;
-
-/**
- * @brief Enumerates I/O interrupt polarities.
- */
-typedef enum {
-    /** Interrupt at a low level or falling edge */
-    IOT_GPIO_EDGE_FALL_LEVEL_LOW = 0,
-    /** Interrupt at a high level or rising edge */
-    IOT_GPIO_EDGE_RISE_LEVEL_HIGH
-} IotGpioIntPolarity;
-
-/**
- * @brief Indicates the GPIO interrupt callback.
- *
- */
-typedef void (*GpioIsrCallbackFunc) (char *arg);
-
-/**
- * @brief Initializes a GPIO device.
- *
- * @param id Indicates the GPIO pin number.
- * @return Returns {@link IOT_SUCCESS} if the GPIO device is initialized;
- * returns {@link IOT_FAILURE} otherwise. For details about other return values, see the chip description.
- * @since 2.2
- * @version 2.2
- */
-unsigned int IoTGpioInit(unsigned int id);
-
-/**
- * @brief Deinitializes a GPIO device.
- *
- * @param id Indicates the GPIO pin number.
- * @return Returns {@link IOT_SUCCESS} if the GPIO device is deinitialized;
- * returns {@link IOT_FAILURE} otherwise. For details about other return values, see the chip description.
- * @since 2.2
- * @version 2.2
- */
-unsigned int IoTGpioDeinit(unsigned int id);
-
-/**
- * @brief Sets the direction for a GPIO pin.
- *
- * @param id Indicates the GPIO pin number.
- * @param dir Indicates the GPIO input/output direction.
- * @return Returns {@link IOT_SUCCESS} if the direction is set;
- * returns {@link IOT_FAILURE} otherwise. For details about other return values, see the chip description.
- * @since 2.2
- * @version 2.2
- */
-unsigned int IoTGpioSetDir(unsigned int id, IotGpioDir dir);
-
-/**
- * @brief Obtains the direction for a GPIO pin.
- *
- * @param id Indicates the GPIO pin number.
- * @param dir Indicates the pointer to the GPIO input/output direction.
- * @return Returns {@link IOT_SUCCESS} if the direction is obtained;
- * returns {@link IOT_FAILURE} otherwise. For details about other return values, see the chip description.
- * @since 2.2
- * @version 2.2
- */
-unsigned int IoTGpioGetDir(unsigned int id, IotGpioDir *dir);
-
-/**
- * @brief Sets the output level value for a GPIO pin.
- *
- * @param id Indicates the GPIO pin number.
- * @param val Indicates the output level value.
- * @return Returns {@link IOT_SUCCESS} if the output level value is set;
- * returns {@link IOT_FAILURE} otherwise. For details about other return values, see the chip description.
- * @since 2.2
- * @version 2.2
- */
-unsigned int IoTGpioSetOutputVal(unsigned int id, IotGpioValue val);
-
-/**
- * @brief Obtains the output level value of a GPIO pin.
- *
- * @param id Indicates the GPIO pin number.
- * @param val Indicates the pointer to the output level value.
- * @return Returns {@link IOT_SUCCESS} if the output level value is obtained;
- * returns {@link IOT_FAILURE} otherwise. For details about other return values, see the chip description.
- * @since 2.2
- * @version 2.2
- */
-unsigned int IoTGpioGetOutputVal(unsigned int id, IotGpioValue *val);
-
-/**
- * @brief Obtains the input level value of a GPIO pin.
- *
- * @param id Indicates the GPIO pin number.
- * @param val Indicates the pointer to the input level value.
- * @return Returns {@link IOT_SUCCESS} if the input level value is obtained;
- * returns {@link IOT_FAILURE} otherwise. For details about other return values, see the chip description.
- * @since 2.2
- * @version 2.2
- */
-unsigned int IoTGpioGetInputVal(unsigned int id, IotGpioValue *val);
-
-/**
- * @brief Enables the interrupt feature for a GPIO pin.
- *
- * This function can be used to set the interrupt type, interrupt polarity, and interrupt callback for a GPIO pin.
- *
- * @param id Indicates the GPIO pin number.
- * @param intType Indicates the interrupt type.
- * @param intPolarity Indicates the interrupt polarity.
- * @param func Indicates the interrupt callback function.
- * @param arg Indicates the pointer to the argument used in the interrupt callback function.
- * @return Returns {@link IOT_SUCCESS} if the interrupt feature is enabled;
- * returns {@link IOT_FAILURE} otherwise. For details about other return values, see the chip description.
- * @since 2.2
- * @version 2.2
- */
-unsigned int IoTGpioRegisterIsrFunc(unsigned int id, IotGpioIntType intType, IotGpioIntPolarity intPolarity,
-                                    GpioIsrCallbackFunc func, char *arg);
-
-/**
- * @brief Disables the interrupt feature for a GPIO pin.
- *
- * @param id Indicates the GPIO pin number.
- * @return Returns {@link IOT_SUCCESS} if the interrupt feature is disabled;
- * returns {@link IOT_FAILURE} otherwise. For details about other return values, see the chip description.
- * @since 2.2
- * @version 2.2
- */
-unsigned int IoTGpioUnregisterIsrFunc(unsigned int id);
-
-/**
- * @brief Masks the interrupt feature for a GPIO pin.
- *
- * @param id Indicates the GPIO pin number.
- * @param mask Indicates whether the interrupt function is masked.
- * The value <b>1</b> means to mask the interrupt function, and <b>0</b> means not to mask the interrupt function.
- * @return Returns {@link IOT_SUCCESS} if the interrupt feature is masked;
- * returns {@link IOT_FAILURE} otherwise. For details about other return values, see the chip description.
- * @since 2.2
- * @version 2.2
- */
-unsigned int IoTGpioSetIsrMask(unsigned int id, unsigned char mask);
-
-/**
- * @brief Sets the interrupt trigger mode of a GPIO pin.
- *
- * This function configures a GPIO pin based on the interrupt type and interrupt polarity.
- *
- * @param id Indicates the GPIO pin number.
- * @param intType Indicates the interrupt type.
- * @param intPolarity Indicates the interrupt polarity.
- * @return Returns {@link IOT_SUCCESS} if the interrupt trigger mode is set;
- * returns {@link IOT_FAILURE} otherwise. For details about other return values, see the chip description.
- * @since 2.2
- * @version 2.2
- */
-unsigned int IoTGpioSetIsrMode(unsigned int id, IotGpioIntType intType, IotGpioIntPolarity intPolarity);
-
-#endif
-/** @} */

+ 0 - 311
vendor/bossay/smart_door/demo_smartdoor/OLED/src/OLED_I2C.c

@@ -1,311 +0,0 @@
-#include "OLED_I2C.h"
-#include "codetab.h"
-#include "iot_gpio.h"
-#include "iot_gpio_ex.h"
-#include "iot_i2c.h"
-#include "iot_i2c_ex.h"
-#include <cmsis_os2.h>
-
-#define I2C1_SDA_GPIO 10
-#define I2C1_SCL_GPIO 9
-#define IOT_GPIO_FUNC_GPIO_0_I2C1_SDA  6
-#define IOT_GPIO_FUNC_GPIO_1_I2C1_SCL 6
-#define WIFI_IOT_I2C_IDX_1 0
-
-#define BEEP_GPIO 12
-
-
-
-void initKey(GpioIsrCallbackFunc func)
-{    
-    IoTGpioInit(KEY_GPIO);
-    IoTGpioSetFunc(KEY_GPIO, IOT_GPIO_FUNC_GPIO_11_GPIO);
-    IoTGpioSetDir(KEY_GPIO, IOT_GPIO_DIR_IN);
-	IoTGpioSetPull(KEY_GPIO, IOT_GPIO_PULL_UP);
-    IoTGpioRegisterIsrFunc(KEY_GPIO, IOT_INT_TYPE_EDGE, IOT_GPIO_EDGE_FALL_LEVEL_LOW, func, NULL);
-}
-
-
-
-
-bool isKeyON(void)
-{
-    IotGpioValue temp;
-    IoTGpioGetInputVal(KEY_GPIO,&temp);
-    return !temp;
-}
-
-void OLED_BoardInit(void)
-{   
-    IoTGpioInit(BEEP_GPIO);
-    IoTGpioSetFunc(BEEP_GPIO, IOT_GPIO_FUNC_GPIO_12_GPIO);
-    IoTGpioSetDir(BEEP_GPIO, IOT_GPIO_DIR_OUT); // 设置GPIO_14为输出模式
-
-    IoTGpioSetOutputVal(BEEP_GPIO, 1); // 设置输出高电平打开蜂鸣器
-
-    //GPIO_0复用为I2C1_SDA
-    IoTGpioInit(I2C1_SDA_GPIO);
-    IoTGpioSetFunc(I2C1_SDA_GPIO, IOT_GPIO_FUNC_GPIO_10_I2C0_SDA);
-
-    //GPIO_1复用为I2C1_SCL
-    IoTGpioInit(I2C1_SCL_GPIO);
-    IoTGpioSetFunc(I2C1_SCL_GPIO, IOT_GPIO_FUNC_GPIO_9_I2C0_SCL);
-
-    //baudrate: 400kbps
-    IoTI2cInit(WIFI_IOT_I2C_IDX_1, 400000);
-
-}
-
- /**
-  * @brief  I2C_WriteByte,向OLED寄存器地址写一个byte的数据
-  * @param  addr:寄存器地址
-	*					data:要写入的数据
-  * @retval 无
-  */
-void I2C_WriteByte(uint8_t addr,uint8_t data)
-{
-    uint32_t ret;
-    uint8_t send_data[2] = {addr, data};
-    ret = IoTI2cWrite(WIFI_IOT_I2C_IDX_1, (OLED_ADDRESS << 1) | 0x00, send_data, 2);
-    if (ret != 0) {
-        printf("===== Error: I2C write ret = 0x%x! =====\r\n", ret);
-        return -1;
-    }
-    return 0;
-}
-
-
- /**
-  * @brief  WriteCmd,向OLED写入命令
-  * @param  I2C_Command:命令代码
-  * @retval 无
-  */
-void WriteCmd(unsigned char I2C_Command)//写命令
-{
-	I2C_WriteByte(0x00, I2C_Command);
-}
-
-
- /**
-  * @brief  WriteDat,向OLED写入数据
-  * @param  I2C_Data:数据
-  * @retval 无
-  */
-void WriteDat(unsigned char I2C_Data)//写数据
-{
-	I2C_WriteByte(0x40, I2C_Data);
-}
-
-
- /**
-  * @brief  OLED_Init,初始化OLED
-  * @param  无
-  * @retval 无
-  */
-void OLED_Init(void)
-{
-	osDelay(100); //这里的延时很重要
-	
-	WriteCmd(0xAE); //display off
-	WriteCmd(0x20);	//Set Memory Addressing Mode	
-	WriteCmd(0x10);	//00,Horizontal Addressing Mode;01,Vertical Addressing Mode;10,Page Addressing Mode (RESET);11,Invalid
-	WriteCmd(0xb0);	//Set Page Start Address for Page Addressing Mode,0-7
-	WriteCmd(0xc8);	//Set COM Output Scan Direction
-	WriteCmd(0x00); //---set low column address
-	WriteCmd(0x10); //---set high column address
-	WriteCmd(0x40); //--set start line address
-	WriteCmd(0x81); //--set contrast control register
-	WriteCmd(0xff); //亮度调节 0x00~0xff
-	WriteCmd(0xa1); //--set segment re-map 0 to 127
-	WriteCmd(0xa6); //--set normal display
-	WriteCmd(0xa8); //--set multiplex ratio(1 to 64)
-	WriteCmd(0x3F); //
-	WriteCmd(0xa4); //0xa4,Output follows RAM content;0xa5,Output ignores RAM content
-	WriteCmd(0xd3); //-set display offset
-	WriteCmd(0x00); //-not offset
-	WriteCmd(0xd5); //--set display clock divide ratio/oscillator frequency
-	WriteCmd(0xf0); //--set divide ratio
-	WriteCmd(0xd9); //--set pre-charge period
-	WriteCmd(0x22); //
-	WriteCmd(0xda); //--set com pins hardware configuration
-	WriteCmd(0x12);
-	WriteCmd(0xdb); //--set vcomh
-	WriteCmd(0x20); //0x20,0.77xVcc
-	WriteCmd(0x8d); //--set DC-DC enable
-	WriteCmd(0x14); //
-	WriteCmd(0xaf); //--turn on oled panel
-}
-
-
- /**
-  * @brief  OLED_SetPos,设置光标
-  * @param  x,光标x位置
-	*					y,光标y位置
-  * @retval 无
-  */
-void OLED_SetPos(unsigned char x, unsigned char y) //设置起始点坐标
-{ 
-	WriteCmd(0xb0+y);
-	WriteCmd(((x&0xf0)>>4)|0x10);
-	WriteCmd((x&0x0f)|0x01);
-}
-
- /**
-  * @brief  OLED_Fill,填充整个屏幕
-  * @param  fill_Data:要填充的数据
-	* @retval 无
-  */
-void OLED_Fill(unsigned char fill_Data)//全屏填充
-{
-	unsigned char m,n;
-	for(m=0;m<8;m++)
-	{
-		WriteCmd(0xb0+m);		//page0-page1
-		WriteCmd(0x00);		//low column start address
-		WriteCmd(0x10);		//high column start address
-		for(n=0;n<128;n++)
-			{
-				WriteDat(fill_Data);
-			}
-	}
-}
-
- /**
-  * @brief  OLED_CLS,清屏
-  * @param  无
-	* @retval 无
-  */
-void OLED_CLS(void)//清屏
-{
-	OLED_Fill(0x00);
-}
-
-
- /**
-  * @brief  OLED_ON,将OLED从休眠中唤醒
-  * @param  无
-	* @retval 无
-  */
-void OLED_ON(void)
-{
-	WriteCmd(0X8D);  //设置电荷泵
-	WriteCmd(0X14);  //开启电荷泵
-	WriteCmd(0XAF);  //OLED唤醒
-}
-
-
- /**
-  * @brief  OLED_OFF,让OLED休眠 -- 休眠模式下,OLED功耗不到10uA
-  * @param  无
-	* @retval 无
-  */
-void OLED_OFF(void)
-{
-	WriteCmd(0X8D);  //设置电荷泵
-	WriteCmd(0X10);  //关闭电荷泵
-	WriteCmd(0XAE);  //OLED休眠
-}
-
-
- /**
-  * @brief  OLED_ShowStr,显示codetab.h中的ASCII字符,有6*8和8*16可选择
-  * @param  x,y : 起始点坐标(x:0~127, y:0~7);
-	*					ch[] :- 要显示的字符串; 
-	*					TextSize : 字符大小(1:6*8 ; 2:8*16)
-	* @retval 无
-  */
-void OLED_ShowStr(unsigned char x, unsigned char y, unsigned char ch[], unsigned char TextSize)
-{
-	unsigned char c = 0,i = 0,j = 0;
-	switch(TextSize)
-	{
-		case 1:
-		{
-			while(ch[j] != '\0')
-			{
-				c = ch[j] - 32;
-				if(x > 126)
-				{
-					x = 0;
-					y++;
-				}
-				OLED_SetPos(x,y);
-				for(i=0;i<6;i++)
-					WriteDat(F6x8[c][i]);
-				x += 6;
-				j++;
-			}
-		}break;
-		case 2:
-		{
-			while(ch[j] != '\0')
-			{
-				c = ch[j] - 32;
-				if(x > 120)
-				{
-					x = 0;
-					y++;
-				}
-				OLED_SetPos(x,y);
-				for(i=0;i<8;i++)
-					WriteDat(F8X16[c*16+i]);
-				OLED_SetPos(x,y+1);
-				for(i=0;i<8;i++)
-					WriteDat(F8X16[c*16+i+8]);
-				x += 8;
-				j++;
-			}
-		}break;
-	}
-}
-
- /**
-  * @brief  OLED_ShowCN,显示codetab.h中的汉字,16*16点阵
-  * @param  x,y: 起始点坐标(x:0~127, y:0~7); 
-	*					N:汉字在codetab.h中的索引
-	* @retval 无
-  */
-void OLED_ShowCN(unsigned char x, unsigned char y, unsigned char N)
-{
-	unsigned char wm=0;
-	unsigned int  adder=32*N;
-	OLED_SetPos(x , y);
-	for(wm = 0;wm < 16;wm++)
-	{
-		WriteDat(F16x16[adder]);
-		adder += 1;
-	}
-	OLED_SetPos(x,y + 1);
-	for(wm = 0;wm < 16;wm++)
-	{
-		WriteDat(F16x16[adder]);
-		adder += 1;
-	}
-}
-
-
-
- /**
-  * @brief  OLED_DrawBMP,显示BMP位图
-  * @param  x0,y0 :起始点坐标(x0:0~127, y0:0~7);
-	*					x1,y1 : 起点对角线(结束点)的坐标(x1:1~128,y1:1~8)
-	* @retval 无
-  */
-void OLED_DrawBMP(unsigned char x0,unsigned char y0,unsigned char x1,unsigned char y1,unsigned char BMP[])
-{
-	unsigned int j=0;
-	unsigned char x,y;
-
-  if(y1%8==0)
-		y = y1/8;
-  else
-		y = y1/8 + 1;
-	for(y=y0;y<y1;y++)
-	{
-		OLED_SetPos(x0,y);
-    for(x=x0;x<x1;x++)
-		{
-			WriteDat(BMP[j++]);
-		}
-	}
-}

+ 0 - 25
vendor/bossay/smart_door/demo_smartdoor/cloud_connect/BUILD.gn

@@ -1,25 +0,0 @@
-static_library("cloud_connect") {
-    sources = [
-        "src/cloud_communicate.c",
-        "src/cloud_schedule.c",
-    ]
-    
-    cflags = [ "-Wno-unused-variable" ]
-    cflags += [ "-Wno-unused-but-set-variable" ]
-    cflags += [ "-Wno-unused-parameter" ]
-    
-    include_dirs = [
-        "inc",
-        "../../../common/inc",
-        "//third_party/cJSON",
-        "//utils/native/lite/include/",
-    ]
-
-    deps = [ 
-        "../../../common/iot_schedule:iot_schedule",
-        "../../../common/iot_cloud:iot_cloud",
-        "../../../common/iot_wifi:iot_wifi",
-        "../../../common/iot_sntp:iot_sntp",
-    ]
-
-}

+ 0 - 170
vendor/bossay/smart_door/demo_smartdoor/cloud_connect/inc/cloud_communicate.h

@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 2021 Jinan Bosai Network Intelligent Technology Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-/*
-    Standard information upload:
-    format:
-    serviceID
-        |-- proprety_01
-        |    |-- status
-        |-- proprety_02
-             |-- status
-
-        status:
-        typedef enum {
-            IOT_PROFILE_KEY_DATATYPE_INT = 0,
-            IOT_PROFILE_KEY_DATATYPE_LONG,
-            IOT_PROFILE_KEY_DATATYPE_FLOAT,
-            IOT_PROFILE_KEY_DATATYPE_DOUBLE,
-            IOT_PROFILE_KEY_DATATYPE_STRING,
-            IOT_PROFILE_KEY_DATATYPE_LAST,
-        }IotProfileDataType;
-
-    so we just construct a struct named InforUplod:
-    struct InforService
-    {
-        serviceIDName;
-        nextProtrety;
-    };
-    struct InforProprety
-    {
-        propretyType;
-        propretyName;
-        value;
-        nextProtrety;
-    };
-
-    IotProfileService service = createService("serviceID");
-    createProprety(&service,"propretyName",propretyType);
-    deleteProprety(&service,"propretyName",propretyType);
-    uploadService(&service);
-*/
-
-#ifndef __CLOUD_COMMUNICATE_H__
-#define __CLOUD_COMMUNICATE_H__
-
-#include "iot_cloud.h"
-#include <cmsis_os2.h>
-#include <stdbool.h>
-#include "cJSON.h"
-
-#define CLOUD_MALLOC_ENABEL true
-
-#define CLOUD_COMMAND_NAME "command_name"
-#define CLOUD_PARA_NAME "paras"
-#define WIFI_SSID_MAX_LEN_ 256
-#define WIFI_PWD_MAX_LEN_ 256
-#define KV_STORE_SSID_ID "ssid"
-#define KV_STORE_PWD_ID "pwd"
-#define NAN_WIFI_AP_SSID "bossay"
-
-#define MAX_STRING_VALUE_LEN 30
-#define MAX_CMD_NAME_LEN 30
-#define MAX_CMD_PARA_NAME_LEN 30
-
-
-typedef union 
-{
-    /* data */
-    int valueInt;
-    double valueDouble;
-    char valueString[MAX_STRING_VALUE_LEN];
-}CmdValue;
-
-typedef enum
-{
-    Cloud_Int,
-    Cloud_Double,
-    Cloud_String,
-}ValueType;
-
-typedef struct{
-    CmdValue value;
-    ValueType type;
-}FuncValue_t;
-
-typedef int (*cmdFuncCallback)(FuncValue_t value);
-
-typedef struct 
-{
-    /* data */
-    char name[MAX_CMD_PARA_NAME_LEN];
-    ValueType type;
-    cmdFuncCallback func;
-    struct CmdParam *nxt;
-}CmdParam;
-
-
-typedef struct {
-//    CmdValue value;
-    char name[MAX_CMD_NAME_LEN];
-    CmdParam* params;
-    struct cmdNode *nxt;
-}CmdNode;
-
-
-typedef struct{
-    char ssid[WIFI_SSID_MAX_LEN_];
-    char pwd[WIFI_PWD_MAX_LEN_];
-}WIFI_ssid_pwd;
-
-
-
-//int getStoredWifiInfo(WIFI_ssid_pwd* wifi);
-//int setStoredWifiInfo(WIFI_ssid_pwd* wifi);
-int NanWifiConnect(bool restartNan);
-int cloud_CloudInit(const char *deviceID, const char *devicePwd, \
-    const char *serverIP, const char *serverPort);
-
-// this .h file has the 'namespace' cloud, all the variables has the prefix cloud or CLOD
-/*---------------------- The lower is uploadind message to the cloud ------------------------*/
-typedef IotProfileService   Cloud_Servic;
-typedef IotProfileKV        Cloud_Proprety;
-typedef IotProfileDataType  Cloud_DataType;
-
-
-
-#if CLOUD_MALLOC_ENABEL == true
-
-Cloud_Servic* cloud_createService(const char* name,const char * event);
-int cloud_createAndAppendProprety(Cloud_Servic *service,const char *name,Cloud_DataType type,void* value);
-void cloud_deleteService(Cloud_Servic *service);
-
-CmdNode* cloud_createCmd(char* name);
-CmdParam* cloud_createAndAppendPara(CmdNode* cmd,const char* name,ValueType type,cmdFuncCallback func);
-void cloud_deleteCmd();
-#endif
-
-#if CLOUD_MALLOC_ENABEL == false
-
-void cloud_initService(Cloud_Servic *service,const char* name,const char * event);
-void cloud_initAndAppendProprety(Cloud_Servic *service,Cloud_Proprety *proprety,const char *name,Cloud_DataType type,void* value);
-
-void cloud_initCmd(CmdNode* nextNode,char* name);
-void cloud_initAndAppendPara(CmdNode* cmd,CmdParam* para,const char* name,ValueType type,cmdFuncCallback func);
-
-#endif
-
-int cloud_uploadService(Cloud_Servic *service);
-
-/*----------------------- The lower is download message from cloud -------------------------*/
-bool cloud_isCommandName(cJSON* root,char* name);
-
-
-
-#define cloud_Connect CLOUD_Connect
-
-#endif

+ 0 - 78
vendor/bossay/smart_door/demo_smartdoor/cloud_connect/inc/cloud_schedule.h

@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2021 Jinan Bosai Network Intelligent Technology Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __CLOUD_SCHEDULE_H__
-#define __CLOUD_SCHEDULE_H__
-
-#include "iot_schedule.h"
-#include "cloud_communicate.h"
-
-#include <stdbool.h>
-#include <time.h>
-
-#define CN_MAX_WEEKDAY 7
-#define CN_MAX_SCHID 30
-
-
-// #define CLOUD_SCHEDULE_MALLOC_EN true
-// #if CLOUD_SCHEDULE_MALLOC_EN
-#define CLOUD_SCHEDULE_NAME_LEN 15
-// #else
-// #define CLOUD_SCHEDULE_NAME_LEN 30
-// #endif
-
-typedef struct tm TIME;
-
-typedef enum{
-    SCHE_UPDATE = 0,
-    SCHE_ADD,
-    SCHE_DELELTE,
-}SheduleUpdateOption;
-
-typedef struct{
-    CmdParam* param;
-    CmdValue value;
-}CmdControl;
-
-typedef struct {
-    uint8_t Days;         // the day which has 1001100 format
-    uint8_t startHour;   // less than 24
-    uint8_t startMinute; // less than 60
-    uint8_t startSeconds;
-    uint16_t duration;    // less than 1440
-    CmdControl ctrl;
-    char id[CLOUD_SCHEDULE_NAME_LEN];
-    struct ScheduleCtrl_t* nxt;
-}ScheduleCtrl_t;
-
-
-
-
-void bindingScheduleToCmd(ScheduleCtrl_t* schedule,CmdNode* cmd,const char* name,ValueType type,cmdFuncCallback func);
-
-void ScheduleInit();
-
-void updataSchedule(ScheduleCtrl_t* shedule,SheduleUpdateOption option);
-
-
-ScheduleCtrl_t* cloud_createSchedule(char* id,uint8_t wdays,uint8_t start_hour,uint8_t start_min,\
-                                    uint8_t start_sec,uint16_t dur, CmdControl ctrl);
-int cloud_updateSchedule(char* id,uint8_t wdays,uint8_t start_hour,uint8_t start_min,\
-                                    uint8_t start_sec,uint16_t dur);
-int cloud_deleteScheduleByID(const char* id);
-
-
-
-#endif

+ 0 - 525
vendor/bossay/smart_door/demo_smartdoor/cloud_connect/src/cloud_communicate.c

@@ -1,525 +0,0 @@
-/*
- * @Author: bearpi_gdtr
- * @Date: 2022-03-18 17:32:25
- * @LastEditTime: 2022-03-31 09:29:59
- * @LastEditors: Please set LastEditors
- * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
- * @FilePath: \v3_0_2\vendor\bossay\smart_door\demo_smartdoor\cloud_command\src\cloud_commuinate.c
- */
-#include "cloud_communicate.h"
-#include "network_config_service.h"
-#include "iot_wifi.h"
-#include "kv_store.h"
-#include <stdio.h>
-#include <string.h>
-
-
-static CmdNode cmdNodeFirst = {
-    .nxt = NULL,
-    .params = NULL,
-    .name = NULL,
-    //.value.valueU64 = 0,
-};
-
-/**
- * @description: get wifi inforamtion from kvstore
- * @param {WIFI_ssid_pwd*} wifi
- * @return {*}
- */
-int getStoredWifiInfo(WIFI_ssid_pwd* wifi)
-{
-    int ret = -1;
-    ret = UtilsGetValue(KV_STORE_SSID_ID,wifi->ssid,WIFI_SSID_MAX_LEN_);
-    if(ret != 0){
-        RaiseLog(LOG_LEVEL_DEBUG,"Can't get the wifi ssid from kV store");
-        return ret;
-    }
-    ret = UtilsGetValue(KV_STORE_PWD_ID,wifi->pwd,WIFI_PWD_MAX_LEN_);
-    if(ret != 0){
-        RaiseLog(LOG_LEVEL_DEBUG,"Can't get the wifi pwd from kV store");
-        return ret;
-    }
-    RaiseLog(LOG_LEVEL_INFO, "get wifi success! \n");
-    RaiseLog(LOG_LEVEL_INFO,"Wifi ssid: %s",wifi->ssid);
-    RaiseLog(LOG_LEVEL_INFO,"Wifi pwd: %s",wifi->pwd);
-    return ret;
-}
-
-/**
- * @description: store the wifi
- * @param {WIFI_ssid_pwd*} wifi
- * @return {*}
- */
-int setStoredWifiInfo(WIFI_ssid_pwd* wifi)
-{
-    int ret = -1;
-    ret = UtilsSetValue(KV_STORE_SSID_ID,wifi->ssid);
-    if(ret != 0){
-        RaiseLog(LOG_LEVEL_DEBUG,"Can't store the wifi ssid to the kV store");
-        return ret;
-    }
-    ret = UtilsSetValue(KV_STORE_PWD_ID,wifi->pwd);
-    if(ret != 0){
-        RaiseLog(LOG_LEVEL_DEBUG,"Can't store the wifi pwd to the kV store");
-        return ret;
-    }
-    RaiseLog(LOG_LEVEL_INFO, "Store wifi success! \n");
-    return ret;
-}
-
-/**
- * @description: initialize the cloud
- * @param {*}
- * @return {*}
- */
-int cloud_CloudInit(const char *deviceID, const char *devicePwd, \
-    const char *serverIP, const char *serverPort)
-{
-    if (CLOUD_Init() != 0) {
-        RaiseLog(LOG_LEVEL_DEBUG,"Cloud init failed");
-        return -1;
-    }
-    if (CLOUD_Connect(deviceID, devicePwd,\
-            serverIP, serverPort) != 0) {
-        RaiseLog(LOG_LEVEL_DEBUG,"Cloud connect failed");
-        return -1;
-    }
-    return 0;
-}
-
-/**
- * @description: NAN connect the wifi
- * @param {WIFI_ssid_pwd} *wifi
- * @return {*}
- */
-int NanWifiConnect(bool restartNan)
-{
-    WIFI_ssid_pwd wifi;
-    printf("--------------- NAN --------------------%d\n",sizeof(wifi.ssid));
-    if(restartNan){
-        goto CLOUD_START_NAN;
-    }
-    if(getStoredWifiInfo(&wifi) == 0){
-        goto CLOUD_CONNECT_WIFI;
-    }
-    
-CLOUD_START_NAN:
-
-    RaiseLog(LOG_LEVEL_INFO,"Try to get the wifi info by NAN network....");
-    int ret;
-    ret = BOARD_NAN_NetCfgStartConfig(NAN_WIFI_AP_SSID,wifi.ssid,sizeof(wifi.ssid),\
-                                        wifi.pwd,sizeof(wifi.pwd));
-    if(ret != 0){
-        RaiseLog(LOG_LEVEL_INFO,"NAN network get wifi info failed");
-        return ret;
-    }
-    RaiseLog(LOG_LEVEL_INFO,"NAN network get wifi info success");
-    RaiseLog(LOG_LEVEL_INFO,"Wifi ssid: %s",wifi.ssid);
-    RaiseLog(LOG_LEVEL_INFO,"Wifi pwd: %s",wifi.pwd);
-
-CLOUD_CONNECT_WIFI:
-
-    BOARD_InitWifi();
-    ret = BOARD_ConnectWifi(wifi.ssid, wifi.pwd);
-    if (ret != 0) {
-        RaiseLog(LOG_LEVEL_ERR, "Connect to wifi failed! \n");
-        NotifyNetCfgResult(NETCFG_DEV_INFO_INVALID);
-        return ret;
-    }
-    NotifyNetCfgResult(NETCFG_OK);
-    StopNetCfg();
-    ret = setStoredWifiInfo(&wifi);
-    if(ret != 0){
-        RaiseLog(LOG_LEVEL_ERR,"Wifi info store failed!");
-    }
-    return ret;
-}
-
-
-
-/**
- * @description: cloud_createService: create one service
- * @param {char*} name: serviceID's name.
- * @param {char *} event: The event time of service,which cloud be the NULL
- * @return {*}
- */
-Cloud_Servic* cloud_createService(const char* name,const char * event)
-{
-    Cloud_Servic* service = malloc(sizeof(Cloud_Servic));
-    if(service == NULL){
-        RaiseLog(LOG_LEVEL_DEBUG,"malloc Cloud_Proprety failed!");
-        return;
-    }
-    service->serviceID = name;
-    service->propertyLst = NULL;
-    service->nxt = NULL;
-    service->eventTime = NULL;
-    return service;
-}
-
-/**
- * @description: cloud_appendProprety : append one proprety to service
- * @param {Cloud_Servic} *service : .....
- * @param {char} *name : proprety's name
- * @param {Cloud_DataType} type: proprety's type.
- * @param {void*} value: proprety's value
- * @return {*}
- */
-int cloud_createAndAppendProprety(Cloud_Servic *service,const char *name,Cloud_DataType type,void* value)
-{   
-    Cloud_Proprety* tempPrp;
-    Cloud_Servic* tempService;
-    Cloud_Proprety* prpty = malloc(sizeof(Cloud_Proprety));
-    if(prpty == NULL){
-        RaiseLog(LOG_LEVEL_DEBUG,"malloc Cloud_Proprety failed!");
-        return -1;
-    }
-    prpty->nxt = NULL;
-    prpty->type = type;
-    prpty->value = value;
-    prpty->key = name;
-    tempPrp = service->propertyLst;
-    if(tempPrp == NULL){
-        service->propertyLst = prpty;
-    }else{
-        while(tempPrp->nxt != NULL){
-            tempPrp = tempPrp->nxt;
-        }
-        tempPrp->nxt = prpty;
-    }
-    return 0;
-}
-
-/**
- * @description: cloud_appendPropretyAndUpload :
- *               upload the service to the cloud,
- * @param {Cloud_Servic} *service : .....
- * @param {char} *name : proprety's name
- * @param {Cloud_DataType} type: proprety's type.
- * @param {void*} value: proprety's value
- * @return {*}
- */
-int cloud_uploadService(Cloud_Servic *service)
-{
-    cJSON* jsonString;
-    int ret;
-    jsonString = IoTProfilePackage(service);
-    if (NULL != jsonString) {
-        RaiseLog(LOG_LEVEL_INFO, "jsonString:%s", jsonString);
-        ret = CLOUD_ReportMsg(jsonString);
-        free(jsonString);
-        return ret;
-    }
-    return -1;
-}
-
-
-/**
- * @description: delete the Service
- * @param {Cloud_Servic} *service
- * @return {*}
- */
-void cloud_deleteService(Cloud_Servic *service)
-{
-    Cloud_Proprety* tempPrp;
-    Cloud_Servic* tempService;
-        // free the service and it's propreties.
-    tempService = service;
-    while(tempService != NULL){
-        tempPrp = tempService->propertyLst;
-        while(tempPrp != NULL){
-            Cloud_Proprety* prp = tempPrp;
-            tempPrp = tempPrp->nxt;
-            free(prp);
-        }
-        Cloud_Servic* svc;
-        tempService = tempService->nxt;
-        free(svc);
-    }
-}
-
-/**
- * @description: 
- * @param {Cloud_Servic} *service
- * @param {char*} name
- * @param {char *} event
- * @return {*}
- */
-void cloud_initService(Cloud_Servic *service,const char* name,const char * event)
-{
-    service->serviceID = name;
-    service->propertyLst = NULL;
-    service->nxt = NULL;
-    service->eventTime = NULL;
-    return service;
-}
-
-/**
- * @description: 
- * @param {Cloud_Servic} *service
- * @param {Cloud_Proprety} *prpty
- * @param {char} *name
- * @param {Cloud_DataType} type
- * @param {void*} value
- * @return {*}
- */
-void cloud_initAndAppendProprety(Cloud_Servic *service,Cloud_Proprety *prpty,const char *name,Cloud_DataType type,void* value)
-{
-    Cloud_Proprety* tempPrp;
-    Cloud_Servic* tempService;
-    prpty->nxt = NULL;
-    prpty->type = type;
-    prpty->value = value;
-    prpty->key = name;
-    tempPrp = service->propertyLst;
-    if(tempPrp == NULL){
-        service->propertyLst = prpty;
-    }else{
-        while(tempPrp->nxt != NULL){
-            tempPrp = tempPrp->nxt;
-        }
-        tempPrp->nxt = prpty;
-    }
-}
-
-/**
- * @description: create Para for cmd
- * @param {CmdNode*} cmd
- * @param {ValueType} type
- * @param {cmdFuncCallback} func
- * @return {CmdParam*}
- */
-CmdParam* cloud_createAndAppendPara(CmdNode* cmd,const char* name,ValueType type,cmdFuncCallback func)
-{
-    CmdParam* para = malloc(sizeof(CmdParam));
-    if(para == NULL){
-        RaiseLog(LOG_LEVEL_DEBUG,"Malloc CmdParam failed!");
-        return para;
-    }
-    strcpy(para->name,name);
-    para->nxt = NULL;
-    para->func = func;
-    para->type = type;
-
-    if(cmd->params == NULL){
-        cmd->params = para;
-        return para;
-    }
-
-    CmdParam* pTemp = cmd->params;
-    while (pTemp->nxt != NULL){
-        pTemp = pTemp->nxt;
-    }
-    pTemp->nxt = para;
-    return para;
-}
-
-/**
- * @description: create cmd add to the cmd list cmdNodeFirst which static defined in this file
- * @param {char*} name
- * @return {*}
- */
-CmdNode* cloud_createCmd(char* name)
-{
-    CmdNode* cmd = malloc(sizeof(CmdNode));
-    if(cmd == NULL){
-        RaiseLog(LOG_LEVEL_ERR,"Malloc CmdBode failed!");
-        return -1;
-    }
-    strcpy(cmd->name,name);
-    cmd->nxt = NULL;
-    cmd->params = NULL;
-
-    CmdNode* pTemp = &cmdNodeFirst;
-    while (pTemp->nxt != NULL){
-        pTemp = pTemp->nxt;
-    }
-    pTemp->nxt = cmd;
-    return cmd;
-}
-
-/**
- * @description: free all the cmd and their paras except cmdNodeFirst
- * @param {*}
- * @return {*}
- */
-void cloud_deleteCmd()
-{
-    CmdNode* pCmd = cmdNodeFirst.nxt;
-    CmdParam* pPara;
-    while (pCmd != NULL)
-    {
-        pPara = pCmd->params;
-        while (pPara != NULL){
-           CmdParam* tempP = pPara;
-           pPara = pPara->nxt;
-           free(tempP);
-        }
-        CmdNode* tempC = pCmd;
-        pCmd = pCmd->nxt;
-        free(tempC);
-    }
-}
-
-
-/**
- * @description: init one cmd
- * @param {CmdNode*} cmd
- * @param {char*} name
- * @return {*}
- */
-void cloud_initCmd(CmdNode* cmd,char* name)
-{
-    strcpy(cmd->name,name);
-    cmd->nxt = NULL;
-    cmd->params = NULL;
-
-    CmdNode* pTemp = &cmdNodeFirst;
-    while (pTemp->nxt != NULL){
-        pTemp = pTemp->nxt;
-    }
-    pTemp->nxt = cmd;
-}
-
-
-/**
- * @description: init one cmdparam and append it to the end of cmd
- * @param {CmdNode*} cmd
- * @param {CmdParam*} para
- * @param {char*} name
- * @param {ValueType} type
- * @param {cmdFuncCallback} func
- * @return {*}
- */
-void cloud_initAndAppendPara(CmdNode* cmd,CmdParam* para,const char* name,ValueType type,cmdFuncCallback func)
-{
-    strcpy(para->name,name);
-    para->nxt = NULL;
-    para->func = func;
-    para->type = type;
-    if(cmd->params == NULL){
-        cmd->params = para;
-        return 0;
-    }
-
-    CmdParam* pTemp = cmd->params;
-    while (pTemp->nxt != NULL){
-        pTemp = pTemp->nxt;
-    }
-    pTemp->nxt = para;
-    return 0;
-}
-
-/**
- * @description: cloud_isCommandName: Determine if Parameters has the json object named objName
- * @param {cJSON*} root
- * @param {char*} objName
- * @param {cJSON*} retObj
- * @return {*}
- */
-bool cloud_isCommandName(cJSON* root,char* name)
-{
-    cJSON* obj = cJSON_GetObjectItem(root,CLOUD_COMMAND_NAME);
-    if(obj==NULL){
-        RaiseLog(LOG_LEVEL_DEBUG,"root json don't has json object named 'command_name'.");
-        return false;
-    }
-    if(0 == strcmp(cJSON_GetStringValue(obj),name)){
-        return true;
-        
-    }
-    return false;
-}
-
-
-/**
- * @description: check the cmd list and execute the callback functions of paras
- * @param {*}
- * @return {*}
- */
-int cloud_checkCmdListAndExec(cJSON* root)
-{
-    CmdNode* cmd = cmdNodeFirst.nxt;
-    while (cmd != NULL)
-    {
-        CmdParam* para = cmd->params;
-        if(cloud_isCommandName(root,cmd->name))
-        {
-            while (para != NULL)
-            {
-                cJSON* paraObj = NULL;
-                CmdValue value;
-
-                cJSON* objParas = cJSON_GetObjectItem(root,CLOUD_PARA_NAME);
-                if(objParas==NULL){
-                    RaiseLog(LOG_LEVEL_DEBUG,"Root json don't has json object named 'paras'.");
-                    return -1;
-                }
-                paraObj = cJSON_GetObjectItem(objParas,para->name);
-                if(paraObj==NULL){
-                    RaiseLog(LOG_LEVEL_DEBUG,"paras don't has json object named %s",para->name);
-                    para = para->nxt;
-                    continue;
-                }
-                // if the paras object has parameter named para->name
-                FuncValue_t fValue;
-                switch(para->type)
-                {
-                    case Cloud_Int:
-                        value.valueInt = cJSON_GetNumberValue(paraObj);
-                        fValue.type = Cloud_Int;
-                        fValue.value = value;
-                        para->func(fValue);
-                        break;
-                    case Cloud_Double:
-                        value.valueDouble = cJSON_GetNumberValue(paraObj);
-                        fValue.type = Cloud_Double;
-                        fValue.value = value;
-                        para->func(fValue);
-                        break;
-                    case Cloud_String:
-                        strcpy(value.valueString,cJSON_GetStringValue(paraObj));
-                        fValue.type = Cloud_String;
-                        fValue.value = value;
-                        para->func(fValue);
-                        break;
-                    default: 
-                        break;
-                }
-                para = para->nxt;
-            }
-            return 0;
-        }
-        cmd = cmd->nxt;
-    }
-    return -1;
-}
-
-
-/**
- * @description: The cloud call back function
- * @param {char} *jsonString
- * @return {*}
- */
-int CLOUD_CommandCallBack(const char *jsonString)
-{
-    cJSON* root = NULL;
-    cJSON* obj = NULL;
-    int ret = -1;
-    if(jsonString == NULL){
-        RaiseLog(LOG_LEVEL_DEBUG,"Received none data from cloud!");
-        return ret;
-    }
-    root = cJSON_Parse(jsonString);
-    if(root == NULL){
-        RaiseLog(LOG_LEVEL_DEBUG,"No data parsed from json string!");
-        return ret;
-    }
-    ret = cloud_checkCmdListAndExec(root);
-    free(root);
-    return ret;
-}
-
-
-
-

+ 0 - 300
vendor/bossay/smart_door/demo_smartdoor/cloud_connect/src/cloud_schedule.c

@@ -1,300 +0,0 @@
-/*
- * Copyright (c) 2021 Jinan Bosai Network Intelligent Technology Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "cloud_schedule.h"
-#include "iot_demo_def.h"
-#include "ohos_init.h"
-#include <time.h>
-#include <stdbool.h>
-#include "iot_sntp.h"
-
-
-#define TIMER_PERIOD 1      // [s]
-#define SCHEDULE_TASK_SIZE 1024*6
-#define SCHEDULE_TASK_PRIOR 25
-#define CONFIG_LOCAL_TIMEZONE  8
-#define ONE_MINUITE_SECONDS 60
-#define ONE_HOUR_SECONDS 3600
-#define ONE_DAY_SECOND_SECONDS 86400
-#define SNTP_TIME_YEAR_OFFSET 1900
-#define CONFIG_TASK_SCHEDULE_SIZE 0x1000
-#define CONFIG_TASK_SCHEDULE_PRIOR 31
-
-
-static time_t currentTime = 0;
-static osTimerId_t osTimer_ID;
-static ScheduleCtrl_t scheduleFirstNode = {
-    .nxt = NULL,
-};
-static int oneHourSeconds = TIMER_PERIOD * 3600;
-static int quarterMinuSeconds = TIMER_PERIOD * 15;
-
-/**
- * @description: Bind the schedule to the command which is defined in cloud communicate
- * @param {ScheduleCtrl_t*} schedule
- * @param {CmdNode*} cmd
- * @param {char*} name
- * @param {ValueType} type
- * @param {cmdFuncCallback} func
- * @return {*}
- */
-void bindingScheduleToCmd(ScheduleCtrl_t* schedule,CmdNode* cmd,const char* name,ValueType type,cmdFuncCallback func)
-{
-    CmdParam* para = &schedule->ctrl;
-    strcpy(para->name,name);
-    para->nxt = NULL;
-    para->func = func;
-    para->type = type;
-
-    if(cmd->params == NULL){
-        cmd->params = para;
-        return para;
-    }
-
-    CmdParam* pTemp = cmd->params;
-    while (pTemp->nxt != NULL){
-        pTemp = pTemp->nxt;
-    }
-    pTemp->nxt = para;
-    return para;
-}
-
-/**
- * @description: Get current time by sntp and up sync the local time
- * @param {*}
- * @return {*}
- */
-TIME getAndUpdateCurrentTm()
-{
-    TIME time;
-    if(SntpGetRtcTime(CONFIG_LOCAL_TIMEZONE, &time) != 0){
-        RaiseLog(LOG_LEVEL_DEBUG,"Sync the time failed!");
-                return *localtime(&currentTime);
-    }
-    currentTime = mktime(&time);
-    return time;
-}
-/**
- * @description: Get start seconds in one day  interval: (0,86400)
- * @param {ScheduleCtrl_t*} schedule
- * @return {*}
- */
-uint32_t getStartSecondsInDay(const ScheduleCtrl_t* schedule)
-{
-    return schedule->startHour * ONE_HOUR_SECONDS + schedule->startMinute * ONE_MINUITE_SECONDS + schedule->startSeconds;
-}
-
-/**
- * @description: Get end seconds in one day  interval: (0,86400)
- * @param {ScheduleCtrl_t*} schedule
- * @return {*}
- */
-uint32_t getEndSecondsInDay(const ScheduleCtrl_t* schedule)
-{
-    return getStartSecondsInDay(schedule) + schedule->duration;
-}
-
-
-/**
- * @description: determine whether current time is in the time period of schedule
- * @param {ScheduleCtrl_t*} schedule
- * @return {*}
- */
-bool isTimeToStartSchedule(const ScheduleCtrl_t* schedule)
-{
-    TIME ctime = getAndUpdateCurrentTm();
-    uint8_t days = schedule->Days;
-
-    uint8_t cday = ctime.tm_wday;
-    uint8_t chour = ctime.tm_hour;
-    uint8_t cmin = ctime.tm_min;
-    uint8_t csec = ctime.tm_sec;
-    RaiseLog(LOG_LEVEL_INFO,"%d%d%d%d",cday,chour,cmin,csec);
-    uint32_t currentSecondInday = chour*ONE_HOUR_SECONDS + cmin*ONE_MINUITE_SECONDS + csec;
-    //gdtr_TODO: check the format of tm_wday and change it
-    if((days >> (cday)) & 0x01){ // today is in schedule
-        if(currentSecondInday >= getStartSecondsInDay(schedule) &&\
-         currentSecondInday <= getEndSecondsInDay(schedule)){
-             RaiseLog(LOG_LEVEL_INFO,"is execute time of schedule");
-             return true;
-         }
-    }
-    RaiseLog(LOG_LEVEL_INFO," is not execute time of schedule");
-    return false;
-}
-
-/**
- * @description: The local timer callback every a quarter minuite
- * @param {void*} argument
- * @return {*}
- */
-void scheduleTimeCallback(void* argument)
-{
-    currentTime++;
-    quarterMinuSeconds -= TIMER_PERIOD;
-}
-
-void scheduleThreadCallback(void* arguement)
-{
-    for(;;)
-    {
-        if(quarterMinuSeconds <= 0){
-            ScheduleCtrl_t* ptr = scheduleFirstNode.nxt;
-            FuncValue_t value;
-            RaiseLog(LOG_LEVEL_INFO,"---------------------");
-            while (ptr != NULL)
-            {
-                if(isTimeToStartSchedule(ptr)){
-                    RaiseLog(LOG_LEVEL_INFO,"Start the schedule%s",ptr->id);
-                    value.type = ptr->ctrl.param->type;
-                    value.value = ptr->ctrl.value;
-                    ptr->ctrl.param->func(value);
-                }        
-                ptr = ptr->nxt;
-            }
-            quarterMinuSeconds = 15*TIMER_PERIOD;
-        }
-        osDelay(40);
-    }
-}
-
-/**
- * @description: Schedule initilize function
- * @param {ScheduleCtrl_t*} schedule
- * @return {*}
- */
-void ScheduleInit()
-{
-    int ret;
-    TIME time;
-    SntpGetRtcTime(CONFIG_LOCAL_TIMEZONE, &time);
-    if(ret != 0){
-        RaiseLog(LOG_LEVEL_DEBUG,"Get Simple Network Time Protocol failed!");
-        return;
-    }
-    currentTime = mktime(&time);
-    
-    RaiseLog(LOG_LEVEL_DEBUG,"Current time is:%d",currentTime);
-    RaiseLog(LOG_LEVEL_INFO,"%4d.%2d.%2d %2d:%2d:%2d",time.tm_yday + SNTP_TIME_YEAR_OFFSET,time.tm_mon,time.tm_mday,\
-                time.tm_hour,time.tm_min,time.tm_sec);
-    osTimerAttr_t attr_timer;
-    attr_timer.name = "scheduleTimer";
-    attr_timer.cb_mem = NULL;
-    attr_timer.cb_size = NULL;
-    osTimer_ID = osTimerNew(scheduleTimeCallback,osTimerPeriodic,NULL,&attr_timer);
-    osTimerStart(osTimer_ID,TIMER_PERIOD * 100);
-
-    osThreadAttr_t attr_thread;
-    attr_thread.attr_bits = 0U;
-    attr_thread.cb_mem = NULL;
-    attr_thread.cb_size = 0U;
-    attr_thread.stack_mem = NULL;
-    attr_thread.stack_size = CONFIG_TASK_SCHEDULE_SIZE;
-    attr_thread.priority = CONFIG_TASK_SCHEDULE_PRIOR;
-    attr_thread.name = "IoTMain";
-    (void) osThreadNew((osThreadFunc_t)scheduleThreadCallback, NULL, (const osThreadAttr_t *)&attr_thread);
-
-    return;
-}
-
-/**
- * @description: Create one schedule and put it to the scheduleFirstNode static variable which defined in this file
- * @param {*}
- * @return {*}
- */
-ScheduleCtrl_t* cloud_createSchedule(char* id,uint8_t wdays,uint8_t start_hour,uint8_t start_min,\
-                                    uint8_t start_sec,uint16_t dur, CmdControl ctrl)
-{
-    if(start_hour > 24 || start_min > 60 || start_sec > 60 || dur > 1440){
-        RaiseLog(LOG_LEVEL_DEBUG,"Wrong format of schedule");
-        return NULL;
-    }
-
-    ScheduleCtrl_t* schedule = malloc(sizeof(ScheduleCtrl_t));
-    if(schedule == NULL){
-        RaiseLog(LOG_LEVEL_ERR,"Malloc Schedule failed!");
-        return schedule;
-    }
-    
-    strcpy(schedule->id,id);
-    schedule->ctrl = ctrl;
-    schedule->Days  = wdays;
-    schedule->startHour = start_hour;
-    schedule->startMinute = start_min;
-    schedule->startSeconds = start_sec;
-    schedule->duration = dur;
-    schedule->nxt = NULL;
-
-    ScheduleCtrl_t* ptr = &scheduleFirstNode;
-    while (ptr->nxt != NULL){
-        ptr = ptr->nxt;
-    }
-    ptr->nxt = schedule;
-    return schedule;
-}
-
-/**
- * @description: Delete the schedule
- * @param {char*} id
- * @return {*}
- */
-int cloud_deleteScheduleByID(const char* id)
-{
-    ScheduleCtrl_t* ptr = &scheduleFirstNode;
-    ScheduleCtrl_t* temp;
-    while (ptr->nxt != NULL)
-    { 
-        temp = ptr->nxt;
-        if(strcmp(temp->id,id) == 0){
-            ptr = temp->nxt;
-            free(temp);
-            return 0;
-        }
-        ptr = ptr->nxt;
-    }
-    RaiseLog(LOG_LEVEL_DEBUG,"No %s in the schedule list",id);
-    return -1;
-}
-
-/**
- * @description: update the schedule
- * @param {*}
- * @return {*}
- */
-int cloud_updateSchedule(char* id,uint8_t wdays,uint8_t start_hour,uint8_t start_min,\
-                                    uint8_t start_sec,uint16_t dur)
-{
-    ScheduleCtrl_t* ptr = scheduleFirstNode.nxt;
-    while (ptr != NULL)
-    {
-        if(strcmp(ptr->id,id) == 0){
-            ptr->Days = wdays;
-            ptr->startHour = start_hour;
-            ptr->startMinute = start_min;
-            ptr->startSeconds = start_sec;
-            ptr->duration = dur;
-            return 0;
-        }
-        ptr = ptr->nxt;
-    }
-    RaiseLog(LOG_LEVEL_DEBUG,"No %s in the schedule list",id);
-    return -1;
-}
-
-
-
-
-
-

+ 0 - 166
vendor/bossay/smart_door/demo_smartdoor/main_entry.c

@@ -1,166 +0,0 @@
-/*
- * Copyright (c) 2021 Jinan Bosai Network Technology Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-#include "iot_cloud.h"
-#include "iot_boardled.h"
-#include "iot_boardbutton.h"
-#include "iot_wifi.h"
-#include "iot_netcfg.h"
-#include "iot_sntp.h"
-#include "ohos_init.h"
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <cmsis_os2.h>
-#include <stdbool.h>
-#include "kv_store.h"
-#include "iot_schedule.h"
-#include "network_config_service.h"
-#include "iot_netcfg_nan.h"
-
-#include "hi_reset.h"
-#include "cloud_communicate.h"
-#include "cloud_schedule.h"
-#include "DOOR.h"
-#include "OLED_I2C.h"
-
-#define CONFIG_TASK_MAIN_STACKSIZE 0x2000
-#define CONFIG_TASK_MAIN_PRIOR 25
-
-#define CONFIG_CLOUD_DEFAULT_SERVERIP "121.36.42.100"   // Huawei cloud service ip
-#define CONFIG_CLOUD_DEFAULT_SERVERPORT "1883"          // // Huawei cloud service port
-#define CLOUD_DEVICE_ID "62b673444c7c4e3646b77810_Lamp01"   // user need to change it according to the device id in cloud
-#define CLOUD_DEVICE_PWD "12345678"  // user need to change it according to the device pwd in cloud
-
-#define NFC_DEVICE_ID_LEN 50
-#define NFC_DEVICE_PWD_LEN 50
-
-// user add cmd in this func
-int cmdBeepCallback(FuncValue_t ret)
-{
-    RaiseLog(LOG_LEVEL_INFO,"Beep Cmd:%s",ret.value.valueString);
-    return 0;
-}
-
-int cmdSafeLEDCallback(FuncValue_t ret)
-{
-    RaiseLog(LOG_LEVEL_INFO,"SafeLED Cmd:%s",ret.value.valueString);
-    return 0;
-}
-
-int cmdWarnLEDCallback(FuncValue_t ret)
-{
-    RaiseLog(LOG_LEVEL_INFO,"WarnLED cmd:%s",ret.value.valueString);
-    return 0;
-}
-
-
-/* if user want to en able the schedule control could disable comment below  */
-
-// int scheduleCallback(FuncValue_t value)
-// {
-//     switch(value.type)
-//     {
-//     case Cloud_Int:
-//     break;
-//     case Cloud_Double:
-//     break;
-//     case Cloud_String:
-//     break;
-//     default:
-//     break;
-//     }
-//     return 0;
-// }
-
-static bool keyStatus = false;
-void keycallback(char* arg){
-    keyStatus = true;
-    return;
-}
-
-void IotMainTaskEntry(void* argument)
-{
-    DOORBoardInit();
-    initKey(keycallback);
-    IOT_ScheduleInit();
-    BOARD_InitWifi();
-    osDelay(300);
-    
-    NanWifiConnect(keyStatus);
-    cloud_CloudInit(CLOUD_DEVICE_ID,CLOUD_DEVICE_PWD,CONFIG_CLOUD_DEFAULT_SERVERIP,CONFIG_CLOUD_DEFAULT_SERVERPORT);
-    
-    char doorBell[10];
-    strcpy(doorBell,"OFF");
-
-    Cloud_Servic* service = cloud_createService("DoorService",NULL);
-    cloud_createAndAppendProprety(service,"Door_status",IOT_PROFILE_KEY_DATATYPE_STRING,(void*)doorBell);
-    
-    CmdNode* cmdControlBeep = cloud_createCmd("DoorControlBeep");
-    CmdNode* cmdControlSafeLED = cloud_createCmd("DoorControlSafeLED");
-    CmdNode* cmdControlWarnLED = cloud_createCmd("DoorControlWarnLED");
-
-    CmdParam* paraBeep = cloud_createAndAppendPara(cmdControlBeep,"Beep",Cloud_String,cmdBeepCallback);
-    cloud_createAndAppendPara(cmdControlSafeLED,"SafeLED",Cloud_String,cmdSafeLEDCallback);
-    cloud_createAndAppendPara(cmdControlWarnLED,"WarnLED",Cloud_String,cmdWarnLEDCallback);
-
-    /* if user want to en able the schedule control could disable comment below  */
-    // ScheduleInit();
-    // CmdControl ctrl_0 = {
-    //     .param = paraBeep,
-    //     .value.valueString = "ON",
-    // };
-    // CmdControl ctrl_1 = {
-    //     .param = paraBeep,
-    //     .value.valueString = "OFF",
-    // };
-    // ScheduleCtrl_t* shd_OpenDoor =  cloud_createSchedule("OpenBeep",0xff,18,55,30,1440,ctrl_0);
-    // ScheduleCtrl_t* shd_CloseDoor =  cloud_createSchedule("CloseBeep",0xff,18,55,30,30,ctrl_1);
-
-    for(;;)
-    {
-        int isOn =  DoorBell_Read_Data();
-        if(isOn == 0) strcpy(doorBell,"ON");
-        else strcpy(doorBell,"OFF");
-
-        cloud_uploadService(service);
-        osDelay(100);
-    }
-}
-
-static void EntryMain(void)
-{
-    osThreadAttr_t attr;
-    RaiseLog(LOG_LEVEL_INFO, "DATA:%s Time:%s \r\n", __FUNCTION__, __DATE__, __TIME__);
-    // Create the IoT Main task
-    attr.attr_bits = 0U;
-    attr.cb_mem = NULL;
-    attr.cb_size = 0U;
-    attr.stack_mem = NULL;
-    attr.stack_size = CONFIG_TASK_MAIN_STACKSIZE;
-    attr.priority = CONFIG_TASK_MAIN_PRIOR;
-    attr.name = "IoTMain";
-    (void) osThreadNew((osThreadFunc_t)IotMainTaskEntry, NULL, (const osThreadAttr_t *)&attr);
-
-    return;
-}
-APP_FEATURE_INIT(EntryMain);
-
-
-

+ 0 - 23
vendor/bossay/smart_door/demo_smartdoor/sensor/BUILD.gn

@@ -1,23 +0,0 @@
-static_library("bossay_hi3861_l0_sensor") {
-    sources = [
-        "src/DOOR.c"
-    ]
-    
-    cflags = [ "-Wno-unused-variable" ]
-    cflags += [ "-Wno-unused-but-set-variable" ]
-    cflags += [ "-Wno-unused-parameter" ]
-    
-    include_dirs = [
-        "inc",
-        "//base/iot_hardware/peripheral/interfaces/kits",
-        "//device/bossay/hi3861_l0/iot_hardware_hals/include",
-        "//device/bossay/hi3861_l0/sdk_liteos/include",
-    ]
-
-    deps = [ 
-
-    ]
-
-}
-
-

+ 0 - 37
vendor/bossay/smart_door/demo_smartdoor/sensor/inc/DOOR.h

@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2021 Jinan Bosai Network Intelligent Technology Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef __DOOR_H__
-#define __DOOR_H__
-
-
-#include <stdint.h>
-
-
-typedef enum
-{
-	OFF = 0,
-	ON
-} SwitchStatus;
-
-void DOORBoardInit(void);
-
-uint8_t DoorBell_Read_Data(void);
-
-void BeepStatusSet(SwitchStatus status);
-void LedWarnStatusSet(SwitchStatus status);	
-void LedSafeStatusSet(SwitchStatus status);
-#endif
-
-

+ 0 - 113
vendor/bossay/smart_door/demo_smartdoor/sensor/src/DOOR.c

@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2021 Jinan Bosai Network Intelligent Technology Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "DOOR.h"
-#include "iot_gpio.h"
-#include "iot_gpio_ex.h"
-
-
-#define OUT_GPIO 13
-#define LED_SAFE_GPIO 7
-#define LED_WARN_GPIO 14
-#define BEEP_GPIO 8
-
-uint8_t     RxBuffer[3];
-
-
-void DOORBoardInit(void)
-{   
-    IoTGpioInit(OUT_GPIO);
-    IoTGpioSetFunc(OUT_GPIO, IOT_GPIO_FUNC_GPIO_13_GPIO);
-    IoTGpioSetDir(OUT_GPIO, IOT_GPIO_DIR_IN); // 设置GPIO_8为输出模式
-
-    IoTGpioInit(LED_SAFE_GPIO);
-    IoTGpioSetFunc(LED_SAFE_GPIO, IOT_GPIO_FUNC_GPIO_7_GPIO);
-    IoTGpioSetDir(LED_SAFE_GPIO, IOT_GPIO_DIR_OUT); // 设置为输出模式
-
-    IoTGpioInit(LED_WARN_GPIO);
-    IoTGpioSetFunc(LED_WARN_GPIO, IOT_GPIO_FUNC_GPIO_14_GPIO);
-    IoTGpioSetDir(LED_WARN_GPIO, IOT_GPIO_DIR_OUT); // 设置为输出模式
-
-    IoTGpioInit(BEEP_GPIO);
-    IoTGpioSetFunc(BEEP_GPIO, IOT_GPIO_FUNC_GPIO_8_GPIO);
-    IoTGpioSetDir(BEEP_GPIO, IOT_GPIO_DIR_OUT); // 设置为输入模式
-}
-
-/***************************************************************
-* 函数名称: Door_Read_Data
-* 说    明: 读取数据
-* 参    数: 无
-* 返 回 值: 无
-***************************************************************/
-uint8_t DoorBell_Read_Data(void)
-{
-    IotGpioValue temp = {0};
-    IoTGpioGetInputVal(OUT_GPIO,&temp);
-    return temp;
-}
-
-/***************************************************************
- * 函数名称: BeepStatusSet
- * 说    明: Beep状态设置
- * 参    数: status,ENUM枚举的数据
- *									OFF,关
- *									ON,开
- * 返 回 值: 无
- ***************************************************************/
-void BeepStatusSet(SwitchStatus status)
-{
-    if (status == ON) {
-        IoTGpioSetOutputVal(BEEP_GPIO, 1); // 设置GPIO_7输出高电平点亮灯
-    }
-    if (status == OFF) {
-        IoTGpioSetOutputVal(BEEP_GPIO, 0); // 设置GPIO_7输出低电平关闭灯
-    }
-}
-
-/***************************************************************
- * 函数名称: LedWarnStatusSet
- * 说    明: LED_Warn状态设置
- * 参    数: status,ENUM枚举的数据
- *									OFF,关
- *									ON,开
- * 返 回 值: 无
- ***************************************************************/
-void LedWarnStatusSet(SwitchStatus status)
-{
-    if (status == ON) {
-        IoTGpioSetOutputVal(LED_WARN_GPIO, 1); // 设置输出高电平点亮灯
-    }
-
-    if (status == OFF) {
-        IoTGpioSetOutputVal(LED_WARN_GPIO, 0); // 设置输出低电平关闭灯
-    }
-}
-/***************************************************************
- * 函数名称: LedSafeStatusSet
- * 说    明: LED_Safe状态设置
- * 参    数: status,ENUM枚举的数据
- *									OFF,关
- *									ON,开
- * 返 回 值: 无
- ***************************************************************/
-void LedSafeStatusSet(SwitchStatus status)
-{
-    if (status == ON) {
-        IoTGpioSetOutputVal(LED_SAFE_GPIO, 1); // 设置输出高电平点亮灯
-    }
-
-    if (status == OFF) {
-        IoTGpioSetOutputVal(LED_SAFE_GPIO, 0); // 设置输出低电平关闭灯
-    }
-}

+ 1 - 7
vendor/bossay/smart_lamp/config.json

@@ -88,14 +88,8 @@
           { "component": "kv_store", "features":[] },
           { "component": "os_dump", "features":[] }
         ]
-      },
-      {
-       "subsystem": "test",
-       "components": [
-         { "component": "xts_acts", "features":[] },
-         { "component": "xts_tools", "features":[] }
-        ]
       }
+      
     ],
     "third_party_dir": "//device/bossay/hi3861_l0/sdk_liteos/third_party",
     "product_adapter_dir": "//vendor/bossay/hi3861_l0/hals"

+ 4 - 0
vendor/bossay/smart_lamp/demo_smart_lamp/cloud_connect/BUILD.gn

@@ -13,6 +13,10 @@ static_library("cloud_connect") {
         "../../../common/inc",
         "//third_party/cJSON",
         "//utils/native/lite/include/",
+
+        #"//base/iot_hardware/peripheral/interfaces/kits",
+        #"//device/bossay/hi3861_l0/iot_hardware_hals/include",
+        #"//device/bossay/hi3861_l0/sdk_liteos/include",
     ]
 
     deps = [ 

+ 4 - 4
vendor/bossay/smart_lamp/demo_smart_lamp/cloud_connect/inc/cloud_communicate.h

@@ -61,6 +61,7 @@
 #include <stdbool.h>
 #include "cJSON.h"
 
+
 #define CLOUD_MALLOC_ENABEL true
 
 #define CLOUD_COMMAND_NAME "command_name"
@@ -69,7 +70,7 @@
 #define WIFI_PWD_MAX_LEN_ 256
 #define KV_STORE_SSID_ID "ssid"
 #define KV_STORE_PWD_ID "pwd"
-#define NAN_WIFI_AP_SSID "bossay"
+#define NAN_WIFI_AP_SSID "teamX-Lamp166"
 
 #define MAX_STRING_VALUE_LEN 30
 #define MAX_CMD_NAME_LEN 30
@@ -122,9 +123,8 @@ typedef struct{
 }WIFI_ssid_pwd;
 
 
-
-//int getStoredWifiInfo(WIFI_ssid_pwd* wifi);
-//int setStoredWifiInfo(WIFI_ssid_pwd* wifi);
+int getStoredWifiInfo(WIFI_ssid_pwd* wifi);
+int setStoredWifiInfo(WIFI_ssid_pwd* wifi);
 int NanWifiConnect(bool restartNan);
 int cloud_CloudInit(const char *deviceID, const char *devicePwd, \
     const char *serverIP, const char *serverPort);

+ 48 - 4
vendor/bossay/smart_lamp/demo_smart_lamp/cloud_connect/src/cloud_communicate.c

@@ -87,6 +87,9 @@ int cloud_CloudInit(const char *deviceID, const char *devicePwd, \
     return 0;
 }
 
+
+
+
 /**
  * @description: NAN connect the wifi
  * @param {WIFI_ssid_pwd} *wifi
@@ -102,7 +105,7 @@ int NanWifiConnect(bool restartNan)
     if(getStoredWifiInfo(&wifi) == 0){
         goto CLOUD_CONNECT_WIFI;
     }
-    
+    //goto CLOUD_CONNECT_WIFI;   //新增语句
 CLOUD_START_NAN:
 
     RaiseLog(LOG_LEVEL_INFO,"Try to get the wifi info by NAN network....");
@@ -121,6 +124,7 @@ CLOUD_CONNECT_WIFI:
 
     BOARD_InitWifi();
     ret = BOARD_ConnectWifi(wifi.ssid, wifi.pwd);
+    //ret = BOARD_ConnectWifi("Bossay", "Bossay@123");   //新增语句
     if (ret != 0) {
         RaiseLog(LOG_LEVEL_ERR, "Connect to wifi failed! \n");
         NotifyNetCfgResult(NETCFG_DEV_INFO_INVALID);
@@ -292,6 +296,9 @@ void cloud_initAndAppendProprety(Cloud_Servic *service,Cloud_Proprety *prpty,con
 CmdParam* cloud_createAndAppendPara(CmdNode* cmd,const char* name,ValueType type,cmdFuncCallback func)
 {
     CmdParam* para = malloc(sizeof(CmdParam));
+
+    //printf("CmdParam* para fanhui 111501:%s\r\n",*para);
+
     if(para == NULL){
         RaiseLog(LOG_LEVEL_DEBUG,"Malloc CmdParam failed!");
         return para;
@@ -306,11 +313,16 @@ CmdParam* cloud_createAndAppendPara(CmdNode* cmd,const char* name,ValueType type
         return para;
     }
 
+    //printf("cmd->params fanhui 111502:%s\r\n",cmd->params);
     CmdParam* pTemp = cmd->params;
+    
     while (pTemp->nxt != NULL){
         pTemp = pTemp->nxt;
     }
-    pTemp->nxt = para;
+    
+    //printf("para fanhui 111503:%s\r\n",para);
+    pTemp->nxt = para;  
+
     return para;
 }
 
@@ -322,6 +334,9 @@ CmdParam* cloud_createAndAppendPara(CmdNode* cmd,const char* name,ValueType type
 CmdNode* cloud_createCmd(char* name)
 {
     CmdNode* cmd = malloc(sizeof(CmdNode));
+
+    //printf("CmdNode* cmd fanhui 111511:%s\r\n",*cmd);
+
     if(cmd == NULL){
         RaiseLog(LOG_LEVEL_ERR,"Malloc CmdBode failed!");
         return -1;
@@ -331,10 +346,13 @@ CmdNode* cloud_createCmd(char* name)
     cmd->params = NULL;
 
     CmdNode* pTemp = &cmdNodeFirst;
+    //printf("CmdNode* pTemp fanhui 111512:%s\r\n",*pTemp);
     while (pTemp->nxt != NULL){
         pTemp = pTemp->nxt;
     }
+    //printf("cmd fanhui 111513:%s\r\n",cmd);
     pTemp->nxt = cmd;
+    
     return cmd;
 }
 
@@ -420,11 +438,18 @@ void cloud_initAndAppendPara(CmdNode* cmd,CmdParam* para,const char* name,ValueT
 bool cloud_isCommandName(cJSON* root,char* name)
 {
     cJSON* obj = cJSON_GetObjectItem(root,CLOUD_COMMAND_NAME);
+
+    //printf("cJSON_GetObjectItem fanhui 3:%s\r\n",*obj);
+
     if(obj==NULL){
         RaiseLog(LOG_LEVEL_DEBUG,"root json don't has json object named 'command_name'.");
         return false;
     }
+    //if(0 == (strcmp(cJSON_GetStringValue(obj),name))){
     if(0 == strcmp(cJSON_GetStringValue(obj),name)){
+        // printf("!!!@@@###$$$%%%^^^1&&&***\r\n");
+        // RaiseLog(LOG_LEVEL_INFO,"cJSON_GetStringValue(obj):%s",cJSON_GetStringValue(obj));
+        // printf("!!!@@@###$$$%%%^^^2&&&***\r\n");
         return true;
         
     }
@@ -439,11 +464,17 @@ bool cloud_isCommandName(cJSON* root,char* name)
  */
 int cloud_checkCmdListAndExec(cJSON* root)
 {
+    
     CmdNode* cmd = cmdNodeFirst.nxt;
+
     while (cmd != NULL)
     {
         CmdParam* para = cmd->params;
+
+        //printf("$$$$$$$$$ cmd->params fanhui:%s\r\n",*para);
+
         if(cloud_isCommandName(root,cmd->name))
+        //printf("cloud_isCommandName fanhui:%s\r\n",cmd->name);
         {
             while (para != NULL)
             {
@@ -451,11 +482,15 @@ int cloud_checkCmdListAndExec(cJSON* root)
                 CmdValue value;
 
                 cJSON* objParas = cJSON_GetObjectItem(root,CLOUD_PARA_NAME);
+
+                //printf("cJSON_GetObjectItem fanhui 1:%s\r\n",*objParas);
+
                 if(objParas==NULL){
                     RaiseLog(LOG_LEVEL_DEBUG,"Root json don't has json object named 'paras'.");
                     return -1;
                 }
                 paraObj = cJSON_GetObjectItem(objParas,para->name);
+                //printf("cJSON_GetObjectItem fanhui 2:%s\r\n",paraObj);
                 if(paraObj==NULL){
                     RaiseLog(LOG_LEVEL_DEBUG,"paras don't has json object named %s",para->name);
                     para = para->nxt;
@@ -463,6 +498,7 @@ int cloud_checkCmdListAndExec(cJSON* root)
                 }
                 // if the paras object has parameter named para->name
                 FuncValue_t fValue;
+                
                 switch(para->type)
                 {
                     case Cloud_Int:
@@ -470,18 +506,21 @@ int cloud_checkCmdListAndExec(cJSON* root)
                         fValue.type = Cloud_Int;
                         fValue.value = value;
                         para->func(fValue);
+                        //printf("Cloud_Int:%s\r\n",value.valueInt);
                         break;
                     case Cloud_Double:
                         value.valueDouble = cJSON_GetNumberValue(paraObj);
                         fValue.type = Cloud_Double;
                         fValue.value = value;
                         para->func(fValue);
+                        //printf("Cloud_Double:%s\r\n",value.valueDouble);
                         break;
                     case Cloud_String:
                         strcpy(value.valueString,cJSON_GetStringValue(paraObj));
                         fValue.type = Cloud_String;
                         fValue.value = value;
                         para->func(fValue);
+                        //printf("Cloud_String:%s\r\n",value.valueString);
                         break;
                     default: 
                         break;
@@ -491,6 +530,7 @@ int cloud_checkCmdListAndExec(cJSON* root)
             return 0;
         }
         cmd = cmd->nxt;
+        RaiseLog(LOG_LEVEL_DEBUG,"cmd is:%s",cmd);
     }
     return -1;
 }
@@ -511,15 +551,19 @@ int CLOUD_CommandCallBack(const char *jsonString)
         return ret;
     }
     root = cJSON_Parse(jsonString);
+
+    //printf("@@@@@@@@@@@@@@root@@@@@@@@@@@@@@:%s\r\n",root);
+
     if(root == NULL){
         RaiseLog(LOG_LEVEL_DEBUG,"No data parsed from json string!");
         return ret;
     }
     ret = cloud_checkCmdListAndExec(root);
+
+    //printf("%%%%%%%%%%%%%%%%%%ret%%%%%%%%%%%%%%%%%%:%s\r\n",ret);
+    
     free(root);
     return ret;
 }
 
 
-
-

+ 90 - 26
vendor/bossay/smart_lamp/demo_smart_lamp/main_entry.c

@@ -44,31 +44,53 @@
 
 #define CONFIG_CLOUD_DEFAULT_SERVERIP "121.36.42.100"   // Huawei cloud service ip
 #define CONFIG_CLOUD_DEFAULT_SERVERPORT "1883"          // // Huawei cloud service port
-#define CLOUD_DEVICE_ID "6209f0a6c7fb24029b11d672_Lamp01"   // user need to change it according to the device id in cloud
+#define CLOUD_DEVICE_ID "6209f0a6c7fb24029b11d672_Lamp167"   // user need to change it according to the device id in cloud
 #define CLOUD_DEVICE_PWD "12345678"  // user need to change it according to the device pwd in cloud
 
 #define NFC_DEVICE_ID_LEN 50
 #define NFC_DEVICE_PWD_LEN 50
 
+
 static int cmdLampStatus;
+static int dutycycle;
 
 int cmdLampCallback(FuncValue_t ret)
 {
     RaiseLog(LOG_LEVEL_INFO,"Lamp Cmd:%s",ret.value.valueString); 
-    if(strcmp(ret.value.valueString,"ON")){
+    if((strcmp(ret.value.valueString,"ON"))==0){
+        //if(strcmp(ret.value.valueString,"ON")){
         cmdLampStatus = ON;
+        //dutycycle=100;
     }else{
         cmdLampStatus = OFF;
+        dutycycle=0;
     }
     return 0;
 }
 
+//新增
+int cmdPwmLedCallback(FuncValue_t ret)
+{   
+        dutycycle=ret.value.valueInt;
+        if(cmdLampStatus==OFF){
+            dutycycle=0;
+        }
+        return 0;
+    
+    // //RaiseLog(LOG_LEVEL_INFO,"Dutycycle:%d",ret.value.valueInt);
+    // dutycycle=ret.value.valueInt;
+    // return 0;
+}
+
+
+
 static bool keyStatus = false;
 void keycallback(char* arg){
     keyStatus = true;
     return;
 }
 
+
 void IotMainTaskEntry(void* argument)
 {
     int ret;
@@ -82,41 +104,83 @@ void IotMainTaskEntry(void* argument)
     }
 
     initKey(keycallback);
-    IOT_ScheduleInit();
-    BOARD_InitWifi();
+    // IOT_ScheduleInit();
+
+    // BOARD_InitWifi();
     osDelay(300);
-    NanWifiConnect(keyStatus);
-    cloud_CloudInit(CLOUD_DEVICE_ID,CLOUD_DEVICE_PWD,CONFIG_CLOUD_DEFAULT_SERVERIP,CONFIG_CLOUD_DEFAULT_SERVERPORT);
+    ret = microBitSL(&Lux);
+    // RaiseLog(LOG_LEVEL_INFO,"Lux data:%.2f\r\n", Lux);
+    // NanWifiConnect(keyStatus);
+    // cloud_CloudInit(CLOUD_DEVICE_ID,CLOUD_DEVICE_PWD,CONFIG_CLOUD_DEFAULT_SERVERIP,CONFIG_CLOUD_DEFAULT_SERVERPORT);
+
+    // Cloud_Servic* service = cloud_createService("SmartLamp",NULL);
+    // cloud_createAndAppendProprety(service,"LampStatus",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&cmdLampStatus); 
+    // cloud_createAndAppendProprety(service,"LightIntensity",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&Lux);
+
+    // CmdNode* cmdLampCtrl = cloud_createCmd("SetLampStatus");
+    // CmdParam* paraBeep = cloud_createAndAppendPara(cmdLampCtrl,"LampStatus",Cloud_String,cmdLampCallback);
+    // printf("******------*******%s,%s*********--***\r\n",*paraBeep,*cmdLampCtrl);
 
-    Cloud_Servic* service = cloud_createService("Lamp_Service",NULL);
-    cloud_createAndAppendProprety(service,"lamp_status",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&isLamp_ON);
-    cloud_createAndAppendProprety(service,"Lux_status",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&Lux);
+    // CmdNode* cmdPwmLedCtrl = cloud_createCmd("SetLampDutyCycle");   //新增
+    // //CmdParam* paraPwmLed = cloud_createAndAppendPara(cmdPwmLedCtrl,"DutyCycle",Cloud_String,cmdPwmLedCallback); //新增(有错、类型不对,无法运行)
+    // CmdParam* paraPwmLed = cloud_createAndAppendPara(cmdPwmLedCtrl,"DutyCycle",Cloud_Int,cmdPwmLedCallback);   //新增
+    // printf("**********+++****%s,%s**********++***\r\n",*cmdPwmLedCtrl,*paraPwmLed);
 
-    CmdNode* cmdLampCtrl = cloud_createCmd("cmdLampCtrl");
-    CmdParam* paraBeep = cloud_createAndAppendPara(cmdLampCtrl,"lamp",Cloud_String,cmdLampCallback);
 
     printf("=================================================\r\n");
     printf("************* smart Lamp_demo ***********\r\n");
+    printf("DeviceID is :%s\r\n",CLOUD_DEVICE_ID);
     printf("=================================================\r\n");
+    
+        
     for(;;)
     {
-        ret = BH1750ReadData(&Lux);
-        if (ret != 0) {
-            RaiseLog(LOG_LEVEL_ERR,"Lamp Read Data failed!\r\n");
-            continue;
-        }
-        RaiseLog(LOG_LEVEL_INFO,"Lux data:%.2f\r\n", Lux);
-        if (Lux < 20) {
-            isLamp_ON = cmdLampStatus & ON; 
-            LightStatusSet(isLamp_ON);
-        } else {
-            isLamp_ON = cmdLampStatus | OFF;
-            LightStatusSet(isLamp_ON);      // cmd has the max perminssion
-        }
-        
-        cloud_uploadService(service);
+        // ret = microBitSL(&Lux);
+        // if (ret != 0) {
+        //     RaiseLog(LOG_LEVEL_ERR,"Lamp Read Data failed!\r\n");
+        //     continue;
+        // }
+        // RaiseLog(LOG_LEVEL_INFO,"Lux data:%.2f\r\n", Lux);
+ret = microBitSL(&Lux);        
+if(ret>20)
+{
+    LightStatusSet(ON);
+
+}else{
+    LightStatusSet(OFF);
+}
+        //Lux=100;
+        // if (Lux < 20) {
+        //     isLamp_ON = cmdLampStatus & ON;
+        //     //printf("cmdLampStatus is %d,ON is %d,isLamp_ON is %d\r\n",cmdLampStatus,ON,isLamp_ON);
+        //     LightStatusSet(isLamp_ON);
+        //     //PwmLedSet(isLamp_ON);    //新增
+
+        // } else { 
+        //     isLamp_ON = cmdLampStatus | OFF;
+        //     LightStatusSet(isLamp_ON);      // cmd has the max perminssion
+           
+        //     printf("cmdLampStatus is %d,OFF is %d,isLamp_ON is %d\r\n",cmdLampStatus,OFF,isLamp_ON);         
+
+        // }
+
+
+        // osDelay(100);
+
+        // printf("***&&&+++ dutycycle is %d\r\n",dutycycle);
+        // if((dutycycle>0 && dutycycle<100) && (isLamp_ON == 1))
+        // {
+        //     PwmLedSet(dutycycle);
+        //     //printf("Pwm Led \r\n");
+        // }
+
+        // PwmLedSet(cmdLampStatus , dutycycle);     
+        // osDelay(100);
+        // cloud_uploadService(service);
         osDelay(100);
     }
+
+
 }
 
 static void EntryMain(void)

+ 9 - 4
vendor/bossay/smart_lamp/demo_smart_lamp/sensor/inc/BH1750.h

@@ -13,13 +13,15 @@
  * limitations under the License.
  */
 
-#ifndef __E53_SC1_H__
-#define __E53_SC1_H__
+#ifndef __BH1750_H__
+#define __BH1750_H__
 
 #include <stdint.h>
 
 #define BH1750_ADDR 0x23
 
+
+
 typedef enum
 {
 	OFF = 0,
@@ -27,9 +29,12 @@ typedef enum
 } SwitchStatus;
 
 int BoardInit(void);
-int E53SC1ReadData(float *data);
+int microBitSL(float *data);
 void LightStatusSet(SwitchStatus status);
 
 
-#endif /* __E53_SC1_H__ */
+void PwmLedSet(int lampStatus ,int dutycycle);   //新增
+
+
+#endif /* __BH1750_H__ */
 

+ 95 - 11
vendor/bossay/smart_lamp/demo_smart_lamp/sensor/src/BH1750.c

@@ -24,11 +24,17 @@
 #include <string.h>
 #include <unistd.h>
 
+
 #define WIFI_IOT_IO_FUNC_GPIO_0_I2C1_SDA 6
 #define WIFI_IOT_IO_FUNC_GPIO_1_I2C1_SCL 6
 #define WIFI_IOT_IO_FUNC_GPIO_7_GPIO 0
 #define WIFI_IOT_I2C_IDX_1 1
 
+//新增
+#define WIFI_IOT_IO_NAME_GPIO_7 7
+#define WIFI_IOT_PWM_PORT_PWM0 0
+#define WIFI_IOT_IO_FUNC_GPIO_7_PWM0_OUT 5
+
 
 /***************************************************************
  * 函数名称: GpioInit
@@ -38,16 +44,48 @@
  ***************************************************************/
 static void GpioInit(void)
 {
-    IoTGpioInit(7);
-    IoTGpioSetFunc(7, WIFI_IOT_IO_FUNC_GPIO_7_GPIO);
-    IoTGpioSetDir(7, IOT_GPIO_DIR_OUT); //设置GPIO_7为输出模式
-
+//    IoTGpioInit(7);
+//    IoTGpioSetFunc(7, WIFI_IOT_IO_FUNC_GPIO_7_GPIO);
+//    IoTGpioSetDir(7, IOT_GPIO_DIR_OUT); //设置GPIO_7为输出模式
+    // IoTGpioInit(7);                                      //初始化GPIO_7
+    // IoTGpioSetFunc(7, WIFI_IOT_IO_FUNC_GPIO_7_PWM0_OUT); //设置GPIO_7引脚复用功能为PWM
+    // IoTGpioSetDir(7, IOT_GPIO_DIR_OUT);                  //设置GPIO_7引脚为输出模式
+    // IoTPwmInit(WIFI_IOT_PWM_PORT_PWM0);                                        //初始化PWM2端口
+    IoTGpioInit(WIFI_IOT_IO_NAME_GPIO_7);                                      //初始化GPIO_7
+    IoTGpioSetFunc(WIFI_IOT_IO_NAME_GPIO_7, WIFI_IOT_IO_FUNC_GPIO_7_PWM0_OUT); //设置GPIO_7引脚复用功能为PWM
+    IoTGpioSetDir(WIFI_IOT_IO_NAME_GPIO_7, IOT_GPIO_DIR_OUT);                  //设置GPIO_7引脚为输出模式
+    IoTPwmInit(WIFI_IOT_PWM_PORT_PWM0);                                        //初始化PWM0端口
+    printf("GPIO init...\r\n");
     IoTGpioInit(0);
     IoTGpioSetFunc(0, WIFI_IOT_IO_FUNC_GPIO_0_I2C1_SDA); // GPIO_0复用为I2C1_SDA
     IoTGpioInit(1);
     IoTGpioSetFunc(1, WIFI_IOT_IO_FUNC_GPIO_1_I2C1_SCL); // GPIO_1复用为I2C1_SCL
     IoTI2cInit(WIFI_IOT_I2C_IDX_1, 400000);              /* baudrate: 400kbps */
+    printf("GPIO init...OK\r\n");
+
 }
+
+//新增
+// void PwmLedInit(void)
+// {
+//     IoTGpioInit(LED_GPIO);
+//     IoTGpioSetFunc(LED_GPIO, IOT_GPIO_FUNC_GPIO_7_GPIO);
+//     IoTGpioSetDir(LED_GPIO, IOT_GPIO_DIR_OUT); //设置GPIO_7为输出模式
+
+//     IoTGpioInit(WIFI_IOT_IO_NAME_GPIO_2);                                      //初始化GPIO_2
+//     IoTGpioSetFunc(WIFI_IOT_IO_NAME_GPIO_2, WIFI_IOT_IO_FUNC_GPIO_2_PWM2_OUT); //设置GPIO_2引脚复用功能为PWM
+//     IoTGpioSetDir(WIFI_IOT_IO_NAME_GPIO_2, IOT_GPIO_DIR_OUT);                  //设置GPIO_2引脚为输出模式
+//     IoTPwmInit(WIFI_IOT_PWM_PORT_PWM2);                                        //初始化PWM2端口
+//     IoTGpioInit(0);
+//    IoTGpioSetFunc(0, WIFI_IOT_IO_FUNC_GPIO_0_I2C1_SDA); // GPIO_0复用为I2C1_SDA
+//    IoTGpioInit(1);
+//    IoTGpioSetFunc(1, WIFI_IOT_IO_FUNC_GPIO_1_I2C1_SCL); // GPIO_1复用为I2C1_SCL
+//    IoTI2cInit(WIFI_IOT_I2C_IDX_1, 400000);              /* baudrate: 400kbps */
+// }
+
+
+
+
 /***************************************************************
  * 函数名称: InitBH1750
  * 说    明: 写命令初始化BH1750
@@ -94,9 +132,9 @@ int BoardInit(void)
     int ret;
     GpioInit();
     ret = InitBH1750();
-    if (ret != 0) {
-        return -1;
-    }
+    // if (ret != 0) {
+    //     return -1;
+    // }
     return 0;
 }
 /***************************************************************
@@ -105,7 +143,7 @@ int BoardInit(void)
  * 参    数: data,光照强度数据指针
  * 返 回 值: 0 成功; -1 失败
  ***************************************************************/
-int BH1750ReadData(float* data)
+int microBitSL(float* data)
 {
     int ret;
     int result;
@@ -120,6 +158,7 @@ int BH1750ReadData(float* data)
     if (ret != 0) {
         return -1;
     }
+    printf("recevie data is :%x,%x\r\n",recv_data[0],recv_data[1]);
     *data = (float)(((recv_data[0] << 8) + recv_data[1]) / 1.2); //合成数据,即光照数据
     return 0;
 }
@@ -131,14 +170,59 @@ int BH1750ReadData(float* data)
  *									ON,开灯
  * 返 回 值: 无
  ***************************************************************/
+
 void LightStatusSet(SwitchStatus status)
 {
+    // if (status == ON) {
+    //     //IoTGpioSetOutputVal(7, 1); //设置GPIO_7输出高电平点亮LED灯
+    //     IoTPwmStart(WIFI_IOT_PWM_PORT_PWM0, 50, 4000); //输出PWM波
+    // }
+    // if (status == OFF) {
+    //     //IoTGpioSetOutputVal(7, 0); //设置GPIO_7输出低电平点亮LED灯
+    //     IoTPwmStop(WIFI_IOT_PWM_PORT_PWM0);
+    // }
+
     if (status == ON) {
-        IoTGpioSetOutputVal(7, 1); //设置GPIO_7输出高电平点亮LED灯
+        IoTPwmStart(WIFI_IOT_PWM_PORT_PWM0, 99, 4000); //输出PWM波
     }
-
     if (status == OFF) {
-        IoTGpioSetOutputVal(7, 0); //设置GPIO_7输出低电平点亮LED灯
+        IoTPwmStop(WIFI_IOT_PWM_PORT_PWM0);
     }
 }
 
+
+//新增
+void PwmLedSet(int lampStatus,int dutycycle)
+{
+    printf("@@@$$$$ dutycycle is %d\r\n",dutycycle);
+    
+    if(lampStatus == OFF){
+        IoTPwmStop(WIFI_IOT_PWM_PORT_PWM0);
+    }
+    else if(lampStatus == ON){
+
+        if(dutycycle>0 && dutycycle<100){
+            IoTPwmStart(WIFI_IOT_PWM_PORT_PWM0, dutycycle, 4000);  //输出PWM波
+        }
+        else if(dutycycle==0){
+            IoTPwmStart(WIFI_IOT_PWM_PORT_PWM0, 50, 4000);  //在手机应用页面点击开灯的瞬间是50亮度。在手机应用端点击开灯之后,但是没有点击亮度、亮度还是关灯时候的0。此功能是把开发板灯光强制设置为50亮度。
+        } 
+        else if(dutycycle==100){
+            IoTPwmStart(WIFI_IOT_PWM_PORT_PWM0, 99, 4000);  //手机应用页面亮度范围是从0到100。硬件电路最大能实现99亮度,因此应用页面显示的是100亮度、但是开发板灯光实际是99亮度。
+        }
+        else {
+            IoTPwmStart(WIFI_IOT_PWM_PORT_PWM0, 50, 4000);  //超出0到100范围的数值,硬件电路不能实现对应数值的亮度。因此强制设置为50亮度。
+        }
+
+        //IoTPwmStart(WIFI_IOT_PWM_PORT_PWM0, dutycycle, 4000);
+
+        // if(dutycycle==0){
+        //     IoTPwmStart(WIFI_IOT_PWM_PORT_PWM0, 99, 4000);
+        // }
+        // else if(dutycycle>0 && dutycycle<100){
+        //     IoTPwmStart(WIFI_IOT_PWM_PORT_PWM0, dutycycle, 4000);  //输出PWM波
+        // }    
+    }
+}
+
+

+ 0 - 7
vendor/bossay/smart_smoke_detect/config.json

@@ -88,13 +88,6 @@
           { "component": "kv_store", "features":[] },
           { "component": "os_dump", "features":[] }
         ]
-      },
-      {
-       "subsystem": "test",
-       "components": [
-         { "component": "xts_acts", "features":[] },
-         { "component": "xts_tools", "features":[] }
-        ]
       }
     ],
     "third_party_dir": "//device/bossay/hi3861_l0/sdk_liteos/third_party",

+ 4 - 3
vendor/bossay/smart_smoke_detect/demo_smoke_detect/cloud_connect/inc/cloud_communicate.h

@@ -69,7 +69,8 @@
 #define WIFI_PWD_MAX_LEN_ 256
 #define KV_STORE_SSID_ID "ssid"
 #define KV_STORE_PWD_ID "pwd"
-#define NAN_WIFI_AP_SSID "bossay"
+#define NAN_WIFI_AP_SSID "Smoke166"   //新增语句
+//#define NAN_WIFI_AP_SSID "bossay"
 
 #define MAX_STRING_VALUE_LEN 30
 #define MAX_CMD_NAME_LEN 30
@@ -123,8 +124,8 @@ typedef struct{
 
 
 
-//int getStoredWifiInfo(WIFI_ssid_pwd* wifi);
-//int setStoredWifiInfo(WIFI_ssid_pwd* wifi);
+// int getStoredWifiInfo(WIFI_ssid_pwd* wifi);
+// int setStoredWifiInfo(WIFI_ssid_pwd* wifi);
 int NanWifiConnect(bool restartNan);
 int cloud_CloudInit(const char *deviceID, const char *devicePwd, \
     const char *serverIP, const char *serverPort);

+ 10 - 9
vendor/bossay/smart_smoke_detect/demo_smoke_detect/cloud_connect/src/cloud_communicate.c

@@ -95,14 +95,14 @@ int cloud_CloudInit(const char *deviceID, const char *devicePwd, \
 int NanWifiConnect(bool restartNan)
 {
     WIFI_ssid_pwd wifi;
-    printf("--------------- NAN --------------------%d\n",sizeof(wifi.ssid));
-    if(restartNan){
-        goto CLOUD_START_NAN;
-    }
-    if(getStoredWifiInfo(&wifi) == 0){
-        goto CLOUD_CONNECT_WIFI;
-    }
-    
+    // printf("--------------- NAN --------------------%d\n",sizeof(wifi.ssid));
+    // if(restartNan){
+    //     goto CLOUD_START_NAN;
+    // }
+    // if(getStoredWifiInfo(&wifi) == 0){
+    //     goto CLOUD_CONNECT_WIFI;
+    // }
+    goto CLOUD_CONNECT_WIFI;   //新增语句
 CLOUD_START_NAN:
 
     RaiseLog(LOG_LEVEL_INFO,"Try to get the wifi info by NAN network....");
@@ -120,7 +120,8 @@ CLOUD_START_NAN:
 CLOUD_CONNECT_WIFI:
 
     BOARD_InitWifi();
-    ret = BOARD_ConnectWifi(wifi.ssid, wifi.pwd);
+    // ret = BOARD_ConnectWifi(wifi.ssid, wifi.pwd);
+    ret = BOARD_ConnectWifi("bossay123", "123456789");   //新增语句
     if (ret != 0) {
         RaiseLog(LOG_LEVEL_ERR, "Connect to wifi failed! \n");
         NotifyNetCfgResult(NETCFG_DEV_INFO_INVALID);

+ 85 - 15
vendor/bossay/smart_smoke_detect/demo_smoke_detect/main_entry.c

@@ -44,7 +44,8 @@
 
 #define CONFIG_CLOUD_DEFAULT_SERVERIP "121.36.42.100"   // Huawei cloud service ip
 #define CONFIG_CLOUD_DEFAULT_SERVERPORT "1883"          // // Huawei cloud service port
-#define CLOUD_DEVICE_ID "62b6a6c66b9813541d4e37b6_Lamp01"   // user need to change it according to the device id in cloud
+//#define CLOUD_DEVICE_ID "62b6a6c66b9813541d4e37b6_Lamp01"   // user need to change it according to the device id in cloud
+#define CLOUD_DEVICE_ID "6376e718e0dd6929d6d90686_Smoke166"   // user need to change it according to the device id in cloud   //新增语句
 #define CLOUD_DEVICE_PWD "12345678"  // user need to change it according to the device pwd in cloud
 
 #define NFC_DEVICE_ID_LEN 50
@@ -52,6 +53,41 @@
 
 
 static bool keyStatus = false;
+
+//新增开始
+static int cmdBeepStatus;
+static float threshold;
+static float SmokeDensity;
+int cmdBeepCallback(FuncValue_t ret)
+{
+    RaiseLog(LOG_LEVEL_INFO,"Beep Status Cmd:%s",ret.value.valueString); 
+    if((strcmp(ret.value.valueString,"ON"))==0){
+        cmdBeepStatus = ON;
+    }else{
+        cmdBeepStatus = OFF;
+        //SmokeDensity = 0;
+    }
+    return 0;
+}
+
+
+int cmdThresholdCallback(FuncValue_t ret)
+{   
+    RaiseLog(LOG_LEVEL_INFO,"Threshold is :%f",ret.value.valueDouble);
+    threshold=ret.value.valueDouble;
+    printf("$$$$$$$&&&&&&& threshold is :%f\r\n", threshold);
+    // if(cmdBeepStatus==OFF){
+    //     threshold=0;
+    // }
+    return 0;
+    
+    // //RaiseLog(LOG_LEVEL_INFO,"Threshold:%d",ret.value.valueInt);
+    // threshold=ret.value.valueInt;
+    // return 0;
+}
+//新增结束
+
+
 void keycallback(char* arg){
     keyStatus = true;
     return;
@@ -60,44 +96,78 @@ void keycallback(char* arg){
 void IotMainTaskEntry(void* argument)
 {
     int ret;
-    float  ppm;
+    //float  ppm;   //原有的烟雾浓度
+
+    //int isBeep_ON = 0;    //新增
+    
     BoardInit();
     usleep(1000000);        
     MQ2PPMCalibration();  
 
     initKey(keycallback);
     IOT_ScheduleInit();
-    BOARD_InitWifi();
+    // BOARD_InitWifi();
     osDelay(300);
-    NanWifiConnect(keyStatus);
-    cloud_CloudInit(CLOUD_DEVICE_ID,CLOUD_DEVICE_PWD,CONFIG_CLOUD_DEFAULT_SERVERIP,CONFIG_CLOUD_DEFAULT_SERVERPORT);
+    // NanWifiConnect(keyStatus);
+    // cloud_CloudInit(CLOUD_DEVICE_ID,CLOUD_DEVICE_PWD,CONFIG_CLOUD_DEFAULT_SERVERIP,CONFIG_CLOUD_DEFAULT_SERVERPORT);
     
     char doorBell[10];
     strcpy(doorBell,"OFF");
 
-    Cloud_Servic* service = cloud_createService("Somke_detect",NULL);
-    cloud_createAndAppendProprety(service,"ppm",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&ppm);
+    // Cloud_Servic* service = cloud_createService("Smoke_detect",NULL);
+    //cloud_createAndAppendProprety(service,"ppm",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&ppm);   //原有的烟雾浓度
+    // cloud_createAndAppendProprety(service,"SmokeDensity",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&SmokeDensity);   //新增的烟雾浓度
+    // cloud_createAndAppendProprety(service,"Threshold",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&threshold);   //新增的报警阈值
+    // cloud_createAndAppendProprety(service,"BeepStatus",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&cmdBeepStatus);   //新增
+
+    CmdNode* cmdBeepCtrl = cloud_createCmd("SetBeepStatus");
+    CmdParam* paraBeep = cloud_createAndAppendPara(cmdBeepCtrl,"BeepStatus",Cloud_String,cmdBeepCallback);
+    printf("******----&&*******%s,%s*********--***\r\n",*cmdBeepCtrl,*paraBeep);
+
+
+    CmdNode* cmdThresholdCtrl = cloud_createCmd("SetThreshold");   //新增
+    CmdParam* paraThreshold = cloud_createAndAppendPara(cmdThresholdCtrl,"Threshold",Cloud_Double,cmdThresholdCallback);   //新增
+    printf("**********+++****%s,%s**********++***\r\n",*cmdThresholdCtrl,*paraThreshold);   //新增
+
 
     printf("=============================================\r\n");
-    printf("************* smoke_detect_demo *************\r\n");
+    printf("************* Smoke_detect_demo *************\r\n");
     printf("=============================================\r\n");
     for(;;)
-    {
-        ret = GetMQ2PPM(&ppm);
+    {        
+        //ret = GetMQ2PPM(&ppm);   //原有的烟雾浓度
+
+        ret = GetMQ2PPM(&SmokeDensity);
         if (ret != 0) {
             printf("ADC Read Fail\n");
             return ;
         }
-        printf("ppm:%.3f \n", ppm);
-        if (ppm > 30) {
-            BeepStatusSet(ON);
+        printf("+++***@@@ SmokeDensity is :%.3f \n", SmokeDensity);
+        printf("+++***@@@ threshold is %f\r\n",threshold);
+    
+
+        //if (SmokeDensity > 30) {
+        if (SmokeDensity > 100) {
+            cmdBeepStatus = ON;
+            printf("cmdBeepStatusON is %d\r\n",cmdBeepStatus);
+            BeepStatusSet(cmdBeepStatus);
+
+            //BeepStatusSet(ON);
             LedStatusSet(ON);
         } else {
-            BeepStatusSet(OFF);
+            cmdBeepStatus = OFF;
+            printf("cmdBeepStatusOFF is %d\r\n",cmdBeepStatus);
+            BeepStatusSet(cmdBeepStatus);
+
+            //BeepStatusSet(OFF);
             LedStatusSet(OFF);
         }
 
-        cloud_uploadService(service);
+        printf("cmdBeepStatus is %d\r\n",cmdBeepStatus);
+        printf("threshold is %f\r\n",threshold);
+        osDelay(100);
+
+        // cloud_uploadService(service);
         osDelay(100);
     }
 }

+ 2 - 1
vendor/bossay/smart_smoke_detect/demo_smoke_detect/sensor/src/MQ2.c

@@ -103,6 +103,7 @@ int GetMQ2PPM(float* ppm)
 void MQ2PPMCalibration(void)
 {
     float voltage = GetVoltage();
+    printf("V:%f\r\n",voltage);
     float RS = (5 - voltage) / voltage * RL;
     R0 = RS / pow(CAL_PPM / 613.9f, 1 / -2.074f);
 }
@@ -128,7 +129,7 @@ void BeepStatusSet(SwitchStatus status)
  * 函数名称: LedStatusSet
  * 说    明: 报警灯报警与否
  * 参    数: status,ENUM枚举的数据
- *									OFF,
+ *									OFF,
  *									ON,开灯
  * 返 回 值: 无
  ***************************************************************/

+ 2 - 2
vendor/bossay/smart_weather/BUILD.gn

@@ -1,10 +1,10 @@
 # Copyright (C) 2020 Hisilicon (Shanghai) Technologies Co., Ltd. All rights reserved.
 
-group("smart_weather") {
+group("smart_Weather") {
     deps = [
         "//device/bossay/hi3861_l0/sdk_liteos:wifiiot_sdk",
         "../common/iot_wifi:iot_wifi",
         # "//applications/sample/app:app",
-        "demo_smart_weather:bossay_hi3861_l0_smart_weather",
+        "demo_smart_Weather:bossay_hi3861_l0_smart_Weather",
     ]
 }

+ 1 - 8
vendor/bossay/smart_weather/config.json

@@ -1,5 +1,5 @@
 {
-    "product_name": "smart_weather",
+    "product_name": "smart_Weather",
     "ohos_version": "OpenHarmony 1.0",
     "device_company": "bossay",
     "board": "hi3861_l0",
@@ -88,13 +88,6 @@
           { "component": "kv_store", "features":[] },
           { "component": "os_dump", "features":[] }
         ]
-      },
-      {
-       "subsystem": "test",
-       "components": [
-         { "component": "xts_acts", "features":[] },
-         { "component": "xts_tools", "features":[] }
-        ]
       }
     ],
     "third_party_dir": "//device/bossay/hi3861_l0/sdk_liteos/third_party",

+ 1 - 1
vendor/bossay/smart_weather/demo_smart_weather/BUILD.gn

@@ -1,4 +1,4 @@
-static_library("bossay_hi3861_l0_smart_weather") {
+static_library("bossay_hi3861_l0_smart_Weather") {
     sources = [
         "main_entry.c",
     ]

+ 3 - 3
vendor/bossay/smart_weather/demo_smart_weather/cloud_connect/inc/cloud_communicate.h

@@ -69,7 +69,7 @@
 #define WIFI_PWD_MAX_LEN_ 256
 #define KV_STORE_SSID_ID "ssid"
 #define KV_STORE_PWD_ID "pwd"
-#define NAN_WIFI_AP_SSID "bossay"
+#define NAN_WIFI_AP_SSID "Weather166"
 
 #define MAX_STRING_VALUE_LEN 30
 #define MAX_CMD_NAME_LEN 30
@@ -123,8 +123,8 @@ typedef struct{
 
 
 
-//int getStoredWifiInfo(WIFI_ssid_pwd* wifi);
-//int setStoredWifiInfo(WIFI_ssid_pwd* wifi);
+int getStoredWifiInfo(WIFI_ssid_pwd* wifi);
+int setStoredWifiInfo(WIFI_ssid_pwd* wifi);
 int NanWifiConnect(bool restartNan);
 int cloud_CloudInit(const char *deviceID, const char *devicePwd, \
     const char *serverIP, const char *serverPort);

+ 3 - 1
vendor/bossay/smart_weather/demo_smart_weather/cloud_connect/src/cloud_communicate.c

@@ -102,7 +102,7 @@ int NanWifiConnect(bool restartNan)
     if(getStoredWifiInfo(&wifi) == 0){
         goto CLOUD_CONNECT_WIFI;
     }
-    
+    // goto CLOUD_CONNECT_WIFI;   //新增语句    
 CLOUD_START_NAN:
 
     RaiseLog(LOG_LEVEL_INFO,"Try to get the wifi info by NAN network....");
@@ -121,6 +121,8 @@ CLOUD_CONNECT_WIFI:
 
     BOARD_InitWifi();
     ret = BOARD_ConnectWifi(wifi.ssid, wifi.pwd);
+    // ret = BOARD_ConnectWifi("Bossay", "Bossay@123");   //新增语句
+
     if (ret != 0) {
         RaiseLog(LOG_LEVEL_ERR, "Connect to wifi failed! \n");
         NotifyNetCfgResult(NETCFG_DEV_INFO_INVALID);

+ 161 - 13
vendor/bossay/smart_weather/demo_smart_weather/main_entry.c

@@ -37,6 +37,9 @@
 #include "cloud_communicate.h"
 #include "cloud_schedule.h"
 #include "WATHER.h"
+#include "dht21.h"      //补增,原始文件忘记添加
+#include "bmp280.h"     //补增,原始文件忘记添加
+
 #include "OLED_I2C.h"
 
 #define CONFIG_TASK_MAIN_STACKSIZE 0x2000
@@ -44,7 +47,7 @@
 
 #define CONFIG_CLOUD_DEFAULT_SERVERIP "121.36.42.100"   // Huawei cloud service ip
 #define CONFIG_CLOUD_DEFAULT_SERVERPORT "1883"          // // Huawei cloud service port
-#define CLOUD_DEVICE_ID "62b6adb26b9813541d4e38c1_Lamp01"   // user need to change it according to the device id in cloud
+#define CLOUD_DEVICE_ID "63809127e0dd6929d6d9ffaa_Weather166"   // user need to change it according to the device id in cloud
 #define CLOUD_DEVICE_PWD "12345678"  // user need to change it according to the device pwd in cloud
 
 #define NFC_DEVICE_ID_LEN 50
@@ -82,12 +85,81 @@ void keycallback(char* arg){
     return;
 }
 
+
+//新增开始
+static int cmdBeepStatus;
+static float temperatureThreshold;
+static float humidityThreshold;
+static float pressureThreshold;
+static float altiudeThreshold;
+static float temperature;
+static float humidity;
+static float pressure;
+static float altiude;
+int cmdBeepCallback(FuncValue_t ret)
+{
+    RaiseLog(LOG_LEVEL_INFO,"Beep Status Cmd:%s",ret.value.valueString); 
+    if((strcmp(ret.value.valueString,"ON"))==0){
+        cmdBeepStatus = ON;
+    }else{
+        cmdBeepStatus = OFF;
+        //Temperature = 0;
+    }
+    return 0;
+}
+
+
+int cmdTemperatureThresholdCallback(FuncValue_t ret)
+{   
+    RaiseLog(LOG_LEVEL_INFO,"Temperature_Threshold is :%f",ret.value.valueDouble);
+    temperatureThreshold=ret.value.valueDouble;
+    printf("$$$$$$$&&&&&&& temperatureThreshold is :%f\r\n", temperatureThreshold);
+    // if(cmdBeepStatus==OFF){
+    //     temperatureThreshold=0;
+    // }
+    return 0;
+    
+    // RaiseLog(LOG_LEVEL_INFO,"Temperature_Threshold:%d",ret.value.valueInt);
+    // temperatureThreshold=ret.value.valueInt;
+    // printf("$$$$$$$&&&&&&& temperatureThreshold is :%d\r\n", temperatureThreshold);
+    // return 0;
+}
+
+int cmdHumidityThresholdCallback(FuncValue_t ret)
+{   
+    RaiseLog(LOG_LEVEL_INFO,"Humidity_Threshold is :%f",ret.value.valueDouble);
+    humidityThreshold=ret.value.valueDouble;
+    printf("$$$$$$$&&&&&&& humidityThreshold is :%f\r\n", humidityThreshold);
+    return 0;
+}
+
+int cmdPressureThresholdCallback(FuncValue_t ret)
+{   
+    RaiseLog(LOG_LEVEL_INFO,"Pressure_Threshold is :%f",ret.value.valueDouble);
+    pressureThreshold=ret.value.valueDouble;
+    printf("$$$$$$$&&&&&&& pressureThreshold is :%f\r\n", pressureThreshold);
+    return 0;
+}
+
+int cmdAltiudeThresholdCallback(FuncValue_t ret)
+{   
+    RaiseLog(LOG_LEVEL_INFO,"Altiude_Threshold is :%f",ret.value.valueDouble);
+    altiudeThreshold=ret.value.valueDouble;
+    printf("$$$$$$$&&&&&&& altiudeThreshold is :%f\r\n", altiudeThreshold);
+    return 0;
+}
+
+//新增结束
+
+
+
 void IotMainTaskEntry(void* argument)
 {
-    BMP280_HandleTypedef bmp280;
-    float pressure, temperature, asl,humidity;
+    BMP280_HandleTypedef bmp280;  
     uint16_t dht_temperature;
 	uint16_t dht_humidity;
+    //float pressure, temperature, altiude,humidity;
+
     BoardInit();
     bmp280_init_default_params(&bmp280.params);
     	while (!bmp280_init(&bmp280, &bmp280.params)) {
@@ -103,11 +175,44 @@ void IotMainTaskEntry(void* argument)
     cloud_CloudInit(CLOUD_DEVICE_ID,CLOUD_DEVICE_PWD,CONFIG_CLOUD_DEFAULT_SERVERIP,CONFIG_CLOUD_DEFAULT_SERVERPORT);
     
 
-    Cloud_Servic* service = cloud_createService("Weather_service",NULL);
-    cloud_createAndAppendProprety(service,"temperatire_status",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&temperature);
-    cloud_createAndAppendProprety(service,"pressure_status",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&pressure);
-    cloud_createAndAppendProprety(service,"asl_status",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&asl);
-    cloud_createAndAppendProprety(service,"humidity_status",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&humidity);
+    // Cloud_Servic* service = cloud_createService("Weather_service",NULL);
+    // cloud_createAndAppendProprety(service,"temperatire_status",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&temperature);
+    // cloud_createAndAppendProprety(service,"pressure_status",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&pressure);
+    // cloud_createAndAppendProprety(service,"asl_status",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&asl);
+    // cloud_createAndAppendProprety(service,"humidity_status",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&humidity);
+
+
+    Cloud_Servic* service = cloud_createService("WeatherDetection",NULL);
+    cloud_createAndAppendProprety(service,"BeepStatus",IOT_PROFILE_KEY_DATATYPE_INT,(void*)&cmdBeepStatus);
+    cloud_createAndAppendProprety(service,"Temperature",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&temperature);
+    cloud_createAndAppendProprety(service,"Humidity",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&humidity);
+    cloud_createAndAppendProprety(service,"Pressure",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&pressure);
+    cloud_createAndAppendProprety(service,"Altiude",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&altiude);
+    cloud_createAndAppendProprety(service,"Temperature_Threshold",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&temperatureThreshold);   
+    cloud_createAndAppendProprety(service,"Humidity_Threshold",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&humidityThreshold);   
+    cloud_createAndAppendProprety(service,"Pressure_Threshold",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&pressureThreshold);   
+    cloud_createAndAppendProprety(service,"Altiude_Threshold",IOT_PROFILE_KEY_DATATYPE_FLOAT,(void*)&altiudeThreshold);    
+
+    CmdNode* cmdBeepCtrl = cloud_createCmd("SetBeepStatus");
+    CmdParam* paraBeep = cloud_createAndAppendPara(cmdBeepCtrl,"BeepStatus",Cloud_String,cmdBeepCallback);
+    printf("******----&&*******%s,%s*********--***\r\n",*cmdBeepCtrl,*paraBeep);
+
+
+    CmdNode* cmdTemperatureThresholdCtrl = cloud_createCmd("SetTemperature_Threshold");   
+    CmdParam* paraTemperatureThreshold = cloud_createAndAppendPara(cmdTemperatureThresholdCtrl,"Temperature_Threshold",Cloud_Double,cmdTemperatureThresholdCallback);   
+    printf("**********+++****%s,%s**********++***\r\n",*cmdTemperatureThresholdCtrl,*paraTemperatureThreshold); 
+
+    CmdNode* cmdHumidityThresholdCtrl = cloud_createCmd("SetHumidity_Threshold");   
+    CmdParam* paraHumidityThreshold = cloud_createAndAppendPara(cmdHumidityThresholdCtrl,"Humidity_Threshold",Cloud_Double,cmdHumidityThresholdCallback);   
+    printf("**********+++****%s,%s**********++***\r\n",*cmdHumidityThresholdCtrl,*paraHumidityThreshold); 
+
+    CmdNode* cmdPressureThresholdCtrl = cloud_createCmd("SetPressure_Threshold");   
+    CmdParam* paraPressureThreshold = cloud_createAndAppendPara(cmdPressureThresholdCtrl,"Pressure_Threshold",Cloud_Double,cmdPressureThresholdCallback);   
+    printf("**********+++****%s,%s**********++***\r\n",*cmdPressureThresholdCtrl,*paraPressureThreshold); 
+
+    CmdNode* cmdAltiudeThresholdCtrl = cloud_createCmd("SetAltiude_Threshold");   
+    CmdParam* paraAltiudeThreshold = cloud_createAndAppendPara(cmdAltiudeThresholdCtrl,"Altiude_Threshold",Cloud_Double,cmdAltiudeThresholdCallback);   
+    printf("**********+++****%s,%s**********++***\r\n",*cmdAltiudeThresholdCtrl,*paraAltiudeThreshold); 
 
 
     /* if user want to en able the schedule control could disable comment below  */
@@ -123,18 +228,61 @@ void IotMainTaskEntry(void* argument)
     // ScheduleCtrl_t* shd_OpenDoor =  cloud_createSchedule("OpenBeep",0xff,18,55,30,1440,ctrl_0);
     // ScheduleCtrl_t* shd_CloseDoor =  cloud_createSchedule("CloseBeep",0xff,18,55,30,30,ctrl_1);
     printf("=======================================\r\n");
-    printf("************* demo_smart_weather ***********\r\n");
+    printf("************* demo_smart_Weather ***********\r\n");
     printf("=======================================\r\n");
     for(;;)
     {
         DHT21_onewire(&dht_temperature,&dht_humidity);
 		humidity = (float)dht_humidity/10;
-        if(humidity>80) BeepStatusSet(ON);
-        else BeepStatusSet(OFF);
-        while (!bmp280_read_float(&bmp280, &temperature, &pressure, &asl)) {
-            RaiseLog(LOG_LEVEL_INFO,"Temperature/pressure reading failed\n");
+        // if(humidity>80) BeepStatusSet(ON);
+        // else BeepStatusSet(OFF);
+        // while (!bmp280_read_float(&bmp280, &temperature, &pressure, &asl)) {
+        //     RaiseLog(LOG_LEVEL_INFO,"Temperature/pressure reading failed\n");
+        // }
+
+        //if(humidity>humidityThreshold)
+        // if(humidity>80)
+        // {
+        //     cmdBeepStatus = ON;
+        //     printf("cmdBeepStatusON is %d\r\n",cmdBeepStatus);
+        //     BeepStatusSet(cmdBeepStatus);
+
+        // }
+        // else
+        // {
+        //     cmdBeepStatus = OFF;
+        //     printf("cmdBeepStatusOFF is %d\r\n",cmdBeepStatus);
+        //     BeepStatusSet(cmdBeepStatus);
+        // }
+		// printf("temperature=%d\r\n",dht_temperature);
+		// printf("humidity=%d\r\n",dht_humidity);
+
+        //读取温度、气压、海拔数据,学员自行补充
+        while (!bmp280_read_float(&bmp280, &temperature, &pressure, &altiude)) 
+        {
+            printf("Temperature/pressure reading failed\n");
         }
+        printf("temperature: %.2f C\r\nhumidity: %.2f %%\r\npressure: %.2f hPa\r\naltiude: %.2f m\r\n",temperature,humidity,pressure,altiude);
+        //12月22日14:41办公室的数据是temperature: 29.11 C,humidity: 99.90 %,pressure: 1012.02 hPa,altiude: -17.45 m
 
+        
+        if((humidity>humidityThreshold)||(temperature>temperatureThreshold)||(pressure>pressureThreshold)||(altiude>altiudeThreshold))
+        //if(humidity>80)
+        {
+            cmdBeepStatus = ON;
+            printf("cmdBeepStatusON is %d\r\n",cmdBeepStatus);
+            BeepStatusSet(cmdBeepStatus);
+
+        }
+        else
+        {
+            cmdBeepStatus = OFF;
+            printf("cmdBeepStatusOFF is %d\r\n",cmdBeepStatus);
+            BeepStatusSet(cmdBeepStatus);
+        }
+
+
+        osDelay(100);
         cloud_uploadService(service);
         osDelay(100);
     }