summaryrefslogtreecommitdiffstats
path: root/core/jni/android_bluetooth_common.h
diff options
context:
space:
mode:
authorRobert Greenwalt <>2009-04-02 22:41:08 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-04-02 22:41:08 -0700
commit28d139fa953c0b3bf2c66d92587e5287ec4dd5ab (patch)
tree86a1b99f94c796e770240d585324205389314f11 /core/jni/android_bluetooth_common.h
parent460ae0c910e46f6aeb48316f8745be810f68b5a4 (diff)
downloadframeworks_base-28d139fa953c0b3bf2c66d92587e5287ec4dd5ab.zip
frameworks_base-28d139fa953c0b3bf2c66d92587e5287ec4dd5ab.tar.gz
frameworks_base-28d139fa953c0b3bf2c66d92587e5287ec4dd5ab.tar.bz2
AI 144392: am: CL 144241 Stop polling dbus.
Original author: rgreenwalt Automated import of CL 144392
Diffstat (limited to 'core/jni/android_bluetooth_common.h')
-rw-r--r--core/jni/android_bluetooth_common.h41
1 files changed, 25 insertions, 16 deletions
diff --git a/core/jni/android_bluetooth_common.h b/core/jni/android_bluetooth_common.h
index c30ba22..69092dd 100644
--- a/core/jni/android_bluetooth_common.h
+++ b/core/jni/android_bluetooth_common.h
@@ -24,7 +24,9 @@
#include "utils/Log.h"
#include <errno.h>
+#include <pthread.h>
#include <stdint.h>
+#include <sys/poll.h>
#ifdef HAVE_BLUETOOTH
#include <dbus/dbus.h>
@@ -45,6 +47,9 @@ namespace android {
#define BTADDR_SIZE 18 // size of BT address character array (including null)
+// size of the dbus event loops pollfd structure, hopefully never to be grown
+#define DEFAULT_INITIAL_POLLFD_COUNT 8
+
jfieldID get_field(JNIEnv *env,
jclass clazz,
const char *member,
@@ -63,29 +68,33 @@ jfieldID get_field(JNIEnv *env,
struct event_loop_native_data_t {
DBusConnection *conn;
- /* These variables are set in waitForAndDispatchEventNative() and are
- valid only within the scope of this function. At any other time, they
- are NULL. */
+
+ /* protects the thread */
+ pthread_mutex_t thread_mutex;
+ pthread_t thread;
+ /* our comms socket */
+ /* mem for the list of sockets to listen to */
+ struct pollfd *pollData;
+ int pollMemberCount;
+ int pollDataSize;
+ /* mem for matching set of dbus watch ptrs */
+ DBusWatch **watchData;
+ /* pair of sockets for event loop control, Reader and Writer */
+ int controlFdR;
+ int controlFdW;
+ /* our vm and env Version for future env generation */
+ JavaVM *vm;
+ int envVer;
+ /* reference to our java self */
jobject me;
- JNIEnv *env;
};
-dbus_bool_t dbus_func_args_async_valist(JNIEnv *env,
- DBusConnection *conn,
- int timeout_ms,
- void (*reply)(DBusMessage *, void *),
- void *user,
- const char *path,
- const char *ifc,
- const char *func,
- int first_arg_type,
- va_list args);
-
dbus_bool_t dbus_func_args_async(JNIEnv *env,
DBusConnection *conn,
int timeout_ms,
- void (*reply)(DBusMessage *, void *),
+ void (*reply)(DBusMessage *, void *, void *),
void *user,
+ void *nat,
const char *path,
const char *ifc,
const char *func,