Wireless Sensor Networks Lab - Stanford University
WiSNAP
Wireless Image Sensor Network Application Platform

  Go to function:

    Index    Contents 

[ DOWNLOAD ]

 

 

Wireless Mote API: Functions

WiSNAP's Wireless Mote API provides the following functions to interface with wireless motes.

 


Function: open

Opens a communications session with the wireless mote.

Syntax

handle = wireless_mote_api(device,'open',port)

Input(s)

device

Wireless mote device (string):
'CC2420DB': Chipcon CC2420DB wireless mote.

port

Communications port (string).

Output(s)

handle

Device handle (positive integer).

Example(s)

mhandle = wireless_mote_api('CC2420DB','open','COM2')

 


Function: init

Initializes the wireless mote.

Syntax

status = wireless_mote_api(device,'init',handle,PhyInfo)

Input(s)

device

See function open.

handle

Device handle (positive integer).

PhyInfo

 

PHY information (structure):

PhyInfo.Channel – Transceiver ISM channel (integer).
PhyInfo.Address – Mote's node address (integer).
PhyInfo.PanID – Personal Area Network (PAN) ID (integer).

Output(s)

status

Success status (-1 = error, +1 = success).

Example(s)

status = wireless_mote_api('CC2420DB','init',mhandle,PhyInfo)

 


Function: recv

Receives a MAC packet from a wireless mote.

Syntax

RxMacPckt = wireless_mote_api(device,'recv',handle)

Input(s)

device

See function open.

handle

Device handle (positive integer).

Output(s)

RxMacPckt

RxMacPckt = -1 – if packet receive buffer empty.
Otherwise MAC receive packet (structure):

RxMacPckt.seqNumber – Sequence number (integer).
RxMacPckt.scrAddress – Source address (integer).
RxMacPckt.scrPanID – Source PAN ID (integer).
RxMacPckt.length – Payload length in bytes (positive integer).
RxMacPckt.pPayload – Payload (1xlength vector).
RxMacPckt.ackRequest – Acknowledge request (0 = no, 1 = yes).
RxMacPckt.rssi – Received signal strength indicator (integer).

Example(s)

RxMacPckt = wireless_mote_api('CC2420DB','recv',mhandle)

 


Function: send

Transmits a MAC packet to a wireless mote.

Syntax

status = wireless_mote_api(device,'send',handle,TxMacPckt)

Input(s)

device

See function open.

handle

Device handle (positive integer).

TxMacPckt

 

MAC transmit packet (structure):

TxMacPckt.destAddress – Destination address (integer).
TxMacPckt.destPanID – Destination PAN ID (integer).
TxMacPckt.length – Payload length in bytes (positive integer).
TxMacPckt.pPayload – Payload (1xlength vector).
TxMacPckt.ackRequest – Acknowledge request (0 = no, 1 = yes).

Output(s)

status

Success status (-1 = error, +1 = success).

Example(s)

status = wireless_mote_api('CC2420DB','send',mhandle,TxMacPckt)

 


Function: close

Closes the communications session with the wireless mote.

Syntax

status = wireless_mote_api(device,'close',handle)

Input(s)

device

See function open.

handle

Device handle (positive integer).

Output(s)

status

Success status (-1 = error, +1 = success).

Example(s)

status = wireless_mote_api('CC2420DB','close',mhandle)

 


[ Previous | Contents | Next ]