void notifyNativeReadCallback(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { if (nativeCallback != null) { nativeCallback.onCharacteristicRead(gatt, characteristic, status); } } }
@Override public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { RxBleLog.d("onCharacteristicRead characteristic=%s status=%d", characteristic.getUuid(), status); nativeCallbackDispatcher.notifyNativeReadCallback(gatt, characteristic, status); super.onCharacteristicRead(gatt, characteristic, status); if (readCharacteristicOutput.hasObservers() && !propagateErrorIfOccurred( readCharacteristicOutput, gatt, characteristic, status, BleGattOperationType.CHARACTERISTIC_READ )) { readCharacteristicOutput.valueRelay.accept(new ByteAssociation<>(characteristic.getUuid(), characteristic.getValue())); } }
@Override public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { super.onCharacteristicRead(gatt, characteristic, status); }
@Override public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { super.onCharacteristicRead(gatt, characteristic, status); Log.i("CharacteristicRead", characteristic.toString()); }
@Override public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { super.onCharacteristicRead(gatt, characteristic, status); mLogger.debug("On read call for characteristic: " + characteristic.getUuid().toString()); }
@Override public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { super.onCharacteristicRead(gatt, characteristic, status); mCurrentAction = null; execute(gatt); }
@Override public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { NeatleLogger.d("createCharacteristicRead"); BluetoothGattCallback target; synchronized (lock) { target = currentCallback; } target.onCharacteristicRead(gatt, characteristic, status); }
@Override public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { super.onCharacteristicRead(gatt, characteristic, status); byte[] data = characteristic.getValue(); parseData(data); }
@Override public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { super.onCharacteristicRead(gatt, characteristic, status); print("onCharacteristicRead:" + status); if (status == BluetoothGatt.GATT_SUCCESS) { print("GATT_Success"); } byte[] data = characteristic.getValue(); parseData(data); }
@Override public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { super.onCharacteristicRead(gatt, characteristic, status); if (mBluetoothListener != null){ ((BluetoothLEListener)mBluetoothListener).onReadData(characteristic); } }
@Override public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { super.onCharacteristicRead(gatt, characteristic, status); if (BluetoothGatt.GATT_SUCCESS == status) { this.onSuccess(characteristic); } else { this.onFail(status, "실패"); } }
@Override public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { super.onCharacteristicRead(gatt, characteristic, status); sendmsg("OnCharacteristicRead"); if (status == BluetoothGatt.GATT_SUCCESS) { byte[] characteristicValue = characteristic.getValue(); sendmsg("char is " + characteristicValue.toString()); } else if (status == BluetoothGatt.GATT_READ_NOT_PERMITTED) { sendmsg("No permitted to read a characteristic"); } else if (status == BluetoothGatt.GATT_FAILURE) { sendmsg("failed to read a characteristic"); } }
@Override public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { super.onCharacteristicRead(gatt, characteristic, status); if (BluetoothGatt.GATT_SUCCESS == status) { notifyWithResult(characteristic); } else { UUID serviceId = characteristic.getService().getUuid(); UUID characteristicId = characteristic.getUuid(); notifyWithFail(serviceId, characteristicId, "onCharacteristicRead fail"); } }
/** * generate 20byte of random data and notify it to the user * @param characteristic characteristics that we will read * @return */ @Implementation public boolean readCharacteristic(BluetoothGattCharacteristic characteristic){ if(userCallBack!=null) { characteristic.setValue(genRandomData()); userCallBack.onCharacteristicRead(bluetoothGatt, characteristic, BluetoothGatt.GATT_SUCCESS); return true; }else return true; }
/** * 主动读取通道当中的数据回调 * * @param gatt * @param characteristic * @param status */ @Override public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { super.onCharacteristicRead(gatt, characteristic, status); NotifyMessage notifyMessage = new NotifyMessage(); notifyMessage.setCode(CodeUtils.SERVICE_ONREAD); CharacteristicValues characteristicValues = new CharacteristicValues(characteristic.getStringValue(0), HexUtils.bytesToHexString(characteristic.getValue()), characteristic.getValue()); notifyMessage.setData(characteristicValues); notifyMessage.setTag(tag); EventManager.servicePost(notifyMessage); // switch (code) { // case CodeUtils.SERVICE_READ_DATA_BYTEARRAY: // notifyMessage.setData(characteristic.getValue()); // break; // case CodeUtils.SERVICE_READ_DATA_HEX2STR: // notifyMessage.setData(HexUtils.bytesToHexString(characteristic.getValue())); // break; // case CodeUtils.SERVICE_READ_DATA: // notifyMessage.setData(characteristic.getStringValue(0)); // break; // } }