Combo: add reading MAC address to RuffyCommands.

This commit is contained in:
Johannes Mockenhaupt 2021-04-18 16:27:00 +02:00
parent 9c8f99b331
commit 38bab84047
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
3 changed files with 15 additions and 0 deletions

View file

@ -20,4 +20,5 @@ interface IRuffyService {
void rtSendKey(byte keyCode, boolean changed);
void resetPairing();
boolean isConnected();
String getMacAddress();
}

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter;
import androidx.annotation.Nullable;
import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.history.PumpHistoryRequest;
public interface RuffyCommands {
@ -45,5 +46,8 @@ public interface RuffyCommands {
CommandResult getDateAndTime();
CommandResult setDateAndTime();
@Nullable
String getMacAddress();
}

View file

@ -822,6 +822,16 @@ public class RuffyScripter implements RuffyCommands {
throw new RuntimeException("Not supported");
}
@Nullable
public String getMacAddress() {
try {
return ruffyService.getMacAddress();
} catch (RemoteException e) {
// ignore; ruffy version is probably old and doesn't support reading MAC address yet
return null;
}
}
/**
* Confirms and dismisses the given alert if it's raised before the timeout
*/