diff options
author | Kiran Kelageri <kirankelageri@codeaurora.org> | 2015-09-10 11:27:45 -0700 |
---|---|---|
committer | Kiran Kelageri <kirankelageri@codeaurora.org> | 2015-09-10 11:27:45 -0700 |
commit | 39755e666ac801c74fb66eed12a57237326d4576 (patch) | |
tree | 4050cfae26dfbb086bed5267173ede5c6ef98d6a /wipower-host | |
parent | 69441ab744ca73bd1e2bea3f5899aba2de45268f (diff) | |
download | android_packages_apps_BluetoothExt-39755e666ac801c74fb66eed12a57237326d4576.tar.gz android_packages_apps_BluetoothExt-39755e666ac801c74fb66eed12a57237326d4576.tar.bz2 android_packages_apps_BluetoothExt-39755e666ac801c74fb66eed12a57237326d4576.zip |
Bluetooth-Wipower: A4WP missing changes.
Changes include fixes that are missing when compared
to previous versions.
Change-Id: I0cef0c49803eadfe261b2715e332d35599c9c858
Diffstat (limited to 'wipower-host')
-rw-r--r-- | wipower-host/a4wp/src/org/codeaurora/bluetooth/a4wp_app/A4wpService.java | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/wipower-host/a4wp/src/org/codeaurora/bluetooth/a4wp_app/A4wpService.java b/wipower-host/a4wp/src/org/codeaurora/bluetooth/a4wp_app/A4wpService.java index c5024a6..e8bf7e5 100644 --- a/wipower-host/a4wp/src/org/codeaurora/bluetooth/a4wp_app/A4wpService.java +++ b/wipower-host/a4wp/src/org/codeaurora/bluetooth/a4wp_app/A4wpService.java @@ -107,13 +107,13 @@ public class A4wpService extends Service private final static short DEFAULT_RFU = 0x0000; //03 if MTP, Has to be 04 for fluid. private final static byte DEFAULT_CATEGORY = 0x0003; - private final static byte DEFAULT_CAPABILITIES = 0x0010; + private final static byte DEFAULT_CAPABILITIES = 0x00; private final static byte DEFAULT_HW_VERSION = 0x0007; private final static byte DEFAULT_FW_VERSION = 0x0006; private final static byte DEFAULT_MAX_POWER_DESIRED = 0x0032; // 5Watts private final static short DEFAULT_VRECT_MIN = 7100; // 7.1 Volts private final static short DEFAULT_VRECT_MAX = 19300; // 19.3 Volts - private final static short DEFAULT_VRECT_SET = 7100; // 7.1 Volts + private final static short DEFAULT_VRECT_SET = 7200; // 7.2 Volts private final static short DEFAULT_DELTA_R1 = 0x0001; private final static int DEFAULT_RFU_VAL = 0x0000; private static final int MSB_MASK = 0xFF00; @@ -204,6 +204,7 @@ public class A4wpService extends Service Log.v(LOGTAG, "initiateDisconnection:" + " dropping Connection"); mDiscInitiated = true; mBluetoothGattServer.cancelConnection(mDevice); + mWipowerManager.enablePowerApply(false, false, false); if (mChargeComplete == true) { mWipowerManager.enablePowerApply(true, true, true); } else { @@ -220,6 +221,7 @@ public class A4wpService extends Service public void onWbcEventUpdate(int what, int arg1, int arg2) { Log.v(LOGTAG, "onWbcEventUpdate rcvd: " + what + ", " + arg1 + ", " + arg2); if ((what == WbcTypes.WBC_EVENT_TYPE_CHARGING_REQUIRED_STATUS)){ + mWipowerManager.enablePowerApply(false, false, false); if ((arg1 == WbcTypes.WBC_BATTERY_STATUS_CHARGING_NOT_REQUIRED)){ // this will set charge complete bit in pru alert // eventally leading to a possible disconnect from ptu @@ -230,6 +232,8 @@ public class A4wpService extends Service alert = (byte) (alert | CHARGE_COMPLETE_BIT); mPruAlert.sendPruAlert(alert); } + if ((mState == BluetoothProfile.STATE_DISCONNECTED) && (mWipowerManager != null)) + mWipowerManager.enablePowerApply(true, true, true); } 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 */ @@ -613,12 +617,13 @@ public class A4wpService extends Service 0x81 Denied due to limited affordable power 0x82 Denied due to limited PTU Number of Devices 0x83 Denied due to limited PTU Class support + All other values: RFU */ public boolean getPermission() { Log.v(LOGTAG, "getPermission" + mPermission); - if ((mPermission&0x80) == 0x80) return false; - else return true; + if (mPermission == 0x00) return true; + else return false; } /* returns time in ms */ @@ -660,7 +665,7 @@ public class A4wpService extends Service return status; } - if (mPruControl.getEnablePruOutput()) { + if (mPruControl.getEnablePruOutput() && mPruControl.getPermission()) { Log.v(LOGTAG, "do Enable PruOutPut"); /* Wake lock is enabled by default, to disbale need to set property */ if(SystemProperties.getBoolean("persist.a4wp.skipwakelock", false) == false) { @@ -670,9 +675,6 @@ public class A4wpService extends Service mOutputControl = true; } else { Log.v(LOGTAG, "do Disable PruOutPut"); - if (mChargeComplete == true) { - mWipowerManager.enablePowerApply(true, true, true); - } mWipowerManager.stopCharging(); isChargePortSet = false; mOutputControl = false; @@ -780,8 +782,11 @@ public class A4wpService extends Service mWipowerManager.enableAlertNotification(false); mEnablePruAlerts = false; mWipowerManager.stopCharging(); + mWipowerManager.enablePowerApply(false, false, false); if (mChargeComplete != true) { mWipowerManager.enablePowerApply(true, true, false); + } else { + mWipowerManager.enablePowerApply(true, true, true); } if(SystemProperties.getBoolean("persist.a4wp.skipwakelock", false) == false) { /* Drop wake lock once the connection is dropped gracefully */ @@ -897,8 +902,8 @@ public class A4wpService extends Service value[VRECT_MAX_LSB] = (byte)(LSB_MASK & DEFAULT_VRECT_MAX); value[VRECT_MAX_MSB] = (byte)((MSB_MASK & DEFAULT_VRECT_MAX) >> 8); if ((byte)(value[PRU_ALERT] & CHARGE_PORT_MASK) == CHARGE_PORT_MASK) { - value[VRECT_MIN_LSB] = (byte)(LSB_MASK & DEFAULT_VRECT_SET); - value[VRECT_MIN_MSB] = (byte)((MSB_MASK & DEFAULT_VRECT_SET) >> 8); + value[VRECT_MIN_LSB] = (byte)(LSB_MASK & DEFAULT_VRECT_MIN); + value[VRECT_MIN_MSB] = (byte)((MSB_MASK & DEFAULT_VRECT_MIN) >> 8); value[VRECT_SET_LSB] = (byte)(LSB_MASK & DEFAULT_VRECT_SET); value[VRECT_SET_MSB] = (byte)((MSB_MASK & DEFAULT_VRECT_SET) >> 8); } else { |