private BleOnState mBleOnState = new BleOnState();
public boolean isTurningOn() {
- boolean isTurningOn= mPendingCommandState.isTurningOn();
- verboseLog("isTurningOn()=" + isTurningOn);
- return isTurningOn;
+ return mPendingCommandState.isTurningOn();
}
public boolean isBleTurningOn() {
- boolean isBleTurningOn= mPendingCommandState.isBleTurningOn();
- verboseLog("isBleTurningOn()=" + isBleTurningOn);
- return isBleTurningOn;
+ return mPendingCommandState.isBleTurningOn();
}
public boolean isBleTurningOff() {
- boolean isBleTurningOff = mPendingCommandState.isBleTurningOff();
- verboseLog("isBleTurningOff()=" + isBleTurningOff);
- return isBleTurningOff;
+ return mPendingCommandState.isBleTurningOff();
}
public boolean isTurningOff() {
- boolean isTurningOff= mPendingCommandState.isTurningOff();
- verboseLog("isTurningOff()=" + isTurningOff);
- return isTurningOff;
+ return mPendingCommandState.isTurningOff();
}
private AdapterState(AdapterService service, AdapterProperties adapterProperties) {
@Override
public boolean processMessage(Message msg) {
- boolean isTurningOn= isTurningOn();
+ /* Cache current states */
+ /* TODO(eisenbach): Not sure why this is done at all.
+ * Seems like the mIs* variables should be protected,
+ * or really, removed. Which reminds me: This file needs
+ * a serious refactor...*/
+ boolean isTurningOn = isTurningOn();
boolean isTurningOff = isTurningOff();
boolean isBleTurningOn = isBleTurningOn();
boolean isBleTurningOff = isBleTurningOff();
+ logTransientStates();
+
AdapterService adapterService = mAdapterService;
AdapterProperties adapterProperties = mAdapterProperties;
if ((adapterService == null) || (adapterProperties == null)) {
}
return true;
}
+
+ private void logTransientStates() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("PendingCommand - transient state(s):");
+
+ if (isTurningOn()) sb.append(" isTurningOn");
+ if (isTurningOff()) sb.append(" isTurningOff");
+ if (isBleTurningOn()) sb.append(" isBleTurningOn");
+ if (isBleTurningOff()) sb.append(" isBleTurningOff");
+
+ verboseLog(sb.toString());
+ }
}
private void notifyAdapterStateChange(int newState) {
}
private void warningLog(String msg) {
- if (DBG) Log.d(TAG, msg);
+ if (DBG) Log.w(TAG, msg);
}
private void verboseLog(String msg) {