Class Info |
|---|
public class MessageHandler extends Object 目标消息的回调处理类。在目标消息发现、目标消息丢失及目标消息关联设备的蓝牙信号发生变化或距离发生变化时触发。 |
Qualifier and Type | Method Name and Description |
|---|---|
void | onBleSignalChanged(Message message, BleSignal bleSignal) 当第一次扫描到Beacon设备时或者检测到扫描到Beacon设备的信号强度等级发生变化(RSSI变化超过10dbm)时此回调函数会被调用。 |
void | onDistanceChanged(Message message, Distance distance) 当第一次扫描到Beacon设备时或者检测到扫描到Beacon设备的距离发生变化(超过设定精度,如:1米)时此回调函数会被调用。 |
void | 收到消息后调用此方法。第一次收到消息,或者消息丢失(onLost)后再次被发现,都可以调用此方法。 |
void | 消息丢失后此回调函数会被调用。 |
Parameters
Name | Description |
|---|---|
message | 已发布消息对象。 |
bleSignal | BLE信号,包含RSSI和TxPower。 |
Parameters
Name | Description |
|---|---|
message | 已发布消息对象。 |
distance | 更新的距离估算值。 |
Parameters
Name | Description |
|---|---|
message | 已发布消息对象。 |
Method |
|---|
public void onLost(Message message) 消息丢失后此回调函数会被调用。 此方法目前最适合用于BLE beacon消息,其他消息类型可能调用不及时;此方法不会被重复调用,除非收到消息后又丢失。 |
Parameters
Name | Description |
|---|---|
message | 消息。 |