Loading android/app/src/com/android/bluetooth/bass_client/BassClientService.java +2 −2 Original line number Diff line number Diff line Loading @@ -1050,7 +1050,7 @@ public class BassClientService extends ProfileService { public void addSource(BluetoothDevice sink, BluetoothLeBroadcastMetadata sourceMetadata, boolean isGroupOp) { log("addSource: device: " + sink + " sourceMetadata" + sourceMetadata + " isGroupOp" + isGroupOp); + " isGroupOp: " + isGroupOp); List<BluetoothDevice> devices = getTargetDeviceList(sink, isGroupOp); // Don't coordinate it as a group if there's no group or there is one device only Loading Loading @@ -1206,7 +1206,7 @@ public class BassClientService extends ProfileService { * @param sourceId source ID as delivered in onSourceAdded */ public void removeSource(BluetoothDevice sink, int sourceId) { log("removeSource: device = " + sink + "sourceId " + sourceId); log("removeSource: device = " + sink + ", sourceId " + sourceId); Map<BluetoothDevice, Integer> devices = getGroupManagedDeviceSources(sink, sourceId).second; for (Map.Entry<BluetoothDevice, Integer> deviceSourceIdPair : devices.entrySet()) { Loading android/app/src/com/android/bluetooth/bass_client/BassClientStateMachine.java +8 −43 Original line number Diff line number Diff line Loading @@ -328,7 +328,7 @@ public class BassClientStateMachine extends StateMachine { } void parseScanRecord(int syncHandle, ScanRecord record) { log("parseScanRecord" + record); log("parseScanRecord: " + record); BluetoothDevice srcDevice = mService.getDeviceForSyncHandle(syncHandle); Map<ParcelUuid, byte[]> bmsAdvDataMap = record.getServiceData(); if (bmsAdvDataMap != null) { Loading Loading @@ -657,7 +657,6 @@ public class BassClientStateMachine extends StateMachine { } private void processPASyncState(BluetoothLeBroadcastReceiveState recvState) { log("processPASyncState " + recvState); int serviceData = 0; if (recvState == null) { Log.e(TAG, "processPASyncState: recvState is null"); Loading Loading @@ -857,7 +856,6 @@ public class BassClientStateMachine extends StateMachine { numSubGroups, bisSyncState, metadataList); log(recvState.toString()); } return recvState; } Loading Loading @@ -886,8 +884,7 @@ public class BassClientStateMachine extends StateMachine { checkAndUpdateBroadcastCode(recvState); processPASyncState(recvState); } else { log("old sourceInfo: " + oldRecvState); log("new sourceInfo: " + recvState); log("Updated receiver state: " + recvState); mBluetoothLeBroadcastReceiveStates.replace(characteristic.getInstanceId(), recvState); String emptyBluetoothDevice = "00:00:00:00:00:00"; if (oldRecvState.getSourceDevice() == null Loading Loading @@ -990,7 +987,6 @@ public class BassClientStateMachine extends StateMachine { BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { log("onCharacteristicRead:: status: " + status + "char:" + characteristic); if (status == BluetoothGatt.GATT_SUCCESS && characteristic.getUuid() .equals(BassConstants.BASS_BCAST_RECEIVER_STATE)) { log("onCharacteristicRead: BASS_BCAST_RECEIVER_STATE: status" + status); Loading Loading @@ -1022,13 +1018,6 @@ public class BassClientStateMachine extends StateMachine { @Override public void onDescriptorWrite( BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { log("onDescriptorWrite"); if (status == BluetoothGatt.GATT_SUCCESS && descriptor.getUuid() .equals(BassConstants.CLIENT_CHARACTERISTIC_CONFIG)) { log("CCC write resp"); } // Move the SM to connected so further reads happens Message m = obtainMessage(GATT_TXN_PROCESSED); m.arg1 = status; Loading @@ -1037,7 +1026,6 @@ public class BassClientStateMachine extends StateMachine { @Override public void onMtuChanged(BluetoothGatt gatt, int mtu, int status) { log("onMtuChanged: mtu:" + mtu); if (mMTUChangeRequested && mBluetoothGatt != null) { acquireAllBassChars(); mMTUChangeRequested = false; Loading @@ -1050,34 +1038,18 @@ public class BassClientStateMachine extends StateMachine { @Override public void onCharacteristicChanged( BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) { log("onCharacteristicChanged :: " + characteristic.getUuid().toString()); if (characteristic.getUuid().equals(BassConstants.BASS_BCAST_RECEIVER_STATE)) { log("onCharacteristicChanged is rcvr State :: " + characteristic.getUuid().toString()); if (characteristic.getValue() == null) { Log.e(TAG, "Remote receiver state is NULL"); return; } logByteArray("onCharacteristicChanged: Received ", characteristic.getValue(), 0, characteristic.getValue().length); processBroadcastReceiverState(characteristic.getValue(), characteristic); } } @Override public void onCharacteristicWrite( BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { log("onCharacteristicWrite: " + characteristic.getUuid().toString() + "status:" + status); if (status == 0 && characteristic.getUuid() .equals(BassConstants.BASS_BCAST_AUDIO_SCAN_CTRL_POINT)) { log("BASS_BCAST_AUDIO_SCAN_CTRL_POINT is written successfully"); } public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { Message m = obtainMessage(GATT_TXN_PROCESSED); m.arg1 = status; sendMessage(m); Loading Loading @@ -1112,7 +1084,6 @@ public class BassClientStateMachine extends StateMachine { * getAllSources */ public List<BluetoothLeBroadcastReceiveState> getAllSources() { log("getAllSources"); List list = new ArrayList(mBluetoothLeBroadcastReceiveStates.values()); return list; } Loading Loading @@ -1343,7 +1314,6 @@ public class BassClientStateMachine extends StateMachine { byte[] bcastSourceAddr = Utils.getBytesFromAddress(advSource.getAddress()); BassUtils.reverse(bcastSourceAddr); stream.write(bcastSourceAddr, 0, 6); log("Address bytes: " + advSource); // Advertising_SID stream.write(metaData.getSourceAdvertisingSid()); Loading @@ -1352,13 +1322,11 @@ public class BassClientStateMachine extends StateMachine { stream.write(metaData.getBroadcastId() & 0x00000000000000FF); stream.write((metaData.getBroadcastId() & 0x000000000000FF00) >>> 8); stream.write((metaData.getBroadcastId() & 0x0000000000FF0000) >>> 16); log("mBroadcastId: " + metaData.getBroadcastId()); // PA_Sync if (!mDefNoPAS) { stream.write(0x01); } else { log("setting PA sync to ZERO"); stream.write(0x00); } Loading Loading @@ -1390,7 +1358,6 @@ public class BassClientStateMachine extends StateMachine { } byte[] res = stream.toByteArray(); log("ADD_BCAST_SOURCE in Bytes"); BassUtils.printByteArray(res); return res; } Loading Loading @@ -1623,7 +1590,6 @@ public class BassClientStateMachine extends StateMachine { break; case ADD_BCAST_SOURCE: metaData = (BluetoothLeBroadcastMetadata) message.obj; log("Adding Broadcast source" + metaData); byte[] addSourceInfo = convertMetadataToAddSourceByteArray(metaData); if (addSourceInfo == null) { Log.e(TAG, "add source: source Info is NULL"); Loading @@ -1649,7 +1615,7 @@ public class BassClientStateMachine extends StateMachine { metaData = (BluetoothLeBroadcastMetadata) message.obj; int sourceId = message.arg1; int paSync = message.arg2; log("Updating Broadcast source" + metaData); log("Updating Broadcast source: " + metaData); byte[] updateSourceInfo = convertBroadcastMetadataToUpdateSourceByteArray( sourceId, metaData, paSync); if (updateSourceInfo == null) { Loading Loading @@ -1897,7 +1863,9 @@ public class BassClientStateMachine extends StateMachine { case SET_BCAST_CODE: case REMOVE_BCAST_SOURCE: case PSYNC_ACTIVE_TIMEOUT: log("defer the message:" + message.what + "so that it will be processed later"); log("defer the message: " + messageWhatToString(message.what) + ", so that it will be processed later"); deferMessage(message); break; default: Loading Loading @@ -1933,14 +1901,11 @@ public class BassClientStateMachine extends StateMachine { } switch (currentState) { case "Disconnected": log("Disconnected"); return BluetoothProfile.STATE_DISCONNECTED; case "Connecting": log("Connecting"); return BluetoothProfile.STATE_CONNECTING; case "Connected": case "ConnectedProcessing": log("connected"); return BluetoothProfile.STATE_CONNECTED; default: Log.e(TAG, "Bad currentState: " + currentState); Loading android/app/src/com/android/bluetooth/bass_client/BassUtils.java +0 −4 Original line number Diff line number Diff line Loading @@ -54,10 +54,6 @@ class BassUtils { static void printByteArray(byte[] array) { log("Entire byte Array as string: " + Arrays.toString(array)); log("printitng byte by bte"); for (int i = 0; i < array.length; i++) { log("array[" + i + "] :" + Byte.toUnsignedInt(array[i])); } } static void reverse(byte[] address) { Loading Loading
android/app/src/com/android/bluetooth/bass_client/BassClientService.java +2 −2 Original line number Diff line number Diff line Loading @@ -1050,7 +1050,7 @@ public class BassClientService extends ProfileService { public void addSource(BluetoothDevice sink, BluetoothLeBroadcastMetadata sourceMetadata, boolean isGroupOp) { log("addSource: device: " + sink + " sourceMetadata" + sourceMetadata + " isGroupOp" + isGroupOp); + " isGroupOp: " + isGroupOp); List<BluetoothDevice> devices = getTargetDeviceList(sink, isGroupOp); // Don't coordinate it as a group if there's no group or there is one device only Loading Loading @@ -1206,7 +1206,7 @@ public class BassClientService extends ProfileService { * @param sourceId source ID as delivered in onSourceAdded */ public void removeSource(BluetoothDevice sink, int sourceId) { log("removeSource: device = " + sink + "sourceId " + sourceId); log("removeSource: device = " + sink + ", sourceId " + sourceId); Map<BluetoothDevice, Integer> devices = getGroupManagedDeviceSources(sink, sourceId).second; for (Map.Entry<BluetoothDevice, Integer> deviceSourceIdPair : devices.entrySet()) { Loading
android/app/src/com/android/bluetooth/bass_client/BassClientStateMachine.java +8 −43 Original line number Diff line number Diff line Loading @@ -328,7 +328,7 @@ public class BassClientStateMachine extends StateMachine { } void parseScanRecord(int syncHandle, ScanRecord record) { log("parseScanRecord" + record); log("parseScanRecord: " + record); BluetoothDevice srcDevice = mService.getDeviceForSyncHandle(syncHandle); Map<ParcelUuid, byte[]> bmsAdvDataMap = record.getServiceData(); if (bmsAdvDataMap != null) { Loading Loading @@ -657,7 +657,6 @@ public class BassClientStateMachine extends StateMachine { } private void processPASyncState(BluetoothLeBroadcastReceiveState recvState) { log("processPASyncState " + recvState); int serviceData = 0; if (recvState == null) { Log.e(TAG, "processPASyncState: recvState is null"); Loading Loading @@ -857,7 +856,6 @@ public class BassClientStateMachine extends StateMachine { numSubGroups, bisSyncState, metadataList); log(recvState.toString()); } return recvState; } Loading Loading @@ -886,8 +884,7 @@ public class BassClientStateMachine extends StateMachine { checkAndUpdateBroadcastCode(recvState); processPASyncState(recvState); } else { log("old sourceInfo: " + oldRecvState); log("new sourceInfo: " + recvState); log("Updated receiver state: " + recvState); mBluetoothLeBroadcastReceiveStates.replace(characteristic.getInstanceId(), recvState); String emptyBluetoothDevice = "00:00:00:00:00:00"; if (oldRecvState.getSourceDevice() == null Loading Loading @@ -990,7 +987,6 @@ public class BassClientStateMachine extends StateMachine { BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { log("onCharacteristicRead:: status: " + status + "char:" + characteristic); if (status == BluetoothGatt.GATT_SUCCESS && characteristic.getUuid() .equals(BassConstants.BASS_BCAST_RECEIVER_STATE)) { log("onCharacteristicRead: BASS_BCAST_RECEIVER_STATE: status" + status); Loading Loading @@ -1022,13 +1018,6 @@ public class BassClientStateMachine extends StateMachine { @Override public void onDescriptorWrite( BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { log("onDescriptorWrite"); if (status == BluetoothGatt.GATT_SUCCESS && descriptor.getUuid() .equals(BassConstants.CLIENT_CHARACTERISTIC_CONFIG)) { log("CCC write resp"); } // Move the SM to connected so further reads happens Message m = obtainMessage(GATT_TXN_PROCESSED); m.arg1 = status; Loading @@ -1037,7 +1026,6 @@ public class BassClientStateMachine extends StateMachine { @Override public void onMtuChanged(BluetoothGatt gatt, int mtu, int status) { log("onMtuChanged: mtu:" + mtu); if (mMTUChangeRequested && mBluetoothGatt != null) { acquireAllBassChars(); mMTUChangeRequested = false; Loading @@ -1050,34 +1038,18 @@ public class BassClientStateMachine extends StateMachine { @Override public void onCharacteristicChanged( BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) { log("onCharacteristicChanged :: " + characteristic.getUuid().toString()); if (characteristic.getUuid().equals(BassConstants.BASS_BCAST_RECEIVER_STATE)) { log("onCharacteristicChanged is rcvr State :: " + characteristic.getUuid().toString()); if (characteristic.getValue() == null) { Log.e(TAG, "Remote receiver state is NULL"); return; } logByteArray("onCharacteristicChanged: Received ", characteristic.getValue(), 0, characteristic.getValue().length); processBroadcastReceiverState(characteristic.getValue(), characteristic); } } @Override public void onCharacteristicWrite( BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { log("onCharacteristicWrite: " + characteristic.getUuid().toString() + "status:" + status); if (status == 0 && characteristic.getUuid() .equals(BassConstants.BASS_BCAST_AUDIO_SCAN_CTRL_POINT)) { log("BASS_BCAST_AUDIO_SCAN_CTRL_POINT is written successfully"); } public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { Message m = obtainMessage(GATT_TXN_PROCESSED); m.arg1 = status; sendMessage(m); Loading Loading @@ -1112,7 +1084,6 @@ public class BassClientStateMachine extends StateMachine { * getAllSources */ public List<BluetoothLeBroadcastReceiveState> getAllSources() { log("getAllSources"); List list = new ArrayList(mBluetoothLeBroadcastReceiveStates.values()); return list; } Loading Loading @@ -1343,7 +1314,6 @@ public class BassClientStateMachine extends StateMachine { byte[] bcastSourceAddr = Utils.getBytesFromAddress(advSource.getAddress()); BassUtils.reverse(bcastSourceAddr); stream.write(bcastSourceAddr, 0, 6); log("Address bytes: " + advSource); // Advertising_SID stream.write(metaData.getSourceAdvertisingSid()); Loading @@ -1352,13 +1322,11 @@ public class BassClientStateMachine extends StateMachine { stream.write(metaData.getBroadcastId() & 0x00000000000000FF); stream.write((metaData.getBroadcastId() & 0x000000000000FF00) >>> 8); stream.write((metaData.getBroadcastId() & 0x0000000000FF0000) >>> 16); log("mBroadcastId: " + metaData.getBroadcastId()); // PA_Sync if (!mDefNoPAS) { stream.write(0x01); } else { log("setting PA sync to ZERO"); stream.write(0x00); } Loading Loading @@ -1390,7 +1358,6 @@ public class BassClientStateMachine extends StateMachine { } byte[] res = stream.toByteArray(); log("ADD_BCAST_SOURCE in Bytes"); BassUtils.printByteArray(res); return res; } Loading Loading @@ -1623,7 +1590,6 @@ public class BassClientStateMachine extends StateMachine { break; case ADD_BCAST_SOURCE: metaData = (BluetoothLeBroadcastMetadata) message.obj; log("Adding Broadcast source" + metaData); byte[] addSourceInfo = convertMetadataToAddSourceByteArray(metaData); if (addSourceInfo == null) { Log.e(TAG, "add source: source Info is NULL"); Loading @@ -1649,7 +1615,7 @@ public class BassClientStateMachine extends StateMachine { metaData = (BluetoothLeBroadcastMetadata) message.obj; int sourceId = message.arg1; int paSync = message.arg2; log("Updating Broadcast source" + metaData); log("Updating Broadcast source: " + metaData); byte[] updateSourceInfo = convertBroadcastMetadataToUpdateSourceByteArray( sourceId, metaData, paSync); if (updateSourceInfo == null) { Loading Loading @@ -1897,7 +1863,9 @@ public class BassClientStateMachine extends StateMachine { case SET_BCAST_CODE: case REMOVE_BCAST_SOURCE: case PSYNC_ACTIVE_TIMEOUT: log("defer the message:" + message.what + "so that it will be processed later"); log("defer the message: " + messageWhatToString(message.what) + ", so that it will be processed later"); deferMessage(message); break; default: Loading Loading @@ -1933,14 +1901,11 @@ public class BassClientStateMachine extends StateMachine { } switch (currentState) { case "Disconnected": log("Disconnected"); return BluetoothProfile.STATE_DISCONNECTED; case "Connecting": log("Connecting"); return BluetoothProfile.STATE_CONNECTING; case "Connected": case "ConnectedProcessing": log("connected"); return BluetoothProfile.STATE_CONNECTED; default: Log.e(TAG, "Bad currentState: " + currentState); Loading
android/app/src/com/android/bluetooth/bass_client/BassUtils.java +0 −4 Original line number Diff line number Diff line Loading @@ -54,10 +54,6 @@ class BassUtils { static void printByteArray(byte[] array) { log("Entire byte Array as string: " + Arrays.toString(array)); log("printitng byte by bte"); for (int i = 0; i < array.length; i++) { log("array[" + i + "] :" + Byte.toUnsignedInt(array[i])); } } static void reverse(byte[] address) { Loading