20151204_jeffrey - silenceuncrio/diary GitHub Wiki

0905

jammy 昨天分享一篇 一塊 Raspberry Pi 五美元開發版,帶給台灣硬體廠的啟示

0945

Spring 告知 EFM Bridge 隱藏版的 480 kb 限制已經找到了
在 [ABSREAD.C] 裡

int flash_absread(short int drive, short int nsects, long lsect, char * buff_addr) {  
  int max_sect;
  char *chptr,*src;
  unsigned long i, count;

  drive = drive;

  /* dynamically search the start point */
  src = (char *)drive_start_addr;
  max_sect = 1024;
  if ( (lsect >= max_sect) || (lsect + nsects) > max_sect) {
    return(-1);
  }
  chptr = src + lsect * 512;
  if (nsects <= 128) {
    count = nsects * 512;
    for (i = 0; i < count; i ++) {
      *buff_addr ++ = *chptr ++;
    }
  } else {
    count = 128 * 512; // max 64kb (128 sectors)
    for (i = 0; i < count; i ++) {
      *buff_addr ++ = *chptr ++;
    }
    return(-1);
  }
  return (0);
}

就是這個 max_sect = 1024;
這會讓 網頁相關的 PFS (Private file system) 再從 FLASH 讀取資料的時候
無法突破 512 kb 的限制

這個話題的延續導致交換了一些我目前 IoT 平台的情報

S 的情報

  • 每周研發會議都會 review 每個計劃
    但問及 IoT 計畫時
    P 答先不用管這計畫
  • P 想做 home automation
    但老闆想走 工廠 或 office
    因為 home 這一塊很競爭
    連外觀都要漂亮

我給的情報

  • 就規劃一下架構
    有 box 和 center
    就跟以前 CAPWAP 差不多
  • 我規劃
    P 負責 K 我
    我很不爽

我給的情報都不是什麼秘密
一個 mantis Wiki 有
一個大家都知道

不過 Spring 給我的情報很不錯
讓我不至於跟換了 CPU 的 EFM Bridge 脫節太多

1100

年度健康檢查完畢
今年自費 5400 做了 A + B + C 套餐 全檢
包括 癌症 篩檢

1120

Jammy 的分享文引起了一番迴響

Proscend/Jim Chen (陳金勇) 於 2015/12/4 上午 11:17 寫道:

Dear All,

This is a good article about IoT industry. We knew a design house with excellent MTK's solution (around NT$500/set) and flexible developing platform.

FYI!

Jim

pioneer 於 2015/12/4 上午 10:13 寫道:

Dear all,
This article is worth reading.
Don't put your focus on "PI zero is only $5".

Best regards,
Pioneer

On 2015/12/3 下午 09:33, Jammy wrote:

Dear all,

I just found a good article. Share to you!
http://www.inside.com.tw/2015/12/03/what-can-we-learn-from5-dollars-raspberry-pi

Jammy

希望這股認知可以拓散出去

1315

中午散步的時候想到 Box 與 Center 之間的溝通方式
又想到 Box 和 Center 都有 Web Server 可以提供 RESTful Web APIs 既然雙方都可以提供 APIs
表示雙方都提供服務
那我應該重新思考以下的架構

           ============                         ============
               Box                                 Center
           ============                         ============

                                   :

                         Configure Request
                 <------------------------------------
                         Configure Response
                 ------------------------------------>

                                   :

                             Status Request
                 ------------------------------------>
                             Status Response
                 <------------------------------------

                                   :
                             Alarm Request
                 ------------------------------------>
                             Alarm Response
                 <------------------------------------

                                   :

參考 RESTful Web Services Cookbook
CHAPTER 1 Using the Uniform Interface

HTTP is an application-level protocol that defines operations for transferring representations between clients and servers. In this protocol, methods such as GET, POST, PUT, and DELETE are operations on resources.
This protocol eliminates the need for you to invent application-specific operations such as createOrder, getStatus, updateStatus, etc. How much you can benefit from the HTTP infrastructure largely depends on how well you can use HTTP as an application-level protocol.

突然覺得我的方向錯得離譜
如果我定義好 box 所應提供的 RESTful API 之後
box 不應該知道到底是 哪個 client 在存取它的 resource 才對
那 control center 說穿了就像個雞婆的 client
只是幫忙把一堆 box 所提供的 resource 統一表現在自己身上
再包裝得很聰明裝作 家庭智慧中心的腳色罷了

理論上 box 只是一堆 resource 的集合才對

我應該重新針對學生們負責的每個 sensor 來審視它們該如何利用 RESTful API 來做表現

Request

GET /keypadInput HTTP/1.1
Host: lun.box

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "mode": "on",
  "usePass1": true,
  "usePass2": false
}

1530

直接在 mantis wiki 上各個 sensor 的專欄做修改
不要改學生們已經寫好的內容
而是直接加一個子標題 RESTful Web API

1620

jammy: ameba 點燈反應較慢是因為 printf 的關係
jammy: 把 printf 關掉就好了

看 jammy demo 了一下
效果超讚 打趴 itwinkle
不錯

1740

竟很快的就把 RESTful Web API 定義好了
原本想說架構弄錯了要重改超麻煩的
想不到一下子就改的超級俐落的

1810

不經意地跟 charlie 聊到 歐瑞博COCO智能插線板
再搭配 阿里小智 APP
charlie 眼睛又亮了
又叫我下禮拜一拿來拆看看裡面用啥 Wi-Fi 模組
禮拜二順便 Demo
他還要跟老闆報告 阿里雲 的生意模式

無意中配合得越來越有默契了