1.tcl用于编写网络拓扑、事件触发等脚本事件,c++用于处理具体的数据包等底层网络协议;
otcl的类和c++的类是一一对应的 。
2. Helper Functions:
getRandomNumber {llim ulim}
node {}
nodeID {}
mac {}
getX {} getY {}
getER {}
GoToSleep {}
WakeUp {}
setCode code
checkAlive {}
3. Cluster Head Functions:
isClusterHead? {} {
hasbeenClusterHead? {} {
hasnotbeenClusterHead {} {
setClusterHead {} {
unsetClusterHead {} {
4. Distributed Cluster Set-up Functions:
decideClusterHead {}
findBestCluster {}
informClusterHead {}
createSchedule {}
5. Receiving Functions:
recv {args}
recvADV_CH {msg}
recvJOIN_REQ {nodeID}
recvADV_SCH {order}
recvDATA {msg}
6. Sending Functions
sendData {}
send {mac_dst link_dst type msg data_size dist code}
send_now {mac_dst link_dst type msg \ data_size dist code}
SendDataToBS {}
SendMyDataToBS {}
能把这些过程尤其是TDMASchedule转换成面向interface的nesc语言,就算巨大的成功了。这只是网络层的协议,必须同时修改mac协议才能在tmote上形成了leach自组网。国外有人做出了,那是人家的,郁郁啊!