summaryrefslogtreecommitdiffstats
path: root/core/jni/android_server_BluetoothService.cpp
diff options
context:
space:
mode:
authorJaikumar Ganesh <jaikumar@google.com>2010-06-04 10:23:03 -0700
committerJaikumar Ganesh <jaikumar@google.com>2010-06-17 13:49:25 -0700
commit545e6708adda6859932b55fd824794b1401f5318 (patch)
treece35056656b208a19aca1edc98864f35935d4edf /core/jni/android_server_BluetoothService.cpp
parent4e74ae3d5b27d917ea26d0929015f9fdc64af412 (diff)
downloadframeworks_base-545e6708adda6859932b55fd824794b1401f5318.zip
frameworks_base-545e6708adda6859932b55fd824794b1401f5318.tar.gz
frameworks_base-545e6708adda6859932b55fd824794b1401f5318.tar.bz2
HID profile.
Change-Id: I52e965a6537bce02c751ba26fe7b44dd03832510
Diffstat (limited to 'core/jni/android_server_BluetoothService.cpp')
-rw-r--r--core/jni/android_server_BluetoothService.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/core/jni/android_server_BluetoothService.cpp b/core/jni/android_server_BluetoothService.cpp
index 4420aca..a52a74c 100644
--- a/core/jni/android_server_BluetoothService.cpp
+++ b/core/jni/android_server_BluetoothService.cpp
@@ -16,6 +16,8 @@
#define DBUS_ADAPTER_IFACE BLUEZ_DBUS_BASE_IFC ".Adapter"
#define DBUS_DEVICE_IFACE BLUEZ_DBUS_BASE_IFC ".Device"
+#define DBUS_INPUT_IFACE BLUEZ_DBUS_BASE_IFC ".Input"
+
#define LOG_TAG "BluetoothService.cpp"
#include "android_bluetooth_common.h"
@@ -881,6 +883,43 @@ static jboolean setLinkTimeoutNative(JNIEnv *env, jobject object, jstring object
return JNI_FALSE;
}
+static jboolean connectInputDeviceNative(JNIEnv *env, jobject object, jstring path) {
+ LOGV(__FUNCTION__);
+#ifdef HAVE_BLUETOOTH
+ native_data_t *nat = get_native_data(env, object);
+ if (nat) {
+ const char *c_path = env->GetStringUTFChars(path, NULL);
+
+ bool ret = dbus_func_args_async(env, nat->conn, -1, NULL, NULL, nat,
+ c_path, DBUS_INPUT_IFACE, "Connect",
+ DBUS_TYPE_INVALID);
+
+ env->ReleaseStringUTFChars(path, c_path);
+ return ret ? JNI_TRUE : JNI_FALSE;
+ }
+#endif
+ return JNI_FALSE;
+}
+
+static jboolean disconnectInputDeviceNative(JNIEnv *env, jobject object,
+ jstring path) {
+ LOGV(__FUNCTION__);
+#ifdef HAVE_BLUETOOTH
+ native_data_t *nat = get_native_data(env, object);
+ if (nat) {
+ const char *c_path = env->GetStringUTFChars(path, NULL);
+
+ bool ret = dbus_func_args_async(env, nat->conn, -1, NULL, NULL, nat,
+ c_path, DBUS_INPUT_IFACE, "Disconnect",
+ DBUS_TYPE_INVALID);
+
+ env->ReleaseStringUTFChars(path, c_path);
+ return ret ? JNI_TRUE : JNI_FALSE;
+ }
+#endif
+ return JNI_FALSE;
+}
+
static JNINativeMethod sMethods[] = {
/* name, signature, funcPtr */
{"classInitNative", "()V", (void*)classInitNative},
@@ -926,6 +965,9 @@ static JNINativeMethod sMethods[] = {
{"addRfcommServiceRecordNative", "(Ljava/lang/String;JJS)I", (void *)addRfcommServiceRecordNative},
{"removeServiceRecordNative", "(I)Z", (void *)removeServiceRecordNative},
{"setLinkTimeoutNative", "(Ljava/lang/String;I)Z", (void *)setLinkTimeoutNative},
+ // HID functions
+ {"connectInputDeviceNative", "(Ljava/lang/String;)Z", (void *)connectInputDeviceNative},
+ {"disconnectInputDeviceNative", "(Ljava/lang/String;)Z", (void *)disconnectInputDeviceNative},
};
int register_android_server_BluetoothService(JNIEnv *env) {