W!o+ 的《小伶鼬工坊演義》︰ 一窺全豹之系統設計《關鍵》

固然我們現今可以閱讀 GrovePi 韌體的原始碼,

# GrovePi V1.2.5 韌體 I2C 讀寫流程骨幹

33 int cmd[5];
34 int index=0;
35 int flag=0;

68 void setup()
69 {
70     // Serial.begin(38400); // start serial for output
71     Wire.begin(SLAVE_ADDRESS);
72
73     Wire.onReceive(receiveData);
74     Wire.onRequest(sendData);
75         attachInterrupt(0,readPulseDust,CHANGE);
76 }

79 void loop()
80 {
81   long dur,RangeCm;
82   if(index==4)
83 {
84   flag=1;
85   //IR reciever pin set command
86   if(cmd[0]==22)
87      IR.Init(cmd[1]);
88
89   //Grove IR recieve command
90   else if(cmd[0]==21)
91   {
92      if(IR.IsDta())
93       {
94          int length= IR.Recv(dta);
95          b[0]=1;
96          for(i=0;i<20;i++)
97              b[i+1]=dta[i];
98       }
99   }
100
101 //Digital Read
102 else if(cmd[0]==1)
103   val=digitalRead(cmd[1]);
104 //Digital Write
105 else if(cmd[0]==2)
106   digitalWrite(cmd[1],cmd[2]);

646 void receiveData(int byteCount)
647 {
648     while(Wire.available())
649      {
650       if(Wire.available()==4)
651        {
652         flag=0;
653         index=0;
654                 run_once=1;
655        }
656         cmd[index++] = Wire.read();
657       }
658 }

660 // callback for sending data
661 void sendData()
662 {
663   if(cmd[0] == 1)
664     Wire.write(val);
665   if(cmd[0] == 3 || cmd[0] == 7 || cmd[0] == 56)
666     Wire.write(b, 3);
667   if(cmd[0] == 8 || cmd[0] == 20)
668     Wire.write(b, 4);
669   if(cmd[0] == 30)
670     Wire.write(b, 9);
671   if(cmd[0] == 40)
672     Wire.write(dht_b, 9);
673
674   if(cmd[0]==21)
675    {
676     Wire.write(b,21);
677     b[0]=0;
678    }
679   if(cmd[0]==dust_sensor_read_cmd)
680    {
681     Wire.write(b,4);
682         dust_latest=0;
683         cmd[0]=0;
684    }
685   if(cmd[0]==encoder_read_cmd)
686    {
687     Wire.write(enc_val,2);
688     enc_val[0]=0;
689         cmd[0]=0;
690    }
691   if(cmd[0]==flow_read_cmd)
692    {
693     Wire.write(flow_val,3);
694     flow_val[0]=0;
695         cmd[0]=0;
696    }
697
698 }


 

,追跡其上裝置的驅動始末,甚至可以創寫新的可連接設備。但思『架構拼圖』時,『全貌』是『關鍵』,一時過細恐泥。況且通常『應用軟體界面』 API ,實有多種多層

中介軟體

中介軟體英語Middleware)是提供系統軟體應用軟體之間連線的軟體,以便於軟體各部件之間的溝通,特別是應用軟體對於系統軟體的集中的邏輯,在現代資訊科技應用框架如Web服務面向服務的體系結構等中應用比較廣泛。如資料庫、Apache的Tomcat,IBM公司的WebSphere,BEA公司的WebLogic應用伺服器,東方通公司的Tong系列中介軟體,以及Kingdee公司的等都屬於中介軟體。

嚴格來講,中介軟體技術已經不局限於應用伺服器、資料庫伺服器。圍繞中介軟體,Apache組織、IBM、Oracle(BEA)、微軟各自發展出了較為完整的軟體產品體系。(Microsoft Servers是 微軟公司的伺服器產品介紹)。中介軟體技術建立在對應用軟體部分常用功能的抽象上,將常用且重要的過程呼叫、分散式元件、訊息佇列、事務、安全、連結器、 商業流程、網路並行、HTTP伺服器、Web Service等功能集於一身或者分別在不同品牌的不同產品中分別完成。一般認為在商業中介軟體及資訊化市場主要存在微軟陣營、Java陣營、開源陣營。陣營的區分主要體現在對下層作業系統的選擇以及對上層元件標準的制訂。目前主流商業作業系統主要來自Unix蘋果公司Linux的系統以及微軟視窗系列。微軟陣營的主要技術提供商來自微軟及其商業夥伴,Java陣營則來自IBMSun(已被Oracle收購)、OracleBEA(已被Oracle收購)、金蝶(Kingdee Apusic)及其合作夥伴,開源陣營則主要來自諸如Apache,SourceForge等組織的共享代碼。

中介軟體技術的蓬勃發展離不開標準化,標準的建立有助於融合不同陣營的系統。越來越多的標準被三大陣營共同接受並推廣發展。 中介軟體技術的發展方向朝著更廣闊範圍的標準化,功能的層次化 ,產品的系列化方面發展。

基於中介軟體技術構建的商業資訊軟體廣泛的應用於能源、電信、金融、銀行、醫療、教育等行業軟體,降低了面向行業的軟體的開發成本。

 

Linux_kernel_and_gaming_input-output_latency.svg

Anything between the kernel and user applications is considered middleware. Functionality such as gesture recognition or speech recognition is usually processed by some middleware, and the results are transmitted to user applications.

 

Middleware_Schema.svg

Software architecture: Middleware

───

 

居處其間。何妨此刻『渡河彼岸』,從樹莓派這一端來看 GrovePi 上之裝置存取的呢?!

雖說這也可能只是一種『整體』 與『部份』理解之『錯覺』,

 

□ A 和 B 的顏色其實是一樣的

360px-Grey_square_optical_illusion

360px-Same_color_illusion_proof2

泰戈爾‧錯覺

河的此岸暗自歎息:『我相信,一切歡樂都在對岸。』

河的彼岸一聲長嘆:『唉,也许,幸福盡在對岸。』

知識到底是什麼?真理果真能追求??

或是
凡所有相,皆是虛妄 ── 金剛經 ──

還是
一切只是『幻覺』,如墬『虛擬實境』中!!

─── 摘自《知識是什麼?

 

,不過問題是我們如何能夠知道自己

是否是活在柏拉圖之『洞穴』

裡的耶??!!