DBusHandlerResult a2dp_event_filter(DBusMessage *msg, JNIEnv *env) { DBusError err; if (!nat) { LOGV("... skipping %s\n", __FUNCTION__); LOGV("... ignored\n"); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } dbus_error_init(&err); if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_SIGNAL) { return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED; if (dbus_message_is_signal(msg, "org.bluez.AudioSink", "PropertyChanged")) { jobjectArray str_array = parse_property_change(env, msg, (Properties *)&sink_properties, sizeof(sink_properties) / sizeof(Properties)); const char *c_path = dbus_message_get_path(msg); jstring path = env->NewStringUTF(c_path); env->CallVoidMethod(nat->me, method_onSinkPropertyChanged, path, str_array); env->DeleteLocalRef(path); result = DBUS_HANDLER_RESULT_HANDLED; return result; } else if (dbus_message_is_signal(msg, "org.bluez.Control", "GetPlayStatus")) { const char *c_path = dbus_message_get_path(msg); jstring path = env->NewStringUTF(c_path); env->CallVoidMethod(nat->me, method_onGetPlayStatusRequest, path); env->DeleteLocalRef(path); result = DBUS_HANDLER_RESULT_HANDLED; return result; }else { LOGV("... ignored"); } if (env->ExceptionCheck()) { LOGE("VM Exception occurred while handling %s.%s (%s) in %s," " leaving for VM", dbus_message_get_interface(msg), dbus_message_get_member(msg), dbus_message_get_path(msg), __FUNCTION__); } return result; }
jobjectArray parse_remote_characteristic_property_change(JNIEnv *env, DBusMessage *msg) { return parse_property_change(env, msg, (Properties *) &characteristic_properties, sizeof(characteristic_properties) / sizeof(Properties)); }