summaryrefslogtreecommitdiffstats
path: root/src/com/android/bluetooth/hid
diff options
context:
space:
mode:
authorMike J. Chen <mjchen@google.com>2014-03-04 17:24:54 -0800
committerMike J. Chen <mjchen@google.com>2014-03-04 17:25:53 -0800
commit3a04c35ba5f723ee4a6e1f1c37514691ebd1447d (patch)
tree1701d232541692717a39cf6a98812fad7e9e8502 /src/com/android/bluetooth/hid
parent871bee0d1f380f2c04a9c02d03704f5f7407ef38 (diff)
downloadandroid_packages_apps_Bluetooth-3a04c35ba5f723ee4a6e1f1c37514691ebd1447d.tar.gz
android_packages_apps_Bluetooth-3a04c35ba5f723ee4a6e1f1c37514691ebd1447d.tar.bz2
android_packages_apps_Bluetooth-3a04c35ba5f723ee4a6e1f1c37514691ebd1447d.zip
Add handshake callback support
Change-Id: I7619e6e2ac3589ffa5e0b70e4b28e536c886ce02 Signed-off-by: Mike J. Chen <mjchen@google.com>
Diffstat (limited to 'src/com/android/bluetooth/hid')
-rwxr-xr-xsrc/com/android/bluetooth/hid/HidService.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/com/android/bluetooth/hid/HidService.java b/src/com/android/bluetooth/hid/HidService.java
index 77a3065fe..893054a8e 100755
--- a/src/com/android/bluetooth/hid/HidService.java
+++ b/src/com/android/bluetooth/hid/HidService.java
@@ -67,6 +67,7 @@ public class HidService extends ProfileService {
private static final int MESSAGE_SET_REPORT = 10;
private static final int MESSAGE_SEND_DATA = 11;
private static final int MESSAGE_ON_VIRTUAL_UNPLUG = 12;
+ private static final int MESSAGE_ON_HANDSHAKE = 13;
static {
classInitNative();
@@ -249,6 +250,13 @@ public class HidService extends ProfileService {
broadcastReport(device, report, bufferSize);
}
break;
+ case MESSAGE_ON_HANDSHAKE:
+ {
+ BluetoothDevice device = getDevice((byte[])msg.obj);
+ int status = msg.arg1;
+ broadcastHandshake(device, status);
+ }
+ break;
case MESSAGE_SET_REPORT:
{
BluetoothDevice device = (BluetoothDevice) msg.obj;
@@ -564,6 +572,13 @@ public class HidService extends ProfileService {
mHandler.sendMessage(msg);
}
+ private void onHandshake(byte[] address, int status) {
+ Message msg = mHandler.obtainMessage(MESSAGE_ON_HANDSHAKE);
+ msg.obj = address;
+ msg.arg1 = status;
+ mHandler.sendMessage(msg);
+ }
+
private void onVirtualUnplug(byte[] address, int status) {
Message msg = mHandler.obtainMessage(MESSAGE_ON_VIRTUAL_UNPLUG);
msg.obj = address;
@@ -603,6 +618,14 @@ public class HidService extends ProfileService {
sendBroadcast(intent, BLUETOOTH_PERM);
}
+ private void broadcastHandshake(BluetoothDevice device, int status) {
+ Intent intent = new Intent(BluetoothInputDevice.ACTION_HANDSHAKE);
+ intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
+ intent.putExtra(BluetoothInputDevice.EXTRA_STATUS, status);
+ intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
+ sendBroadcast(intent, BLUETOOTH_PERM);
+ }
+
private void broadcastProtocolMode(BluetoothDevice device, int protocolMode) {
Intent intent = new Intent(BluetoothInputDevice.ACTION_PROTOCOL_MODE_CHANGED);
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);