summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUmesh Vats <uvats@codeaurora.org>2015-03-11 09:46:02 -0700
committerUmesh Vats <uvats@codeaurora.org>2015-03-12 13:15:40 -0700
commitaab0a0260c3b19a45b2e81298b5f11739183d77c (patch)
tree89457fd3272b978f0ba4daddaa634dd44cba8c53 /src
parente0cdb21b595109fd32b22ca40ecf56593e23519d (diff)
downloadandroid_packages_apps_BluetoothExt-aab0a0260c3b19a45b2e81298b5f11739183d77c.tar.gz
android_packages_apps_BluetoothExt-aab0a0260c3b19a45b2e81298b5f11739183d77c.tar.bz2
android_packages_apps_BluetoothExt-aab0a0260c3b19a45b2e81298b5f11739183d77c.zip
BluetoothWiPower: PRU Alert notifications(Interface change)
Changes in the interface for passing alerts to Wipower App Some log messages are also fixed. Change-Id: I160fee6f7d2ff0bd45149b8a7e51cff01a3addf7
Diffstat (limited to 'src')
-rw-r--r--src/org/codeaurora/bluetooth/a4wp/A4wpService.java49
1 files changed, 9 insertions, 40 deletions
diff --git a/src/org/codeaurora/bluetooth/a4wp/A4wpService.java b/src/org/codeaurora/bluetooth/a4wp/A4wpService.java
index cf7cba6..f517206 100644
--- a/src/org/codeaurora/bluetooth/a4wp/A4wpService.java
+++ b/src/org/codeaurora/bluetooth/a4wp/A4wpService.java
@@ -53,7 +53,6 @@ import java.nio.ByteBuffer;
import android.wipower.WipowerManager;
import android.wipower.WipowerManagerCallback;
import android.wipower.WipowerManager.WipowerState;
-import android.wipower.WipowerManager.WipowerAlert;
import android.wipower.WipowerManager.PowerApplyEvent;
import android.wipower.WipowerManager.PowerLevel;
import android.wipower.WipowerDynamicParam;
@@ -177,6 +176,12 @@ public class A4wpService extends Service
// this will set charge complete bit in pru alert
// eventally leading to a possible disconnect from ptu
mChargeComplete = true;
+ if (mPruAlert != null)
+ {
+ byte alert = 0;
+ alert = (byte) (alert | CHARGE_COMPLETE_BIT);
+ mPruAlert.sendPruAlert(alert);
+ }
} else {
// We could be in 600mS scan state here and since charging needs to be resumed
// send enable power apply command to scan for short beacons */
@@ -619,13 +624,7 @@ public class A4wpService extends Service
return status;
}
- private static final int OVER_VOLT_BIT = 0x80;
- private static final byte OVER_CURR_BIT = 0x40;
- private static final byte OVER_TEMP_BIT = 0x20;
- private static final byte SELF_PROT_BIT = 0x10;
private static final byte CHARGE_COMPLETE_BIT = 0x08;
- private static final byte WIRED_CHARGE_DETECT = 0x04;
- private static final byte CHARGE_PORT = 0x02;
/**
* Wipower callbacks
@@ -670,39 +669,9 @@ public class A4wpService extends Service
}
@Override
- public void onWipowerAlert(WipowerAlert alert) {
- Log.v(LOGTAG, "onWipowerAlert: " + alert);
- byte alertVal = 0;
- if (alert == WipowerAlert.ALERT_OVER_VOLTAGE) {
- Log.v(LOGTAG, "Over Voltage");
- alertVal |= OVER_VOLT_BIT&0xff;
- }
- else if (alert == WipowerAlert.ALERT_OVER_CURRENT) {
- Log.v(LOGTAG, "Over Current");
- alertVal |= OVER_CURR_BIT;
- }
- else if (alert == WipowerAlert.ALERT_OVER_TEMPERATURE) {
- Log.v(LOGTAG, "Over Temperature");
- alertVal |= OVER_TEMP_BIT;
- }
- else if (alert == WipowerAlert.ALERT_SELF_PROTECTION) {
- Log.v(LOGTAG, "PRU self protection ON");
- alertVal |= SELF_PROT_BIT;
- }
- else if (alert == WipowerAlert.ALERT_CHARGE_COMPLETE) {
- Log.v(LOGTAG, "Charge complete alert ");
- alertVal |= CHARGE_COMPLETE_BIT;
- }
- else if (alert == WipowerAlert.ALERT_WIRED_CHARGER_DETECTED) {
- Log.v(LOGTAG, "Wired charger detected");
- alertVal |= WIRED_CHARGE_DETECT;
- }
- else if (alert == WipowerAlert.ALERT_CHARGE_PORT) {
- Log.v(LOGTAG, "Alert charge port");
- alertVal |= CHARGE_PORT;
- }
-
- mPruAlert.sendPruAlert(alertVal);
+ public void onWipowerAlert(byte alert) {
+ Log.v(LOGTAG, "onWipowerAlert: " + alert + " alert recieved");
+ mPruAlert.sendPruAlert(alert);
}