sGattIf->client->read_characteristic(conn_id, handle, authReq);
}
+static void gattClientReadUsingCharacteristicUuidNative(
+ JNIEnv* env, jobject object, jint conn_id, jlong uuid_lsb, jlong uuid_msb,
+ jint s_handle, jint e_handle, jint authReq) {
+ if (!sGattIf) return;
+
+ bt_uuid_t uuid;
+ set_uuid(uuid.uu, uuid_msb, uuid_lsb);
+ sGattIf->client->read_using_characteristic_uuid(conn_id, &uuid, s_handle,
+ e_handle, authReq);
+}
+
static void gattClientReadDescriptorNative(JNIEnv* env, jobject object,
jint conn_id, jint handle,
jint authReq) {
{"gattClientGetGattDbNative", "(I)V", (void*)gattClientGetGattDbNative},
{"gattClientReadCharacteristicNative", "(III)V",
(void*)gattClientReadCharacteristicNative},
+ {"gattClientReadUsingCharacteristicUuidNative", "(IJJIII)V",
+ (void*)gattClientReadUsingCharacteristicUuidNative},
{"gattClientReadDescriptorNative", "(III)V",
(void*)gattClientReadDescriptorNative},
{"gattClientWriteCharacteristicNative", "(IIII[B)V",
return true;
}
+ boolean permissionCheck(UUID uuid) {
+ if (isRestrictedCharUuid(uuid) && (0 != checkCallingOrSelfPermission(BLUETOOTH_PRIVILEGED)))
+ return false;
+ else
+ return true;
+ }
+
boolean permissionCheck(int connId, int handle) {
List<BluetoothGattService> db = gattClientDatabases.get(connId);
if (db == null) return true;
service.readCharacteristic(clientIf, address, handle, authReq);
}
+ public void readUsingCharacteristicUuid(int clientIf, String address, ParcelUuid uuid,
+ int startHandle, int endHandle, int authReq) {
+ GattService service = getService();
+ if (service == null) return;
+ service.readUsingCharacteristicUuid(
+ clientIf, address, uuid.getUuid(), startHandle, endHandle, authReq);
+ }
+
public void writeCharacteristic(int clientIf, String address, int handle,
int writeType, int authReq, byte[] value) {
GattService service = getService();
gattClientReadCharacteristicNative(connId, handle, authReq);
}
+ void readUsingCharacteristicUuid(
+ int clientIf, String address, UUID uuid, int startHandle, int endHandle, int authReq) {
+ enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+
+ if (VDBG) Log.d(TAG, "readUsingCharacteristicUuid() - address=" + address);
+
+ Integer connId = mClientMap.connIdByAddress(clientIf, address);
+ if (connId == null) {
+ Log.e(TAG, "readUsingCharacteristicUuid() - No connection for " + address + "...");
+ return;
+ }
+
+ if (!permissionCheck(uuid)) {
+ Log.w(TAG, "readUsingCharacteristicUuid() - permission check failed!");
+ return;
+ }
+
+ gattClientReadUsingCharacteristicUuidNative(connId, uuid.getLeastSignificantBits(),
+ uuid.getMostSignificantBits(), startHandle, endHandle, authReq);
+ }
+
void writeCharacteristic(int clientIf, String address, int handle, int writeType,
int authReq, byte[] value) {
enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
private native void gattClientReadCharacteristicNative(int conn_id, int handle, int authReq);
+ private native void gattClientReadUsingCharacteristicUuidNative(
+ int conn_id, long uuid_msb, long uuid_lsb, int s_handle, int e_handle, int authReq);
+
private native void gattClientReadDescriptorNative(int conn_id, int handle, int authReq);
private native void gattClientWriteCharacteristicNative(int conn_id,