20190814_jeffrey - silenceuncrio/diary GitHub Wiki

0900

再準備一次 M330 的 firmware images 給 yuncore

今天產出的 mcsv 為 014B00000062E95E

user@3b95631f73fe:~$ ./manufacture.py
Software MCSV: 014B00000062E95E
MAC start: 00:03:79:06:60:00
MAC end: 00:03:79:06:6B:B7
Serial Number start: BL7VB3WE0000
Serial Number end: BL7VB3WE03E7
MAC range: 00:03:79:06:60:00 ~ 00:03:79:06:6B:B7
Serial Number range: BL7VB3WE0000 ~ BL7VB3WE03E7

利用 md5sum 產生各個 file 的 checksum 給 yuncore 以免跟前天的搞混

0940

M330 要給 hytec 的版本需要提供 DO 的 web api - 跟 M300 一樣

注意到 url rewrite rule

diff --git a/proscend/prosrc/icos/icoslib/web/webcfg.c b/proscend/prosrc/icos/icoslib/web/webcfg.c
index 1cd8d3a..5f3b5de 100644
--- a/proscend/prosrc/icos/icoslib/web/webcfg.c
+++ b/proscend/prosrc/icos/icoslib/web/webcfg.c
@@ -121,6 +121,7 @@
 #define WEB_CONFIG_URL_REWRITE \
     "url.rewrite = ( \n" \
     "  \"^/api/([a-zA-Z]+)[0-9a-zA-Z=.?]*$\" => \"/cgi-bin/api.cgi?act=$1\",\n" \
+    "  \"^/(DO_ON|DO_OFF|DO_PULSE|RESTORE_DO_ALARM)$\" => \"/cgi-bin/api.cgi?act=$1\",\n" \
     ")\n" \
     "\n"

diff --git a/proscend/prosrc/webcgi/api.c b/proscend/prosrc/webcgi/api.c
index 9643107..0fd963b 100644
--- a/proscend/prosrc/webcgi/api.c
+++ b/proscend/prosrc/webcgi/api.c
@@ -8,6 +8,32 @@



+static void _api_do_on()
+{
+    ICOS_msg_sendto(MODULE_WEBUI, MODULE_ALARM, NULL, 0, ICOS_UCAST_REMOTE_DO_ON);
+    jweb.out.json.ok();
+}
+
+static void _api_do_off()
+{
+    ICOS_msg_sendto(MODULE_WEBUI, MODULE_ALARM, NULL, 0, ICOS_UCAST_REMOTE_DO_OFF);
+    jweb.out.json.ok();
+}
+
+static void _api_do_pulse()
+{
+    ICOS_msg_sendto(MODULE_WEBUI, MODULE_ALARM, NULL, 0, ICOS_UCAST_REMOTE_DO_PULSE);
+    jweb.out.json.ok();
+}
+
+static void _api_restore_do_alarm()
+{
+    ICOS_msg_sendto(MODULE_WEBUI, MODULE_ALARM, NULL, 0, ICOS_UCAST_RESTORE_DO_ALARM);
+    jweb.out.json.ok();
+}
+
+
+
 static void _help()
 {
     jweb.out.json.ok();
@@ -63,6 +89,24 @@ int main(void)
     {
         jweb.api.upload_file(UPLOAD_PATH_CUSTOMER_FILE);
     }
+#if !defined(PROSRC_NO_DIDO) && defined(PROSRC_DO_REMOTE)
+    else if (STRCMP(jweb.in.act, "DO_ON"))
+    {
+        jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _api_do_on);
+    }
+    else if (STRCMP(jweb.in.act, "DO_OFF"))
+    {
+        jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _api_do_off);
+    }
+    else if (STRCMP(jweb.in.act, "DO_PULSE"))
+    {
+        jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _api_do_pulse);
+    }
+    else if (STRCMP(jweb.in.act, "RESTORE_DO_ALARM"))
+    {
+        jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _api_restore_do_alarm);
+    }
+#endif
     else if (STRCMP(jweb.in.act, "help"))
     {
         _help();

M330[release/v0.06] - offer the following web api to control DO

commit 444e7ae1ccc071100048ae710c3057c37c16fb13
Refs: [release/v0.06], {origin/release/v0.06}
Author: jeffrey <[email protected]>
Date:   Wed Aug 14 09:49:21 2019 +0800

    offer the following web api to control DO
    /DO_ON
    /DO_OFF
    /DO_PULSE
    /RESTORE_DO_ALARM

    we need a url rewrite rule - "  \"^/(DO_ON|DO_OFF|DO_PULSE|RESTORE_DO_ALARM)$\" => \"/cgi-bin/api.cgi?act=$1\"
    to map to the following CGIs:
    - /cgi-bin/api.cgi?act=DO_ON
    - /cgi-bin/api.cgi?act=DO_OFF
    - /cgi-bin/api.cgi?act=DO_PULSE
    - /cgi-bin/api.cgi?act=RESTORE_DO_ALARM

 proscend/prosrc/icos/icoslib/web/webcfg.c |  1 +
 proscend/prosrc/webcgi/api.c              | 44 +++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)

1105

檯面上的 task

M300

  • P1 - GRG tunnel 需支援 keep-alive, key 加密...
    • 07/29 ~ 08/20
    • 目前自己的部分已完成
  • P3 - Layer 2 Encapsulation over GRE (L2oGRE)

M330

  • P1 - All modules related to OpenSSl need to check (new 1.0.2)
    • 完成
  • P1 - web port needs to be editable
  • P2 - Web UI: WAN WiFi
    • 40%
  • P2 - Wizard
  • P2 - web ui display issue via smartphone
  • P2 - web ui: GPS track drawing

來做 M330 - P1 - web port needs to be editable

切回 M330[develop] - GENERIC/1_GENERIC_WIFI


M330[develop] - add 'Management > Web' for user to change the HTTP/HTTPS port

commit 484c58f6d1c67ac9938b2d1bdc887feb1831a0a4
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Aug 14 11:50:17 2019 +0800

    add 'Management > Web' for user to change the HTTP/HTTPS port

 proscend/prosrc/webcgi/Makefile                    |   2 +
 proscend/prosrc/webcgi/web.c                       | 112 +++++++++++++++++++++
 proscend/prosrc/www/app/feature/web.html           |  45 +++++++++
 proscend/prosrc/www/app/feature/web.js             |  64 ++++++++++++
 proscend/prosrc/www/app/locale-en.json             |   8 ++
 proscend/prosrc/www/app/locale-fr.json             |   7 ++
 proscend/prosrc/www/app/locale-zh-tw.json          |   7 ++
 proscend/prosrc/www/app/services/icos.service.js   |  11 ++
 proscend/prosrc/www/src/index.html.src             |   1 +
 proscend/prosrc/www/src/manual.html.src            |   1 +
 .../prosrc/www/src/manual/management_web.h.html    |  38 +++++++
 proscend/prosrc/www/src/manual/sidebar.h.html      |   3 +
 proscend/prosrc/www/src/menu.html.src              |   1 +
 13 files changed, 300 insertions(+)

1300

檯面上的 task 目前排序來到 M330 - P2 - Web UI: WAN WiFi

一樣是 M330[develop] - GENERIC/1_GENERIC_WIFI

不過記得在 proscend 目錄下 make menuconfig

WIFI Support(STA mode) 打開 - PROSRC_WIFI_STA=y


M330[develop] - use status.scan_count to force the length of status.scan_list

commit bc12fcd8cd28c547b04ef651f2b5fb20eb6fff83
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Aug 14 15:06:27 2019 +0800

    use status.scan_count to force the length of status.scan_list
    - or ng-repeat will display all include null entry in the status.scan_list

 proscend/prosrc/www/app/feature/wifi_sta.js | 1 +
 1 file changed, 1 insertion(+)

先來一小步練練手


直接從 CGI 就控制 vm.status.scan_list 的數量更合理

diff --git a/proscend/prosrc/webcgi/wifi_sta.c b/proscend/prosrc/webcgi/wifi_sta.c
index 38ea73a..0a9239e 100644
--- a/proscend/prosrc/webcgi/wifi_sta.c
+++ b/proscend/prosrc/webcgi/wifi_sta.c
@@ -87,7 +87,7 @@ static void _config()
 static json_object * _obj_status_scan_list()
 {
     json_object *obj = json_object_new_array();
-    for (int i = 0; i < MAX_WPACLI_SCAN_AP_NUM; i ++)
+    for (int i = 0; i < Wifi_sta_status.scan_count; i ++)
     {
         json_object *e = json_object_new_object();

diff --git a/proscend/prosrc/www/app/feature/wifi_sta.js b/proscend/prosrc/www/app/feature/wifi_sta.js
index d642832..d7861e4 100644
--- a/proscend/prosrc/www/app/feature/wifi_sta.js
+++ b/proscend/prosrc/www/app/feature/wifi_sta.js
@@ -88,7 +88,6 @@ function controller($timeout, $scope, $route, icos, config) {
                 vm.status_timeout();
               } else {
                 vm.statusing = false;
-                vm.status.scan_list.length = vm.status.scan_count; // force the array length
               }
             },
             function() {

M330[develop] - use status.scan_count to force the length of status.scan_list in the CGI

commit d5b1f4f3ef9e18484cff8f7d28e35a35b487ed86
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Aug 14 15:29:15 2019 +0800

    use status.scan_count to force the length of status.scan_list in the CGI

 proscend/prosrc/webcgi/wifi_sta.c           | 2 +-
 proscend/prosrc/www/app/feature/wifi_sta.js | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)