Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

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

  • 00-hello

Table of Contents

 


The 

Include Page
_def_ocsdk_library
_def_ocsdk_library
 implements the full run-time environment for your application. For your application to start running, it needs to do at least the following:

...

This sample application follows the steps above and prints the string "Hello, World!" on the CLI interface. 


Note

To be able to see the "Hello, World!" message, connect a terminal client (such as PuTTY or TeraTerm) to the CLI serial interface of your device.

Refer to the SmartMesh IP Tools Guide for information about the different serial ports.

When the mote boots, you see the following on your terminal client:

No Format
> Hello, World!

The 

Include Page
_def_ocsdk_library
_def_ocsdk_library
 implements a base command line interface, by default. You can type help to see the default CLI commands:

No Format
> Hello, World!
>
> help
help <command>
Commands:
   mtrace
   mset
   mget
   minfo
   mlog
   mfs
   mseti
   mgeti
   mshow
   mxtal
   mhwlog
>
Note

By convention, all default CLI commands start with the letter "m", for "mote".

You can issue the command minfo to obtain general information about the state of the device:

No Format
> minfo
Net stack  v1.2.1.3
state:     Idle
mac:       00:17:0d:00:00:38:0f:47
moteid:    0
netid:     423
blSwVer:   13
ldrSwVer:  1.0.3.12
UTC time:  0:0
reset st:  200

You can use the command mset to configure a number of elements of the 

Include Page
_def_ocsdk_stack
_def_ocsdk_stack
. For example, change the Network ID of the mote through the following command:

No Format
> mset netid 477

This setting is stored in non-volatile memory. After a reboot of the device, you can verify that the setting is still present.

No Format
> Hello, World!
> mget netid
netid = 477
Tip

Refer to the SmartMesh IP Manager Mote CLI Guide for a description of these commands.

Implementation Details

The 00-hello sample application initializes the CLI Module, before printing "Hello, World!" over it. Initialization involves:

  • opening the CLI module by calling dnm_ucli_openPort();
  • raising the default access level to DN_CLI_ACCESS_USER so the user can issue CLI commands such as mset;
  • create a channel to receive CLI notifications;
  • initialize the CLI Module.
  • continuously call the (blocking) dnm_loc_processNotifications() to process received CLI command.
 


Tip

These operations are so common that we built the simple cli_task Helper Module.

The 00-hello_common sample application is equivalent to 00-hello, but using this helper module (see Helper Modules)