Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Current »

This section refers to the following sample application(s):

  • 00-hello
  • 00-hello_common

The 00-hello sample application contains a task dedicated at driving the local interface module by continuously calling the dnm_loc_processNotifications() function. To simplify the code of all sample applications, this task, together with the other required initialization code listed in A First Application, is put in the following helper modules:

  • common/loc_task.c handles the common code for interfacing with the local interface module.
  • common/cli_task.c handles the common code for interfacing with the CLI module.

These helper modules are included in all sample applications.

The cli_task helper module

 

This helper module deals with the CLI, and avoids duplicated code across sample applications.

 

To use this module, your application needs to call the cli_task_init() function. It takes the following parameters:
  • cliContext, the CLI context of the application (as detailed in CLI Module).
  • appNamea string which will appear in the greeting banner.
  • cliCmds, an array of CLI commands which will appear next to the base CLI commands when typing "help". Pass NULL to not register additional CLI commands. 

This module:

  • Prints a banner with your application's name and the version number, as well as the version number of the 

    SmartMesh network stack

     it is linked against.
  • Registers the list of CLI commands, if any.
  • Starts a task to receive indications when a user enters one of the CLI commands your application added.

The loc_task helper module

This helper module deals with joining a network and requesting a service, and avoids duplicated code across sample applications.

To use this module, your application needs to call the loc_task_init() function. It takes the following parameters:

  • cliContext, the CLI context of the application (as detailed in CLI Module).
  • fJoin, a flag to indicate whether you want the module to join a network. Pass JOIN_NO to not join.
  • netId, the Network ID of the network to join. Pass NETID_NONE if you don't want to overwrite the one already present in the mote.
  • udpPort, the UDP port you want your application to bind to. Pass UDPPORT_NONE if you do not want to create a socket.
  • joinedSem, a pointer to a uC/OS-II semaphore which will be posted when the loc_task helper module is done joining the network. Pass NULL if you don't need this functionality.
  • bandwidth, the amount of bandwidth you'd like the loc_task helper module to request after it has joined. Pass BANDWIDTH_NONE if you don't require additional bandwidth.
  • serviceSem, a pointer to a uC/OS-II semaphore which will be posted when the loc_task helper module has been granted that additional bandwidth. Pass NULL if you don't need this functionality.
This module will then:
  • Create the appropriate channel to communicate with the 

    SmartMesh network stack

    .
  • Initialize the "Local Interface Module".
  • Optionally, configure the network identified of the mote.
  • Optionally, create a UDP socket and bind it to the specified UDP port.
  • Optionally, join a network.
  • Optionally, post a semaphore indicating it has joined a network.
  • Optionally, request a service to the 

    SmartMesh manager

    .
  • Optionally, post a semaphore indicating the service was granted.
The loc_task helper module allows the sample applications to perform these routine actions by calling a single function.

The complete  Application Programming Interface for programming the

LTC5800

, i.e. the functions and data structures to interact with the

SmartMesh library

provided as part of the

On-Chip Software Development Kit

are provided in the

SmartMesh On-Chip API html documentation

in the doc/ directory of the

On-Chip SDK repository

.

The 00-hello_common Sample Application

This sample application is similar to the 00-hello sample application, but relies on the cli_task and loc_task to initialize the CLI and 

SmartMesh network stack

.
When running the 00-hello_common sample application, a first banner prints the name of the application and the version. A second banner prints the version of the 

SmartMesh network stack

.

 

> hello_common app, ver 1.0.0.1
SmartMeshIP stack, ver 1.2.1.3
>
> help
help <command>
Commands:
   mtrace
   mset
   mget
   minfo
   mlog
   mfs
   mseti
   mgeti
   mshow
   mxtal
   mhwlog
>
  • No labels