clog.info("Socket_SEND_Thread data:{} {}".format(data[0],data[1]))
count=20
- while count & self.ack_sem :
+ while count and self.ack_sem :
utime.sleep_ms(1)
count=count-1
# if data[2]:
clog.info("Socket_SEND_Thread while data:{} {}".format(data[0],data[1]))
if data:
- clog.info("data ok!!")
+ clog.info("data ok!! {} {}".format(self.ack_sem,count))
else:
clog.error("data error!!")
except Exception :
#endif
#ifdef SUPPORT_PHONE_SERVICE
-#include "PhoneService.h"
+#include "phoneservice/include/PhoneService.h"
#include "phoneservice/include/PhoneServiceC.h"
#endif
bool AssistantModel::StartAssistant(void) {
#ifdef SUPPORT_PHONE_SERVICE
if (uapi_open_voice_recognition() == 0) {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uapi_open_voice_recognition is
- ok");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uapi_open_voice_recognition is ok");
//成功开启语音助手
uapi_dev_runtime_set_voice_status(1);
return true;
#include "custom_utils.h"
#include "notification_manager.h"
-#ifdef SUPPORT_PHONE_SERVICE
+#ifdef SUPPORT_CAT1_HFP_AG_SERV
#include "phoneservice/include/PhoneAGService.h"
#endif
jumpView->ChangeView(JumpView::BluetoothJumpViewNum::BLUETOOTHDEVICELISTVIEW,
JumpView::BluetoothJumpViewNum::BLUETOOTHEOPTIONSVIEW);
}
- #ifdef SUPPORT_BT_SERVICE
+ #ifdef SUPPORT_CAT1_HFP_AG_SERV
else if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERSETTING)
{
MainBluetoothView *mainBluetoothView = MainBluetoothView::GetInstance();
#include "custom_utils.h"\r
#include "notification_manager.h"\r
\r
-#ifdef SUPPORT_PHONE_SERVICE\r
+#ifdef SUPPORT_CAT1_HFP_AG_SERV\r
#include "phoneservice/include/PhoneAGService.h"\r
#endif\r
\r
if(OHOS::CallerLogModel::GetInstance()->GetCallSource() == OHOS::CallerLogModel::CallSourceCat1\r
&& OHOS::NotificationManager::GetInstance()->GetWatchCallStatus())\r
{\r
- #ifdef SUPPORT_BT_SERVICE\r
+ #ifdef SUPPORT_CAT1_HFP_AG_SERV\r
bool SCOConnected = headset_SCO_Is_connect_extend( (bd_addr_t *)&infoData.addr);\r
#else\r
bool SCOConnected = false;\r
#include "lwip_driver_adapter.h"\r
#endif\r
\r
+#ifdef SUPPORT_CAT1_HFP_AG_SERV\r
+#include "phoneservice/include/PhoneAGService.h"\r
+#endif\r
+\r
#ifdef SUPPORT_BLE_SERVICE\r
#include <bleEvent.h>\r
#include "bleService.h"\r
#include "vibrator_service.h"\r
#include "ConfigModel.h"\r
\r
-#ifdef SUPPORT_PHONE_SERVICE\r
-#include "phoneservice/include/PhoneAGService.h"\r
-#endif\r
\r
#include "custom_save_runtime.h"\r
#include "bluetooth/include/BluetoothHeadsetEvent.h"\r
PhoneAudioManagerSetDeviceConnState(OUT_BLUETOOTH_A2DP, AUDIO_DEVICE_CONNECTED);\r
GraphicService::GetInstance()->PostGraphicEvent(std::bind(ACLConnectionSuss, *bdAddr));\r
\r
- #ifdef SUPPORT_BLE_SERVICE\r
- // SendMsgToUIService(EARPHONE_CONNECTED_TO_UI, 0, nullptr, 0);\r
+ #ifdef SUPPORT_CAT1_HFP_AG_SERV\r
+ SendMsgToUIService(EARPHONE_CONNECTED_TO_UI, 0, nullptr, 0);\r
\r
-\r
-\r
uapi_dev_runtime_set_earphone_connect_stat(1);\r
uapi_save_runtime_log(RUNTIME_LOG_BR_CONNECT_A2DP_HEADSET);\r
- // if(headset_Is_connect() == false)\r
- // do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CONNECT_AG, nullptr, 0);\r
+ if(headset_Is_connect() == false)\r
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CONNECT_AG, nullptr, 0);\r
\r
#endif\r
\r
#endif
#include "alarm/include/AlarmClockModel.h"
-// #ifdef SUPPORT_PHONE_SERVICE
+#ifdef SUPPORT_CAT1_HFP_AG_SERV
#include "phoneservice/include/PhoneAGService.h"
-// #endif
+#endif
#include "custom_save_runtime.h"
#ifdef SUPPORT_CAT1_HFP_AG_SERV
if(headset_Is_connect())
{
- // cat1_ag_send_call_event(TOPIC_EVENT_CAT1_CALLENDED,NULL);
+ cat1_ag_send_call_event(TOPIC_EVENT_CAT1_CALLENDED,NULL);
}
#endif
}
}
if(headset_SCO_Is_connect()==true && cat1_api_get_cat1_volte_voice_state()!=2)
{
- if(cat1_api_get_cat1_volte_voice_state()==2)
+ if(cat1_api_get_cat1_volte_voice_state()==1)
{
do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_STOP, nullptr, 0);
}
- do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_AUDIO_START, nullptr, 0);
+ else
+ {
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_AUDIO_START, nullptr, 0);
+ }
}
}
#endif
#include "ui_resource_string.h"
-#ifdef SUPPORT_PHONE_SERVICE
+#ifdef SUPPORT_CAT1_HFP_AG_SERV
#include "phoneservice/include/PhoneAGService.h"
#endif
DialingMethodView::GetInstance()->fail_Dial_show(1);
}
else
- DialCall((unsigned char *)get_address_number(),strlen(get_address_number()));
+ {
+ DialCall((unsigned char *)get_address_number(),strlen(get_address_number()));
+ }
}
else
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallLOGListitemView::SetItemInfo");
if(data==NULL)
{
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallLOGListitemView::data is NULL");
return;
}
static void sample_hfp_ag_sco_conn_state_changed_callback(const bd_addr_t *bd_addr, hfp_sco_connect_state_t state)
{
// sample_hfp_ag_print_addr(bd_addr);
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"state: %d\n", state);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"sample_hfp_ag_sco_conn_state_changed_callback state: %d\n", state);
osal_kthread_handler task_body = NULL;
switch (state) {
case HFP_SCO_STATE_CONNECTING:
{
return 0;
}
+
+ cat1_api_set_MicMute_volte_voice(isMute);
#endif
- ret=AudioStreamOutSetMute(isMute);
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioStreamOutSetMute] end! ret = %d", ret);
return 0;
#include "gfx_utils/mem_api.h"
#include "ConfigModelC.h"
#include "UiConfig.h"
+#ifdef SUPPORT_CAT1_HFP_AG_SERV
#include "phoneservice/include/PhoneAGService.h"
+#endif
#include "cmath"
#include "phone_crt.h"
void PhoneServiceInit(void)
{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[PhoneServiceInit] start");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[PhoneServiceInit] start");
g_scoFlag = HFP_SCO_STATE_DISCONNECTED;
AudioInit();
InitMutex();
RegisterHfpHfCallbacks();
//AG 服务注册
#ifdef SUPPORT_CAT1_HFP_AG_SERV
- // hfp_ag_reg_callback();
+ hfp_ag_reg_callback();
#endif
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[PhoneServiceInit] end");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[PhoneServiceInit] end");
}
// 手表主动拨打电话
#endif
#ifdef FD230
+
+#ifdef SUPPORT_CAT1_HFP_AG_SERV
+#include "phoneservice/include/PhoneAGService.h"
+#endif
+
#include "ConfigModel.h"
#include "PlayersModelC.h"
#include "PlayersModel.h"
}
else
{
+ if(cat1_api_get_cat1_volte_voice_state()==0)
do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_AUDIO_START, nullptr, 0);
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "headset_Is_connect is false");
}
if(headset_SCO_Is_connect())
{
+ if(cat1_api_get_cat1_volte_voice_state()==0)
do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_AUDIO_START, nullptr, 0);
}
}
#include "custom_utils.h"
#include "notification_manager.h"
-#ifdef SUPPORT_PHONE_SERVICE
+#ifdef SUPPORT_CAT1_HFP_AG_SERV
#include "phoneservice/include/PhoneAGService.h"
#endif
#include "custom_utils.h"\r
#include "notification_manager.h"\r
\r
-#ifdef SUPPORT_PHONE_SERVICE\r
+#ifdef SUPPORT_CAT1_HFP_AG_SERV\r
#include "phoneservice/include/PhoneAGService.h"\r
#endif\r
\r
#include "vibrator_service.h"\r
#include "ConfigModel.h"\r
\r
-#ifdef SUPPORT_PHONE_SERVICE\r
+#ifdef SUPPORT_CAT1_HFP_AG_SERV\r
#include "phoneservice/include/PhoneAGService.h"\r
#endif\r
\r
#endif
#include "alarm/include/AlarmClockModel.h"
-#ifdef SUPPORT_PHONE_SERVICE
+#ifdef SUPPORT_CAT1_HFP_AG_SERV
#include "phoneservice/include/PhoneAGService.h"
#endif
#include "ui_resource_string.h"
-#ifdef SUPPORT_PHONE_SERVICE
+#ifdef SUPPORT_CAT1_HFP_AG_SERV
#include "phoneservice/include/PhoneAGService.h"
#endif
#include "gfx_utils/mem_api.h"
#include "ConfigModelC.h"
#include "UiConfig.h"
+
+#ifdef SUPPORT_CAT1_HFP_AG_SERV
#include "phoneservice/include/PhoneAGService.h"
+#endif
+
#include "cmath"
#ifdef __cplusplus
extern "C" {
int32_t AudioStreamInSetBitRate(uint32_t bitrate)
{
std::string str("setbitrate = " + std::to_string(bitrate));
- if (g_streamIn == nullptr) {\r
+ if (g_streamIn == nullptr) {
ALOGE("audio stream in handle is NUll!");
- return AUDIO_ERROR;\r
+ return AUDIO_ERROR;
}
int32_t ret = g_streamIn->SetParam(str.c_str(), str.size());
if (ret != AUDIO_SUCCESS) {
int32_t AudioStreamOutSetMute(bool mute)
{
- int32_t ret = g_streamOut->SetMute(mute);
- if (ret != AUDIO_SUCCESS) {
- ALOGE("audio stream out set mute failed 0x%x", ret);
- return AUDIO_ERROR;
- }
+ if(g_streamOut)
+ {
+ int32_t ret = g_streamOut->SetMute(mute);
+ if (ret != AUDIO_SUCCESS) {
+ ALOGE("audio stream out set mute failed 0x%x", ret);
+ return AUDIO_ERROR;
+ }
+
- ALOGD("success");
- return AUDIO_SUCCESS;
+ ALOGD("success");
+ return AUDIO_SUCCESS;
+ }
+ ALOGD("g_streamOut is null");
+ return AUDIO_ERROR;
+
}
int32_t AudioManagerSetSeaEnable(bool enable)
ALOGE("aef param null");
return AUDIO_ERROR;
}
- if (g_a2dpCtx == nullptr || g_a2dpCtx->a2dpAsohandle == nullptr) {\r
+ if (g_a2dpCtx == nullptr || g_a2dpCtx->a2dpAsohandle == nullptr) {
ALOGE("aso handle is null!");
- return AUDIO_ERROR;\r
+ return AUDIO_ERROR;
}
char *aefBuf = (char *)malloc(AEF_BUFFER_SIZE);
if (aefBuf == nullptr) {
ALOGE("sprintf_s failed");
return AUDIO_ERROR;
}
- if (g_a2dpCtx == nullptr || g_a2dpCtx->a2dpAsohandle == nullptr) {\r
- ALOGE("aso handle is null!");\r
- return AUDIO_ERROR;\r
- }\r
+ if (g_a2dpCtx == nullptr || g_a2dpCtx->a2dpAsohandle == nullptr) {
+ ALOGE("aso handle is null!");
+ return AUDIO_ERROR;
+ }
ret = g_a2dpCtx->a2dpAsohandle->SetParam(buf, BUFFER_SIZE);
if (ret != AUDIO_SUCCESS) {
ALOGE("set aso param failed");
MEDIA_ERR_LOG("release audio focus failed");
return nullptr;
}
-
+
return nullptr;
}
static int32_t StartVoiceCall(const char **param)
{
MediaMutexLock(g_voiceCallVolteContextMutex);
- int32_t type = strtol(param[0x1], nullptr, NUMBER_BASE);
+ int32_t type = 0;//strtol(param[0x1], nullptr, NUMBER_BASE);
if (g_voiceCallVolteContext != nullptr) {
MEDIA_ERR_LOG("invalid operation");
goto EXIT;
// For Bluetooth voice call, we only support type 0 (normal voice call)
if (type == 0) {
- MediaThreadattr attr = { "VoiceCallVolteThread", 0x2000, THREAD_SCHED_INVALID, 0, true };
+ MediaThreadattr attr = { "VoiceCallVolteThreadbluetooth", 0x2000, THREAD_SCHED_INVALID, 0, false };
MediaThreadIdHandle taskHandle = MediaThreadCreate(VoiceCallVolteThread, g_voiceCallVolteContext, &attr);
if (taskHandle == nullptr) {
MEDIA_ERR_LOG("create voice call volte thread failed");
return -1;
}
g_voiceCallVolteContext->taskHandle = taskHandle;
- } else {
+ } else {
MEDIA_ERR_LOG("unsupported voice call type: %d", type);
free(g_voiceCallVolteContext);
g_voiceCallVolteContext = nullptr;
g_voiceCallVolteContext->isVoiceCallVolteStopped = true;
MediaThreadCondSignal(g_voiceCallVolteContext->cond);
MediaMutexUnLock(g_voiceCallVolteContext->mutex);
-
+
MediaThreadJoin(&g_voiceCallVolteContext->taskHandle);
(void)MediaThreadCondDestroy(&g_voiceCallVolteContext->cond);
(void)MediaMutexDestroy(&g_voiceCallVolteContext->mutex);
MEDIA_ERR_LOG("not support set mic mute!");
return -1;
}
-
+ printf("VoiceCallMicMute : %s\r\n",param[0x1]);
+ int32_t mute=0;
int32_t mute = strtol(param[0x1], nullptr, NUMBER_BASE);
- int32_t ret = 0;
- if (mute == 0) {
- ret = AudioStreamOutSetMute(false);
- } else {
- ret = AudioStreamOutSetMute(true);
+ int32_t ret = -1;
+ printf("AudioStreamOutSetMute : %d\r\n",mute);
+
+ if(g_streamOutUplink)
+ {
+ ret = g_streamOutUplink->SetMute(mute);
}
+
+ if(g_streamOutDownink)
+ {
+ ret = g_streamOutDownink->SetMute(mute);
+ }
+
+
if (ret != 0) {
MEDIA_ERR_LOG("set mic mute failed");
int32_t VoiceCallVolteBluetoothSample(int32_t argc, const char *argv[])
{
MEDIA_UNUSED(argc);
- MEDIA_INFO_LOG("enter bluetooth voice call volte sample");
+ printf("enter bluetooth voice call volte sample\r\n");
- MEDIA_INFO_LOG("input param:%s", argv[0]);
+ printf("input param:%s\r\n", argv[0]);
int32_t ret = -1;
for (uint32_t i = 0; i < ARRAY_SIZE(g_voiceCallVolteFuncs); i++) {
} else {
continue;
}
- MEDIA_INFO_LOG("%s execute %s", g_voiceCallVolteFuncs[i].cmd, (ret != 0) ? "failed" : "success");
+ printf("%s execute %s \r\n", g_voiceCallVolteFuncs[i].cmd, (ret != 0) ? "failed" : "success");
}
// will free g_voiceCallVolteContext when voice call volte exit
- MEDIA_INFO_LOG("exit");
+ printf("exit\r\n");
return 0;
}
extern void restart_sleep_cat1_timer(void);
void cat1_ring_isr_callback(pin_t pin, uintptr_t param)
{
- // cat1_print_warning("cat1_ring_isr_callback %d 0x%X\n",pin,param);
+ printf("cat1_ring_isr_callback %d 0x%X\n",pin,param);
uapi_gpio_clear_interrupt(pin);
// do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_ADD_CAT1VOTE,NULL,0);
cat1_api_add_cat1_vote();
// #if PY_SRV_VER_CURRENT >=16
if(g_py_ver>=16)
{
- if(osTimerIsRunning(g_timer_time_Dial)==0 )
+ if(osTimerIsRunning(g_timer_time_Dial)==0 )
{
- osStatus_t ret = osTimerStart(g_timer_time_Dial,5000);
+ osStatus_t ret = osTimerStart(g_timer_time_Dial,8000);
cat1_print_info("cat1 g_timer_time_Dial timer ret %d\n",ret);
}
}
g_msg_callback_func(MESSAGE_4G_NETWORK_STAT_CHANGED,NULL,0);
}
}
- if(osTimerIsRunning(g_timer_time_sync)==1 )
- {
- osStatus_t ret = osTimerStop(g_timer_time_sync);
- cat1_print_info("cat1 powered off, stop timer , ret %d\n",ret);
- }
+ // if(osTimerIsRunning(g_timer_time_sync)==1 )
+ // {
+ // osStatus_t ret = osTimerStop(g_timer_time_sync);
+ // cat1_print_info("cat1 powered off, stop timer , ret %d\n",ret);
+ // }
return ;
}else{
if (cat1_api_runtime_get_cat1_powerstat()==0)
if (g_msg_callback_func!=NULL)
g_msg_callback_func(MESSAGE_4G_CALL_CONNECTED,phonenum,strlen(phonenum));
- cat1_api_start_cat1_volte_voice();
return 1;
}
//来电挂断处理
if (g_msg_callback_func!=NULL)
g_msg_callback_func(MESSAGE_4G_CALL_DISCONNECTED,phonenum,strlen(phonenum));
- cat1_api_stop_cat1_volte_voice();
return 1;
}
void cat1_UI_call_dial(char *tell);
+int32_t cat1_api_set_MicMute_volte_voice(bool data);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
if(cat1_voice!=0)
{
- ret = VoiceCallVolteSample(argc, (const char **)&argv);
+ if(cat1_voice==2)
+ {
+ ret = VoiceCallVolteBluetoothSample(argc, (const char **)&argv);
+ }
+ else
+ {
+ ret = VoiceCallVolteSample(argc, (const char **)&argv);
+ }
if(ret==0)
cat1_voice=0;
}
- cat1_print_dbg("ret %d %d ",ret, cat1_voice);
+ cat1_print_dbg("cat1_api_stop_cat1_volte_voice ret %d %d ",ret, cat1_voice);
return ret;
}
int32_t argc = 1;
uint8_t *argv = (uint8_t *)"start";
- if(cat1_voice!=0)
+ cat1_print_dbg("cat1_cat1_start_SCO_volte_voice %d \n",cat1_voice);
+
+ if(cat1_voice==0)
{
ret = VoiceCallVolteBluetoothSample(argc, (const char **)&argv);
if(ret==0)
cat1_voice=2;
}
+ else
+ {
+ cat1_print_dbg("cat1_voice!=0");
+ }
- cat1_print_dbg("ret %d %d ",ret, cat1_voice);
+ cat1_print_dbg("cat1_cat1_start_SCO_volte_voice ret %d %d ",ret, cat1_voice);
return ret;
}
+
+int32_t cat1_api_set_MicMute_volte_voice(bool data)
+{
+ cat1_print_dbg("cat1_api_set_MicMute_volte_voice\n");
+
+ int32_t ret = ERRCODE_FAIL;
+ int32_t argc = 2;
+ const char * argv[] ={"mute", "1"};
+ if(data)
+ {
+ argv[1]="1";
+ }
+ else
+ {
+ argv[1]="0";
+ }
+
+ if(cat1_voice!=0)
+ {
+ if(cat1_voice==2)
+ {
+ ret = VoiceCallVolteBluetoothSample(argc, argv);
+ }
+ else
+ {
+ ret = VoiceCallVolteSample(argc, argv);
+ }
+ }
+
+ cat1_print_dbg("cat1_api_set_MicMute_volte_voice ret %d %d ",ret, cat1_voice);
+
+ return ret;
+}
+
+
#include "power_display_service.h"
/*获取屏幕状态: return 1 need update */
const power_display_svr_api_t *display_api = power_display_svr_get_api();
screen_state_t state = display_api->get_screen_state();
- // printf("uapi_get_screen_state = %s . \r\n", state==SCREEN_ON?"on":"off");
+ printf("uapi_get_screen_state = %s . \r\n", state==SCREEN_ON?"on":"off");
if( state == SCREEN_ON){
return 1;
}else{
#define CUSTOM_CMD_MSG_STOP_CHECK_MIC 0x1E
+#define CUSTOM_CMD_MSG_CONNECT_AG 0x1F
+
typedef enum {
BR_HFP_CONNECT=1,
BR_HFP_DISCONNECT,