add Orange Firmware/Hardware Version
This commit is contained in:
parent
b57ca6f94c
commit
1d01a8ecd5
4 changed files with 44 additions and 3 deletions
|
@ -92,6 +92,17 @@ public class RileyLinkBLE {
|
|||
if (radioResponseCountNotified != null) {
|
||||
radioResponseCountNotified.run();
|
||||
}
|
||||
|
||||
if (characteristic.getUuid().toString().equals(GattAttributes.UUID_NOTIF_CHARACTER.toString())) {
|
||||
final byte[] data = characteristic.getValue();
|
||||
int first = 0xff & data[0];
|
||||
aapsLogger.info(LTag.PUMPBTCOMM,
|
||||
"onCharacteristicChanged " + ByteUtil.shortHexString(characteristic.getValue()) + "=====" + first);
|
||||
String fv = data[3] + "." + data[4];
|
||||
String hv = data[5] + "." + data[6];
|
||||
rileyLinkServiceData.versionOrangeFV = fv;
|
||||
rileyLinkServiceData.versionOrangeHV = hv;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -242,6 +253,9 @@ public class RileyLinkBLE {
|
|||
if (gattDebugEnabled) {
|
||||
debugService(service, 0);
|
||||
}
|
||||
if (GattAttributes.isOrange(uuidService)) {
|
||||
rileyLinkServiceData.isOrange = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (gattDebugEnabled) {
|
||||
|
@ -369,9 +383,21 @@ public class RileyLinkBLE {
|
|||
aapsLogger.error(LTag.PUMPBTCOMM, "Error setting response count notification");
|
||||
return false;
|
||||
}
|
||||
if(rileyLinkServiceData.isOrange){
|
||||
enableNotificationsOrange();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean enableNotificationsOrange() {
|
||||
aapsLogger.error(LTag.PUMPBTCOMM, "enableNotificationsORG");
|
||||
BLECommOperationResult result = setNotification_blocking(GattAttributes.UUID_NOTIF_SERVICE, //
|
||||
GattAttributes.UUID_NOTIF_CHARACTER);
|
||||
if (result.resultCode != BLECommOperationResult.RESULT_SUCCESS) {
|
||||
aapsLogger.error(LTag.PUMPBTCOMM, "Error setting response count notification");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
String macAddress;
|
||||
|
||||
public void findRileyLink(String RileyLinkAddress) {
|
||||
|
|
|
@ -29,6 +29,9 @@ public class GattAttributes {
|
|||
public static String CHARA_RADIO_CUSTOM_NAME = "d93b2af0-1e28-11e4-8c21-0800200c9a66";
|
||||
public static String CHARA_RADIO_VERSION = "30d99dc9-7c91-4295-a051-0a104d238cf2";
|
||||
public static String CHARA_RADIO_LED_MODE = "c6d84241-f1a7-4f9c-a25f-fce16732f14e";
|
||||
//Orange Radio Service
|
||||
public static UUID UUID_NOTIF_SERVICE = UUID.fromString("6e400001-b5a3-f393-e0a9-e50e24dcca9e");
|
||||
public static UUID UUID_NOTIF_CHARACTER = UUID.fromString("6e400003-b5a3-f393-e0a9-e50e24dcca9e");
|
||||
|
||||
private static final Map<String, String> attributes;
|
||||
private static final Map<String, String> attributesRileyLinkSpecific;
|
||||
|
@ -83,5 +86,8 @@ public class GattAttributes {
|
|||
public static boolean isRileyLink(UUID uuid) {
|
||||
return attributesRileyLinkSpecific.containsKey(uuid.toString());
|
||||
}
|
||||
public static boolean isOrange(UUID uuid) {
|
||||
return UUID_NOTIF_SERVICE.equals(uuid.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -107,8 +107,14 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
|
|||
RileyLinkError rileyLinkError = rileyLinkServiceData.rileyLinkError;
|
||||
this.connectionError.setText(rileyLinkError == null ? PLACEHOLDER : resourceHelper.gs(rileyLinkError.getResourceId(targetDevice)));
|
||||
|
||||
this.firmwareVersion.setText(resourceHelper.gs(R.string.rileylink_firmware_version_value,
|
||||
Optional.ofNullable(rileyLinkServiceData.versionBLE113).orElse(PLACEHOLDER), Optional.ofNullable(rileyLinkServiceData.versionCC110).orElse(PLACEHOLDER)));
|
||||
|
||||
if(rileyLinkServiceData.isOrange){
|
||||
this.firmwareVersion.setText("FV:"+Optional.ofNullable(rileyLinkServiceData.versionOrangeFV).orElse(PLACEHOLDER)+"\nHV:"+Optional.ofNullable(rileyLinkServiceData.versionOrangeHV).orElse(PLACEHOLDER));
|
||||
}else{
|
||||
this.firmwareVersion.setText(resourceHelper.gs(R.string.rileylink_firmware_version_value,
|
||||
Optional.ofNullable(rileyLinkServiceData.versionBLE113).orElse(PLACEHOLDER), Optional.ofNullable(rileyLinkServiceData.versionCC110).orElse(PLACEHOLDER)));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
RileyLinkPumpDevice rileyLinkPumpDevice = (RileyLinkPumpDevice) activePlugin.getActivePump();
|
||||
|
|
|
@ -48,6 +48,9 @@ public class RileyLinkServiceData {
|
|||
public String versionBLE113;
|
||||
// radio version
|
||||
public String versionCC110;
|
||||
public boolean isOrange;
|
||||
public String versionOrangeFV;
|
||||
public String versionOrangeHV;
|
||||
|
||||
public RileyLinkTargetDevice targetDevice;
|
||||
|
||||
|
|
Loading…
Reference in a new issue