mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-08-28 10:05:35 +02:00
HPlus: Handles missing phone number. Fixes #675
This commit is contained in:
parent
9f309df84d
commit
d73d4b3a13
@ -667,14 +667,6 @@ public class HPlusSupport extends AbstractBTLEDeviceSupport {
|
||||
|
||||
private void showIncomingCall(String name, String rawNumber) {
|
||||
try {
|
||||
StringBuilder number = new StringBuilder();
|
||||
|
||||
//Clean up number as the device only accepts digits
|
||||
for (char c : rawNumber.toCharArray()) {
|
||||
if (Character.isDigit(c)) {
|
||||
number.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
TransactionBuilder builder = performInitialized("incomingCall");
|
||||
|
||||
@ -684,11 +676,10 @@ public class HPlusSupport extends AbstractBTLEDeviceSupport {
|
||||
//Show Call Icon
|
||||
builder.write(ctrlCharacteristic, new byte[]{HPlusConstants.CMD_SET_INCOMING_CALL, HPlusConstants.ARG_INCOMING_CALL});
|
||||
|
||||
if(name != null) {
|
||||
byte[] msg = new byte[13];
|
||||
|
||||
|
||||
//Show call name
|
||||
|
||||
for (int i = 0; i < msg.length; i++)
|
||||
msg[i] = ' ';
|
||||
|
||||
@ -701,9 +692,19 @@ public class HPlusSupport extends AbstractBTLEDeviceSupport {
|
||||
|
||||
msg[0] = HPlusConstants.CMD_ACTION_DISPLAY_TEXT_NAME_CN;
|
||||
builder.write(ctrlCharacteristic, msg);
|
||||
}
|
||||
|
||||
builder.wait(200);
|
||||
msg = msg.clone();
|
||||
if(rawNumber != null) {
|
||||
StringBuilder number = new StringBuilder();
|
||||
|
||||
//Clean up number as the device only accepts digits
|
||||
for (char c : rawNumber.toCharArray()) {
|
||||
if (Character.isDigit(c)) {
|
||||
number.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
byte[] msg = new byte[13];
|
||||
|
||||
//Show call number
|
||||
for (int i = 0; i < msg.length; i++)
|
||||
@ -714,7 +715,9 @@ public class HPlusSupport extends AbstractBTLEDeviceSupport {
|
||||
|
||||
msg[0] = HPlusConstants.CMD_SET_INCOMING_CALL_NUMBER;
|
||||
|
||||
builder.wait(200);
|
||||
builder.write(ctrlCharacteristic, msg);
|
||||
}
|
||||
|
||||
performConnected(builder.getTransaction());
|
||||
} catch (IOException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user