Wiselib
|
00001 /* 00002 * BGU_Sensor.h 00003 * 00004 * Created on: Dec 1, 2010 00005 * Author: Guy Leshem 00006 */ 00007 00008 #ifndef SENSOR_H_ 00009 #define SENSOR_H_ 00010 00011 #include "algorithms/bgu_clustering/MessageDestination.h" 00012 #include "algorithms/bgu_clustering/TopologyMessage.h" 00013 #include "algorithms/bgu_clustering/MessageQueue.h" 00014 #include <map> 00015 #include "algorithms/neighbor_discovery/echo.h" 00016 #include "algorithms/cluster/clustering_types.h" 00017 #include "util/pstl/vector_static.h" 00018 #include "util/pstl/priority_queue.h" 00019 #include "util/pstl/pair.h" 00020 #include "util/pstl/map_static_vector.h" 00021 #include "internal_interface/routing_table/routing_table_static_array.h" 00022 #include "util/delegates/delegate.hpp" 00023 00024 #define SENSOR_DEBUG 00025 #define SENSOR_MSG_RECV_DEBUG 00026 #define VISOR_DEBUG 00027 00028 00029 namespace wiselib 00030 { 00031 template<typename OsModel_P, 00032 typename Radio_P = typename OsModel_P::Radio, 00033 typename Timer_P = typename OsModel_P::Timer, 00034 typename Clock_P = typename OsModel_P::Clock, 00035 typename Debug_P = typename OsModel_P::Debug 00036 /* typename Neighbor_P = typename wiselib::Echo<OsModel_P, Radio_P, Timer_P, Debug_P> */ > 00037 00038 00039 class Sensor : public MessageDestination 00040 { 00041 public: 00042 // Type definitions. 00043 // Type definition of the used Templates. 00044 typedef OsModel_P OsModel; 00045 typedef Radio_P Radio; 00046 typedef Timer_P Timer; 00047 typedef Clock_P Clock; 00048 // typedef Neighbor_P Neighbor; 00049 typedef Debug_P Debug; 00050 00051 /*************************************************************************/ 00052 /* From Sensor.h */ 00053 /*************************************************************************/ 00054 typedef Sensor<OsModel, Radio, Timer, Clock, Debug> self_type; 00055 //typedef Sensor<OsModel, Radio, Timer, Clock, Neighbor, Debug> self_type; 00056 typedef wiselib::Echo<Os, Os::TxRadio, Os::Timer, Os::Debug> NeighborDiscovery; 00057 typedef wiselib::vector_static<wiselib::OSMODEL, nodeid_t, 10> vector_static; 00058 typedef self_type* self_pointer_t; 00059 00060 // Basic types definition. 00061 typedef typename Radio::node_id_t node_id_t; 00062 typedef typename Radio::size_t size_t; 00063 typedef typename Radio::block_data_t block_data_t; 00064 typedef typename Timer::millis_t millis_t; 00065 00066 // -------------------------------------------------------------------- 00067 // Public method declaration. | 00068 // -------------------------------------------------------------------- 00069 00072 Sensor(){ } 00073 00076 //~Sensor(); 00077 00079 // virtual 00080 error_code_t init(typename Timer::self_pointer_t timer, 00081 typename Radio::self_pointer_t radio, 00082 MessageQueue* mqueue, 00083 Os::Debug::self_pointer_t debug, 00084 Os::Clock::self_pointer_t clock, 00085 NeighborDiscovery& neighbor_discovery); 00086 00087 // virtual 00088 error_code_t handle(TopologyMessage* msg); 00089 00090 nodeid_t cluster_head(); 00091 nodeid_t parent(); 00092 uint8_t hops(); 00093 nodeid_t cluster_id(); 00094 00095 //protected: 00096 void doWork(void*); 00097 void doBlink(void*); 00098 00099 bool shouldAccept(Message*); 00100 uint8_t distanceToNode(nodeid_t node); 00101 void resetTopology(); 00102 bool shouldAssumeLeadership(const topology_record_t&); 00103 error_code_t handleAllMessages(); 00104 nodeid_t findLeader(); 00105 error_code_t broadcastTopology(); 00106 private: 00107 static const int BLINK_INTERVAL=1000; // every second 00108 static const int WORK_INTERVAL=10000; // every 10 seconds 00109 static const uint8_t LEADER_RADIUS=6; 00110 static const uint8_t INFINITE_DISTANCE = 0xFF; 00111 00112 Os::Clock::self_pointer_t _clock; 00113 typename Timer::self_pointer_t _timer; 00114 typename Radio::self_pointer_t _radio; 00115 Os::Debug::self_pointer_t _debug; 00116 MessageQueue* _mqueue; 00117 NeighborDiscovery * neighbor_discovery_; 00118 00119 void scheduleWorkCallback() 00120 { 00121 //_timer->set_timer<Sensor, &Sensor::doWork>(WORK_INTERVAL, this, NULL); 00122 //_timer.template set_timer<Sensor, &Sensor::doWork > (WORK_INTERVAL, this, NULL); 00123 _timer->template set_timer<self_type, &self_type::doWork > (WORK_INTERVAL, this, NULL); 00124 } 00125 00126 void scheduleBlinkCallback() 00127 { 00128 //_timer->set_timer<Sensor, &Sensor::doBlink>(BLINK_INTERVAL, this, NULL); 00129 //_timer.template set_timer<Sensor, &self_type::doBlink > (BLINK_INTERVAL, this, NULL); 00130 } 00131 00132 bool _led_state; 00133 nodeid_t _id; 00134 nodeid_t _parent; 00135 bool _leader; 00136 // bool _candidate; 00137 nodeid_t leader_id; 00138 00139 void findMyNeighbors(); 00140 // Calculating new topology from information in the Messages continer 00141 void calculateNewTopology(); 00142 bool isNeighbor(nodeid_t other); 00143 vector_static myNeigbours; 00144 typedef std::map<nodeid_t, topology_record_t> topology_container_t; 00145 typedef topology_container_t::iterator topology_iterator; 00146 topology_container_t _topology; 00147 00148 // MSG Container holds the last msg recived from each node. 00149 typedef std::map<nodeid_t, TopologyMessage*> message_container_t; 00150 typedef message_container_t::iterator message_iterator; 00151 message_container_t _messages; 00152 }; 00153 00154 /*************************************************************************/ 00155 /* From Sensor.cpp */ 00156 /*************************************************************************/ 00157 template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P > 00158 //template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P,typename Neighbor_P > 00159 /* 00160 error_code_t 00161 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P,Neighbor_P >::init(typename Sensor::Timer::self_pointer_t timer, 00162 typename Sensor::Radio::self_pointer_t radio, 00163 MessageQueue* mqueue, 00164 Os::Debug::self_pointer_t debug, 00165 wiselib::OSMODEL::Clock::self_pointer_t clock, 00166 NeighborDiscovery& neighbor_discovery) 00167 {*/ 00168 error_code_t 00169 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P >::init(typename Sensor::Timer::self_pointer_t timer, typename Sensor::Radio::self_pointer_t radio, 00170 MessageQueue* mqueue, 00171 Os::Debug::self_pointer_t debug, 00172 wiselib::OSMODEL::Clock::self_pointer_t clock, 00173 NeighborDiscovery& neighbor_discovery) 00174 { 00175 00176 _timer = timer; 00177 00178 _radio = radio; 00179 00180 _mqueue = mqueue; 00181 00182 _debug = debug; 00183 00184 _clock = clock; 00185 00186 _id = _radio->id(); 00187 00188 00189 // neighbor_discovery_ = &neighbor_discovery; 00190 00191 // neighbor_discovery_->init( *_radio, *_clock, *_timer, *_debug ); 00192 00193 // neighbor_discovery_->enable(); 00194 00195 00196 scheduleBlinkCallback(); 00197 scheduleWorkCallback(); 00198 return ecSuccess; 00199 } 00200 00201 00202 /*template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P,typename Neighbor_P > 00203 error_code_t 00204 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P,Neighbor_P >::handle(TopologyMessage* msg) 00205 {*/ 00206 template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P > 00207 error_code_t 00208 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P >::handle(TopologyMessage* msg) 00209 { 00210 00211 if (_messages.find(msg->id) != _messages.end()) 00212 { 00213 _messages.erase(_messages.find(msg->id)); 00214 } 00215 _parent=msg->id; 00216 _messages.insert(std::make_pair(msg->id,msg)); 00217 00218 return ecSuccess; 00219 } 00220 00221 // calculate new topology from information in the Messages continer 00222 /*template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P,typename Neighbor_P > 00223 void 00224 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P,Neighbor_P >::calculateNewTopology() 00225 {*/ 00226 template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P > 00227 void 00228 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P >::calculateNewTopology() 00229 { 00230 _debug->debug( "HERE2010! \n "); 00231 resetTopology(); 00232 00233 for (message_iterator it_m = _messages.begin(); it_m != _messages.end(); ++it_m) 00234 { 00235 TopologyMessage* msg = (it_m->second); 00236 for (TopologyMessage::iterator it = msg->begin(); it != msg->end(); ++it) 00237 { 00238 topology_record_t rec = *it; 00239 rec.distance += 1; //add the distance to the originator 00240 if (rec.distance > LEADER_RADIUS) 00241 { 00242 continue;//this node is too far away 00243 } 00244 00245 if (distanceToNode(rec.nodeid) > rec.distance) 00246 { 00247 // _debug->debug( "OKAY! \n"); 00248 //std::map::insert guarentees that this entry replaces any previous entry with the same node id 00249 if (leader_id == _radio->id()) _parent = -1; 00250 topology_record_t& self_record = _topology.find(_radio->id())->second; 00251 self_record.parent=_parent; 00252 00253 // if theres already a topology remove it 00254 if (_topology.find(rec.nodeid) != _topology.end() ) 00255 _topology.erase(_topology.find(rec.nodeid)); 00256 00257 _topology.insert(std::make_pair(rec.nodeid, rec)); 00258 } 00259 00260 } 00261 } 00262 00263 _debug->debug( "MyID is: %d => My Leader is %d i know that:\n" ,_radio->id() ,leader_id); 00264 for (topology_iterator it = _topology.begin(); it != _topology.end(); ++it) 00265 { 00266 topology_record_t rec = it->second; 00267 _debug->debug( "[%d] Id: %d | distance: %d | isLeader %d | leader: %d | parent %d \n" ,_radio->id(),rec.nodeid ,rec.distance ,rec.is_leader ,rec.leader ,rec.parent); 00268 } 00269 00270 _debug->debug("\n TEST TEST TEST!!! [%d] Parent %d Hops %d CluseterID %d ClusterHead %d\n\n",_radio->id(), parent(), hops(), cluster_id(), cluster_head()); 00271 } 00272 00273 // get node neighbors 00274 /*template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P,typename Neighbor_P > 00275 void 00276 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P,Neighbor_P >::findMyNeighbors(){ 00277 */ 00278 template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P > 00279 void 00280 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P >::findMyNeighbors(){ 00281 00282 _debug->debug( "Node %d beighbors are:[ " ,_radio->id()); 00283 00284 for ( NeighborDiscovery::iterator_t it = neighbor_discovery_->neighborhood.begin(); 00285 it!= neighbor_discovery_->neighborhood.end(); ++it) 00286 { 00287 // Print only the neighbors we have bidi links 00288 if (it->bidi) 00289 _debug->debug( " %d [%d]" , it->id, 255-it->last_lqi); 00290 } 00291 _debug->debug( " ]\n"); 00292 00293 //return 0; 00294 } 00295 00296 // checks if node is my neighbor 00297 /*template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P,typename Neighbor_P > 00298 bool 00299 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P,Neighbor_P >::isNeighbor(nodeid_t other){*/ 00300 template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P > 00301 bool 00302 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P >::isNeighbor(nodeid_t other){ 00303 for ( NeighborDiscovery::iterator_t it = neighbor_discovery_->neighborhood.begin(); 00304 it!= neighbor_discovery_->neighborhood.end(); ++it) 00305 { 00306 if ((other==it->id) &&(it->bidi)) return true; 00307 00308 } 00309 00310 return false; 00311 } 00312 00313 /*template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P,typename Neighbor_P > 00314 void 00315 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P,Neighbor_P >::doWork(void*) 00316 {*/ 00317 template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P > 00318 void 00319 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P >::doWork(void*/*unused*/) 00320 { 00321 00322 //act on all accumulated messages 00323 if (handleAllMessages() != ecSuccess) 00324 { 00325 assert(false); 00326 } 00327 00328 calculateNewTopology(); 00329 //findParent(); 00330 //do leader selection 00331 leader_id = findLeader(); 00332 _leader = (leader_id == _radio->id()); 00333 00334 //update self entry in topology 00335 topology_record_t& self_record = _topology.find(_radio->id())->second; 00336 self_record.is_leader = _leader; 00337 self_record.leader = leader_id; 00338 00339 //broadcast the updated topology 00340 if (broadcastTopology() != ecSuccess) 00341 { 00342 assert(false); 00343 } 00344 00345 00346 findMyNeighbors(); 00347 00348 //re-schedule this function 00349 scheduleWorkCallback(); 00350 } 00351 00352 /*template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P,typename Neighbor_P > 00353 void 00354 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P,Neighbor_P >::doBlink(void*) 00355 {*/ 00356 template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P > 00357 void 00358 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P >::doBlink(void*/*unused*/) 00359 { 00360 _led_state = !_led_state; 00362 scheduleBlinkCallback(); 00363 } 00364 00365 00366 /*template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P,typename Neighbor_P > 00367 bool 00368 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P,Neighbor_P >::shouldAccept(Message* msg) 00369 {*/ 00370 00371 template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P > 00372 bool 00373 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P >::shouldAccept(Message* msg) 00374 { 00375 TopologyMessage* _msg; 00376 _msg = dynamic_cast<TopologyMessage*> (msg); 00377 00378 // if (isNeighbor(_msg->id)) _debug->debug( "%d accepted a msg from %d \n", _radio->id(), _msg->id); 00379 // else _debug->debug( "%d rejected a msg from %d \n", _radio->id(), _msg->id); 00380 00381 00382 return isNeighbor(_msg->id); 00383 } 00384 00385 00386 00387 /*template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P,typename Neighbor_P > 00388 uint8_t 00389 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P,Neighbor_P >::distanceToNode(nodeid_t node) 00390 {*/ 00391 00392 00393 template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P > 00394 uint8_t 00395 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P >::distanceToNode(nodeid_t node) 00396 { 00397 topology_iterator it = _topology.find(node); 00398 if (it == _topology.end()) 00399 { 00400 return INFINITE_DISTANCE; 00401 } 00402 return it->second.distance; 00403 } 00404 00405 /*template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P,typename Neighbor_P > 00406 void 00407 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P,Neighbor_P >::resetTopology() 00408 { 00409 */ 00410 template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P > 00411 void 00412 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P >::resetTopology() 00413 { 00414 _topology.clear(); 00415 _leader = false; 00416 // // _candidate = false; 00417 00418 topology_record_t self; 00419 00420 self.distance=0; 00421 // self.is_candidate=false; 00422 self.is_leader=false; 00423 self.leader=0; 00424 self.nodeid=_radio->id(); 00425 self.parent=-1; 00426 00427 _topology.insert(std::make_pair(self.nodeid, self)); 00428 } 00429 00430 /*template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P,typename Neighbor_P > 00431 bool 00432 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P,Neighbor_P >::shouldAssumeLeadership(const topology_record_t& record) 00433 { */ 00434 00435 template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P > 00436 bool 00437 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P >::shouldAssumeLeadership(const topology_record_t& record) 00438 { 00439 return record.nodeid < _radio->id(); 00440 } 00441 00442 /*template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P,typename Neighbor_P > 00443 error_code_t 00444 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P,Neighbor_P >::handleAllMessages() 00445 {*/ 00446 template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P > 00447 error_code_t 00448 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P >::handleAllMessages() 00449 { 00450 Message* recv_msg = _mqueue->nextMessage(); 00451 00452 while (recv_msg != NULL) 00453 { 00454 if (shouldAccept(recv_msg)) 00455 { 00456 00457 error_code_t errcode = recv_msg->applyTo(this); 00458 00459 if (errcode != ecSuccess) 00460 { 00461 return errcode; 00462 } 00463 } 00464 recv_msg = _mqueue->nextMessage(); 00465 } 00466 00467 return ecSuccess; 00468 } 00469 00470 /*template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P,typename Neighbor_P > 00471 nodeid_t 00472 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P,Neighbor_P >::findLeader() 00473 {*/ 00474 template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P > 00475 nodeid_t 00476 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P >::findLeader() 00477 { 00478 00479 nodeid_t leader_id = _radio->id(); 00480 00481 for (topology_iterator it = _topology.begin(); it != _topology.end(); ++it) 00482 { 00483 if (it->second.distance > LEADER_RADIUS) 00484 { 00485 continue; //node is too far away for leader decisions. advance to the next node. 00486 } 00487 00488 if ((it->second.is_leader) && (!shouldAssumeLeadership(it->second))) 00489 { 00490 leader_id = it->second.nodeid; 00491 break; //we found our leader. nothing else left to do. 00492 } 00493 } 00494 00495 return leader_id; 00496 } 00497 00498 /*template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P,typename Neighbor_P > 00499 error_code_t 00500 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P,Neighbor_P >::broadcastTopology() 00501 {*/ 00502 template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P > 00503 error_code_t 00504 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P >::broadcastTopology() 00505 { 00506 TopologyMessage send_msg; 00507 send_msg.id = _radio->id(); 00508 for (topology_iterator it = _topology.begin(); it != _topology.end(); ++it) 00509 { 00510 send_msg.addTopologyRecord(it->second); 00511 } 00512 00513 uint8_t buffer[Radio::MAX_MESSAGE_LENGTH]; 00514 send_msg.serialize(buffer, ARRSIZE(buffer)); 00515 //_debug->debug( "sending msg from %d \n", send_msg.id); 00516 00517 _radio->send(Radio::BROADCAST_ADDRESS, sizeof(buffer)/sizeof(typename Radio::block_data_t), buffer); 00518 00519 return ecSuccess; 00520 } 00521 00523 /*template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P,typename Neighbor_P > 00524 nodeid_t 00525 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P,Neighbor_P >::cluster_head(){*/ 00526 template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P > 00527 nodeid_t 00528 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P >::cluster_head(){ 00529 return leader_id; 00530 } 00531 00532 /*template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P,typename Neighbor_P > 00533 nodeid_t 00534 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P,Neighbor_P >::parent(){*/ 00535 template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P > 00536 nodeid_t 00537 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P>::parent(){ 00538 return _parent; 00539 } 00540 00541 /*template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P,typename Neighbor_P > 00542 uint8_t 00543 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P,Neighbor_P >::hops(){*/ 00544 template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P > 00545 uint8_t 00546 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P >::hops(){ 00547 00548 return (_topology.find(leader_id))->second.distance; 00549 } 00550 00551 /*template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P,typename Neighbor_P > 00552 nodeid_t 00553 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P,Neighbor_P >::cluster_id(){*/ 00554 template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Clock_P, typename Debug_P > 00555 nodeid_t 00556 Sensor<OsModel_P,Radio_P,Timer_P,Clock_P,Debug_P >::cluster_id(){ 00557 return leader_id; 00558 } 00559 00560 } 00561 #endif