|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.spot.peripheral.radio.LowPanPacket
public class LowPanPacket
LowPanPacket.java
Field Summary | |
---|---|
protected static int |
BROADCAST_PACKET
Indicates this LowPanPacket will use a RadioPacket of the type 'Broadcast' |
protected static int |
DATA_PACKET
Indicates this LowPanPacket will use a RadioPacket of the type 'Data' |
protected static byte |
DISPATCH_MASK
bitmask used to extract the dispatch field |
Constructor Summary | |
---|---|
LowPanPacket(int type)
Create a LowPanPacket of either DATA_PACKET or BROADCAST_PACKET |
|
LowPanPacket(RadioPacket packet)
Parse a RadioPacket and use it to create a new instance of LowPanPacket that represents this RadioPacket. |
Method Summary | |
---|---|
int |
getBCastSeqNo()
return the sequence number for this mesh broadcast |
int |
getDestLen()
returns the length in bytes of the destination address field 2 bytes == 16-bit addressing 8 bytes == 64-bit addressing |
long |
getFDestinationAddress()
return the final destination address of this packet |
byte |
getFragOff()
retrieve the offset of this fragment as related to the original datagram offsets are in multiples of 8 bytes |
short |
getFragSize()
retrieve the total size of the original datagram of which this fragment is part |
short |
getFragTag()
retrieve the datagram tag for this fragment |
byte |
getFragType()
retrieve the fragment type bits from the fragmentation header |
int |
getHeaderLength()
return the length of the LowPanPacket header |
byte |
getHopsLeft()
returns the number of hops left for this packet |
int |
getLppPayloadOffset()
return the starting offset of the payload section of the packet |
long |
getOriginatorAddress()
return the address of the originator field of the mesh header |
int |
getOrigLen()
return the length in bytes of the originator address field 2 bytes == 16-bit addressing 8 bytes == 64-bit addressing |
int |
getPayloadSize()
return the actual size of the LowPanPacket payload |
byte |
getProtocol()
retrieve the protocol number from this packet |
byte |
getProtocolFamily()
retrieve the protocol family number from this packet |
RadioPacket |
getRadioPacket()
return a representation of this LowPanPacket in an actual RadioPacket |
long |
getRPSourceAddress()
return the source address of the actual radio packet |
boolean |
isBCast()
determine if there is a LowPan broadcast header |
boolean |
isExtendedProtocol()
determine if this packet uses the extended protocol field |
boolean |
isFirstFrag()
determine whether this is a leading fragment of a packet |
boolean |
isFragged()
determine whether this packet has a fragmentation header |
boolean |
isMeshed()
determine if this packet has a mesh header |
void |
setBCast(boolean bCast)
define this packet to have a LowPan broadcast header |
void |
setBCastSeqNo(int bCastSeqNo)
set the sequence number for this mesh broadcast |
void |
setDestLen(int destLen)
set the length in bytes of the destination address field 2 bytes == 16-bit addressing 8 bytes == 64-bit addressing |
void |
setExtendedProtocol(boolean extendedProtocol)
define this packet to use the extended protocol byte |
void |
setFDestinationAddress(long destAddr)
set the final destination for this meshed packet |
void |
setFragged(boolean fragged)
define this packet to have a fragmentation header |
void |
setFragOff(byte fragOff)
set the offset of this fragment as related to the original datagram offsets are in multiples of 8 bytes |
void |
setFragSize(short size)
set the total size of the datagram to which this fragment belongs |
void |
setFragTag(short tag)
set the datagram tag for this fragment |
void |
setFragType(byte type)
define the fragment type for this packet, as defined in the 6lowpan spec |
void |
setHopsLeft(int hopsLeft)
set the number of hops for this packet |
void |
setMeshed(boolean meshed)
define this packet to have a mesh header |
void |
setOriginatorAddress(long origAddr)
set the address of the originator field of the mesh header |
void |
setOrigLen(int origLen)
set the length in bytes of the destination address field 2 bytes == 16-bit addressing 8 bytes == 64-bit addressing |
void |
setPayloadSize(int payloadSize)
set the payload size in this LowPanPacket |
void |
setProtocol(byte protocol)
sets the protocol number for this packet |
void |
setProtocol(byte family,
byte protocol)
sets the protocol number , within a specific family, for this packet |
void |
setProtocolFamily(byte protocolFamily)
sets the protocol family number for this packet |
void |
setRPDestinationAddress(long addr)
set the destination of the underlying radio packet |
void |
setRPSourceAddress(long addr)
set the source address for this radio packet this may be over written by the packet dispatcher. |
String |
toString()
create a string representation of this Object |
void |
writeHeaderAndPayload(LowPanHeader lph,
byte[] buffer,
int start,
int end)
Constructs a RadioPacket using a LowPanHeader and a data buffer. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final byte DISPATCH_MASK
protected static final int DATA_PACKET
protected static final int BROADCAST_PACKET
Constructor Detail |
---|
public LowPanPacket(int type)
type
- the type of underlying RadioPacket to use either a
DATA_PACKET or BROADCAST_PACKETpublic LowPanPacket(RadioPacket packet)
packet
- the RadioPacket to parseMethod Detail |
---|
public void writeHeaderAndPayload(LowPanHeader lph, byte[] buffer, int start, int end)
lph
- the lowpan header for this packetbuffer
- data buffer to sendstart
- index of first byte to send from bufferend
- index of last byte to send from bufferpublic byte getHopsLeft()
public void setHopsLeft(int hopsLeft)
hopsLeft
- number of hops remainingpublic int getDestLen()
public void setDestLen(int destLen)
destLen
- number of bytes in the destination addresspublic int getOrigLen()
public void setOrigLen(int origLen)
origLen
- number of bytes in the originator addresspublic long getOriginatorAddress()
public void setOriginatorAddress(long origAddr)
origAddr
- address of the originator of this packetpublic long getFDestinationAddress()
public void setFDestinationAddress(long destAddr)
destAddr
- new final destination address for this meshed packetpublic int getBCastSeqNo()
public void setBCastSeqNo(int bCastSeqNo)
bCastSeqNo
- the mesh broadcast sequence numberpublic void setFragType(byte type)
type
- set the fragment type bits in this headerpublic byte getFragType()
public void setFragTag(short tag)
tag
- the datagram tag to which this fragment belongspublic short getFragTag()
public void setFragSize(short size)
size
- total size of the original datagrampublic short getFragSize()
public byte getFragOff()
public void setFragOff(byte fragOff)
fragOff
- offset within the original datagrampublic boolean isFirstFrag()
public byte getProtocolFamily()
public void setProtocolFamily(byte protocolFamily)
protocolFamily
- the 8-bit protocol family numberpublic byte getProtocol()
public void setProtocol(byte protocol)
protocol
- the 8-bit protocol numberpublic void setProtocol(byte family, byte protocol)
family
- the protocol familyprotocol
- the 8-bit protocol numberpublic boolean isMeshed()
public void setMeshed(boolean meshed)
meshed
- true if there will be a mesh header in this packetpublic boolean isBCast()
public void setBCast(boolean bCast)
bCast
- true if this packet will have a LowPan broadcast headerpublic boolean isFragged()
public void setFragged(boolean fragged)
fragged
- true if there will be a fragmentation headerpublic long getRPSourceAddress()
public RadioPacket getRadioPacket()
public void setRPDestinationAddress(long addr)
addr
- the destination addresspublic void setRPSourceAddress(long addr)
addr
- source address for this radio packetpublic int getPayloadSize()
public void setPayloadSize(int payloadSize)
payloadSize
- number of bytes that are payloadpublic int getHeaderLength()
public boolean isExtendedProtocol()
public void setExtendedProtocol(boolean extendedProtocol)
extendedProtocol
- true if this is a SPOT protocol numberpublic int getLppPayloadOffset()
public String toString()
toString
in class Object
|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |