public class ADStructure extends Object implements Serializable
This class represents an AD structure. The format of an AD structure is described in "11 ADVERTISING AND SCAN RESPONSE DATA FORMAT" in "Bluetooth Core Specification 4.2". The following is an excerpt from the document.
Each AD structure shall have a Length field of one octet, which contains the Length value, and a Data field of Length octets. The first octet of the Data field contains the AD type field. The content of the remaining Length - 1 octet in the Data field depends on the value of the AD type field and is called the AD data.
Constructor and Description |
---|
ADStructure()
Constructor to create an instance with length=0, type=0, and data=null.
|
ADStructure(int length,
int type,
byte[] data)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getData()
Get the AD data.
|
int |
getLength()
Get the length of the AD structure.
|
int |
getType()
Get the AD type.
|
void |
setData(byte[] data)
Set the AD data.
|
void |
setLength(int length)
Set the length of the AD structure.
|
void |
setType(int type)
Set the AD type.
|
String |
toString() |
public ADStructure()
public ADStructure(int length, int type, byte[] data)
length
- The length of the AD structure.type
- The AD type.data
- The AD data.public int getLength()
This method returns the value of the first octet of the AD structure.
public void setLength(int length)
length
- The length of the AD structure.public int getType()
The list of AD types are found at Generic Access Profile (GAP).
public void setType(int type)
type
- The AD type.public byte[] getData()
The content of the AD data depends on the AD type.
public void setData(byte[] data)
data
- The AD data.Copyright © 2016. All rights reserved.