WSN技術的智能倉儲環境監測與智能控制系統設計與實_第1頁
WSN技術的智能倉儲環境監測與智能控制系統設計與實_第2頁
WSN技術的智能倉儲環境監測與智能控制系統設計與實_第3頁
WSN技術的智能倉儲環境監測與智能控制系統設計與實_第4頁
WSN技術的智能倉儲環境監測與智能控制系統設計與實_第5頁
已閱讀5頁,還剩62頁未讀 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

WSN技術的智能倉儲環境監測與智能控制系統設計

與實

一、教學目標

1、掌握WSN網關通信的有關應用。

2、掌握WSN實現了信息的采集、信息傳輸與信息處理模式。

3、掌握WSN實現倉儲環境監控智能化技術方法。

二、教學內容

10.1設備簡介

10.1.1WSN網關

圖10-1WSN網關圖

供電電源:DC5V,信號獲取接口:USB,上位機通信接口:以太網口,操作系統:Linux?

網關通過USB與協調器連接,并通過協調器與各Zigbee節點進行信號通訊。

10.1.2協調器

圖10-2協調器圖

供電方式:USB供電。該設備為網關與各傳感器節點的中繼,負責轉發Zigbee信號。

10.1.3溫濕度傳感器模塊

圖10-3溫濕度傳感模塊圖

供電方式:DC5V,通訊協議:Zigbee。集成模塊:溫濕度傳感器。

該節點可采集溫濕度數據,并通過Zigbee協議傳輸到網關,上位機通過訪問網關獲取

溫濕度數據。

10.1.4電磁繼電器模塊

圖10-4電磁繼電器模塊圖

供電方式:DC5V,繼電器操縱路數:4路,與網關通信協議:Zigbee。

該繼電器可操縱四路電源,在京勝世紀的實驗臺中,操縱了兩路燈光、一路風扇與一路

電磁門。

10.2類的設計與實現

在本部分實訓中我們要用到數據庫來存儲當前各個節點的信息,以面向對象的思想為例,

我們需要先編寫幾對數據庫操作的基礎類與將節點信息儲存的對象類。

10.2.1DBConnection.cs類

這個類文件是要對數據庫進行連接操作,登錄到本地的數據庫。

引用命名空間。該命名空間是SQLServer.NET數據提供者,是SQLServer專用的內置.NET

提供者,引用該命名空間后就能夠獲得最好的性能與對基礎功能的最直接訪問。

usingSystem.Data.SqlClient;

添加變量

privatestringstr;

privateSqlCommandsqlcom;

privateSqlConnectionconn;

在構造函數中寫入連接數據庫方法

///<summary>

///連接數據庫的方法

///</summary>

publicDBConnection()

{

〃定義了要連接的數據庫的位置,數據庫的名稱,登錄帳號與密碼

this.str=,,Server=localhost;DataBase=SmartShelfD;uid=sa;pwd=123n;

this.conn=newSqlConnection(str);

this.sqlcom=newSqlCommand();

this.sqlcom.Connection=this.conn;

this.conn.Open();

}

上邊定義了兩個全局變量,分變是字符型str,變量量為數據庫連接字符串內容:Server

表示正在訪問的數據庫服務器名稱,其格式是“計算機名'實例名”,假如是本地的數據庫

服務器同時使用的是SQLServer的默認實例名,則能夠使用(Local)或者.來表示。DataBase

表示數據庫名稱,即該項目所要連接的數據庫名;Uid表示數據庫服務器的登錄名稱;Pwd

表示數據庫服務器的密碼。

返回數據連接方法

///〈summary〉

///返回數據連接方法

///〈/summary〉

///<returns></retums>

publicSqlConnectionGetConnection()

{

returnthis.conn;

}

10.2.2DBOperate.es類

該類的作用是對程序中的要用到的對數據庫的操作進行統一,涉及到對數據庫的操作

時,如對數據庫的增刪改操作,都能夠直接調用該類,相應的方法。傳入相應的參數即可。

添加引用

usingSystem.Data.SqlClient;

usingSystem.Data;

定義變量

SqlCommandsqlcom;

SqlConnectionconn;

默認構造方法

///<summary>

///構造函數

///</summary>

///<paramname=,'dbcH></param>

publicDBOperate(DBConnectiondbc)

(

sqlcom=newSqlCommand();

sqlcom.Connection=dbc.GetConnection();

)

編寫執行方法

///<summary>

///執行sql語句

///</summary>

///<paramname="sqr'x/param>

publicvoidExecuteSQL(stringsql)

(

try

(

this.sqlcom.ExecuteNonQueryO;

}

catch{}

}

///<summary>

///獲取數據表格的方法

///</summary>

///<paramname="sqln></param>

///<returns>sql語句〈/returns〉

publicDataTableGetDataTable(stringsql)

(

SqlDataAdaptersda=newSqlDataAdapter(this.sqlcom);

DataSetds=newDataSet();

DataTabledt=newDataTable();

try

(

sda.Fill(ds);

dt=ds.Tables[O];

}

catch{}

returndt;

///<summary>

///執行SQL語句,獲取string類型數據

///〈/summary〉

///<paramname二“sql”>SQL語句</param>

///〈returns〉獲取到的string類型數據〈/returns〉

publicstringGetString(stringsql)

(

stringresultStr="u;

try

(

resultStr=this.sqlcom.ExecuteScalar().ToString();

}

catch(SqlExceptione)

{)

finally

(

this.sqlcom.Dispose();

)

returnresultStr;

)

publicintGetlnt(stringsql)

(

intresultlnt=0;

try

(

resultlnt=Convert.ToInt32(this.sqlcom.ExecuteScalar().ToString());

)

catch(SqlExceptione)

(

System.Windows.Forms.MessageBox.Show(e.Message);

}

finally

(

this.sqlcom.Dispose();

)

returnresultlnt;

}

本資源是基于SQLServer開發的,因此能夠使用using指令能夠引用SQLServer專用

的.NET數據庫提供者:usingSystem.Data.SqlClient;

提取數據庫中數據的4步:

1)連接數據源

2)打開連接

3)發出一個SQL查詢命令

4)執行命令語句

541(2011慎8211是一個用于5(314£T數據提供者的連接對象名稱,表示SQLServer數據

庫的一個打開的連接。SqlConnection對象表示與SQLServer數據源的一個唯一的會話。

關于客戶端/服務器數據庫系統,它等效于到服務器的網絡連接。SqlConnection與

SqlDataAdapter與SqlCommand一起使用,能夠在連接MicrosoftSQLServer數據庫時提

高性能。

"Server=localhost;DataBase=AccessControl;uid=sa;pwd=123"

Server=locak)st,表示正在訪問的SQLServer名稱,其格式是“計,算機名'實例名計算機名

(localhost)是一個非常方便的SQLServer簡短名稱,它表示運行在當前機器上的服務器實

例。DataBase=AccessControl,指定數據庫的名稱。uid=sa;pwd=123,表示登錄數據庫的用戶

名與密碼,這是SQLServer與Windows的標準內置安全。

this.conn.Open();打開數據庫的連接。CommandText屬性獲取或者設置要對數據源執行的

SQL語句或者存儲過程。ExecuteNonQuery()方法,對連接執行SQL語句并返回受影響的

行數。SqlDataAdapter類表示用于填充DataSet與更新SQLServer數據庫的一組數據命令

與一個數據庫連接。SqlDataAdapter是DataSet與SQLServer之間的橋接器,用于檢索與

儲存數據。DataSet是ADO.NET結構的要緊組件,它是從數據源中檢索到的數據在內存中

的緩存。DataSet由一組DataTable對象構成。

try-catch語句由一個try塊后跟一個或者多個catch子句構成,這些子句指定不一致的

特殊處理程序。

try塊包含可能導致特殊的保護代碼。該塊一直執行到引發特殊或者成功完成為止。比

如,下列強制轉換null對象的嘗試引發NullReferenceException特殊:

objecto2=null;

try

(

inti2=(int)o2;〃錯誤

}

10.2.3ObjCargoNode.cs類

該類是對節點信息與數據庫中的進行操作進行的修改。節點加入網絡后,段地址會存儲

到數據庫中。對當前節點的識別也需要讀取數據庫中已輸入的節點信息。

添加命名空間

usingSystem.Data;

定義變量

privateintcargo;

privatestringiEEEAddress;

privatestringshortAddress;

privateintnodeType;

構造函數

publicObjCargoNode()

publicObjCargoNode(intcargo)

(

this.cargo=cargo;

DataTabledtb=Program.dbo.GetDataTable(string.Format(Hselect

Cargo,IEEEAddress,ShortAddress,NodeTypefromCargoNodewhereCargo-{0}*",this.cargo));

DataRowrow=dtb.Rows[0J;

this.cargo=Convert.ToInt32(row["CargoH].ToString0);

this.iEEEAddress=row[,'IEEEAddress"l.ToString();

this.shortAddress=row[nShortAddress"].ToString();

this.nodeType=Convert.ToInt32(row[nNodeType*'].ToString());

)

屬性

publicintCargo

{

get

(

returnthis.cargo;

)

}

publicstringlEEEAddress

(

get

(

returnthis.iEEEAddress;

)

)

publicstringShortAddress

(

get

{

returnthis.shortAddress;

)

set

this.shortAddress=value;

publicintNodeType

get

(

returnthis.nodeType;

}

}

方法

publicvoidInsert()

(

Program.dbo.ExecuteSQL(string.Format(nupdateCargoNodeset

ShortAddress="{0}'whereIEEEAddress=,{1this.shortAddress,this.iEEEAddress));

}

10.3功能設計與實現

該部分實訓內容要緊是通過程序與wsn的網關進行通信,這里我們需要學習關于wsn

網關通信的有關應用。該模塊程序中的代碼,在后面會分解出來應用。

向窗體中添加一個TabControl控件,在TabPages屬性添加6個成員。

控件Name屬性Text屬性UseVisualStyleBac

kColor屬性

TabPagetpConnect建立連接True

TabPagetpPingPing指令True

TabPagetpConfigReadConfigRead指令True

TabPagetpConfigWriteConfig_Write指令True

TabPagetpSensorReadSensor_Read指令True

TabPagetpSensorWriteSensor_Write指令True

10.3.1創建建立連接

1、建立連接TabPage窗體屬性,窗體如圖10-5所示。

TextBox

控化

更掾

2、設置窗體屬性

StartPositionMaximizeBoxMinimizeBoxFormBorderStyle

窗體Text屬性

屬性屬性屬性屬性

Zigbee節

frmGoodsOutCenterParentFalseFalseFixedSingle點連接實

3、設置Labie控件屬性

控件Name屬性Text屬性

T1通道Socket

LableIbllPAddressTlIP地址

LableIblPortTl端口號

LableIblAppIDTlAppID

LableIblPasswordTlPassword

T2通道Socket

LablelblIPAddressT2IP地址

LablelblPortT2端口號

LablelblAppIDT2AppID

LablelblPasswordT2Password

4、設置TextBox屬性

控件Name屬性Text屬性

TextBoxtxtIPAddressTI192.168.1.230

TextBoxtxtPortTl4000

TextBoxtxtAppIDTl1001

TextBoxtxtPasswordTlKingvcSzigvine

TextBoxtxtIPAddressT2192.168.1.230

TextBoxtxtPortT24000

TextBoxtxtAppIDT21001

TextBoxtxtPasswordT2KingvcSzigvine

5、設置顯示]言息內容的TextBox屬性

控件Name屬性Dock屬性MultilineReadOnle屬ScorllBars

屬性性屬性

TextBoxtxtMessageConnectFillTrueTrueVertical

6、設置GroupBox控件屬性

控件Name屬性Text屬性

GroupBoxgbSocket_TlT1通道Socket

GroupBoxgbSocket_T2T2通道Socket

7、設置Button按鈕事件

控件Name屬性Text屬性UseVisualStyleBackColor

屬性

ButtonbtnConnectSocketTlSocketTl連接True

ButtonbtnConnectTlT1通道連接True

ButtonbtnConnectSocketT2SocketT2連接True

ButtonbtnConnectT2T2通道連接True

8、窗體后臺代碼:

1)定義變量

〃定義一個函數結構的委托

privatedelegatevoidShowMessageDel(TextBoxtxt,stringmsg);

privatedelegatevoidShowMessageDelOfTempLabel(LabelIbl,stringvalue);

〃實例化T1數據包消息類

privateGRIP_MessagemessageTl=newGRIP_Message();

〃實例化T2數據包消息類

privateGRIP_MessagemessageT2=newGRIP_Message();

//定義TISocket通訊接口

privateSocketsocketTl;

//定義T2soeket通訊接口

privateSocketsocketT2;

〃定義T1通道流水號

privateUIntl6sequencelDTl;

〃定義T2通道流水號

privateUIntl6sequenceIDT2;

privateinttime;

〃定義一個線程

privateThreadthread;

//sessionlD為連接后網關隨機分配的一個標識ID

privatestringsessionlD=

2)構造函數

///<summary>

///構造函數

///</summary>

publicfrmZigBee()

{

InitializeComponent();

)

3)編寫方法

Socket發送消息方法

///<summary>

///Socket發送消息方法

///</summary>

///<paramname="msgSencT>要發送的字節數組v/param>

///<paramname="socket”>Socket實例</param>

///<paramname="1enSend”>已發送的長度</param>

privatevoidSendMsg(byte[]msgSend,Socketsocket,intlenSend)

(

//需對發送的字節長度有明確認識,發送一段字節后需要加上該段字節的長度

while(lenSend<msgSend.Length)

(

lenSend+=socket.Send(msgSend,lenSend,msgSend.Length-lenSend,

SocketFlags.None);

)

)

Socket接收信息的方法

///<summary>

///Socket接收消息方法

///</summary>

///<paramname="msgRecv”>要接收的字節數組</param>

///<paramname="socket”>Socket實例v/param>

///<paramname="lenRecv”>已接收的長度v/param>

privatevoidRecvMsg(byte[]msgRecv,Socketsocket,intlenRecv)

(

while(lenRecv<msgRecv.Length)

(

lenRecv+=socket.Receive(msgRecv,lenRecv,msgRecv.Length-lenRecv,

SocketFlags.None);

)

}

在控件中顯示信息的方法

//<summary>

///在控件中顯示消息的方法

///</summary>

III<paramname=,,txt',></param>

///<paramname="msgnx/param>

privatevoidShowMessage(TextBoxtxt,stringmsg)

(

if(txt.InvokeRequired)

(

ShowMessageDelsmd=newShowMessageDel(ShowMessage);

txt.Invoke(smd,txt,msg);

)

else

txt.Text+-"\r\n["+DateTime.Now.ToString("yyyy-MM-ddhh-mm-ss")+

]"+msg;

在Label控件中顯示消息的方法

///<summary>

///在Label控件中顯示消息的方法

///</summary>

///<paramname=控件名稱v/param>

///<paramname="value”>要顯示的值</param>

privatevoidShowTempValue(LabelIbl,stringvalue)

(

if(Ibl.InvokeRequired)

(

ShowMessageDelOfTempLabelsmd=new

ShowMessageDelOfTempLabel(ShowTempValue);

lbl.Invoke(smd,Ibl,value);

)

else

{

Ibl.Text=value;

}

)

線程方法

///<summary>

〃/T2通道線程執行方法

///</summary>

privatevoidRun()

{

try

(

while(true)

(

#region解析消息頭

〃定義一個byte類型的6位數組

bytelJmsgRecvHeadBytes=newbyte[61;

〃接收到的消息頭的長度

intlenRecv=0;

//Socket接收消息的方法

RecvMsg(msgRecvHeadBytes,this.socketT2,lenRecv);

〃實例化一個消息頭類

GRIP_MessageHeadmsgHeadRecv=newGRIP_MessageHead();

〃對接收到的消息頭進行轉換

msgHeadRecv.GetHeadBytesOfKecive(msgRecvHeadBytes,0,6);

#endregion

#region心跳包

if(msgHeadRecv.MessageCommand==

(UIntl6)GRIP_Message_CommandID.NWM_HEARTBEAT)

(

try

(

〃消息的長度為16位無符號整數

UIntl6messageLength=0;

〃心跳報消息體「信息為空

UIntl6messageCommand=

(UIntl6)GRIP_Message_CommandID.NWM_HEARTBEAT_RESP;

〃獲取獲取流水號

UIntl6sequencelD=msgHeadRecv.SequencelD;

〃實例化一個消息頭類

GRIP_MessageHeadmsgHeadSend=new

GRIP_MessageHead(messageLength,messageCommand,sequencelD);

〃按照本地字節轉換發送的信息

byte[]msgSend=msgHeadSend.GetHeadBytesOfSend();

〃發送信息方法

SendMsg(msgSend,this.socketT2,0);

〃MessageBox.Show("【T2通道心跳包】發送成功)

)

catch(Exceptionex)

{

MessageBox.Show("【T2通道心跳包】錯誤:"+ex.Message);

}

)

#endregion

#regionStatus_Report

〃推斷消息頭返回命令字是否正確

if(msgHeadRecv.MessageCommand==

(Ulntl6)GRIP_Message_CommandlD.NWM_STATUS_REPORT)

(

try

(

〃定義一個消息頭字節長度的byte數組

byte[JmsgBodyRecvBytes=new

bytefmsgHeadRecv.MessageLength];

〃定義消息體長度變量

intlenBodyRecv=0;

//Socket接收信息方法接收信息

RecvMsg(msgBodyRecvBytes,this.socketT2,lenBodyRecv);

〃實例化節點報告命令

GRIP_MessageBody_Status_ReportmsgBodyRecv=new

GRIP_MessageBody_Status_Report();

//按照本地字節與網絡字節的順序轉換接收到的消息體

msgBodyRecv.ConvertReciveBytes(msgBodyRecvBytes);

UIntl6status=0;

〃實例化節點報告命令響應

GRIP_MessageBody_Status_Report_RespmsgBodySend=

newGRIP_MessageBody_Status_Report_Resp(status);

//實例化消息頭類,并將響應參數傳入

GRIP_MessageHeadmsgHeadSend=new

GRIP_MessageHead(msgBodySend.BodyLength,

(UIntl6)GRIP_Message_CommandID.NWM_STATUS_REPORT_RESP,

msgHeadRecv.SequencelD);

〃獲取發送的數據包的byte數組

byte[]msgSend=

this.messageT2.GetSendMessage(msgHeadSend,msgBodySend);

intlenSend=0;

〃發送消息

SendMsg(msgSend,this.socketT2,lenSend);

if(this.sessionlD==msgBodyRecv.SessionlD)

(

this.ShowMessage(this.txtMessagePing,"\r\n");

this.ShowMessage(this.txtMessagePing,'*[Status_Report]

指令成功)

this.ShowMessage(this.txtMessagePing,u[Status_Report]

IEEEAddress:”+msgBodyRecv.Node.IEEEAddress);

this.ShowMessage(this.txtMessagePing,'IStatus_Report]

ShortAddress:"+msgBodyRecv.Node.ShortAddress.ToString(uX4n));

this.ShowMessage(this.txtMessagePing,u

[?Status_Report]Cause:n+msgBodyRecv.Cause);

lhis.ShowMessage(this.txtMessagePing,H[Status_Report]

SessionlD:”+msgBodyRecv.SessionlD);

this.ShowMessage(this.txtMessagePing,n[Status_Report]

DeviceName:"+msgBodyRecv.DeviceName);

this.ShowMessage(this.txtMessagePing,u[Status_Report]

DeviceType:"+msgBodyRecv.DeviceType);

this.ShowMessage(this.txtMessagePing,n[Status_Report]

Status:"+msgBodyRecv.Status);

this.ShowMessage(this.txtMessagePing,u[Status_Report]

PanlD:0+msgBodyRecv.PanID+”——"+msgBodyRecv.PanID.ToString(',X4,'));

this.ShowMessage(this.txtMessagePing,u[Status_Report]

ParentlEEEAddress:"+msgBodyRecv.ParentNode.IEEEAddress);

this.ShowMessage(this.txtMessagePing,u[Status_Report]

ParentShortAddress:"+msgBodyRecv.ParentNode.ShortAddress.ToString(,,X4,'));

this.ShowMessage(this.txtMessagePing,"[Status_Report]

SensorEnable:"+msgBodyRecv.SensorEnable);

this.ShowMessage(this.txtMessagePing,'IStatus_Report]

SensorClass:"+msgBodyRecv.SensorClass);

this.ShowMessage(this.txtMessagePing,'*[Status_Report]

SensorType:"+msgBodyRecv.SensorType.ToString("X4"));

this.ShowMessage(this.txtMessagePing,

this.ShowMessage(this.txtMessagePing,H

[Status_Report_Resp]指令成功");

)

)

catch(Exceptionex)

(

this.ShowMessage(this.txtMessagePing,n[Status_Report]指

令失敗錯誤:"+ex.Message);

#endregion

#regionSensor_Report

if(msgHeadRecv.MessageCommand==

(UIntl6)GRIP_Message_CommandID.NWM_SENSOR_REPORT)

(

try

(

〃定義一個消息體長度的byte數組

byte[JmsgBodyRecvBytes=new

bytefmsgHeadRecv.MessageLength];

〃接收消息體的長度變量

intlenBodyRecv=0;

〃接收消息體

RecvMsg(msgBodyRecvBytes,this.socketT2,lenBodyRecv);

〃實例化節點報告命令

GRIP_MessageBody_Sensor_ReportmsgBodyRecv=new

GRIP_MessageBody_Sensor_Report();

//將消息體按照本地字節與網絡字節的順序轉換

msgBodyRecv.ConvertReciveBytes(msgBodyRecvBytes);

UIntl6status=0;

〃實例化節點報告命令的響應

GRIP_MessageBody_Sensor_Report_RespmsgBodySend=

newGRIP_MessageBody_Sensor_Report_Resp(status);

//實例化并獲得消息頭

GRIP_MessageHeadmsgHeadSend=new

GRIP_MessageHead(msgBodySend.BodyLength,

(UIntl6)GRIP_Message_CommandID.NWM_SENSOR_REPORT_RESP,

msgHeadRecv.SequencelD);

〃獲取發送的數據包的byte數組

byte[]msgSend=

this.messageT2.GetSendMessage(msgHeadSend,msgBodySend);

intlenSend=0;

〃發送消息

SendMsg(msgSend,this.socketT2,lenSend);

〃推斷會話ID是否相同

if(this.sessionlD==msgBodyRecv.SessionlD)

(

this.ShowMessage(this.txtMessagePing,u\r\n");

this.ShowMessage(this.txtMessagePing,0

[Sensor_Report]指令成功)

this.ShowMessage(this.txtMessagePing,u

[Sensor_Report]lEEEAddress:"+msgBodyRecv.Node.IEEEAddress);

this.ShowMessage(this.txtMessagePing,u

[Sensor_Report]ShortAddress:"+msgBodyRecv.Node.ShortAddress.ToString(uX4u));

this.ShowMessage(this.txtMessagePing,u

[Sensor_Report]Cause:n+msgBodyRecv.Cause);

lhis.ShowMessage(this.txtMessagePing,H

[Sensor_Report]SessionlD:"+msgBodyRecv.SessionlD);

this.ShowMessage(this.txtMessagePing,*'

[Sensor_Report]DataType:"+msgBodyRecv.DataType);

#regionSensojRead引。y發巧6

//推斷節點數據采集是否成功

if(msgBodyRecv.DataType==0x01)

(

this.ShowMessage(this.txtMessagePing,"

[Sensor_Report(SensorData)]SensorClass:"+

((GRIP_SensorData)msgBodyRecv.Data).SensorClass);

this.ShowMessage(this.txtMessagePing,n

[Sensor_Report(SensorData)]SensorType:"+

((GRIP_SensorData)msgBodyRecv.Data).SensorType.ToString("X4"));

this.ShowMessage(this.txtMessagePing,"

[Sensor_Report(SensorData)]SensorDataLength:"+

((GRIP_SensorData)msgBodyRecv.Data).SensorDataLength);

#region溫濕度傳感器

〃推斷溫濕度傳感器節點的數據長度是否正確同

時在窗口中顯示溫濕度

if

(((GRIP_SensorData)msgBodyRecv.Data).SensorDataLength==4)

(

this.ShowMessage(this.txtMessagePing,"

[Sensor_Report(SensorData)]Temp_H:"+((GRIP_SensorData)msgBodyRecv.Data).Temp_H);

this.ShowMessage(this.txtMessagePing,"

[Sensor_Report(SensorData)]Temp_L:"+((GRIP_SensorData)msgBodyRecv.Data).Temp_L);

this.ShowMessage(this.txtMessagePing,"

【Sensor_Report(SensorData)】當前溫度:”+((GRIP_SensorData)msgBodyRecv.Data).Temp_H

++((GRIP_SensorData)msgBodyRecv.Data).Temp_L+

this.ShowMessage(this.txtMessagePing,"

[Sensor_Report(SensorData)]Humi_H:n+((GRIP_SensorData)msgBodyRecv.Data).Humi_H);

this.ShowMessage(this.txtMessagePing,"

[Sensor_Report(SensorData)]Humi_L:”+((GRIP_SensorData)msgBodyRecv.Data).Humi_L);

this.ShowMessage(this.txtMessagePing,"

[Sensor_Report(SensorData)]當前濕度:"+((GRIP_SensorData)msgBodyRecv.Data).Humi_H

++((GRIP_SensorData)msgBodyRecv.Data).Humi_L+"%”);

ShowTempValue(this.lblTempValue,

((GRIP_SensorData)msgBodyRecv.Data).Temp_H++

((GRIP_SensorData)msgBodyRecv.Data).Temp_L+“℃");

ShowTempValue(this.lblHumiValue,

((GRIP_SensorData)msgBodyRecv.Data).Humi_H++

((GRIP_SensorData)msgBodyRecv.Data).Humi_L+"%”);

)

#endregion

#region數碼管節點

〃推斷數碼管節點數據長度是否正確

if

(((GRIP_SensorData)msgBodyRecv.Data).SensorDataLength==5)

(

this.ShowMessage(this.txtMessagePing,"

[Sensor_Report(SensorData)]Value:"+((GRIP_SensorData)msgBodyRecv.Data).Value);

this.ShowMessage(this.txtMessagePing,"

[Sensor_Report(SensorData)]LED:"+((GRIP_SensorData)msgBodyRecv.Data).LED);

this.ShowMessage(this.txtMessagePing,"

[Sensor_Repor

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論