summaryrefslogtreecommitdiffstats
path: root/core/jni/android_server_BluetoothEventLoop.cpp
diff options
context:
space:
mode:
authorJaikumar Ganesh <jaikumar@google.com>2010-09-13 14:57:59 -0700
committerJaikumar Ganesh <jaikumar@google.com>2010-09-13 14:57:59 -0700
commit20c8f47330e7d4f5f191264f0d7ca67f6532adc2 (patch)
tree9e822ed87448a58738f1144c8b6627b3257e6d96 /core/jni/android_server_BluetoothEventLoop.cpp
parentb6b81f5f39f5ff5b8530717b4c015ef31d43e5d4 (diff)
parent0522f5e9b7dac0dc0229c9ddb07e7e5482846b1a (diff)
downloadframeworks_base-20c8f47330e7d4f5f191264f0d7ca67f6532adc2.zip
frameworks_base-20c8f47330e7d4f5f191264f0d7ca67f6532adc2.tar.gz
frameworks_base-20c8f47330e7d4f5f191264f0d7ca67f6532adc2.tar.bz2
resolved conflicts for merge of 0522f5e9 to master
Change-Id: Ie0a7ece33dced1042948087053e49665f6235fc2
Diffstat (limited to 'core/jni/android_server_BluetoothEventLoop.cpp')
-rw-r--r--core/jni/android_server_BluetoothEventLoop.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/core/jni/android_server_BluetoothEventLoop.cpp b/core/jni/android_server_BluetoothEventLoop.cpp
index 1307ec3..459458b 100644
--- a/core/jni/android_server_BluetoothEventLoop.cpp
+++ b/core/jni/android_server_BluetoothEventLoop.cpp
@@ -63,6 +63,8 @@ static jmethodID method_onRequestPasskey;
static jmethodID method_onRequestPasskeyConfirmation;
static jmethodID method_onRequestPairingConsent;
static jmethodID method_onDisplayPasskey;
+static jmethodID method_onRequestOobData;
+static jmethodID method_onAgentOutOfBandDataAvailable;
static jmethodID method_onAgentAuthorize;
static jmethodID method_onAgentCancel;
@@ -116,6 +118,8 @@ static void classInitNative(JNIEnv* env, jclass clazz) {
method_onAgentAuthorize = env->GetMethodID(clazz, "onAgentAuthorize",
"(Ljava/lang/String;Ljava/lang/String;)Z");
+ method_onAgentOutOfBandDataAvailable = env->GetMethodID(clazz, "onAgentOutOfBandDataAvailable",
+ "(Ljava/lang/String;)Z");
method_onAgentCancel = env->GetMethodID(clazz, "onAgentCancel", "()V");
method_onRequestPinCode = env->GetMethodID(clazz, "onRequestPinCode",
"(Ljava/lang/String;I)V");
@@ -135,6 +139,8 @@ static void classInitNative(JNIEnv* env, jclass clazz) {
"(Ljava/lang/String;[Ljava/lang/String;)V");
method_onPanDeviceConnectionResult = env->GetMethodID(clazz, "onPanDeviceConnectionResult",
"(Ljava/lang/String;Z)V");
+ method_onRequestOobData = env->GetMethodID(clazz, "onRequestOobData",
+ "(Ljava/lang/String;I)V");
field_mNativeData = env->GetFieldID(clazz, "mNativeData", "I");
#endif
@@ -345,6 +351,7 @@ static int register_agent(native_data_t *nat,
{
DBusMessage *msg, *reply;
DBusError err;
+ bool oob = TRUE;
if (!dbus_connection_register_object_path(nat->conn, agent_path,
&agent_vtable, nat)) {
@@ -366,6 +373,7 @@ static int register_agent(native_data_t *nat,
}
dbus_message_append_args(msg, DBUS_TYPE_OBJECT_PATH, &agent_path,
DBUS_TYPE_STRING, &capabilities,
+ DBUS_TYPE_BOOLEAN, &oob,
DBUS_TYPE_INVALID);
dbus_error_init(&err);
@@ -1056,6 +1064,43 @@ DBusHandlerResult agent_event_filter(DBusConnection *conn,
}
goto success;
} else if (dbus_message_is_method_call(msg,
+ "org.bluez.Agent", "OutOfBandAvailable")) {
+ char *object_path;
+ if (!dbus_message_get_args(msg, NULL,
+ DBUS_TYPE_OBJECT_PATH, &object_path,
+ DBUS_TYPE_INVALID)) {
+ LOGE("%s: Invalid arguments for OutOfBandData available() method", __FUNCTION__);
+ goto failure;
+ }
+
+ LOGV("... object_path = %s", object_path);
+
+ bool available =
+ env->CallBooleanMethod(nat->me, method_onAgentOutOfBandDataAvailable,
+ env->NewStringUTF(object_path));
+
+
+ // reply
+ if (available) {
+ DBusMessage *reply = dbus_message_new_method_return(msg);
+ if (!reply) {
+ LOGE("%s: Cannot create message reply\n", __FUNCTION__);
+ goto failure;
+ }
+ dbus_connection_send(nat->conn, reply, NULL);
+ dbus_message_unref(reply);
+ } else {
+ DBusMessage *reply = dbus_message_new_error(msg,
+ "org.bluez.Error.DoesNotExist", "OutofBand data not available");
+ if (!reply) {
+ LOGE("%s: Cannot create message reply\n", __FUNCTION__);
+ goto failure;
+ }
+ dbus_connection_send(nat->conn, reply, NULL);
+ dbus_message_unref(reply);
+ }
+ goto success;
+ } else if (dbus_message_is_method_call(msg,
"org.bluez.Agent", "RequestPinCode")) {
char *object_path;
if (!dbus_message_get_args(msg, NULL,
@@ -1086,6 +1131,21 @@ DBusHandlerResult agent_event_filter(DBusConnection *conn,
int(msg));
goto success;
} else if (dbus_message_is_method_call(msg,
+ "org.bluez.Agent", "RequestOobData")) {
+ char *object_path;
+ if (!dbus_message_get_args(msg, NULL,
+ DBUS_TYPE_OBJECT_PATH, &object_path,
+ DBUS_TYPE_INVALID)) {
+ LOGE("%s: Invalid arguments for RequestOobData() method", __FUNCTION__);
+ goto failure;
+ }
+
+ dbus_message_ref(msg); // increment refcount because we pass to java
+ env->CallVoidMethod(nat->me, method_onRequestOobData,
+ env->NewStringUTF(object_path),
+ int(msg));
+ goto success;
+ } else if (dbus_message_is_method_call(msg,
"org.bluez.Agent", "DisplayPasskey")) {
char *object_path;
uint32_t passkey;