Преглед на файлове

Merge branch 'master' of https://gitee.com/openLuat/LuatOS

alienwalker преди 1 година
родител
ревизия
fcd4b5344f
променени са 3 файла, в които са добавени 16 реда и са изтрити 25 реда
  1. 1 1
      components/minmea/luat_lib_libgnss.c
  2. 5 19
      script/libs/iotcloud.lua
  3. 10 5
      tools/make_doc_file.py

+ 1 - 1
components/minmea/luat_lib_libgnss.c

@@ -978,7 +978,7 @@ static int l_libgnss_locStr(lua_State *L) {
                             fabs(lng_f), lng_f > 0 ? 'E' : 'W');
         break;
     case 1:
-        snprintf_(buff, 63, "%d,%d", gnssctx.frame_rmc.latitude.value, gnssctx.frame_rmc.longitude.value);
+        snprintf_(buff, 63, "%ld,%ld", gnssctx.frame_rmc.latitude.value, gnssctx.frame_rmc.longitude.value);
         break;
     default:
         break;

+ 5 - 19
script/libs/iotcloud.lua

@@ -32,7 +32,7 @@
     -- 一型一密
     -- iotcloudc = iotcloud.new(iotcloud.ONENET,{produt_id = "xxx",product_secret = "xxx"})
     -- 一机一密
-    -- iotcloudc = iotcloud.new(iotcloud.ONENET,{produt_id = "xxx",device_name = "xxx",key = "xxx"})
+    -- iotcloudc = iotcloud.new(iotcloud.ONENET,{produt_id = "xxx",device_name = "xxx",device_secret = "xxx"})
 
     -- 华为云
     -- 动态注册(免预注册)
@@ -416,23 +416,9 @@ local function iotcloud_onenet_config(iotcloudc,iot_config,connect_config)
     iotcloudc.ip    = 1883
     if iot_config.product_secret then                       -- 一型一密
         iotcloudc.product_secret = iot_config.product_secret
-        local version = '2018-10-31'
-        local res = "products/"..iotcloudc.product_id
-        local et = '32472115200'
-        local method = 'sha256'
-        local key = crypto.base64_decode(iotcloudc.product_secret)
-        local StringForSignature  = et .. '\n' .. method .. '\n' .. res ..'\n' .. version
-        local sign1 = crypto.hmac_sha256(StringForSignature,key)
-        local sign2 = sign1:fromHex()
-        local sign = crypto.base64_encode(sign2)
-        sign = string.urlEncode(sign)
-        res = string.urlEncode(res)
-        local token = string.format('version=%s&res=%s&et=%s&method=%s&sign=%s',version, res, et, method, sign)
-        iotcloudc.client_id = iotcloudc.device_name
-        iotcloudc.user_name = iotcloudc.product_id
-        iotcloudc.password = token
-    elseif iot_config.key then                              -- 一机一密
-        iotcloudc.client_id,iotcloudc.user_name,iotcloudc.password = iotauth.onenet(iotcloudc.product_id,iotcloudc.device_name,iot_config.key)
+        iotcloudc.client_id,iotcloudc.user_name,iotcloudc.password = iotauth.onenet(iotcloudc.product_id, iotcloudc.device_name, iot_config.product_secret, nil, nil, nil, "products/" .. iotcloudc.product_id)
+    elseif iot_config.device_secret then                              -- 一机一密
+        iotcloudc.client_id,iotcloudc.user_name,iotcloudc.password = iotauth.onenet(iotcloudc.product_id,iotcloudc.device_name,iot_config.device_secret)
     elseif iot_config.userid and iot_config.userkey then    -- 动态注册
         iotcloudc.userid = iot_config.userid
         iotcloudc.userkey = iot_config.userkey
@@ -592,7 +578,7 @@ end
     -- 一型一密
     -- iotcloudc = iotcloud.new(iotcloud.ONENET,{produt_id = "xxx",product_secret = "xxx"})
     -- 一机一密
-    -- iotcloudc = iotcloud.new(iotcloud.ONENET,{produt_id = "xxx",device_name = "xxx",key = "xxx"})
+    -- iotcloudc = iotcloud.new(iotcloud.ONENET,{produt_id = "xxx",device_name = "xxx",device_secret = "xxx"})
 
     -- 华为云
     -- 动态注册(免预注册)

+ 10 - 5
tools/make_doc_file.py

@@ -5,19 +5,24 @@ import requests
 #bsp.h文件列表
 bsp_header_list = [
 {"name":"Air780E","url":"https://github.com/openLuat/luatos-soc-2022/raw/master/project/luatos/inc/luat_conf_bsp.h"},
-{"name":"Air780EP","url":"https://github.com/openLuat/luatos-soc-2023/raw/master/project/luatos/inc/luat_conf_bsp_dft.h"},
-{"name":"Air780EPS","url":"https://github.com/openLuat/luatos-soc-2023/raw/master/project/luatos/inc/luat_conf_bsp_dft.h"},
+{"name":"Air780EP","url":"https://github.com/openLuat/luatos-soc-2024/raw/master/project/luatos/inc/luat_conf_bsp_dft.h"},
+{"name":"Air780EPS","url":"https://github.com/openLuat/luatos-soc-2024/raw/master/project/luatos/inc/luat_conf_bsp_dft.h"},
 ]
 print("getting bsp.h files...")
 for bsp in bsp_header_list:
-    # print("getting "+bsp["name"]+"...")
+    print("getting "+bsp["name"]+"...")
     res = ""
     #有时候获取不到完整的数据,报错的页面就是html
+    retry = 0
     while len(res) < 200 or res.find("</title>") != -1:
         res = requests.get(bsp["url"]).text
-        # print(res)
+        print(str(len(res)) + " bytes")
+        retry = retry + 1
+        if retry > 5:
+            print("failed to get "+bsp["name"]+" bsp.h file")
+            break
     bsp["url"] = res
-    # print("done "+ str(len(bsp["url"])) + " bytes")
+    print("done "+ str(len(bsp["url"])) + " bytes")
 
 def is_supported(tag, bsp) :
     if bsp["url"].find(" "+tag+" ") >= 0 or bsp["url"].find(" "+tag+"\r") >= 0 or bsp["url"].find(" "+tag+"\n") >= 0: