Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
228 changes: 118 additions & 110 deletions CHANGELOG.md

Large diffs are not rendered by default.

53 changes: 0 additions & 53 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,32 +34,21 @@ set(CMAKE_NO_SYSTEM_FROM_IMPORTED ON)
project(ctrlm-main VERSION ${CMAKE_PROJECT_VERSION})

# OPTIONS
option(A5000_ENABLE "ES1 A5000 use libse051" OFF)
option(ANSI_CODES_DISABLED "Disable ANSI code logging" OFF)
option(ASSERT_ON_WRONG_THREAD "Assert on wrong thread" OFF)
option(AUTH_ENABLED "Enable AUTH" OFF)
option(BLE_ENABLED "Enable BLE" ON)
option(BLE_SERVICES "Enable BLE Services" OFF)
option(BREAKPAD "Enable BREAKPAD" OFF)
option(BUILD_CTRLM_FACTORY "Build Control Factory Test" OFF)
option(DEEPSLEEP_CLOSE_DB "Deep Sleep Close DB" OFF)
option(ENABLE_NETWORKED_STANDBY_MODE "Enable Networked Standby Mode)" OFF)
option(FACTORY_AUDIO_PLAYBACK "Factory test audio playback" OFF)
option(FACTORY_CUSTOM_AUDIO_ANALYSIS "Factory custom audio analysis" OFF)
option(FDC_ENABLED "Enable FDC" OFF)
option(IP_ENABLED "Enable IP" OFF)
option(LOCAL_MIC "Local Microphone" OFF)
option(LOCAL_MIC_DISABLE_VIA_PRIVACY "Use Privacy to disable microphone" OFF)
option(MEM_DEBUG "Enable memory debugging" OFF)
option(MEMORY_LOCK "Memory Lock" OFF)
option(MIC_TAP "Enable MIC_TAP" OFF)
option(RF4CE_ENABLED "Enable RF4CE" ON)
option(TELEMETRY_SUPPORT "Enable TELEMETRY_SUPPORT" OFF)
option(THUNDER "Enable THUNDER" ON)
option(THUNDER_SECURITY "Enable THUNDER_SECURITY" OFF)
option(USE_SAFEC "Use safec" OFF)
option(USE_IARM_POWER_MANAGER "Use IARM Power Manager" OFF)
option(VOICE_KEYWORD_BEEP "Enable VOICE_KEYWORD_BEEP" OFF)
option(XRSR_HTTP "Enable XRSR_HTTP" OFF)
option(XRSR_SDT "Enable XRSR_SDT" OFF)
option(ENABLE_ASYNC_SRVR_MSG "Enable Asynchronous Server Messaging Feature" OFF)
Expand Down Expand Up @@ -181,19 +170,10 @@ install(TARGETS controlMgr RUNTIME DESTINATION bin)
install(FILES ${CMAKE_BINARY_DIR}/ctrlm_config.json.template DESTINATION ${CMAKE_INSTALL_SYSCONFDIR} COMPONENT config )

# DEFINES FROM OPTIONS
if(A5000_ENABLE)
find_library( SE_HAL_PATH SE_HAL ${CMAKE_SYSROOT}/usr/lib/se051)
target_link_libraries(controlMgr ${SE_HAL_PATH})
endif()

if(ANSI_CODES_DISABLED)
add_compile_definitions(ANSI_CODES_DISABLED)
endif()

if(ASSERT_ON_WRONG_THREAD)
add_compile_definitions(ASSERT_ON_WRONG_THREAD)
endif()

if(BLE_ENABLED)
target_link_libraries(controlMgr BTMgr)
if(BLE_SERVICES)
Expand All @@ -207,10 +187,6 @@ if(BREAKPAD)
add_compile_definitions(BREAKPAD_SUPPORT)
endif()

if(DEEPSLEEP_CLOSE_DB)
add_compile_definitions(DEEPSLEEP_CLOSE_DB)
endif()

if(ENABLE_ASYNC_SRVR_MSG)
add_compile_definitions(SUPPORT_ASYNC_SRVR_MSG)
endif()
Expand All @@ -219,10 +195,6 @@ if(ENABLE_AVS_WITH_SDT)
add_compile_definitions(SUPPORT_VOICE_DEST_ALSA SUPPORT_ASYNC_SRVR_MSG)
endif()

if(ENABLE_NETWORKED_STANDBY_MODE)
add_compile_definitions(NETWORKED_STANDBY_MODE_ENABLED)
endif()

if(FDC_ENABLED)
add_compile_definitions(FDC_ENABLED)
endif()
Expand All @@ -231,25 +203,6 @@ if(IP_ENABLED)
add_compile_definitions(CTRLM_NETWORK_IP CTRLM_IP_HAL_LOG_ENABLED)
endif()

if(LOCAL_MIC)
add_compile_definitions(CTRLM_LOCAL_MIC)
if(MIC_TAP)
add_compile_definitions(CTRLM_LOCAL_MIC_TAP)
endif()
if(LOCAL_MIC_DISABLE_VIA_PRIVACY)
add_compile_definitions(CTRLM_LOCAL_MIC_DISABLE_VIA_PRIVACY)
endif()
endif()

if(MEM_DEBUG)
add_compile_definitions(MEM_DEBUG)
endif()

if(MEMORY_LOCK)
add_compile_definitions(MEMORY_LOCK)
target_link_libraries(controLMgr clnl)
endif()

# RF4CE options
if(RF4CE_ENABLED)
# All RF4CE platforms have HAL NVM
Expand Down Expand Up @@ -303,12 +256,6 @@ else()
add_compile_definitions(SAFEC_DUMMY_API)
endif()

if(VOICE_KEYWORD_BEEP)
add_compile_definitions(BEEP_ON_KWD_ENABLED)
add_definitions(-DBEEP_ON_KWD_FILE=\"${CMAKE_DATADIR}/${BEEP_ON_KWD_FILE}\")
install(FILES ${CMAKE_SOURCE_DIR}/../${BEEP_ON_KWD_FILE} DESTINATION share )
endif()

if(USE_DEPRECATED_HDMI_INPUT_PLUGIN)
add_compile_definitions(USE_DEPRECATED_HDMI_INPUT_PLUGIN)
endif()
Expand Down
2 changes: 1 addition & 1 deletion src/auth/ctrlm_auth_certificate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ctrlm_auth_certificate_t::ctrlm_auth_certificate_t() {

char *cert_path = NULL;
char *cert_password = NULL;
rdkcertselector_h cert_selector = rdkcertselector_new( NULL, NULL, "MTLS" );
rdkcertselector_h cert_selector = rdkcertselector_new( NULL, NULL, "FBK_MTLS" );

if(cert_selector == NULL){
XLOGD_TELEMETRY("cert selector init failed");
Expand Down
79 changes: 59 additions & 20 deletions src/ble/ctrlm_ble_network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,6 @@ void ctrlm_obj_network_ble_t::req_process_voice_session_begin(void *data, int si

// only support ADPCM from ble-rcu component
ctrlm_hal_ble_VoiceEncoding_t encoding = CTRLM_HAL_BLE_ENCODING_ADPCM;
ctrlm_hal_ble_VoiceStreamEnd_t streamEnd = CTRLM_HAL_BLE_VOICE_STREAM_END_ON_KEY_UP;

ctrlm_voice_format_t voice_format = { .type = CTRLM_VOICE_FORMAT_INVALID };

Expand All @@ -543,43 +542,43 @@ void ctrlm_obj_network_ble_t::req_process_voice_session_begin(void *data, int si
audio_format.getHeaderInfoAdpcm(adpcm_frame->offset_step_size_index, adpcm_frame->offset_predicted_sample_lsb, adpcm_frame->offset_predicted_sample_msb, adpcm_frame->offset_sequence_value, adpcm_frame->shift_sequence_value, adpcm_frame->sequence_value_min, adpcm_frame->sequence_value_max);

pressAndHoldSupport = audio_format.getPressAndHoldSupport();
if(!pressAndHoldSupport) {
streamEnd = CTRLM_HAL_BLE_VOICE_STREAM_END_ON_AUDIO_DURATION;
}
controllers_[controller_id]->setPressAndHoldSupport(pressAndHoldSupport);
}
}

ctrlm_voice_start_audio_params_t audio_start_params;
audio_start_params.m_controller_id = controller_id;
audio_start_params.m_fd = -1;
audio_start_params.m_started = false;
auto audio_start_cb = std::bind(&ctrlm_obj_network_ble_t::start_controller_audio_streaming, this, std::placeholders::_1);

voice_status = ctrlm_get_voice_obj()->voice_session_req(network_id_get(), controller_id, device, voice_format, NULL,
controllers_[controller_id]->get_model().c_str(),
controllers_[controller_id]->get_sw_revision().to_string().c_str(),
controllers_[controller_id]->get_hw_revision().to_string().c_str(), 0.0,
false, NULL, NULL, NULL, true, pressAndHoldSupport);
false, NULL, NULL, NULL, true, pressAndHoldSupport, audio_start_cb, &audio_start_params);
if (!controllers_[controller_id]->get_capabilities().has_capability(ctrlm_controller_capabilities_t::capability::PAR) && (VOICE_SESSION_RESPONSE_AVAILABLE_PAR_VOICE == voice_status)) {
XLOGD_WARN("PAR voice is enabled but not supported by BLE controller treating as normal voice session");
voice_status = VOICE_SESSION_RESPONSE_AVAILABLE;
}
if (VOICE_SESSION_RESPONSE_AVAILABLE != voice_status) {
XLOGD_TELEMETRY("Failed opening voice session in ctrlm_voice_t, error = <%d>", voice_status);
} else {
int fd = -1;
bool success = false;

if (ble_rcu_interface_) {
int fd = -1;

if (!ble_rcu_interface_->startAudioStreaming(ieee_address, encoding, streamEnd, fd)) {
XLOGD_ERROR("failed to start audio streaming on remote");
} else {
if (!audio_start_params.m_started) { // voice session req did not need to start audio
start_controller_audio_streaming(&audio_start_params);
}
fd = audio_start_params.m_fd;

if (fd < 0) {
XLOGD_ERROR("Voice streaming pipe invalid (fd = <%d>), aborting voice session", fd);
success = false;
} else {
XLOGD_INFO("Acquired voice streaming pipe fd = <%d>, sending to voice engine", fd);
//Send the fd acquired from bluez to the voice engine
success = ctrlm_get_voice_obj()->voice_session_data(network_id_get(), controller_id, fd);
}
}
if (fd < 0) {
XLOGD_ERROR("Voice streaming pipe invalid (fd = <%d>), aborting voice session", fd);
success = false;
} else {
XLOGD_INFO("Acquired voice streaming pipe fd = <%d>, sending to voice engine", fd);
//Send the fd acquired from bluez to the voice engine
success = ctrlm_get_voice_obj()->voice_session_data(network_id_get(), controller_id, fd);
}

if (false == success) {
Expand Down Expand Up @@ -2616,3 +2615,43 @@ ctrlm_controller_id_t ctrlm_obj_network_ble_t::find_controller_from_upgrade_sess
}
return id;
}

void ctrlm_obj_network_ble_t::start_controller_audio_streaming(ctrlm_voice_start_audio_params_t *params) {
THREAD_ID_VALIDATE();
int fd = -1;
ctrlm_controller_id_t id = params->m_controller_id;
params->m_fd = fd;
params->m_started = false;

if (!ready_) {
XLOGD_FATAL("Network is not ready!");
return;
}

if(!controller_exists(id)) {
XLOGD_WARN("Controller %u doesn't exist.", id);
return;
}

if (!ble_rcu_interface_) {
XLOGD_WARN("ble rcu interface not ready");
return;
}

ctrlm_hal_ble_VoiceEncoding_t encoding = CTRLM_HAL_BLE_ENCODING_ADPCM;
ctrlm_hal_ble_VoiceStreamEnd_t streamEnd = CTRLM_HAL_BLE_VOICE_STREAM_END_ON_KEY_UP;
auto rcu = controllers_.at(id);

if (rcu->getPressAndHoldSupport()) {
streamEnd = CTRLM_HAL_BLE_VOICE_STREAM_END_ON_AUDIO_DURATION;
}

uint64_t ieee_address = rcu->ieee_address_get().get_value();
if (!ble_rcu_interface_->startAudioStreaming(ieee_address, encoding, streamEnd, fd)) {
XLOGD_ERROR("failed to start audio streaming on remote");
return;
}

params->m_fd = fd;
params->m_started = true;
}
2 changes: 2 additions & 0 deletions src/ble/ctrlm_ble_network.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ class ctrlm_obj_network_ble_t : public ctrlm_obj_network_t {

std::shared_ptr<ConfigSettings> getConfigSettings();

virtual void start_controller_audio_streaming(ctrlm_voice_start_audio_params_t *params);

private:
ctrlm_obj_network_ble_t();

Expand Down
1 change: 1 addition & 0 deletions src/ctrlm.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ gboolean ctrlm_is_one_touch_autobind_active(void);
gboolean ctrlm_is_binding_table_empty(void);
gboolean ctrlm_is_binding_table_full(void);
bool ctrlm_is_pii_mask_enabled(void);
bool ctrlm_is_networked_standby_supported(void);
gboolean ctrlm_main_has_device_id_get(void);
gboolean ctrlm_main_has_device_type_get(void);
gboolean ctrlm_main_has_service_account_id_get(void);
Expand Down
4 changes: 0 additions & 4 deletions src/ctrlm_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@

#include <stdio.h>

#ifdef ANSI_CODES_DISABLED
#define XLOG_OPTS_DEFAULT (XLOG_OPTS_DATE | XLOG_OPTS_TIME | XLOG_OPTS_LF | XLOG_OPTS_MOD_NAME | XLOG_OPTS_LEVEL)
#else
#define XLOG_OPTS_DEFAULT (XLOG_OPTS_DATE | XLOG_OPTS_TIME | XLOG_OPTS_LF | XLOG_OPTS_MOD_NAME | XLOG_OPTS_LEVEL | XLOG_OPTS_COLOR)
#endif

#ifndef XLOG_MODULE_ID
#define XLOG_MODULE_ID XLOG_MODULE_ID_CTRLM
Expand Down
Loading
Loading