public class AprilBeaconConnection
extends java.lang.Object
限定符和类型 | 类和说明 |
---|---|
static class |
AprilBeaconConnection.MyWriteCallback |
static interface |
AprilBeaconConnection.WriteCallback |
限定符和类型 | 字段和说明 |
---|---|
static java.lang.String |
ACTION_DATA_AVAILABLE |
static java.lang.String |
ACTION_GATT_CONNECTED |
static java.lang.String |
ACTION_GATT_DISCONNECTED |
static java.lang.String |
ACTION_GATT_SERVICES_DISCOVERED |
static java.lang.String |
DEVICE_DOES_NOT_SUPPORT_UART |
static java.lang.String |
EXTRA_DATA |
static java.lang.String |
EXTRA_DATA_L |
构造器和说明 |
---|
AprilBeaconConnection(Context context,
Beacon beacon) |
AprilBeaconConnection(Context context,
java.lang.String address) |
限定符和类型 | 方法和说明 |
---|---|
void |
close()
断开连接
|
void |
connectGattToWrite(AprilBeaconConnection.MyWriteCallback mWriteCallback,
java.lang.String password)
连接gatt并对特征值进行写操作
|
void |
enableACNotification()
开启加速度通知
|
void |
enableLightNotification()
开启光传感通知
|
boolean |
isConnected()
判断是否是连接状态
|
void |
turnOffCalu()
关闭三轴加速计
|
void |
turnOffLight()
关闭光线传感计
|
void |
turnOnCalu()
打开三轴加速计
|
void |
turnOnLight()
打开光线传感计
|
void |
writeAdvertisingInterval(int advertisingInterval)
设置写入广播频率
|
void |
writeMajor(int major)
设置写入major值
|
void |
writeMeasuredPower(int measuredPower)
设置写入measuredPower值
|
void |
writeMinor(int minor)
设置写入minor值
|
void |
writePassword(java.lang.String password)
设置写入新密码
|
void |
writeTxPower(int txPower)
设置写入发射功率
|
void |
writeUUID(java.lang.String uuid)
设置写入uuid值
|
public static final java.lang.String ACTION_GATT_CONNECTED
public static final java.lang.String ACTION_GATT_DISCONNECTED
public static final java.lang.String ACTION_GATT_SERVICES_DISCOVERED
public static final java.lang.String ACTION_DATA_AVAILABLE
public static final java.lang.String EXTRA_DATA
public static final java.lang.String EXTRA_DATA_L
public static final java.lang.String DEVICE_DOES_NOT_SUPPORT_UART
public AprilBeaconConnection(Context context, Beacon beacon)
public AprilBeaconConnection(Context context, java.lang.String address)
public void connectGattToWrite(AprilBeaconConnection.MyWriteCallback mWriteCallback, java.lang.String password)
writeCallback
- 连接gatt并进行写操作时的回调public void writeMajor(int major)
major
- 要写入的major值 值在0-65535之间public void writeMinor(int minor)
minor
- 要写入的minor值 值在0-65535之间public void writeMeasuredPower(int measuredPower)
measuredPower
- 要写入的measuredPower值 值在-256-0之间public void writeUUID(java.lang.String uuid)
uuid
- 要写入的uuid值public void writeAdvertisingInterval(int advertisingInterval)
advertisingInterval
- 要写入的广播频率 值在1-100之间 单位为100mspublic void writeTxPower(int txPower)
txPower
- 要写入的发射功率 值为0,1,2,3public void writePassword(java.lang.String password)
新密码为12位数字及字母组合
- public boolean isConnected()
public void close()
public void turnOnCalu()
public void turnOffCalu()
public void enableACNotification()
public void turnOnLight()
public void turnOffLight()
public void enableLightNotification()