This section refers to the following sample application(s):
01-search
This application is new to OCSDK 1.2.0
Network ID is used to separate overlapping networks - devices reject packets with a mismatching network ID early in the packet receiving process. This necessitates configuring the correct network ID on a mote before placing it in the field.
In some cases, "touchless" operation is desired where a mote can be placed and join any network it can hear. The local module's dnm_loc_searchCmd()
can be used for this purpose - it puts the mote into promiscuous listen mode where it reports neighbor ID, RSSI, and network ID of all advertisements heard to your application. Your application can then decide which network to join.
If ACL's are being used on the managers, in addition to having the matching network ID, a mote must also be on the manager's ACL to be able to join.
The 01-search Sample Application
The application is best used with mutliple networks within range of the mote being tested. The application listens for a preferred network, and then joins it or the loudest network heard after a timeout.
Search app, ver 1.2.0.1 SmartMeshIP stack, ver 1.4.1.6 Searching for preferred network 293 for 30 s... Heard network 118 at -82 dBm (louder than previous best) Heard network 103 at -85 dBm Heard network 95 at -86 dBm Heard network 102 at -81 dBm (louder than previous best) ... Joining network 102...
It will print the following once joined:
I'm so happy in network 102!
Implementation Details
The 01-search
sample application uses the Helper Modules to initialize the CLI Module and for interaction with the local interface. It passes JOIN_NO
in the fJoin
flag when initializing the local module in the loc_task_init()
to prevent the local module from attempting to join, since joining will be handled by the application. It also installs a callback function advNotifCb()
to handle advertisement notifications. It has a helper function operationalCheck()
that polls the mote's status to determine if the mote is in Operational mode (i.e. ready to send data).
It uses a single task (searchTask
) which:
- Issues the
dnm_loc_searchCmd()
and waits forSEARCH_TIME
ms. - Issue the
dnm_loc_joinCmd()
to join either the preferred networkPREFERRED_NET
or the loudest network heard during the search. - Loops indefinitely, printing out a status message if the mote is operational.