Wiselib
Classes | Public Types | Public Member Functions | Public Attributes
wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P > Class Template Reference

Echo. More...

#include <echo.h>

List of all members.

Classes

struct  messages_statistics
struct  neighbor_entry
struct  reg_alg_entry

Public Types

enum  error_codes { SUCCESS = OsModel::SUCCESS, RGD_NUM_INUSE = 1, RGD_LIST_FULL = 2, INV_ALG_ID = 3 }
enum  event_codes {
  NEW_NB = 1, NEW_NB_BIDI = 2, DROPPED_NB = 4, NEW_PAYLOAD = 8,
  NEW_PAYLOAD_BIDI = 16, LOST_NB_BIDI = 32, NB_READY = 64, DEFAULT = 5
}
typedef OsModel_P OsModel
typedef Radio_P Radio
typedef Timer_P Timer
typedef Debug_P Debug
typedef OsModel_P::Clock Clock
typedef Radio::node_id_t node_id_t
typedef Radio::size_t size_t
typedef Radio::block_data_t block_data_t
typedef Radio::message_id_t message_id_t
typedef Clock::time_t time_t
typedef Radio::ExtendedData ExData
typedef Radio::TxPower TxPower
typedef EchoMsg< OsModel, RadioEchoMsg_t
typedef Echo< OsModel_P,
Radio_P, Timer_P, Debug_P > 
self_t
typedef delegate4< void,
uint8_t, node_id_t, uint8_t,
uint8_t * > 
event_notifier_delegate_t
typedef struct reg_alg_entry reg_alg_entry_t
typedef wiselib::vector_static
< OsModel, reg_alg_entry_t,
TOTAL_REG_ALG > 
reg_alg_vector_t
typedef reg_alg_vector_t::iterator reg_alg_iterator_t
typedef struct neighbor_entry neighbor_entry_t
 Type of the structure that hold the relevant neighbor data.
typedef wiselib::vector_static
< OsModel, neighbor_entry_t,
ECHO_MAX_NODES > 
node_info_vector_t
 Type of the Vector Containing information for all nodes in the Neighborhood.
typedef
node_info_vector_t::iterator 
iterator_t

Public Member Functions

 Echo ()
 Constructor.
 ~Echo ()
 Destructor.
void enable ()
 Enable the Echo system enable radio and register receive callback initialize vectors change status to SEARCHING start sending hello messages.
void disable ()
 Disable the Echo protocol.
void init_echo ()
 Initialize vectors and variables for Neighborhood Discovery.
uint16_t msgs_count ()
uint32_t msgs_size ()
uint16_t get_node_stability ()
uint8_t register_payload_space (uint8_t payload_id)
 It is used for registering a position in the hello msg payload in order to piggyback the applications data.
uint8_t unregister_payload_space (uint8_t payload_id)
 It is used for unregistering a position in the hello msg.
uint8_t set_payload (uint8_t payload_id, uint8_t *data, uint8_t len)
 It sets the payload for a specific application that is going to be piggybacked in the next hello msg.
bool is_neighbor (node_id_t id)
bool is_neighbor_bidi (node_id_t id)
uint8_t nb_size (void)
uint8_t stable_nb_size (void)
uint8_t bidi_nb_size (void)
uint8_t get_link_assoc (node_id_t neighbor_id)
uint8_t get_ilink_assoc (node_id_t neighbor_id)
uint8_t get_nb_stability (node_id_t id)
uint8_t get_nb_receive_stability (node_id_t id)
void init (Radio &radio, Clock &clock, Timer &timer, Debug &debug)
 Initialize the module.
void init (Radio &radio, Clock &clock, Timer &timer, Debug &debug, uint16_t beacon_pd, uint16_t timeout_pd, uint8_t min_theshold, uint8_t max_threshold)
 Initialize the module.
void set_beacon_period (uint16_t beacon_pd)
void set_timeout_perdio (uint16_t timeout_pd)
template<class T , void(T::*)(uint8_t, node_id_t, uint8_t, uint8_t *) TMethod>
uint8_t reg_event_callback (uint8_t alg_id, uint8_t events_flag, T *obj_pnt)
void unreg_event_callback (uint8_t alg_id)
void register_debug_callback (uint8_t flags)
 Register a callback that prints debug information upon any generated event.

Public Attributes

TxPower power
reg_alg_vector_t registered_apps
 Actual Vector containing callbacks for all the register applications.
node_info_vector_t neighborhood
 Actual Vector containing the nodes in the neighborhood.

Detailed Description

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
class wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >

Echo.


Member Typedef Documentation

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef Radio::block_data_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::block_data_t
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef OsModel_P::Clock wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::Clock
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef Debug_P wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::Debug
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef EchoMsg<OsModel, Radio> wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::EchoMsg_t
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef delegate4<void, uint8_t, node_id_t, uint8_t, uint8_t*> wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::event_notifier_delegate_t
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef Radio::ExtendedData wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::ExData
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef node_info_vector_t::iterator wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::iterator_t
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef Radio::message_id_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::message_id_t
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef struct neighbor_entry wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::neighbor_entry_t

Type of the structure that hold the relevant neighbor data.

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef Radio::node_id_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::node_id_t
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef wiselib::vector_static<OsModel, neighbor_entry_t, ECHO_MAX_NODES> wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::node_info_vector_t

Type of the Vector Containing information for all nodes in the Neighborhood.

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef OsModel_P wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::OsModel
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef Radio_P wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::Radio
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef struct reg_alg_entry wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::reg_alg_entry_t
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef reg_alg_vector_t::iterator wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::reg_alg_iterator_t
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef wiselib::vector_static<OsModel, reg_alg_entry_t, TOTAL_REG_ALG> wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::reg_alg_vector_t
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef Echo<OsModel_P, Radio_P, Timer_P, Debug_P> wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::self_t
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef Radio::size_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::size_t
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef Clock::time_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::time_t
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef Timer_P wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::Timer
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
typedef Radio::TxPower wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::TxPower

Member Enumeration Documentation

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
enum wiselib::Echo::error_codes
Enumerator:
SUCCESS 

The method return with no errors.

RGD_NUM_INUSE 

This app number is already registered.

RGD_LIST_FULL 

The list with the registered apps is full.

INV_ALG_ID 

The alg id is invalid.

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
enum wiselib::Echo::event_codes
Enumerator:
NEW_NB 

Event code for a newly added stable neighbor.

NEW_NB_BIDI 

Event code for a newly added bidi neighbor.

DROPPED_NB 

Event code for a neighbor removed from nb list.

NEW_PAYLOAD 

Event code for a newly arrived pg payload.

NEW_PAYLOAD_BIDI 

Event code for a newly arrived pg payload from a bidi neighbor.

LOST_NB_BIDI 

Event code generated when we loose bidi comm with a nb.

NB_READY 

Event code generated after the nb module has generated a stable nhd Useful for starting other modules that must wait until the nb has produced a stable neighborhood.

DEFAULT 

Event code for NEW_NB + DROPED_NB.


Constructor & Destructor Documentation

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::Echo ( ) [inline]

Constructor.

Sets status to waiting.

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::~Echo ( ) [inline]

Destructor.


Member Function Documentation

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
uint8_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::bidi_nb_size ( void  ) [inline]
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
void wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::disable ( void  ) [inline]

Disable the Echo protocol.

Disables the Echo protocol. The module will unregister the receive callback, and will stop send beacons. The timer will keep triggering every beacon_period Millis. All the existing neighbors will timeout at most after timeout_period and the NB_DROPPED events will be generated.

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
void wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::enable ( void  ) [inline]

Enable the Echo system enable radio and register receive callback initialize vectors change status to SEARCHING start sending hello messages.

Enable normal radio and register the receive callback.

Initialize vectors and variables.

Code for paying with different TxPower values.

Set the status of the module: SEARCHING.

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
uint8_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::get_ilink_assoc ( node_id_t  neighbor_id) [inline]
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
uint8_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::get_link_assoc ( node_id_t  neighbor_id) [inline]
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
uint8_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::get_nb_receive_stability ( node_id_t  id) [inline]
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
uint8_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::get_nb_stability ( node_id_t  id) [inline]
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
uint16_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::get_node_stability ( ) [inline]
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
void wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::init ( Radio radio,
Clock clock,
Timer timer,
Debug debug 
) [inline]

Initialize the module.

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
void wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::init ( Radio radio,
Clock clock,
Timer timer,
Debug debug,
uint16_t  beacon_pd,
uint16_t  timeout_pd,
uint8_t  min_theshold,
uint8_t  max_threshold 
) [inline]

Initialize the module.

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
void wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::init_echo ( ) [inline]

Initialize vectors and variables for Neighborhood Discovery.

It will initialize all the the relevant structures and variables of the module: clear neighborhood vector set the node stability to zero.

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
bool wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::is_neighbor ( node_id_t  id) [inline]
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
bool wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::is_neighbor_bidi ( node_id_t  id) [inline]
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
uint16_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::msgs_count ( ) [inline]
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
uint32_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::msgs_size ( ) [inline]
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
uint8_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::nb_size ( void  ) [inline]
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
template<class T , void(T::*)(uint8_t, node_id_t, uint8_t, uint8_t *) TMethod>
uint8_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::reg_event_callback ( uint8_t  alg_id,
uint8_t  events_flag,
T *  obj_pnt 
) [inline]
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
void wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::register_debug_callback ( uint8_t  flags) [inline]

Register a callback that prints debug information upon any generated event.

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
uint8_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::register_payload_space ( uint8_t  payload_id) [inline]

It is used for registering a position in the hello msg payload in order to piggyback the applications data.

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
void wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::set_beacon_period ( uint16_t  beacon_pd) [inline]
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
uint8_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::set_payload ( uint8_t  payload_id,
uint8_t data,
uint8_t  len 
) [inline]

It sets the payload for a specific application that is going to be piggybacked in the next hello msg.

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
void wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::set_timeout_perdio ( uint16_t  timeout_pd) [inline]
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
uint8_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::stable_nb_size ( void  ) [inline]
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
void wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::unreg_event_callback ( uint8_t  alg_id) [inline]
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
uint8_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::unregister_payload_space ( uint8_t  payload_id) [inline]

It is used for unregistering a position in the hello msg.


Member Data Documentation

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
node_info_vector_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::neighborhood

Actual Vector containing the nodes in the neighborhood.

template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
TxPower wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::power
template<typename OsModel_P, typename Radio_P, typename Timer_P, typename Debug_P>
reg_alg_vector_t wiselib::Echo< OsModel_P, Radio_P, Timer_P, Debug_P >::registered_apps

Actual Vector containing callbacks for all the register applications.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines