Loading android/app/jni/com_android_bluetooth_le_audio.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -514,6 +514,17 @@ static void setCodecConfigPreferenceNative(JNIEnv* env, jobject object, group_id, input_codec_config, output_codec_config); } static void setCcidInformationNative(JNIEnv* env, jobject object, jint ccid, jint contextType) { std::shared_lock<std::shared_timed_mutex> lock(interface_mutex); if (!sLeAudioClientInterface) { LOG(ERROR) << __func__ << ": Failed to get the Bluetooth LeAudio Interface"; return; } sLeAudioClientInterface->SetCcidInformation(ccid, contextType); } static JNINativeMethod sMethods[] = { {"classInitNative", "()V", (void*)classInitNative}, {"initNative", "([Landroid/bluetooth/BluetoothLeAudioCodecConfig;)V", Loading @@ -528,6 +539,7 @@ static JNINativeMethod sMethods[] = { "(ILandroid/bluetooth/BluetoothLeAudioCodecConfig;Landroid/bluetooth/" "BluetoothLeAudioCodecConfig;)V", (void*)setCodecConfigPreferenceNative}, {"setCcidInformationNative", "(II)V", (void*)setCcidInformationNative}, }; /* Le Audio Broadcaster */ Loading android/app/src/com/android/bluetooth/le_audio/LeAudioNativeInterface.java +13 −0 Original line number Diff line number Diff line Loading @@ -265,6 +265,18 @@ public class LeAudioNativeInterface { setCodecConfigPreferenceNative(groupId, inputCodecConfig, outputCodecConfig); } /** * Set content control id (Ccid) along with context type. * @param ccid content control id * @param contextType assigned contextType */ public void setCcidInformation(int ccid, int contextType) { if (DBG) { Log.d(TAG, "setCcidInformation ccid: " + ccid + " context type: " + contextType); } setCcidInformationNative(ccid, contextType); } // Native methods that call into the JNI interface private static native void classInitNative(); private native void initNative(BluetoothLeAudioCodecConfig[] codecConfigOffloading); Loading @@ -277,4 +289,5 @@ public class LeAudioNativeInterface { private native void setCodecConfigPreferenceNative(int groupId, BluetoothLeAudioCodecConfig inputCodecConfig, BluetoothLeAudioCodecConfig outputCodecConfig); private native void setCcidInformationNative(int ccid, int contextType); } system/bta/include/bta_le_audio_api.h +1 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ class LeAudioClient { int group_id, bluetooth::le_audio::btle_audio_codec_config_t input_codec_config, bluetooth::le_audio::btle_audio_codec_config_t output_codec_config) = 0; virtual void SetCcidInformation(int ccid, int context_type) = 0; virtual std::vector<RawAddress> GetGroupDevices(const int group_id) = 0; static void AddFromStorage(const RawAddress& addr, bool autoconnect); static bool IsLeAudioClientRunning(); Loading system/bta/le_audio/client.cc +32 −3 Original line number Diff line number Diff line Loading @@ -307,6 +307,14 @@ class LeAudioClientImpl : public LeAudioClient { group_remove_node(group, address); } int GetCcid(le_audio::types::LeAudioContextType context_type) { if (ccids_.count(context_type) == 0) { return -1; } return ccids_[context_type]; } /* This callback happens if kLeAudioDeviceSetStateTimeoutMs timeout happens * during transition from origin to target state */ Loading Loading @@ -612,7 +620,8 @@ class LeAudioClientImpl : public LeAudioClient { } bool result = groupStateMachine_->StartStream( group, static_cast<LeAudioContextType>(final_context_type)); group, static_cast<LeAudioContextType>(final_context_type), GetCcid(static_cast<LeAudioContextType>(final_context_type))); if (result) stream_setup_start_timestamp_ = bluetooth::common::time_get_os_boottime_us(); Loading Loading @@ -701,6 +710,21 @@ class LeAudioClientImpl : public LeAudioClient { // TODO Implement } void SetCcidInformation(int ccid, int context_type) override { LOG_DEBUG("Ccid: %d, context type %d", ccid, context_type); std::bitset<16> test{static_cast<uint16_t>(context_type)}; auto ctx_type = static_cast<le_audio::types::LeAudioContextType>(context_type); if (test.count() > 1 || ctx_type >= le_audio::types::LeAudioContextType::RFU) { LOG_ERROR("Unknownd context type %d", context_type); return; } ccids_[ctx_type] = ccid; } void StartAudioSession(LeAudioDeviceGroup* group, LeAudioCodecConfiguration* source_config, LeAudioCodecConfiguration* sink_config) { Loading Loading @@ -3446,8 +3470,9 @@ class LeAudioClientImpl : public LeAudioClient { stream_setup_start_timestamp_ = 0; if (group && group->IsPendingConfiguration()) { SuspendedForReconfiguration(); if (groupStateMachine_->ConfigureStream(group, current_context_type_)) { if (groupStateMachine_->ConfigureStream( group, current_context_type_, GetCcid(current_context_type_))) { /* If configuration succeed wait for new status. */ return; } Loading Loading @@ -3489,6 +3514,10 @@ class LeAudioClientImpl : public LeAudioClient { /* Speaker(s) */ AudioState audio_sender_state_; /* Ccid informations */ std::map<le_audio::types::LeAudioContextType /* context */, int /*ccid */> ccids_; /* Current stream configuration */ LeAudioCodecConfiguration current_source_codec_config; LeAudioCodecConfiguration current_sink_codec_config; Loading system/bta/le_audio/client_linux.cc +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ class LeAudioClientImpl : public LeAudioClient { bluetooth::le_audio::btle_audio_codec_config_t input_codec_config, bluetooth::le_audio::btle_audio_codec_config_t output_codec_config) override {} void SetCcidInformation(int ccid, int context_type) override {} std::vector<RawAddress> GetGroupDevices(const int group_id) override { return {}; } Loading Loading
android/app/jni/com_android_bluetooth_le_audio.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -514,6 +514,17 @@ static void setCodecConfigPreferenceNative(JNIEnv* env, jobject object, group_id, input_codec_config, output_codec_config); } static void setCcidInformationNative(JNIEnv* env, jobject object, jint ccid, jint contextType) { std::shared_lock<std::shared_timed_mutex> lock(interface_mutex); if (!sLeAudioClientInterface) { LOG(ERROR) << __func__ << ": Failed to get the Bluetooth LeAudio Interface"; return; } sLeAudioClientInterface->SetCcidInformation(ccid, contextType); } static JNINativeMethod sMethods[] = { {"classInitNative", "()V", (void*)classInitNative}, {"initNative", "([Landroid/bluetooth/BluetoothLeAudioCodecConfig;)V", Loading @@ -528,6 +539,7 @@ static JNINativeMethod sMethods[] = { "(ILandroid/bluetooth/BluetoothLeAudioCodecConfig;Landroid/bluetooth/" "BluetoothLeAudioCodecConfig;)V", (void*)setCodecConfigPreferenceNative}, {"setCcidInformationNative", "(II)V", (void*)setCcidInformationNative}, }; /* Le Audio Broadcaster */ Loading
android/app/src/com/android/bluetooth/le_audio/LeAudioNativeInterface.java +13 −0 Original line number Diff line number Diff line Loading @@ -265,6 +265,18 @@ public class LeAudioNativeInterface { setCodecConfigPreferenceNative(groupId, inputCodecConfig, outputCodecConfig); } /** * Set content control id (Ccid) along with context type. * @param ccid content control id * @param contextType assigned contextType */ public void setCcidInformation(int ccid, int contextType) { if (DBG) { Log.d(TAG, "setCcidInformation ccid: " + ccid + " context type: " + contextType); } setCcidInformationNative(ccid, contextType); } // Native methods that call into the JNI interface private static native void classInitNative(); private native void initNative(BluetoothLeAudioCodecConfig[] codecConfigOffloading); Loading @@ -277,4 +289,5 @@ public class LeAudioNativeInterface { private native void setCodecConfigPreferenceNative(int groupId, BluetoothLeAudioCodecConfig inputCodecConfig, BluetoothLeAudioCodecConfig outputCodecConfig); private native void setCcidInformationNative(int ccid, int contextType); }
system/bta/include/bta_le_audio_api.h +1 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ class LeAudioClient { int group_id, bluetooth::le_audio::btle_audio_codec_config_t input_codec_config, bluetooth::le_audio::btle_audio_codec_config_t output_codec_config) = 0; virtual void SetCcidInformation(int ccid, int context_type) = 0; virtual std::vector<RawAddress> GetGroupDevices(const int group_id) = 0; static void AddFromStorage(const RawAddress& addr, bool autoconnect); static bool IsLeAudioClientRunning(); Loading
system/bta/le_audio/client.cc +32 −3 Original line number Diff line number Diff line Loading @@ -307,6 +307,14 @@ class LeAudioClientImpl : public LeAudioClient { group_remove_node(group, address); } int GetCcid(le_audio::types::LeAudioContextType context_type) { if (ccids_.count(context_type) == 0) { return -1; } return ccids_[context_type]; } /* This callback happens if kLeAudioDeviceSetStateTimeoutMs timeout happens * during transition from origin to target state */ Loading Loading @@ -612,7 +620,8 @@ class LeAudioClientImpl : public LeAudioClient { } bool result = groupStateMachine_->StartStream( group, static_cast<LeAudioContextType>(final_context_type)); group, static_cast<LeAudioContextType>(final_context_type), GetCcid(static_cast<LeAudioContextType>(final_context_type))); if (result) stream_setup_start_timestamp_ = bluetooth::common::time_get_os_boottime_us(); Loading Loading @@ -701,6 +710,21 @@ class LeAudioClientImpl : public LeAudioClient { // TODO Implement } void SetCcidInformation(int ccid, int context_type) override { LOG_DEBUG("Ccid: %d, context type %d", ccid, context_type); std::bitset<16> test{static_cast<uint16_t>(context_type)}; auto ctx_type = static_cast<le_audio::types::LeAudioContextType>(context_type); if (test.count() > 1 || ctx_type >= le_audio::types::LeAudioContextType::RFU) { LOG_ERROR("Unknownd context type %d", context_type); return; } ccids_[ctx_type] = ccid; } void StartAudioSession(LeAudioDeviceGroup* group, LeAudioCodecConfiguration* source_config, LeAudioCodecConfiguration* sink_config) { Loading Loading @@ -3446,8 +3470,9 @@ class LeAudioClientImpl : public LeAudioClient { stream_setup_start_timestamp_ = 0; if (group && group->IsPendingConfiguration()) { SuspendedForReconfiguration(); if (groupStateMachine_->ConfigureStream(group, current_context_type_)) { if (groupStateMachine_->ConfigureStream( group, current_context_type_, GetCcid(current_context_type_))) { /* If configuration succeed wait for new status. */ return; } Loading Loading @@ -3489,6 +3514,10 @@ class LeAudioClientImpl : public LeAudioClient { /* Speaker(s) */ AudioState audio_sender_state_; /* Ccid informations */ std::map<le_audio::types::LeAudioContextType /* context */, int /*ccid */> ccids_; /* Current stream configuration */ LeAudioCodecConfiguration current_source_codec_config; LeAudioCodecConfiguration current_sink_codec_config; Loading
system/bta/le_audio/client_linux.cc +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ class LeAudioClientImpl : public LeAudioClient { bluetooth::le_audio::btle_audio_codec_config_t input_codec_config, bluetooth::le_audio::btle_audio_codec_config_t output_codec_config) override {} void SetCcidInformation(int ccid, int context_type) override {} std::vector<RawAddress> GetGroupDevices(const int group_id) override { return {}; } Loading