Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
|
Class maps a GATT command and optionally its asynchronous response to a synchronous atomic operation. More...
Classes | |
interface | DataCallback |
Public Member Functions | |
BTGattCmd (final BTDevice dev_, final String name_, final String service_uuid_, final String cmd_uuid_) | |
Constructor for commands without response. More... | |
BTGattCmd (final BTDevice dev_, final String name_, final String service_uuid_, final String cmd_uuid_, final String rsp_uuid_) | |
Constructor for commands with notification or indication response. More... | |
void | close () |
Close this command instance, usually called at destruction. More... | |
synchronized HCIStatusCode | close0 () |
Close this command instance, usually called at destruction. More... | |
void | finalize () |
String | getCommandUUID () |
Return command's BTGattChar value jau::uuid_t to write command, never null. More... | |
String | getName () |
Return name, representing the command. More... | |
byte[] | getResponse () |
Returns the read-only response data object for configured commands with response notification or indication. More... | |
String | getResponseUUID () |
Return command's optional BTGattChar value jau::uuid_t for the notification or indication response, may be null. More... | |
String | getServiceUUID () |
Return command's BTGattService jau::uuid_t, may be null. More... | |
boolean | hasResponseSet () |
Return true if a notification or indication response has been set via constructor, otherwise false. More... | |
synchronized boolean | isResolved () |
Query whether all UUIDs of this commands have been resolved. More... | |
synchronized HCIStatusCode | send (final boolean prefNoAck, final byte[] cmd_data, final int timeoutMS) |
Send the command to the remote BTDevice. More... | |
synchronized HCIStatusCode | sendOnly (final boolean prefNoAck, final byte[] cmd_data) |
Send the command to the remote BTDevice, only. More... | |
void | setDataCallback (final DataCallback dcb) |
void | setResponseMinSize (final int v) |
void | setVerbose (final boolean v) |
Set verbosity for UUID resolution. More... | |
String | toString () |
Class maps a GATT command and optionally its asynchronous response to a synchronous atomic operation.
The GATT command is issued by writing the associated GATT characteristic value via BTGattChar.writeValueNoResp() or BTGattChar.writeValue().
Its optional asynchronous characteristic value notification or indication response is awaited and collected after command issuance.
If a response jau.uuid_t is given, notification or indication will be enabled at first send() command and disabled at close() or destruction.
Definition at line 48 of file BTGattCmd.java.
org.direct_bt.BTGattCmd.BTGattCmd | ( | final BTDevice | dev_, |
final String | name_, | ||
final String | service_uuid_, | ||
final String | cmd_uuid_, | ||
final String | rsp_uuid_ | ||
) |
Constructor for commands with notification or indication response.
dev_ | the remote BTDevice |
name_ | user given name, representing the command |
service_uuid_ | command's BTGattService jau.uuid_t, may be null for using a less efficient BTGattChar lookup |
cmd_uuid_ | command's BTGattChar value jau.uuid_t to write the command |
rsp_uuid_ | command's BTGattChar value jau.uuid_t for the notification or indication response. |
Definition at line 253 of file BTGattCmd.java.
org.direct_bt.BTGattCmd.BTGattCmd | ( | final BTDevice | dev_, |
final String | name_, | ||
final String | service_uuid_, | ||
final String | cmd_uuid_ | ||
) |
Constructor for commands without response.
dev_ | the remote BTDevice |
name_ | user given name, representing the command |
service_uuid_ | command's BTGattService jau.uuid_t, may be null for using a less efficient BTGattChar lookup |
cmd_uuid_ | command's BTGattChar value jau.uuid_t to write the command |
Definition at line 279 of file BTGattCmd.java.
void org.direct_bt.BTGattCmd.close | ( | ) |
Close this command instance, usually called at destruction.
If a response jau.uuid_t has been given, notification or indication will be disabled.
Definition at line 202 of file BTGattCmd.java.
synchronized HCIStatusCode org.direct_bt.BTGattCmd.close0 | ( | ) |
Close this command instance, usually called at destruction.
If a response jau.uuid_t has been given, notification or indication will be disabled.
Definition at line 211 of file BTGattCmd.java.
void org.direct_bt.BTGattCmd.finalize | ( | ) |
Definition at line 297 of file BTGattCmd.java.
void org.direct_bt.BTGattCmd.setResponseMinSize | ( | final int | v | ) |
Definition at line 299 of file BTGattCmd.java.
void org.direct_bt.BTGattCmd.setDataCallback | ( | final DataCallback | dcb | ) |
Definition at line 300 of file BTGattCmd.java.
String org.direct_bt.BTGattCmd.getName | ( | ) |
Return name, representing the command.
Definition at line 303 of file BTGattCmd.java.
String org.direct_bt.BTGattCmd.getServiceUUID | ( | ) |
Return command's BTGattService jau::uuid_t, may be null.
Definition at line 306 of file BTGattCmd.java.
String org.direct_bt.BTGattCmd.getCommandUUID | ( | ) |
Return command's BTGattChar value jau::uuid_t to write command, never null.
Definition at line 309 of file BTGattCmd.java.
boolean org.direct_bt.BTGattCmd.hasResponseSet | ( | ) |
Return true if a notification or indication response has been set via constructor, otherwise false.
Definition at line 312 of file BTGattCmd.java.
String org.direct_bt.BTGattCmd.getResponseUUID | ( | ) |
Return command's optional BTGattChar value jau::uuid_t for the notification or indication response, may be null.
Definition at line 315 of file BTGattCmd.java.
void org.direct_bt.BTGattCmd.setVerbose | ( | final boolean | v | ) |
Set verbosity for UUID resolution.
Definition at line 318 of file BTGattCmd.java.
byte[] org.direct_bt.BTGattCmd.getResponse | ( | ) |
Returns the read-only response data object for configured commands with response notification or indication.
jau.TROOctets.size() matches the size of last received command response or zero.
Definition at line 327 of file BTGattCmd.java.
synchronized boolean org.direct_bt.BTGattCmd.isResolved | ( | ) |
Query whether all UUIDs of this commands have been resolved.
In case no command has been issued via send() yet, the UUIDs will be resolved with this call.
Definition at line 341 of file BTGattCmd.java.
synchronized HCIStatusCode org.direct_bt.BTGattCmd.send | ( | final boolean | prefNoAck, |
final byte[] | cmd_data, | ||
final int | timeoutMS | ||
) |
Send the command to the remote BTDevice.
If a notification or indication result jau.uuid_t has been set via constructor, it will be awaited and can be retrieved via getResponse()
after command returns.
prefNoAck | pass true to prefer command write without acknowledge, otherwise use with-ack if available |
cmd_data | raw command octets |
timeoutMS | timeout in milliseconds. Defaults to 10 seconds limited blocking for the response to become available, if any. |
Definition at line 361 of file BTGattCmd.java.
synchronized HCIStatusCode org.direct_bt.BTGattCmd.sendOnly | ( | final boolean | prefNoAck, |
final byte[] | cmd_data | ||
) |
Send the command to the remote BTDevice, only.
Regardless whether a notification or indication result jau::uuid_t has been set via constructor, this command will not wait for the response.
prefNoAck | pass true to prefer command write without acknowledge, otherwise use with-ack if available |
cmd_data | raw command octets |
Definition at line 376 of file BTGattCmd.java.
String org.direct_bt.BTGattCmd.toString | ( | ) |