}
}
+static bool auto_ota_dev_check_dev_name_is_true(unsigned char *dev_name)
+{
+ if (strncmp((const char *)dev_name, AUTO_OTA_DEV_NAME_PREFIX, AUTO_OTA_DEV_NAME_PREFIX_LEN) == 0) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+
+
/* 重置发现设备链表 */
void auto_ota_reset_found_dev_list(void)
{
if (auto_ota_dev_found(bd_addr->addr) != true && auto_ota_dev_check_dev_name(device_name) == true) {
auto_ota_add_node_to_found_dev_list(bd_addr, device_name, cod, 0);
}
-
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "auto_ota_discovery_result_callback end\n");
return;
}
char *dst_ver = (char *)malloc(sizeof(char) * (file_len + 1));
if (dst_ver == NULL) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "malloc fail, file_len = %d.\r\n", file_len);
+ fclose(fp);
return false;
}
WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "fread fail, file_len = %d.\r\n", file_len);
free(dst_ver);
dst_ver = NULL;
+ fclose(fp);
return false;
}
fclose(fp);
return;
}
bool res = auto_ota_spp_connect(uuid, bd_addr);
+
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "auto_ota_spp_connect %d", res);
if (res != true) {
(void)osSemaphoreRelease(g_auto_ota_transmit_done_sem);
return;
int32_t ret;
if(NotificationManager::GetInstance()->GetWatchCallStatus())
{
-
return 0;
}
}
playerCtr->SetAudioSessionId(sessionId);
playerCtr->SetVolume(amIntance.GetMaxVolume(AUDIO_STREAM_MUSIC),amIntance.GetMaxVolume(AUDIO_STREAM_MUSIC));
+ playerCtr->EnableSingleLooping(true);
// 播放
- playerCtr->Play();
+ // playerCtr->Play();
+
+ ret = playerCtr->Play();
+ if (ret != 0) {
+ playerCtr->Stop(); // 暂停
+ playerCtr->Reset(); // 初始化
+
+ AudioManager::GetInstance().DeactivateAudioInterrupt(interrupt);
+ }
return OHOS_SUCCESS;
}
int uapi_open_br_scan(void);
//int uapi_disconnect_remote_device_(void);
+int32_t BtA2dpSnkAudioDestroy(void);
+
int uapi_reconnect_(void);
return 0;\r
}\r
\r
-static int32_t BtA2dpSnkAudioDestroy()\r
+int32_t BtA2dpSnkAudioDestroy(void)\r
{\r
#if MEDIA_A2DP_SNK_INTERFACE\r
int32_t ret = AudioManagerA2dpSinkDestroy();\r
//
osTimerId_t g_shake = nullptr; // 循环震动定时器
-static constexpr uint64_t MS_ONE_SECONDS = 1000;
+static constexpr uint64_t MS_ONE_SECONDS = 2000;
static PhoneCallInfo callList[MULTI_CALL_MAX_NUME]{};
// 电话优先级标志位
static int g_firstPriority = NO_NUMBER_STATUS;
DisableCallingTimer();
if(CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourceCat1)
- uapi_cat1_stop_volte_voice();
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_STOP, nullptr, 0);
CallerLogModel::GetInstance()->Setphonebname("0",0);
CallerLogModel::GetInstance()->SetCallDial(CallerLogModel::HFP_PHONE_DIAL);
if(!MainCallingView::GetInstance()->GetDisplayGroup()->IsVisible())
{
if(!volte_voice_state())
- uapi_cat1_start_volte_voice();
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0);
}
{
int32_t SetMicMutecat1(bool isMute);
+void AudioActInterrupt(AudioStreamType type);
+
+
+
+
+
+
#ifdef __cplusplus
}
#endif
int uapi_close_voice_recognition(void );
+void cat1_audio_AudioSetup(void);
+
+void cat1_audio_AudioRelease(void);
+
+
#ifdef __cplusplus
}
#endif
type, g_audioState);
if ((type == AUDIO_STREAM_VOICE_CALL_BT_SCO && g_audioState >= AUDIO_ACT_INTERRUPT_BT_SCO) ||
- (type == AUDIO_STREAM_RING && g_audioState == AUDIO_ACT_INTERRUPT_WATCH_RING)) {
+ (type == AUDIO_STREAM_RING && g_audioState == AUDIO_ACT_INTERRUPT_WATCH_RING)
+ || type ==AUDIO_STREAM_VOICE_CALL_VOLTE && g_audioState >= AUDIO_STREAM_VOICE_CALL_VOLTE ) {
(void)PhoneAudioManagerDeactInterrupt();
}
}
+
+
// 申请音频焦点
-static void AudioActInterrupt(AudioStreamType type)
+void AudioActInterrupt(AudioStreamType type)
{
int ret = OHOS_SUCCESS;
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioActInterrupt] start type:0x%x, audioState:0x%x",
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioActInterrupt] start type:0x%x, audioState:0x%x",
type, g_audioState);
- if (type != AUDIO_STREAM_VOICE_CALL_BT_SCO && type != AUDIO_STREAM_RING) {
+if (type != AUDIO_STREAM_VOICE_CALL_BT_SCO && type != AUDIO_STREAM_RING && type != AUDIO_STREAM_VOICE_CALL_VOLTE) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioActInterrupt] failed! type:0x%x, audioState:0x%x",
type, g_audioState);
return;
if (ret == OHOS_SUCCESS) {
g_audioState = AUDIO_ACT_INTERRUPT_BT_SCO;
}
- } else if (type == AUDIO_STREAM_RING && g_audioState < AUDIO_ACT_INTERRUPT_WATCH_RING) {
+ }
+ else if (type == AUDIO_STREAM_RING && g_audioState < AUDIO_ACT_INTERRUPT_WATCH_RING)
+ {
ret = PhoneAudioManagerActInterrupt(type);
if (ret == OHOS_SUCCESS) {
- g_audioState = AUDIO_ACT_INTERRUPT_WATCH_RING;
+ g_audioState = AUDIO_ACT_INTERRUPT_WATCH_RING;
}
}
+ else if (type == AUDIO_STREAM_VOICE_CALL_VOLTE && g_audioState < AUDIO_STREAM_VOICE_CALL_VOLTE)
+ {
+ if (g_audioState == AUDIO_ACT_INTERRUPT_WATCH_RING) {
+ AudioDeactInterrupt(AUDIO_STREAM_RING);
+ }
+
+ ret = PhoneAudioManagerActInterrupt(type);
+ if (ret == OHOS_SUCCESS) {
+ g_audioState = AUDIO_STREAM_VOICE_CALL_VOLTE;
+ }
+ }
+
if (ret != OHOS_SUCCESS) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioActInterrupt] failed! type:0x%x, audioState:0x%x",
if (g_scoFlag != HFP_SCO_STATE_CONNECTED || g_audioState < AUDIO_STREAM_INIT) {
return;
- }
+}
MUTEX_Lock(g_audioMutex);
if (g_audioState < AUDIO_STREAM_START_UP) {
return;
}
+#include "PlayersModelC.h"
+#include "BluetoothModelC.h"
+
+void cat1_audio_AudioSetup(void)
+{
+ //AudioActInterrupt(AUDIO_STREAM_VOICE_CALL_VOLTE);
+ if(stopPhonePlayingMusic())
+ {
+ BtA2dpSnkAudioDestroy();
+ sleep(1);//等待释放音频
+ }
+ uapi_cat1_start_volte_voice();
+}
+
+void cat1_audio_AudioRelease(void)
+{
+ uapi_cat1_stop_volte_voice();
+}
+
+
+
// 同步音量
static void SyncVolume(void)
{
WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "[AudioUp] audioState:%d", g_audioState);
}
+
static void AudioSetup(void)
{
//如果已经建立了cat1 媒体通路,不能再建立,SCO通路
}
}
+
+
+
static void AudioUpRelease(void)
{
int ret;
/* 释放音频焦点 */
AudioDeactInterrupt(AUDIO_STREAM_VOICE_CALL_BT_SCO);
AudioDeactInterrupt(AUDIO_STREAM_RING); // 适配某些机型不触发SCO
- g_audioState = AUDIO_UNKNOW;
+ g_audioState = AUDIO_UNKNOW;
WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "[AudioRelease] audioState:%d,", g_audioState);
MUTEX_Unlock(g_audioMutex);
void stopPlayingMusic(void);
void custom_setUpListCase(void);
bool canSyncMusic(uint32_t songSize);
+ bool stopPhonePlayingMusic(void);
#ifdef __cplusplus
#if __cplusplus
return OHOS::SystemLogModel::GetInstance()->canSyncFile(APP_MUSIC_PATH,TOTAL_MUSIC_SPACE,songSize);
}
+
+ bool stopPhonePlayingMusic(void)
+ {
+ if( OHOS::PlayersModel::GetInstance()->get_a2dp_sink_playing_state())
+ {
+ OHOS::PlayersModel::GetInstance()->set_phone_music_play_state(AVRCP_KEY_PAUSE); // 控制手机音乐暂停
+ return true;
+
+ }
+ return false;
+ }
+
+
#ifdef __cplusplus
#if __cplusplus
}
if( 0==AlmmgrGetManagement(&data))
{
- for(int i=0;i<data.eventAlarmCnt;i++)
+ for(int i=0;i<EVENT_ALARM_CLOCK_MAX;i++)
{
+ if(data.eventAlarmInfo[i].alarmClockId==i && data.eventAlarmInfo[i].alarmType==TYPE_EVENT_ALARM_CLOCK)
AlmmgrDeleteAlarmClock(&data.eventAlarmInfo[i]);
}
}
if( 0==AlmmgrGetManagement(&data))
{
- for(int i=0;i<data.eventAlarmCnt;i++)
+
+ for(int i=0;i<EVENT_ALARM_CLOCK_MAX;i++)
{
- cJSON* itemJSON = cJSON_CreateObject();
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟数据:%d\r\n",data.eventAlarmInfo[i].alarmClockId);
- cJSON_AddNumberToObject(itemJSON,"id",data.eventAlarmInfo[i].alarmClockId);
+ if(data.eventAlarmInfo[i].alarmClockId==i && data.eventAlarmInfo[i].alarmType==TYPE_EVENT_ALARM_CLOCK)
+ {
+ cJSON* itemJSON = cJSON_CreateObject();
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟数据:%d\r\n",data.eventAlarmInfo[i].alarmClockId);
+ cJSON_AddNumberToObject(itemJSON,"id",data.eventAlarmInfo[i].alarmClockId);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟使能:%d\r\n",data.eventAlarmInfo[i].alarmClockEnable);
- cJSON_AddNumberToObject(itemJSON,"enable",data.eventAlarmInfo[i].alarmClockEnable);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟使能:%d\r\n",data.eventAlarmInfo[i].alarmClockEnable);
+ cJSON_AddNumberToObject(itemJSON,"enable",data.eventAlarmInfo[i].alarmClockEnable);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟重复:%d\r\n",data.eventAlarmInfo[i].repeatPeriod);
- int anNum[7] = {0};
- int repeatPeriod_num=0;
- for(int j=0 ; j<7;j++)
- {
- if(data.eventAlarmInfo[i].repeatPeriod & 0b00000001<<j)
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟重复:%d\r\n",data.eventAlarmInfo[i].repeatPeriod);
+ int anNum[7] = {0};
+ int repeatPeriod_num=0;
+ for(int j=0 ; j<7;j++)
{
- if(j==0)
- {
- anNum[repeatPeriod_num]=7;
- }
- else
+ if(data.eventAlarmInfo[i].repeatPeriod & 0b00000001<<j)
{
- anNum[repeatPeriod_num]=j;
- }
-
+ if(j==0)
+ {
+ anNum[repeatPeriod_num]=7;
+ }
+ else
+ {
+ anNum[repeatPeriod_num]=j;
+ }
- repeatPeriod_num++;
+
+ repeatPeriod_num++;
+ }
}
- }
- if(repeatPeriod_num==0)
- {
- repeatPeriod_num=1;
- }
- cJSON* repeatPeriod= cJSON_CreateIntArray(anNum,repeatPeriod_num);
-
- cJSON_AddItemToObject(itemJSON,"repeat",repeatPeriod);
+ if(repeatPeriod_num==0)
+ {
+ repeatPeriod_num=1;
+ }
+ cJSON* repeatPeriod= cJSON_CreateIntArray(anNum,repeatPeriod_num);
+
+ cJSON_AddItemToObject(itemJSON,"repeat",repeatPeriod);
- uint8_t refreshHour = data.eventAlarmInfo[i].alarmTime >> 16; // 闹钟存储小时位需要右移16位
-
- uint8_t refreshMin = data.eventAlarmInfo[i].alarmTime & 0x00FF; // 得出闹钟时间的分钟位需要将左置位16位清零
+ uint8_t refreshHour = data.eventAlarmInfo[i].alarmTime >> 16; // 闹钟存储小时位需要右移16位
+
+ uint8_t refreshMin = data.eventAlarmInfo[i].alarmTime & 0x00FF; // 得出闹钟时间的分钟位需要将左置位16位清零
- cJSON_AddNumberToObject(itemJSON,"hour",refreshHour);
+ cJSON_AddNumberToObject(itemJSON,"hour",refreshHour);
- cJSON_AddNumberToObject(itemJSON,"minute",refreshMin);
+ cJSON_AddNumberToObject(itemJSON,"minute",refreshMin);
- cJSON_AddItemReferenceToArray(data_arryJSON,itemJSON);
+ cJSON_AddItemReferenceToArray(data_arryJSON,itemJSON);
+ }
+
//cJSON_AddNumberToObject(itemJSON,"src",data->src);
}
- // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟数据:%d\r\n",data.alarmTime);
- // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟数据:%d\r\n",data.repeatPeriod);
- // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟数据:%d\r\n",data.alarmClockEnable);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟数据:%d\r\n",data.alarmTime);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟数据:%d\r\n",data.repeatPeriod);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟数据:%d\r\n",data.alarmClockEnable);
// i++;
}
else
}
stopPlayingMusic();
+ PlayersModel::GetInstance()->HandPausePhoneMusic(); // 暂停手机音乐
const power_display_svr_api_t *display_api = power_display_svr_get_api();
if (display_api->get_screen_state() != SCREEN_ON)
}
AlarmClockModel::GetInstance()->AlarmPlayerStop();
//AlarmViewEventListener::GetInstance()->CancelAlarmRing();
- uapi_cat1_start_volte_voice();
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0);
CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
}
#include "BluetoothModelC.h"
#include "audio_manager_c_wrapper.h"
+#include "PhoneService.h"
//拨号处理函数
void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req)
{
// int ret = PlayersModel::GetInstance()->PlayerStop();
stopPlayingMusic();
- // PlayersModel::GetInstance()->HandPausePhoneMusci(); // 暂停手机音乐
- // AudioManagerDeactivateInterrupt();
- //BtA2dpSnkAudioDestroy();
+
- //uapi_hfp_disconnect();
if(strcmp(call_data,"SOS")==0)
{
free(call_data);
return;
}
- cat1_call_dial(call_data);
+ cat1_call_dial(call_data);
+
+ CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len);
- uapi_cat1_start_volte_voice();
+ CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
+ NotificationManager::GetInstance()->SetWatchCallStatus(true);
- CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len);
- CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
- cat1_phone_state_change_cb(OPERATE_DIALING);
- NotificationManager::GetInstance()->SetWatchCallStatus(true);
+ cat1_phone_state_change_cb(OPERATE_DIALING);
+
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0);
+
+
+
}
free(call_data);
}
break;
case GOAL_STEP:
tag = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT);;
- tagString=std::to_string(tag);
+ tagString=std::to_string(tag)+"steps";
break;
default:
break;
break;
case GOAL_STEP:
tag = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT);;
- tagString=std::to_string(tag);
+ tagString=std::to_string(tag)+"steps";
break;
default:
break;
case CUSTOM_CMD_MSG_CHECK_DIAL_SPACE:
check_dial_space();
break;
+ case CUSTOM_CMD_MSG_CAT1_AUDIO_START:
+ cat1_audio_AudioSetup();
+ break;
+ case CUSTOM_CMD_MSG_CAT1_AUDIO_STOP:
+ cat1_audio_AudioRelease();
+ break;
+
default:
PRINT("Unknown CUSTOM_CMD_MSG cmd 0x%02X \r\n", mail.cmd);
break;
#define CUSTOM_CMD_MSG_CHECK_DIAL_SPACE 0x12
+#define CUSTOM_CMD_MSG_CAT1_AUDIO_START 0x13
+
+#define CUSTOM_CMD_MSG_CAT1_AUDIO_STOP 0x14
typedef enum {
BR_HFP_CONNECT=1,
BR_HFP_DISCONNECT,