mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-02-04 14:07:32 +01:00
Trim strings coming from DeviceInfoProfile (BLE).
On the Bip strings have trailing zeroes. Putting this in the Database results in a "BLOB"
This commit is contained in:
parent
be147913c3
commit
e839a2c6a3
@ -110,49 +110,49 @@ public class DeviceInfoProfile<T extends AbstractBTLEDeviceSupport> extends Abst
|
|||||||
|
|
||||||
|
|
||||||
private void handleManufacturerName(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
private void handleManufacturerName(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
||||||
String name = characteristic.getStringValue(0);
|
String name = characteristic.getStringValue(0).trim();
|
||||||
deviceInfo.setManufacturerName(name);
|
deviceInfo.setManufacturerName(name);
|
||||||
notify(createIntent(deviceInfo));
|
notify(createIntent(deviceInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleModelNumber(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
private void handleModelNumber(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
||||||
String modelNumber = characteristic.getStringValue(0);
|
String modelNumber = characteristic.getStringValue(0).trim();
|
||||||
deviceInfo.setModelNumber(modelNumber);
|
deviceInfo.setModelNumber(modelNumber);
|
||||||
notify(createIntent(deviceInfo));
|
notify(createIntent(deviceInfo));
|
||||||
}
|
}
|
||||||
private void handleSerialNumber(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
private void handleSerialNumber(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
||||||
String serialNumber = characteristic.getStringValue(0);
|
String serialNumber = characteristic.getStringValue(0).trim();
|
||||||
deviceInfo.setSerialNumber(serialNumber);
|
deviceInfo.setSerialNumber(serialNumber);
|
||||||
notify(createIntent(deviceInfo));
|
notify(createIntent(deviceInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleHardwareRevision(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
private void handleHardwareRevision(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
||||||
String hardwareRevision = characteristic.getStringValue(0);
|
String hardwareRevision = characteristic.getStringValue(0).trim();
|
||||||
deviceInfo.setHardwareRevision(hardwareRevision);
|
deviceInfo.setHardwareRevision(hardwareRevision);
|
||||||
notify(createIntent(deviceInfo));
|
notify(createIntent(deviceInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleFirmwareRevision(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
private void handleFirmwareRevision(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
||||||
String firmwareRevision = characteristic.getStringValue(0);
|
String firmwareRevision = characteristic.getStringValue(0).trim();
|
||||||
deviceInfo.setFirmwareRevision(firmwareRevision);
|
deviceInfo.setFirmwareRevision(firmwareRevision);
|
||||||
notify(createIntent(deviceInfo));
|
notify(createIntent(deviceInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleSoftwareRevision(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
private void handleSoftwareRevision(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
||||||
String softwareRevision = characteristic.getStringValue(0);
|
String softwareRevision = characteristic.getStringValue(0).trim();
|
||||||
deviceInfo.setSoftwareRevision(softwareRevision);
|
deviceInfo.setSoftwareRevision(softwareRevision);
|
||||||
notify(createIntent(deviceInfo));
|
notify(createIntent(deviceInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleSystemId(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
private void handleSystemId(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
||||||
String systemId = characteristic.getStringValue(0);
|
String systemId = characteristic.getStringValue(0).trim();
|
||||||
deviceInfo.setSystemId(systemId);
|
deviceInfo.setSystemId(systemId);
|
||||||
notify(createIntent(deviceInfo));
|
notify(createIntent(deviceInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleRegulatoryCertificationData(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
private void handleRegulatoryCertificationData(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
||||||
// TODO: regulatory certification data list not supported yet
|
// TODO: regulatory certification data list not supported yet
|
||||||
// String regulatoryCertificationData = characteristic.getStringValue(0);
|
// String regulatoryCertificationData = characteristic.getStringValue(0).trim();
|
||||||
// deviceInfo.setRegulatoryCertificationDataList(regulatoryCertificationData);
|
// deviceInfo.setRegulatoryCertificationDataList(regulatoryCertificationData);
|
||||||
// notify(createIntent(deviceInfo));
|
// notify(createIntent(deviceInfo));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user