summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java4
-rw-r--r--hiddtestapp/src/org/codeaurora/bluetooth/hiddtestapp/HidConsts.java12
-rw-r--r--hiddtestapp/src/org/codeaurora/bluetooth/hiddtestapp/Keyboard.java3
-rw-r--r--src/org/codeaurora/bluetooth/a4wp/A4wpService.java28
-rw-r--r--src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java8
5 files changed, 35 insertions, 20 deletions
diff --git a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java
index aaf1369..05e722b 100644
--- a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java
+++ b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java
@@ -389,8 +389,10 @@ public class HfpTestActivity extends MonkeyActivity implements IBluetoothConnect
if (mBluetoothHeadsetClient != null) {
mCalls.clear();
Integer id = 1;
+ int connState = mBluetoothHeadsetClient.getConnectionState(mDevice);
// save all calls status
- if (!mBluetoothHeadsetClient.getCurrentCalls(mDevice).isEmpty()) {
+ if (connState == BluetoothProfile.STATE_CONNECTED &&
+ !mBluetoothHeadsetClient.getCurrentCalls(mDevice).isEmpty()) {
for (BluetoothHeadsetClientCall call :
mBluetoothHeadsetClient.getCurrentCalls(mDevice)) {
mCalls.put(id, call);
diff --git a/hiddtestapp/src/org/codeaurora/bluetooth/hiddtestapp/HidConsts.java b/hiddtestapp/src/org/codeaurora/bluetooth/hiddtestapp/HidConsts.java
index a1b3368..6f616ec 100644
--- a/hiddtestapp/src/org/codeaurora/bluetooth/hiddtestapp/HidConsts.java
+++ b/hiddtestapp/src/org/codeaurora/bluetooth/hiddtestapp/HidConsts.java
@@ -43,7 +43,7 @@ public class HidConsts {
(byte) 0xa1, (byte) 0x01, // COLLECTION (Application)
(byte) 0x09, (byte) 0x01, // USAGE (Pointer)
(byte) 0xa1, (byte) 0x00, // COLLECTION (Physical)
- (byte) 0x85, (byte) 0x01, // REPORT_ID (1)
+ (byte) 0x85, (byte) 0x02, // REPORT_ID (2)
(byte) 0x05, (byte) 0x09, // USAGE_PAGE (Button)
(byte) 0x19, (byte) 0x01, // USAGE_MINIMUM (Button 1)
(byte) 0x29, (byte) 0x03, // USAGE_MAXIMUM (Button 3)
@@ -93,7 +93,7 @@ public class HidConsts {
(byte) 0x05, (byte) 0x01, // USAGE_PAGE (Generic Desktop)
(byte) 0x09, (byte) 0x06, // USAGE (Keyboard)
(byte) 0xa1, (byte) 0x01, // COLLECTION (Application)
- (byte) 0x85, (byte) 0x10, // REPORT_ID (16)
+ (byte) 0x85, (byte) 0x01, // REPORT_ID (1)
(byte) 0x05, (byte) 0x07, // USAGE_PAGE (Keyboard)
(byte) 0x19, (byte) 0xe0, // USAGE_MINIMUM (Keyboard LeftControl)
(byte) 0x29, (byte) 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI)
@@ -121,7 +121,7 @@ public class HidConsts {
(byte) 0x05, (byte) 0x07, // USAGE_PAGE (Keyboard)
(byte) 0x95, (byte) 0x05, // REPORT_COUNT (5)
(byte) 0x75, (byte) 0x01, // REPORT_SIZE (1)
- (byte) 0x85, (byte) 0x10, // REPORT_ID (16)
+ (byte) 0x85, (byte) 0x01, // REPORT_ID (1)
(byte) 0x05, (byte) 0x08, // USAGE_PAGE (LEDs)
(byte) 0x19, (byte) 0x01, // USAGE_MINIMUM (Num Lock)
(byte) 0x29, (byte) 0x05, // USAGE_MAXIMUM (Kana)
@@ -141,11 +141,11 @@ public class HidConsts {
};
/* @formatter:on */
- public final static byte MOUSE_REPORT_ID = 1;
+ public final static byte KEYBOARD_INPUT_REPORT_ID = 1;
- public final static byte KEYBOARD_INPUT_REPORT_ID = 16;
+ public final static byte KEYBOARD_OUTPUT_REPORT_ID = 1;
- public final static byte KEYBOARD_OUTPUT_REPORT_ID = 16;
+ public final static byte MOUSE_REPORT_ID = 2;
public final static byte BOOT_KEYBOARD_REPORT_ID = 1;
diff --git a/hiddtestapp/src/org/codeaurora/bluetooth/hiddtestapp/Keyboard.java b/hiddtestapp/src/org/codeaurora/bluetooth/hiddtestapp/Keyboard.java
index f2e5967..5d58b71 100644
--- a/hiddtestapp/src/org/codeaurora/bluetooth/hiddtestapp/Keyboard.java
+++ b/hiddtestapp/src/org/codeaurora/bluetooth/hiddtestapp/Keyboard.java
@@ -133,7 +133,8 @@ public class Keyboard extends LinearLayout implements Key.KeyListener {
VISIBLE : INVISIBLE);
key.setKeyListener(this);
- if (attrs != null & attrs.shiftLabel != null & attrs.shiftLabel.length() > 0) {
+ if (attrs != null && attrs.shiftLabel != null &&
+ attrs.shiftLabel.length() > 0) {
mKeysWithShiftLabel.add(key);
}
diff --git a/src/org/codeaurora/bluetooth/a4wp/A4wpService.java b/src/org/codeaurora/bluetooth/a4wp/A4wpService.java
index 7e9b7bb..6df222d 100644
--- a/src/org/codeaurora/bluetooth/a4wp/A4wpService.java
+++ b/src/org/codeaurora/bluetooth/a4wp/A4wpService.java
@@ -107,8 +107,8 @@ public class A4wpService extends Service
private static final int MSB_MASK = 0xFF00;
private static final int LSB_MASK= 0x00FF;
- //Timout value set to 30Sec which enures we advertise in lmited mode
- private static final int WIPOWER_ADV_TIMEOUT= 0x7530;
+ //Timeout value set to 5Sec which enures we advertise in limited mode
+ private static final int WIPOWER_ADV_TIMEOUT = 5000;
//PRU Write param length for validation
private static final byte A4WP_PTU_STATIC_LENGTH = 0x11;
@@ -437,15 +437,22 @@ public class A4wpService extends Service
Log.v(LOGTAG, "processPruControl>");
PruControl control = new PruControl(value);
control.print();
+
+ if (mWipowerManager == null) {
+ Log.e(LOGTAG, "mWipowerManager is null");
+ return status;
+ }
+
if (control.getEnablePruOutput()) {
Log.v(LOGTAG, "do Enable PruOutPut");
mWipowerManager.startCharging();
mWipowerManager.enableAlertNotification(false);
mWipowerManager.enableDataNotification(true);
- stopAdvertising();
- isConnected = true;
} else {
Log.v(LOGTAG, "do Disable PruOutPut");
+ if (mChargeComplete == true) {
+ mWipowerManager.enablePowerApply(true, true, true);
+ }
mWipowerManager.stopCharging();
mWipowerManager.enableDataNotification(false);
return status;
@@ -584,11 +591,10 @@ public class A4wpService extends Service
Log.v(LOGTAG, "onConnectionStateChange:DISCONNECTED " + device + "charge complete " + mChargeComplete);
isConnected = false;
if (mDevice != null && mWipowerManager != null) {
+ stopAdvertising();
mWipowerManager.enableDataNotification(false);
mWipowerManager.stopCharging();
- if (mChargeComplete == true) {
- mWipowerManager.enablePowerApply(true, true, true);
- } else {
+ if (mChargeComplete != true) {
mWipowerManager.enablePowerApply(true, true, false);
}
mDevice = null;
@@ -596,6 +602,9 @@ public class A4wpService extends Service
} else if (mState == BluetoothProfile.STATE_CONNECTED) {
Log.v(LOGTAG, "onConnectionStateChange:CONNECTED");
mDevice = device;
+ /* Initiate a dummy connection such that on stop advertisment
+ the advetisment instances are cleared properly */
+ mBluetoothGattServer.connect(mDevice, false);
}
}
@@ -639,7 +648,7 @@ public class A4wpService extends Service
else if(id == A4WP_PRU_STATIC_UUID)
{
value = mPruStaticParam.getValue();
- mBluetoothGattServer.connect(mDevice, false);
+ isConnected = true;
}
else if (id == A4WP_PRU_DYNAMIC_UUID) {
if (mPruDynamicParam == null) {
@@ -786,9 +795,6 @@ public class A4wpService extends Service
mBluetoothGattServer.addService(a4wpService);
- //Log.d(LOGTAG, "calling StartAdvertising");
- //StartAdvertising();
-
return true;
}
diff --git a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java
index 164aa4a..cd2f583 100644
--- a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java
+++ b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java
@@ -83,7 +83,7 @@ public class BluetoothFtpService extends Service {
//public static final boolean VERBOSE = false;
public static final boolean DEBUG = true;
- public static boolean VERBOSE;
+ public static boolean VERBOSE = true;
private int mState;
/**
@@ -314,6 +314,7 @@ public class BluetoothFtpService extends Service {
} else if (action.equals(ACCESS_ALLOWED_ACTION)) {
if (!isWaitingAuthorization) {
// this reply is not for us
+ if (VERBOSE) Log.v(TAG, "isWaitingAuthorization = " + isWaitingAuthorization);
return;
}
@@ -336,6 +337,8 @@ public class BluetoothFtpService extends Service {
}
removeFtpNotification(NOTIFICATION_ID_ACCESS);
} else if (action.equals(ACCESS_DISALLOWED_ACTION)) {
+ if (VERBOSE) Log.v(TAG, "ACCESS_DISALLOWED_ACTION");
+ isWaitingAuthorization = false;
stopObexServerSession();
} else if (action.equals(AUTH_RESPONSE_ACTION)) {
String sessionkey = intent.getStringExtra(EXTRA_SESSION_KEY);
@@ -528,6 +531,7 @@ public class BluetoothFtpService extends Service {
if (VERBOSE) Log.v(TAG, "Ftp Service stopObexServerSession");
if (mServerSession != null) {
+ if (VERBOSE) Log.v(TAG, "stopObexServerSession, closing mServerSession");
mServerSession.close();
mServerSession = null;
}
@@ -535,6 +539,7 @@ public class BluetoothFtpService extends Service {
mRfcommAcceptThread = null;
try {
+ if (VERBOSE) Log.v(TAG, "stopObexServerSession, closeRfcommSocket");
closeRfcommSocket(false, true);
} catch (IOException e) {
Log.e(TAG, "closeSocket error: " + e.toString());
@@ -542,6 +547,7 @@ public class BluetoothFtpService extends Service {
// Last obex transaction is finished, we start to listen for incoming
// connection again
if (mAdapter.isEnabled()) {
+ if (VERBOSE) Log.v(TAG, "stopObexServerSession, startRfcommSocketListener");
startRfcommSocketListener();
}
}