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 4 Next »

Introduction

SimpleIPMgr, SimpleIPMote, and SimpleHartMote are console (non-graphical) applications which show how to interact programmatically with the API of the respective devices. They are meant to serve as sample code.

Running

This sample application is a collection of different scripts:

  • SimpleIPMgr which exercises the API of the SmartMesh IP Manager
  • SimpleIPMote which exercises the API of the SmartMesh IP Mote
  • SimpleHartMote which exercises the API of the SmartMesh IP Mote

You can run those scripts in two ways:

  • by double-clicking on the corresponding Windows executable at /win/
  • by double-clicking on its source files at /src/bin/Simple/

Description

These scripts take you step by step through exploring the capabilities of the SmartMesh SDK. One example output is:

Simple Application which interacts with the IP mote - (c) Dust Networks

================== Step 1. API exploration ========================
=====
Load the API definition of the IP mote
done.
=====
List all the defined command IDs:
[1, 2, 6, 7, 8, 9, 12, 16, 17, 18, 21, 22, 23, 24, 36, 40]
=====
List all the defined command names:
['setParameter', 'getParameter', 'join', 'disconnect', 'reset', 'lowPowerSleep',
 'testRadioRx', 'clearNV', 'requestService', 'getServiceInfo', 'openSocket', 'cl
oseSocket', 'bindSocket', 'sendTo', 'search', 'testRadioTxExt']
=====
Get the command name of command ID 2:
getParameter
=====
Get the command ID of command name 'getParameter':
2
=====
List the subcommand of command 'getParameter':
['macAddress', 'networkId', 'txPower', 'joinDutyCycle', 'eventMask', 'moteInfo',
 'netInfo', 'moteStatus', 'time', 'charge', 'testRadioRxStats', 'OTAPLockout', '
moteId', 'ipv6Address', 'routingMode', 'appInfo', 'powerSrcInfo', 'powerCostInfo
', 'mobilityType', 'advKey', 'sizeInfo', 'autoJoin']
=====
Get a description of the getParameter.moteStatus command:
The getParameter<moteStatus> command is used to retrieve current mote state ando
ther dynamic information.
=====
List the name of the fields in the getParameter.moteStatus request:
[]
=====
List the name of the fields in the getParameter.moteStatus response:
['state', 'reserved_0', 'reserved_1', 'numParents', 'alarms', 'reserved_2']
=====
Print the format of the getParameter.moteStatus 'state' response field:
int
=====
Print the length of the getParameter.moteStatus 'state' response field:
1
=====
Print the valid options of the getParameter.moteStatus 'state' response field:
[0, 1, 2, 3, 4, 5, 6, 7, 8]
=====
Print the description of each valid options of the getParameter.moteStatus 'stat
e' response field:
['init', 'idle', 'searching', 'negotiating', 'connected', 'operational', 'discon
nected', 'radiotest', 'promiscuous listen']

================== Step 2. Connecting to a device =================
Do you want to connect to a device? [y/n] y
Enter the serial port of the IP mote's API (e.g. COM30) COM6
=====
Creating connector
done.
=====
Connecting to IP mote
done.

================== Step 3. Getting information from the device ====
=====
Retrieve the moteStatus, through 'raw' API access:
{'numParents': 0, 'reserved_1': 0, 'reserved_0': 0, 'reserved_2': 0, 'state': 1,
 'RC': 0, 'alarms': 0}
=====
Retrieve the moteStatus, through function-based API access:
Tuple_dn_getParameter_moteStatus(RC=0, state=1, reserved_0=0, reserved_1=0, numP
arents=0, alarms=0, reserved_2=0)

================== Step 4. Disconnecting from the device ==========
=====
Disconnecting from IP mote
done.
Script ended. Press Enter to exit.
  • No labels