Channels

A channel is a software construction used by the 

SmartMesh network stack

, devices and services to communicate with your application.

This definition of "channel" should not be confused with the radio channel which specifies the center frequency of a wireless transmission, e.g. the 2.405 GHz channel.

A channel allows a producer task to send a message to a consumer task. A channel is unidirectional. The message sent over a channel is an arbitrary sequence of bytes, treated by the channel as opaque.

The following diagram highlights the channels between your application and the 

SmartMesh network stack

, devices and services:

Communicating with the SmartMesh Network Stack

Communicating with the 

SmartMesh network stack

 is done through two channels, one in each direction. These channels, together with the format of the messages sent over them, form the Local Interface.

The control channel is used for your application to send commands to the 

SmartMesh network stack

, and receive responses. Example commands are "what is my MAC address?", "join a network," or "send this packet to this address."

The notification channel is used by the 

SmartMesh network stack

 to notify your application that something happened. Example notifications are "I just joined a network", or "I received this packet". To react quickly to notifications, your application can have a uC/OS-II task dedicated to waiting for messages from the notification channel, and reacting to them appropriately.

The exact format of all commands and notifications to send and receive with the

SmartMesh network stack

are defined in the Local Interface component of the Doxygen-based documentation inside the

On-Chip SDK repository

.

The Local Interface Module, provided as source code as part of the

On-Chip Software Development Kit

, handles all the formatting and parsing of the messages sent through the control and notification channels. If you choose to use this module, your application just calls simple functions.

The Local Interface Module is documented in the Doxygen-based documentation.

Receiving Notifications from Devices and Services

The following devices use one of more channels to communicate with your application.

  • The GPIO devices use a dedicated channel to signal an interrupt on one of the GPIOs. The notification contains which GPIO was toggled, and what its current state is.
  • The CLI device uses a dedicated channel to indicate that a user has entered a command you registered earlier. The notification indicates which command was entered, and what the entered string is. Your application can parse that string, possibly identifying parameters, and react accordingly.
  • The time service uses the local interface's notification channel to indicate that the TIME pin has been asserted. The notification contains the exact time at which this event happened. This, for example, allows your application to accurately timestamp measurements done by an external micro-controller.
  • The UART device uses a pair of dedicated channels to notify your application that an HDLC-encoded frame was received over the serial port, and to allow your application to transmit a frame over the serial port.

 

The CLI Module, provided as source code as part of the

On-Chip Software Development Kit

, allows your application to quickly build up a command line interface by registering commands and callback handler functions. The module handles all parsing of the messages received through the CLI channel.

The CLI Module is documented in the Doxygen-based documentation.