|
Wireless Sensor Networks Lab - Stanford University |
|
|
|
WiSNAP's Wireless Mote API provides the following functions to interface with wireless motes.
Opens a communications session with the wireless mote.
handle = wireless_mote_api(device,'open',port)
device |
Wireless mote device (string): |
port |
Communications port (string). |
handle |
Device handle (positive integer). |
mhandle = wireless_mote_api('CC2420DB','open','COM2')
Initializes the wireless mote.
status = wireless_mote_api(device,'init',handle,PhyInfo)
device |
See function open. |
handle |
Device handle (positive integer). |
PhyInfo |
PHY information (structure): PhyInfo.Channel – Transceiver
ISM channel (integer). |
status |
Success status (-1 = error, +1 = success). |
status = wireless_mote_api('CC2420DB','init',mhandle,PhyInfo)
Receives a MAC packet from a wireless mote.
RxMacPckt = wireless_mote_api(device,'recv',handle)
device |
See function open. |
handle |
Device handle (positive integer). |
RxMacPckt |
RxMacPckt = -1 – if packet receive buffer empty. RxMacPckt.seqNumber – Sequence
number (integer). |
RxMacPckt = wireless_mote_api('CC2420DB','recv',mhandle)
Transmits a MAC packet to a wireless mote.
status = wireless_mote_api(device,'send',handle,TxMacPckt)
device |
See function open. |
handle |
Device handle (positive integer). |
TxMacPckt |
MAC transmit packet (structure): TxMacPckt.destAddress – Destination
address (integer). |
status |
Success status (-1 = error, +1 = success). |
status = wireless_mote_api('CC2420DB','send',mhandle,TxMacPckt)
Closes the communications session with the wireless mote.
status = wireless_mote_api(device,'close',handle)
device |
See function open. |
handle |
Device handle (positive integer). |
status |
Success status (-1 = error, +1 = success). |
status = wireless_mote_api('CC2420DB','close',mhandle)