public abstract static class ExchangeListener.ExchangeEvent extends Event
ExchangeListener
, this class should not be used directly as this is just a base class to statically tie together
IncomingListener.IncomingEvent
and OutgoingListener.OutgoingEvent
with a common API.Modifier and Type | Field and Description |
---|---|
static int |
NON_APPLICABLE_REQUEST_ID
|
static java.util.UUID |
NON_APPLICABLE_UUID
Value used in place of
null , either indicating that descUuid()
isn't used for the ExchangeListener.ExchangeEvent because target() is ExchangeListener.Target.CHARACTERISTIC . |
Modifier and Type | Method and Description |
---|---|
java.util.UUID |
charUuid()
The
UUID of the characteristic associated with this ExchangeListener.ExchangeEvent . |
byte[] |
data_received()
The data received from the client if
type() is ExchangeListener.Type.isWrite() , otherwise an empty byte array. |
java.util.UUID |
descUuid()
The
UUID of the descriptor associated with this ExchangeListener.ExchangeEvent . |
boolean |
isFor(java.lang.String macAddress) |
boolean |
isFor(java.util.UUID uuid) |
java.lang.String |
macAddress()
Returns the mac address of the client peripheral that we are exchanging data with.
|
android.bluetooth.BluetoothDevice |
nativeDevice()
Returns the native bluetooth device object representing the client making the request.
|
int |
offset()
The offset forwarded from the native stack.
|
int |
requestId()
The request id forwarded from the native stack.
|
boolean |
responseNeeded()
Dictates whether a response is needed.
|
BleServer |
server()
The
BleServer this ExchangeListener.ExchangeEvent is for. |
java.util.UUID |
serviceUuid()
The
UUID of the service associated with this ExchangeListener.ExchangeEvent . |
ExchangeListener.Target |
target()
The type of GATT object this
ExchangeListener.ExchangeEvent is for, characteristic or descriptor. |
ExchangeListener.Type |
type()
The type of operation, read or write.
|
public static final java.util.UUID NON_APPLICABLE_UUID
null
, either indicating that descUuid()
isn't used for the ExchangeListener.ExchangeEvent
because target()
is ExchangeListener.Target.CHARACTERISTIC
.public static final int NON_APPLICABLE_REQUEST_ID
public final BleServer server()
BleServer
this ExchangeListener.ExchangeEvent
is for.public final java.lang.String macAddress()
public final android.bluetooth.BluetoothDevice nativeDevice()
public final ExchangeListener.Type type()
public final ExchangeListener.Target target()
ExchangeListener.ExchangeEvent
is for, characteristic or descriptor.public final java.util.UUID serviceUuid()
UUID
of the service associated with this ExchangeListener.ExchangeEvent
.public final java.util.UUID charUuid()
UUID
of the characteristic associated with this ExchangeListener.ExchangeEvent
. This will always be
a valid UUID
, even if target()
is ExchangeListener.Target.DESCRIPTOR
.public final java.util.UUID descUuid()
UUID
of the descriptor associated with this ExchangeListener.ExchangeEvent
. If target()
is
ExchangeListener.Target.CHARACTERISTIC
then this will be referentially equal (i.e. you can use == to compare)
to NON_APPLICABLE_UUID
.public final byte[] data_received()
type()
is ExchangeListener.Type.isWrite()
, otherwise an empty byte array.
This is in contrast to OutgoingListener.OutgoingEvent.data_sent()
if
type()
is ExchangeListener.Type.isRead()
.public final int requestId()
BluetoothGattServerCallback
for explanation.
Not relevant if type()
ExchangeListener.Type.isNotificationOrIndication()
is true
.public final int offset()
BluetoothGattServerCallback
for explanation.
Not relevant if type()
ExchangeListener.Type.isNotificationOrIndication()
is true
.public final boolean responseNeeded()
type()
ExchangeListener.Type.isNotificationOrIndication()
is true
.public final boolean isFor(java.lang.String macAddress)
public final boolean isFor(java.util.UUID uuid)