Difference between revisions of "Collect-view Code Details"

From Contiki
Jump to: navigation, search
(Description)
(Description)
Line 36: Line 36:
 
This function also starts the neighbor discovery process along with other other initialization.  
 
This function also starts the neighbor discovery process along with other other initialization.  
  
            '''#if !COLLECT_ANNOUNCEMENTS
+
                #if !COLLECT_ANNOUNCEMENTS
 
                     neighbor_discovery_open(...);
 
                     neighbor_discovery_open(...);
 
                     neighbor_discovery_start(&tc->neighbor_discovery_conn, tc->rtmetric);
 
                     neighbor_discovery_start(&tc->neighbor_discovery_conn, tc->rtmetric);
Line 46: Line 46:
 
                           }
 
                           }
 
                     #endif /* COLLECT_CONF_WITH_LISTEN */
 
                     #endif /* COLLECT_CONF_WITH_LISTEN */
                 #endif /* !COLLECT_ANNOUNCEMENTS */'''
+
                 #endif /* !COLLECT_ANNOUNCEMENTS */
  
 
This portion of code opens a broadcast channel to start the neighbor discovery process. The if else condition is used to choose the max_interval of running the discovery process. if  
 
This portion of code opens a broadcast channel to start the neighbor discovery process. The if else condition is used to choose the max_interval of running the discovery process. if  

Revision as of 16:27, 4 November 2014

Back to Contiki Tutorials


Introduction

This tutorial covers the main features of Collect-view Protocol (CTP) available on ContikiOS 2.7. There are many different section of CTP codes that are distributed over different folders. In this tutorial we will cover the codes and their interdependence in brief details.

You will learn

Through this tutorial you will learn about different code components of CTP. This will help you in any projects that require deep understanding of the code or need modification of some portion of the code.


Source Codes

~/contiki-2.7/core/net/rime/collect.c

~/contiki-2.7/core/net/rime/collect.h

~/contiki-2.7/core/net/rime/collect-neighbor.c

~/contiki-2.7/core/net/rime/collect-neighbor.c

~/contiki-2.7/apps/collect-view/

Description

void collect_open(struct collect_conn *c, uint16_t channels, uint8_t is_router, const struct collect_callbacks *callbacks);

This function opens a unicast channel in each node with the channel being (channels+1) and initialize all the parameters needed for the channel.

                  unicast_open(&tc->unicast_conn, channels + 1, &unicast_callbacks);

There is a function called collect_neighbor_init(void) which initializes a memory to store the information about the collect neighbors. This function also starts the neighbor discovery process along with other other initialization.

               #if !COLLECT_ANNOUNCEMENTS
                   neighbor_discovery_open(...);
                   neighbor_discovery_start(&tc->neighbor_discovery_conn, tc->rtmetric);
               #else /* !COLLECT_ANNOUNCEMENTS */
                   announcement_register(&tc->announcement, channels,received_announcement);
                   #if ! COLLECT_CONF_WITH_LISTEN
                         if(tc->is_router) {
                             announcement_set_value(&tc->announcement, RTMETRIC_MAX);
                         }
                   #endif /* COLLECT_CONF_WITH_LISTEN */
               #endif /* !COLLECT_ANNOUNCEMENTS */

This portion of code opens a broadcast channel to start the neighbor discovery process. The if else condition is used to choose the max_interval of running the discovery process. if




void collect_close(struct collect_conn *c);

int collect_send(struct collect_conn *c, int rexmits);

void collect_set_sink(struct collect_conn *c, int should_be_sink);

int collect_depth(struct collect_conn *c);


const rimeaddr_t *collect_parent(struct collect_conn *c);

void collect_set_keepalive(struct collect_conn *c, clock_time_t period);

void collect_print_stats(void);