// 本地播放文件路径和状态
sliceId = str; // 播放音乐的文件名
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PlayerInit start!");
-
- std::string strSongName = sliceId;
- std::string pureName = strSongName.substr(0, strSongName.rfind(".")); // 播放音乐的路径需要引用.号
- const char *songName = pureName.c_str();
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PlayerInit, url:%s ", sliceId);
- std::string strSrcMusic(APP_MUSIC_PATH);
- std::string tempStr("/");
std::string strName = sliceId;
uri =strName;
// 创建 AM
printf("gap_state_changed_callback transport: %d status: %d\n", transport, status);\r
}\r
\r
+static void sample_gap_scan_mode_changed_callback(int mode)\r
+{\r
+ printf("gap_scan_mode_changed_callback mode: %d\n", mode);\r
+ \r
+}\r
+\r
void BtInitCallBacks(void)\r
{\r
+ g_btGapCallBacks .scan_mode_changed_callback=sample_gap_scan_mode_changed_callback;\r
g_btGapCallBacks.state_change_callback=sample_gap_state_changed_callback;\r
g_btGapCallBacks.discovery_result_callback = BtGapDiscoveryResultCallback;\r
g_btGapCallBacks.discovery_state_changed_callback = BtGapDiscoveryStateChangedCallback;\r
void PhoneChangeStatusCallback(const PhoneCallInfo *phoneCall);\r
void PhoneErrorCallback(PhoneServiceErrorType type, int volume);\r
void UsingPhoneScoStatausCallback(hfp_sco_connect_state_t state);\r
-void StatusReset();\r
+void StatusReset(void);\r
void UsingPhoneChangeStatusCallback(const PhoneCallInfo *phoneCall);\r
void UsingPhoneErrorCallback(PhoneServiceErrorType type);\r
void CAT1_ChangeStatusScreendisplay(int lastStatus);\r
class CallerLogModel {\r
public:\r
typedef enum {\r
+ callleisure,\r
+ CallphoneWait,\r
+ CallCat1Wait,\r
CallSourcePhone,\r
CallSourceCat1,\r
} CallSource;\r
- \r
+\r
+typedef enum {\r
+ HFP_WATCH_DIAL,\r
+ HFP_PHONE_DIAL,\r
+ } Calldial;\r
+\r
+\r
\r
void InitPhoneService();\r
static CallerLogModel *GetInstance(void);\r
{\r
callsrc = source;\r
}\r
+\r
+ uint8_t GetCallDial(void)\r
+ {\r
+ return calldial;\r
+ }\r
+ void SetCallDial(uint8_t dial)\r
+ {\r
+ calldial = dial;\r
+ }\r
+ uint8_t get_RejectIncomingCall_falg()\r
+ {\r
+ return auto_RejectIncomingCall;\r
+ }\r
+\r
+ void set_RejectIncomingCall_falg(uint8_t data)\r
+ {\r
+ auto_RejectIncomingCall=data;\r
+ }\r
+\r
+\r
+ /* 设置cat1临时来电号码显示 */\r
+ void tempSetoperateNumberCAT1(const char *number, char number_len)\r
+ {\r
+ phoneNumberCAT1.clear();\r
+ phoneNumberCAT1.append(reinterpret_cast<const char*>(number), number_len);\r
+ }\r
+\r
+ std::string GettempPhoneNumber(void)\r
+ {\r
+ return phoneNumberCAT1;\r
+ }\r
+\r
+\r
+\r
+\r
private:\r
CallerLogModel();\r
CallerLogModel(const CallerLogModel &);\r
std::string timers; // 时间显示\r
std::string callDuration; // 通话时长\r
std::string phoneNumber; // 电话号码\r
+ std::string phoneNumberCAT1; // 4G电话号码\r
std ::string call_name;\r
bool mulitplePhoneStatus{false}; // 判断是否多路通话界面\r
bool waitingStatus{false}; // 判断是否等待提醒界面\r
bool notifyFlag{false}; // 判断是否来电呼入 由notify生成界面\r
\r
CallSource callsrc{CallSourcePhone}; //电话来源 \r
+ uint8_t calldial{HFP_PHONE_DIAL};\r
+ uint8_t auto_RejectIncomingCall{0};\r
};\r
}\r
#ifdef __cplusplus\r
#include "MainCallingPresenter.h"
#include "PlayersModel.h"
#include "graphic_service.h"
+#include "notification_manager.h"
+#include "osal_timer.h"
+#include "cmsis_os2.h"
#ifdef __cplusplus
extern "C" {
}
/* 状态复位 */
-void StatusReset()
+void StatusReset(void)
{
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "状态复位");
+
CallerLogModel::GetInstance()->SetCallStatus(false);
CallerLogModel::GetInstance()->SetWaitingStatus(false);
DisableCallingTimer();
CallerLogModel::GetInstance()->Setphonebname("0",0);
+ CallerLogModel::GetInstance()->SetCallDial(CallerLogModel::HFP_PHONE_DIAL);
+ CallerLogModel::GetInstance()->set_RejectIncomingCall_falg(0);
+ CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::callleisure);
+ NotificationManager::GetInstance()->SetWatchCallStatus(false);
+ CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone);
+
+ PhoneServiceScreenCtr(false);
+
// If the call is handling in the notification, the slice is not switched
if (!CallerLogModel::GetInstance()->GetNotifyFlag()) {
- NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_PHONE);
+ NativeAbility::GetInstance().BackCountSlice(0);
} else {
g_isWatchCallView = false;
}
static void ExitMakePhoneSlice(void)
{
+
+ if( CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1
+ && NotificationManager::GetInstance()->GetWatchCallStatus()==true)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "4G 通话中不能结束");
+ return;
+ }
+
if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_INCOMING_CALL) {
WEARABLE_LOGD(HILOG_MODULE_AAFWK, "ExitMakePhoneSlice");
if (GetCurrCallNum() == 0) {
- NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN);
+ //NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN);
CallModelPostGraphicEvent(CallModelResumePlayer);
} else {
- NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);
+ //NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);
}
}
- CallerLogModel::GetInstance()->SetCallStatus(false);
- DisableCallingTimer();
- if (CallerLogModel::GetInstance()->GetNotifyFlag()) {
- g_isWatchCallView = false;
- }
+ StatusReset();//状态复位
+ // CallerLogModel::GetInstance()->SetCallStatus(false);
+ // DisableCallingTimer();
+ //if (CallerLogModel::GetInstance()->GetNotifyFlag()) {
+ g_isWatchCallView = false;
+ //}
}
static void DialingHandle(void)
{
CallerLogModel::GetInstance()->SetDialingStatus("正在拨号");
CallerLogModel::GetInstance()->SetMakePhoneStatus(true);
+ NotificationManager::GetInstance()->SetWatchCallStatus(true);
}
static void AlertingHandle(void)
{
CallerLogModel::GetInstance()->SetDialingStatus("正在响铃");
CallerLogModel::GetInstance()->SetMakePhoneStatus(true);
+ NotificationManager::GetInstance()->SetWatchCallStatus(true);
}
static void IncomingHandle(void)
CallerLogModel::GetInstance()->SetMakePhoneStatus(false);
}
+
+static osTimerId_t Waiting_timer=NULL;
+
+static void RejectIncomingCall_Timer_CallBack(int data)
+{
+ if(RejectIncomingCall() != 0) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[HintsHandupClick] RejectIncomingCall error");
+ return ;
+ }
+ osTimerDelete(Waiting_timer);
+ Waiting_timer = NULL;
+}
// 来电等待界面
static void WaitingOpreate()
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[UsingPhoneChangeStatusCallback] is not complete call flow");
return;
}
+
+ if(NotificationManager::GetInstance()->GetWatchCallStatus())
+ {
+ if(!CallerLogModel::GetInstance()->get_RejectIncomingCall_falg())
+ {
+
+ uint32_t tick;
+ osStatus_t retTimer;
+ if(Waiting_timer!=NULL)
+ {
+ if(RejectIncomingCall() != 0) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[HintsHandupClick] RejectIncomingCall error");
+ return ;
+ }
+ osTimerDelete(Waiting_timer);
+ Waiting_timer = NULL;
+ return;
+ }
+
+ Waiting_timer = osTimerNew((osTimerFunc_t)RejectIncomingCall_Timer_CallBack, osTimerOnce, NULL, NULL);
+ tick =3000;// osMs2Tick(1000);
+ retTimer = osTimerStart(Waiting_timer, tick);
+ if (retTimer != osOK && Waiting_timer != NULL) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"StartCallTimer osTimerStart failed, ret = %lx!!", retTimer);
+ osTimerDelete(Waiting_timer);
+ Waiting_timer = NULL;
+ return ;
+ }
+ CallerLogModel::GetInstance()->set_RejectIncomingCall_falg(1);
+
+ }
+ else
+ {
+ if(RejectIncomingCall() != 0) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[HintsHandupClick] RejectIncomingCall error");
+ return ;
+ }
+ return;
+ }
+
+ }
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[WaitingOpreate] WaitingOpreate");
CallerLogModel::GetInstance()->SetCallStatus(false);
CallerLogModel::GetInstance()->SetWaitingStatus(true);
static void WatchFinishHandle(void)
{
+
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WatchFinishHandle");
+
if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_INCOMING_CALL ||
- CallerLogModel::GetInstance()->GetNotifyFlag()) {
+ CallerLogModel::GetInstance()->GetNotifyFlag())
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WatchFinishHandle");
if (GetCurrCallNum() == 0) {
StatusReset();
CallerLogModel::GetInstance()->SetNotifyFlag(false);
}
}
}
+ else
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "??????????????????????");
+ }
g_phoneStatus = PHONE_SINGLE_STATUS;
}
void CAT1_ChangeStatusScreendisplay(int lastStatus)
{
// If the call is handling in the notification, the slice is not switched
- if (lastStatus != OPERATE_PHONE_ACTIVE && (!CallerLogModel::GetInstance()->GetNotifyFlag())) {
+ if (lastStatus != OPERATE_PHONE_ACTIVE) {
NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID,
PRIORITY_ONE);
}
}
// If the call is handling in the notification, the slice is not switched
if (g_callOperate != OPERATE_PHONE_ACTIVE && (!CallerLogModel::GetInstance()->GetNotifyFlag())) {
+
NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID,
PRIORITY_ONE);
}
break;
case OPERATE_INCOMING:
// 显示电话呼入
- IncomingHandle();
+ {
+ IncomingHandle();
+ }
break;
case OPERATE_WAITING:
// 震动一下,提示有新电话呼入 还未对齐
case HFP_HF_CALL_STATE_ACTIVE:
if (g_callOperate == OPERATE_PHONE_ACTIVE) {
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ScoConnectHandle] OPERATE_PHONE_ACTIVE");
+ TransCallToMobilePhone();
return;
}
CallerLogModel::GetInstance()->SetCallStatus(true);
phoneNumber.append(reinterpret_cast<const char*>(number), number_len);
}
+
+
std::string CallerLogModel::GetPhoneNumber(void)
{
return phoneNumber;
#include "components/ui_image_animator.h"
#include "components/ui_view_group.h"
#include "ohos_types.h"
+#include "UiConfig.h"
+#include "ChangeSliceListener.h"
+#include "components/ui_label_button.h"
namespace OHOS {
class WaitingHintsView {
UIViewGroup *CreateUIViewGroup();
static WaitingHintsView *GetInstance();
+ void updataCallingname();
private:
bool InitImageViewDisplay(void);
bool InitUILabelDisplay(void);
+ bool InitAddOnclickevent(void);
UIViewGroup *group{nullptr};
UIView::OnClickListener* clickLeftListener{nullptr};
+
UIImageView *imageDissgree{nullptr};
+
UILabel *callerDisplay{nullptr};
- UILabel *newcallHints{nullptr};
+ UIImageView *imageAgreeing{nullptr};
+ UIImageView *imageperson{nullptr};
+
+ UILabelExt *currentTimes{nullptr};
+ UILabelExt *label_call_source{nullptr};
+ UILabelExt *label_call_hint{nullptr};
};
}
#include "UiConfig.h"
#include "CallerLogModel.h"
#include "MainCallingPresenter.h"
-#include "phone/include/phoneaddressmodel.h"
+#include "ui_resource_string.h"
+#include "bletest.h"
+#include "custom_utils.h"
+
+#include "wearable_log.h"
+#include "PhoneService.h"
+#include "cat1_server.h"
+#include "cat1_server_hal.h"
+#include "phoneaddressmodel.h"
+
+
+
+
+#define PHONE_DIR_GIRL_1 "/user/res/Phone/girl.bin"
+#define PHONE_DIR_BOY_1 "/user/res/Phone/boy.bin"
namespace OHOS {
static constexpr uint16 MATH_ZERO = 0;
// 挂断按钮位置
static constexpr uint16 LABEL_CALLERD_POSITION_Y = 180;
static WaitingHintsView *g_pMainView = nullptr;
+
+// 字体大小
+static constexpr uint16 LABEL_TIME_FONT_SIZE = 25;
+
+
WaitingHintsView::WaitingHintsView()
{
g_pMainView = this;
WaitingHintsView::~WaitingHintsView()
{
- g_pMainView = nullptr;
-
group->RemoveAll();
+
+ delete imageAgreeing;
+ imageAgreeing = nullptr;
+
delete imageDissgree;
imageDissgree = nullptr;
+
+ delete imageperson;
+ imageperson = nullptr;
+
delete callerDisplay;
callerDisplay = nullptr;
- delete newcallHints;
- newcallHints = nullptr;
+ delete label_call_source;
+ label_call_source = nullptr;
+
+ delete currentTimes;
+ currentTimes = nullptr;
+ delete label_call_hint;
+ label_call_hint = nullptr;
delete group;
group = nullptr;
+ g_pMainView = nullptr;
+
+}
+
+void WaitingHintsView::updataCallingname(void)
+{
+ if(CallerLogModel::GetInstance()->Getphonename().length()>5)
+ {
+ callerDisplay->SetText(CallerLogModel::GetInstance()->Getphonename().c_str());
+ }
}
+
+
UIViewGroup *WaitingHintsView::CreateUIViewGroup()
{
group = new UIViewGroup();
return group;
}
+bool WaitingHintsView::InitAddOnclickevent()
+{
+ clickLeftListener = (UIView::OnClickListener*)OHOS::MainCallingPresenter::GetInstance();
+ if (clickLeftListener == nullptr) {
+ return false;
+ }
+ imageAgreeing->SetOnClickListener(clickLeftListener);
+ imageDissgree->SetOnClickListener(clickLeftListener);
+ return true;
+}
+
WaitingHintsView *WaitingHintsView::GetInstance()
{
return g_pMainView;
bool WaitingHintsView::InitImageViewDisplay()
{
+ imageAgreeing = new UIImageView();
+ if (imageAgreeing == nullptr) {
+ return false;
+ }
+ imageAgreeing->SetPosition(369, 207); // 30 : offset
+ imageAgreeing->SetSrc(PNG_ANSWER_230_TMAGE_PATH);
+ imageAgreeing->SetTouchable(true);
+ imageAgreeing->SetViewId("answer");
+ //group->Add(imageAgreeing);
+
imageDissgree = new UIImageView();
if (imageDissgree == nullptr) {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WaitingHintsView::new imageDissgree error");
return false;
}
- imageDissgree->SetPosition(IMAGE_HANDUP_POSITION_X, IMAGE_HANDUP_POSITION_Y); // 30 : offset
- imageDissgree->SetSrc(PNG_DISSGREE_IMAGE_PATH);
+ imageDissgree->SetPosition(46, 207); // 30 : offset
+ imageDissgree->SetSrc(PNG_HANDUP_230_IMAGE_PATH);
imageDissgree->SetTouchable(true);
imageDissgree->SetViewId("hintsHandup");
+ //group->Add(imageDissgree);
- clickLeftListener = (UIView::OnClickListener*)OHOS::MainCallingPresenter::GetInstance();
- if (clickLeftListener == nullptr) {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WaitingHintsView::new clickLeftListener error");
+ imageperson = new UIImageView();
+ if (imageperson == nullptr) {
return false;
}
- imageDissgree->SetOnClickListener(clickLeftListener);
- group->Add(imageDissgree);
+ imageperson->SetPosition(158, 158); // 30 : offset
+ imageperson->SetSrc(PNG_230_PERSON_IMAGE_PATH);
+ imageperson->SetTouchable(true);
+ imageperson->SetViewId("headset");
+
+ char name_buf[30]={0};
+ uint8_t sex;
+ if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),&sex))
+ {
+ if(sex)
+ imageperson->SetSrc(PHONE_DIR_BOY_1);
+ else
+ imageperson->SetSrc(PHONE_DIR_GIRL_1);
+ }
+
+ group->Add(imageperson);
+ InitAddOnclickevent();
return true;
}
bool WaitingHintsView::InitUILabelDisplay()
{
- callerDisplay = new UILabel();
+ callerDisplay = new UILabelExt();
if (callerDisplay == nullptr) {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WaitingHintsView::new callerDisplay error");
return false;
}
- callerDisplay->SetPosition(LABEL_PERCENT_POSITION_X, LABEL_PERCENT_POSITION_Y,
- VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT);
+ callerDisplay->SetPosition(LABEL_PERCENT_POSITION_X, LABEL_PERCENT_POSITION_Y, VIEW_DISTANCE_TO_LEFT_SIDE,
+ TITLE_LABEL_DEFAULT_HEIGHT);
callerDisplay->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
+
char name_buf[30]={0};
if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),NULL))
{
{
callerDisplay->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
}
-
+ if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourcePhone)
+ updataCallingname();
+
callerDisplay->SetAlign(TEXT_ALIGNMENT_CENTER);
- callerDisplay->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_DISPLAY_FONE_SIZE);
+ callerDisplay->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);
callerDisplay->SetTextColor(Color::White());
+ callerDisplay->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);
group->Add(callerDisplay);
- newcallHints = new UILabel();
- if (newcallHints == nullptr) {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WaitingHintsView::new newcallHints error");
- return false;
+ if (label_call_hint == nullptr) {
+ label_call_hint = new UILabelExt();
+ }
+
+ label_call_hint->SetPosition(133, 353); // widget's left position and top position
+ label_call_hint->Resize(200, 35); // widget's width and height
+ label_call_hint->SetViewId("label3");// Set style
+ label_call_hint->SetStyle(STYLE_TEXT_FONT, 30);
+
+ // Set additional property
+ label_call_hint->SetText("挂断/接听");
+ label_call_hint->SetTextId(STR_HANG_UP_OR_ANSWER);
+
+ label_call_hint->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+ label_call_hint->SetTextColor(Color::GetColorFromRGBA(0xAA, 0xAA, 0xAA, 0xff));
+ label_call_hint->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label_call_hint->SetRollSpeed(0);
+ label_call_hint->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ group->Add(label_call_hint);
+
+
+ if (label_call_source == nullptr) {
+ label_call_source = new UILabelExt();
}
- newcallHints->SetPosition(LABEL_CALLERD_POSITION_X, LABEL_CALLERD_POSITION_Y,
- VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT);
- newcallHints->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
- newcallHints->SetText("新来电");
- newcallHints->SetAlign(TEXT_ALIGNMENT_CENTER);
- newcallHints->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_DISPLAY_FONE_SIZE);
- newcallHints->SetTextColor(Color::White());
- group->Add(newcallHints);
+ label_call_source->SetPosition(133, 34); // widget's left position and top position
+ label_call_source->Resize(200, 60); // widget's width and height
+ label_call_source->SetViewId("label1");// Set style
+ label_call_source->SetStyle(STYLE_TEXT_FONT, 30);
+
+ // Set additional property
+ if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1)
+ {
+ label_call_source->SetText("手表来电");
+ label_call_source->SetTextId(STR_WATCH_CALL);
+ }
+ else
+ {
+ label_call_source->SetText("手机来电");
+ label_call_source->SetTextId(STR_PHONE_CALL);
+ }
+
+
+ label_call_source->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+ label_call_source->SetTextColor(Color::GetColorFromRGBA(0xAA, 0xAA, 0xAA, 0xff));
+ label_call_source->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label_call_source->SetRollSpeed(0);
+ label_call_source->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ group->Add(label_call_source);
+
return true;
+
}
}
\ No newline at end of file
- button_calllog_status[i] = TelephonyInitInterface::LabelViewInit(labelParam,color);
+ button_calllog_status[i] = TelephonyInitInterface::LabelViewInit(labelParam,color);
if (button_calllog_status[i] == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::MainPhoneViewTitleLabel new fail!");
{\r
//NativeAbility::GetInstance().Back();\r
//NativeAbility::GetInstance().Back();\r
- NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_PHONE);// EnterSlice(VIEW_MAIN_PHONE);\r
+ NativeAbility::GetInstance().BackCountSlice(2);// EnterSlice(VIEW_MAIN_PHONE);\r
}\r
\r
\r
// 如果是power键,且是亮屏状态,按键释放就返回上一级\r
if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0)\r
{\r
- NativeAbility::GetInstance().Back();\r
+ NativeAbility::GetInstance().BackCountSlice(2);\r
}\r
return true;\r
}\r
CALL_MISSED, // 未接来电
} CallFinishStatus;
+typedef enum {
+ CALL_CAT1 = 0, //
+ CALL_HFP, //
+} CalllogtypeStatus;
+
+
#pragma pack(1)
typedef struct {
char name[NAME_SIZE];
CallFinishStatus status;
uint32 creationTime; // 通话创建时间(不是接通时间)
uint64 callDurTime; // 通话持续时间
+ uint8_t calllogtype;
} CallLogInfo;
-
-#pragma pack(0)
+#pragma pack()
// 通话状态改变回调函数
typedef void (*PhoneServiceCallChangedCb)(const PhoneCallInfo *phoneCall);
// 电话服务失败回调函数
void uapi_hfp_send_DTMF_CODE(char code);
+void Cat1_CallStateChanged(const hfp_hf_calls_info_t *call);
+
+void PhoneServiceScreenCtr(bool turnOnFlag);
+
#ifdef __cplusplus
}
#endif
#include "CallerLogModel.h"
#include "custom_utils.h"
#include "Bluetooyhpabpserver.h"
+#include "AlarmClockModel.h"
+#include "ConfigModel.h"
+#include "custom_runtime.h"
+#include "vibrator_service.h"
#ifdef __cplusplus
extern "C" {
#endif
PhoneServiceCb g_callChanged;
void HfpIncomingEventPublish(uint16 topic, hfp_hf_calls_info_t callsInfo);
-static void PhoneServiceScreenCtr(bool turnOnFlag)
+void PhoneServiceScreenCtr(bool turnOnFlag)
{
if (turnOnFlag) {
ScreenTurnOn(-1);
}
WEARABLE_LOGD("","");
#else
- UNUSED(bdAddr);
+ UNUSED(bdAddr);
#endif
}
{
return;
}
+
+ // if(OHOS::CallerLogModel::GetInstance()->GetCallDial() == OHOS::CallerLogModel::HFP_PHONE_DIAL)
+ // {
+ // return;
+ // }
+ // else
+ // {
+ // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "手表拨号");
+ // }
+
+
ScoStatusCb(HFP_SCO_STATE_CONNECTED);
if (g_currCallState == HFP_HF_CALL_STATE_ACTIVE && g_scoFlag == HFP_SCO_STATE_CONNECTED) {
// The call is transferred from the phone to the watch. Need to show the call notification view.
{
WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "[ScoDisconnectPro] start CallState:%d", g_currCallState);
- if(OHOS::CallerLogModel::GetInstance()->GetCallSource() == OHOS::CallerLogModel::CallSourceCat1
- && OHOS::NotificationManager::GetInstance()->GetWatchCallStatus())
- {
- return;
- }
+ // if(OHOS::CallerLogModel::GetInstance()->GetCallSource() == OHOS::CallerLogModel::CallSourceCat1
+ // && OHOS::NotificationManager::GetInstance()->GetWatchCallStatus())
+ // {
+ // return;
+ // }
+
+ // if(OHOS::CallerLogModel::GetInstance()->GetCallDial() == OHOS::CallerLogModel::HFP_PHONE_DIAL)
+ // {
+ // return;
+ // }
ScoStatusCb(HFP_SCO_STATE_DISCONNECTED);
if (g_currCallState == HFP_HF_CALL_STATE_ACTIVE && g_scoFlag == HFP_SCO_STATE_DISCONNECTED) {
case HFP_SCO_STATE_DISCONNECTED:
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ScoStateChanged] SCO disconnected!");
ScoDisconnectPro();
- PhoneServiceScreenCtr(0);
+ //PhoneServiceScreenCtr(0);
break;
default:
BroadcastApi *broadcastApi = nullptr;
IUnknown *api = nullptr;
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HfpIncomingEventPublish topic=%u!!", topic);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HfpIncomingEventPublish topic=%u!!", topic);
void *publishData = malloc(size);
if (publishData == nullptr) {
} else {
phoneCall->operate = OPERATE_WAITING;
}
+
+ if(OHOS::CallerLogModel::GetInstance()->GetCallSource() == OHOS::CallerLogModel::CallSourceCat1
+ && OHOS::NotificationManager::GetInstance()->GetWatchCallStatus())
+ {
+ if(call->state==HFP_HF_CALL_STATE_INCOMING)
+ {
+ phoneCall->operate = OPERATE_WAITING;
+ }
+ }
+
phoneCall->lastStatus = call->state;
phoneCall->creationTime = time(nullptr);
static void PlayWatchRing(void)
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[PlayWatchRing] start");
+ if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
+ {
+ OHOS::AlarmClockModel::GetInstance()->testPlayerStart("/music/ring/ring.mp3");
+ }
}
static void CallAudioHandle(const hfp_hf_calls_info_t *call)
PostGraphicEvent(PlayWatchRing);
}
}
+ if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
+ {
+ // 震动提醒
+ ui_api_vibrate_once_func();
+ }
+
} else if (state == HFP_HF_CALL_STATE_FINISHED) {
return;
} else if (g_scoFlag == HFP_SCO_STATE_CONNECTED) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "call is null or BT disconnected connStatus: 0x%X", g_btConnState);
return;
}
+ if(OHOS::CallerLogModel::GetInstance()->GetCallDial() == OHOS::CallerLogModel::HFP_PHONE_DIAL)
+ {
+ if(call->state==HFP_HF_CALL_STATE_DIALING||call->state==HFP_HF_CALL_STATE_ALERTING)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HFP_PHONE_DIAL 手机拨号");
+ TransCallToMobilePhone();
+ return;
+ }
+ }
+
if(OHOS::CallerLogModel::GetInstance()->GetCallSource() == OHOS::CallerLogModel::CallSourceCat1
&& OHOS::NotificationManager::GetInstance()->GetWatchCallStatus())
{
- return;
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "4G 电话中");
+ if(call->state==HFP_HF_CALL_STATE_INCOMING||call->state==HFP_HF_CALL_STATE_WAITING)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hint 新电话");
+ HfpIncomingEventPublish(TOPIC_EVENT_HFP_HINT,*call);
+ }
+ TransCallToMobilePhone();
+ return;
+ }
}
SetCompleteCallFlag(call);
uapi_pbap_cmd_pull_vcard_listing((unsigned char *)call->number);
WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "CallStateChanged state:%d", call->state);
+
switch (call->state) {
case HFP_HF_CALL_STATE_ACTIVE: // 正在通话
CallChangeActivePro(call);
break;
case HFP_HF_CALL_STATE_FINISHED: // 拒接/结束电话
CallChangeFinishPro(call);
- PhoneServiceScreenCtr(0);
+ //PhoneServiceScreenCtr(0);
break;
default:
break;
// 手表主动拨打电话
int DialCall(unsigned char *number, unsigned char len)
{
+ OHOS::CallerLogModel::GetInstance()->SetCallDial(OHOS::CallerLogModel::HFP_WATCH_DIAL);
int ret;
unsigned char *tel = nullptr;
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[DialCall] start");
int TransCallToMobilePhone(void)
{
int ret;
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[TransCallToMobilePhone] start");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[TransCallToMobilePhone] start");
if (g_btConnState != PROFILE_STATE_CONNECTED) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[TransCallToMobilePhone] BT connStatus: 0x%X", g_btConnState);
{
CallerLogModel::GetInstance()->SetDialingStatus("正在响铃");
CallerLogModel::GetInstance()->SetMakePhoneStatus(true);
+
}
static void IncomingHandle(void)
CALL_MISSED, // 未接来电
} CallFinishStatus;
+typedef enum {
+ CALL_CAT1 = 0, //
+ CALL_HFP, //
+} CalllogtypeStatus;
+
typedef struct {
char name[NAME_SIZE];
unsigned char nameLen;
CallFinishStatus status;
uint32 creationTime; // 通话创建时间(不是接通时间)
uint64 callDurTime; // 通话持续时间
+ uint8_t calllogtype;
} CallLogInfo;
// 通话状态改变回调函数
g_btConnState = (uint32)hfp_hf_get_device_connect_state(&g_bdAddr);
return g_btConnState;
}
+//获取sco状态
+uint32 GetHFPSCOConnectStatus(void)
+{
+ int soc_state = (uint32)hfp_hf_get_sco_connect_state(&g_bdAddr);
+ if(PROFILE_STATE_DISCONNECTING==soc_state || PROFILE_STATE_DISCONNECTED==soc_state)
+ return 0;
+ else
+ return 1;
+}
+
// SCO连接处理
static void ScoConnectPro(void)
uint32_t time;//时间戳
int uid;//uid 消息唯一编号
int appid;//消息类型:1:微信 2:QQ 3:短信 4:其他
- char title[TITLE_BUF_LEN+1];//消息发送者
- char msg[MSG_BUF_LEN+1];//消息内容
+ char *title;//消息发送者
+ char *msg;//消息内容
int hasCode;//消息hash code
int read;//是否已读 0 未读 1 已读
}ancs_data_info_t;
timestampe = 0;\r
}\r
ancs_data_info_t data;\r
- memset_s(&data,sizeof(ancs_data_info_t),0,sizeof(ancs_data_info_t));\r
+ //memset_s(&data,sizeof(ancs_data_info_t),0,sizeof(ancs_data_info_t));\r
\r
data.appid=appid;\r
- memcpy_s(data.title,TITLE_BUF_LEN+1,title,strlen(title));\r
- memcpy_s(data.msg,MSG_BUF_LEN+1,msg,strlen(msg));\r
+ // memcpy_s(data.title,TITLE_BUF_LEN+1,title,strlen(title));\r
+ // memcpy_s(data.msg,MSG_BUF_LEN+1,msg,strlen(msg));\r
+ data.title=title;\r
+ data.msg=msg;\r
data.uid=uid;\r
data.time=timestampe;\r
data.read=0;\r
data.hasCode=hasCode;\r
+ printf("message_data\r\n");\r
\r
CustomEventPublish_TOPIC_EVENT_MESSAGENOTE(&data);\r
return ;\r
TOPIC_EVENT_HFP_FINISHED,
TOPIC_EVENT_HFP_PHONE_TO_WATCH,
TOPIC_EVENT_HFP_WATCH_TO_PHONE,
+ TOPIC_EVENT_HFP_HINT,
#ifdef CYWEE_SPORT
TOPIC_EVENT_ACTIVITY_UPDATE,
TOPIC_EVENT_ACTIVITY_EXTRA_INFO_UPDATE,
{TOPIC_EVENT_HFP_FINISHED, A_CORE_MASK, 1},
{TOPIC_EVENT_HFP_PHONE_TO_WATCH, A_CORE_MASK, 1},
{TOPIC_EVENT_HFP_WATCH_TO_PHONE, A_CORE_MASK, 1},
+ {TOPIC_EVENT_HFP_HINT, A_CORE_MASK, 1},
+
#ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION
{TOPIC_EVENT_CHARGE_PLUG, A_CORE_MASK, 1},
{TOPIC_EVENT_CHARGE_UNPLUG, A_CORE_MASK, 1},
UIViewGroup* CreateWaitingHintsView(void);
UIViewGroup* CreateCalldialView(void);
UIViewGroup* SOS_cant_dial(void);
+UIViewGroup* CALL_INCOMING_HINT(void);
void HonrsViewChange(void);
VolumeSettingView *GetvolumeSetting(void);
#include "cywee_service.h"
#include "goalview.h"
#include "goalother.h"
-
+#include "ConfigModelC.h"
#include "heart_blood/health_service/health_service.h"
#define DIALDATASET 1
{TOPIC_EVENT_HFP_WATCH_ACTIVE, PRIORITY_ONE},
{TOPIC_EVENT_HFP_WATCH_TO_PHONE, PRIORITY_ONE},
{TOPIC_EVENT_HFP_PHONE_TO_WATCH, PRIORITY_ONE},
+ {TOPIC_EVENT_HFP_HINT, PRIORITY_ONE},
+
#ifdef SUPPORT_CAT1_MODEM
{TOPIC_EVENT_CAT1_INCOMMING, PRIORITY_ONE},
{TOPIC_EVENT_CAT1_CALLCONNTED, PRIORITY_ONE},
MsgCenterSubscribeTopic(TOPIC_EVENT_HFP_FINISHED);
MsgCenterSubscribeTopic(TOPIC_EVENT_HFP_PHONE_TO_WATCH);
MsgCenterSubscribeTopic(TOPIC_EVENT_HFP_WATCH_TO_PHONE);
+ MsgCenterSubscribeTopic(TOPIC_EVENT_HFP_HINT);
#ifdef CYWEE_SPORT
MsgCenterSubscribeTopic(TOPIC_EVENT_ACTIVITY_UPDATE);
MsgCenterSubscribeTopic(TOPIC_EVENT_ACTIVITY_EXTRA_INFO_UPDATE);
return OHOS::CreateSleepNotifyView();
}
+//显示新来电
+static OHOS::UIViewGroup* showcallhintNotify(void)
+{
+ return OHOS::CALL_INCOMING_HINT();
+}
+
void MsgCenterNotifyAlarmProc(const Topic topic, Request* req)
{
if (ret != EOK) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify memcpy_s request data fail!");
} else {
- // Prevent this from happening:
- // When the incoming call view is displayed, the calling number is not set in CallerLogModel.
- CallerLogModel::GetInstance()->SetoperateNumber(callData.number, callData.number_len);
- }
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
- CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone);
-
- if (GetCurrCallNum() > 1) {
- CallerLogModel::GetInstance()->SetNotifyFlag(true);
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetCurrCallNum %d",GetCurrCallNum());
- NotificationManager::GetInstance()->ShowNotify(ShowPhoneCallNotify, static_cast<uint16_t>(topic), true);
- } else {
- EnableWaitingView();
}
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyHfpIncomingProc");
+ CallerLogModel::GetInstance()->SetoperateNumber(callData.number, callData.number_len);
+ CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone);
NotificationManager::GetInstance()->SetWatchCallStatus(true);
}
// finish a single-channel call, or switch to phone, stop the notify
if (CallerLogModel::GetInstance()->GetNotifyFlag()) {
DisableWatingView();
- if ((topic == TOPIC_EVENT_HFP_FINISHED && GetCurrCallNum() == 0) ||
- topic == TOPIC_EVENT_HFP_PHONE_ACTIVE || topic == TOPIC_EVENT_HFP_WATCH_TO_PHONE) {
- NotificationManager::GetInstance()->StopNotify();
+ }
+ if ((topic == TOPIC_EVENT_HFP_FINISHED && GetCurrCallNum() == 0) ||
+ topic == TOPIC_EVENT_HFP_PHONE_ACTIVE || topic == TOPIC_EVENT_HFP_WATCH_TO_PHONE) {
+ NotificationManager::GetInstance()->StopNotify();
+ if( CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSource::CallSourcePhone)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetWatchCallStatus false");
NotificationManager::GetInstance()->SetWatchCallStatus(false);
}
+ else
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "无需结束");
+ }
+
}
- CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone);
+ // CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone);
}
+void MsgCenterNotifyHfpWatchHintProc(const Topic topic, Request* req)
+{
+ unused(req);
+ //NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+ NotificationManager::GetInstance()->ShowNotify(showcallhintNotify,
+ static_cast<uint16_t>(topic), true);
+}
+
+
void MsgCenterNotifyHfpWatchProc(const Topic topic, Request* req)
{
unused(req);
- if (CallerLogModel::GetInstance()->GetNotifyFlag()) {
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+ if (CallerLogModel::GetInstance()->GetNotifyFlag())
+ {
// default not mute
SetMicMute(false);
if (CallerLogModel::GetInstance()->IsMulitplePhoneStatus())
{
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
NotificationManager::GetInstance()->ShowNotify(ShowMultiPhoneCallNotify,
static_cast<uint16_t>(topic), true);
} else {
- //NotificationManager::GetInstance()->ShowNotify(ShowCallingNotify, static_cast<uint16_t>(topic), true);
- //CallerLogModel::GetInstance()->SetCallStatus(true);
+ // NotificationManager::GetInstance()->ShowNotify(ShowCallingNotify, static_cast<uint16_t>(topic), true);
+ // CallerLogModel::GetInstance()->SetCallStatus(true);
// NotificationManager::GetInstance()->StopNotify();
// NativeAbility::GetInstance().ChangeSlice(AppViewId::VIEW_INCOMING_CALL);
}
- NotificationManager::GetInstance()->SetWatchCallStatus(true);
-
+
}
- CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone);
+ NotificationManager::GetInstance()->SetWatchCallStatus(true);
+ CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone);
}
#endif
#ifdef SUPPORT_CAT1_MODEM
+//来电处理函数
void MsgCenterNotifyCatIncomingCallProc(const Topic topic, Request* req)
{
unused(topic);
unused(topic);
if (req == NULL) return ;
char* call_data = (char*)malloc(req->len);
+ if(call_data==NULL)
+ {
+ return;
+ }
int32 ret = memcpy_s(call_data, req->len, req->data, req->len);
if (ret != EOK) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify memcpy_s request data fail!");
} else {
// Prevent this from happening:
// When the incoming call view is displayed, the calling number is not set in CallerLogModel.
- if( NotificationManager::GetInstance()->GetWatchCallStatus())
+ //uapi_hfp_disconnect();
+
+ if(NotificationManager::GetInstance()->GetWatchCallStatus() &&
+ (CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourcePhone))
{
- cat1_call_hungup();
+ std::string hfp_number= CallerLogModel::GetInstance()->GetPhoneNumber();
+
+ CallerLogModel::GetInstance()->tempSetoperateNumberCAT1(hfp_number.c_str(),hfp_number.length());
+
+ CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len);
+
+ cat1_phone_state_change_cb(OPERATE_WAITING);
+
+ free(call_data);
+
return;
}
+ else
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "????????????????????");
+ }
+
int ret = PlayersModel::GetInstance()->PlayerStop();
const power_display_svr_api_t *display_api = power_display_svr_get_api();
if (display_api->get_screen_state() != SCREEN_ON)
- {
- display_api->turn_on_screen();
- }
- display_api->set_screen_set_keepon_timeout(10);
-
+ {
+ display_api->turn_on_screen();
+ }
if(true != ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
{
- AlarmClockModel::GetInstance()->AlarmPlayerStart();
+ AlarmClockModel::GetInstance()->testPlayerStart("/music/ring/ring.mp3");
}
-
+
CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len);
CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
- // hfp_hf_calls_info_t call;
- // CallChangeIncomePro(&call);
+
+ NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
+ cat1_phone_state_change_cb(OPERATE_INCOMING);
+ NotificationManager::GetInstance()->SetWatchCallStatus(true);
}
free(call_data);
- NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
- //CallerLogModel::GetInstance()->SetNotifyFlag(true);
- //NotificationManager::GetInstance()->ShowNotify(ShowPhoneCallNotify, (uint16_t)topic, true);
- cat1_phone_state_change_cb(OPERATE_INCOMING);
-
- NotificationManager::GetInstance()->SetWatchCallStatus(true);
}
+//开始通话处理函数
void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req)
{
unused(topic);
SetMicMute(false);
AlarmClockModel::GetInstance()->AlarmPlayerStop();
NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
- //CallerLogModel::GetInstance()->SetNotifyFlag(true);
-
cat1_phone_state_change_cb(OPERATE_WATCH_ACTIVE);
- //NotificationManager::GetInstance()->ShowNotify(CreateCallingView, (uint16_t)topic, true);
CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
NotificationManager::GetInstance()->SetWatchCallStatus(true);
}
+//拨号处理函数
void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify MsgCenterNotifyCat1dialProc");
} else {
int ret = PlayersModel::GetInstance()->PlayerStop();
-
- const power_display_svr_api_t *display_api = power_display_svr_get_api();
- if (display_api->get_screen_state() != SCREEN_ON)
- {
- display_api->turn_on_screen();
- }
- display_api->set_screen_set_keepon_timeout(10000);
-
+ //uapi_hfp_disconnect();
if(strcmp(call_data,"SOS")==0)
{
free(call_data);
NotificationManager::GetInstance()->ShowNotify(showSOSNotify, (uint16_t)topic, true);
return;
}
- // Prevent this from happening:
- // When the incoming call view is displayed, the calling number is not set in CallerLogModel.
- // const power_display_svr_api_t *display_api = power_display_svr_get_api();
- // if (display_api->get_screen_state() != SCREEN_ON)
- // {
- // display_api->turn_on_screen();
- // }
- // display_api->set_screen_set_keepon_timeout(10);
-
- //AlarmClockModel::GetInstance()->AlarmPlayerStart();
-
-
+
+ cat1_call_dial(call_data);
+
+ CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len);
+ CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
- cat1_call_dial(call_data);
- 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);
- NotificationManager::GetInstance()->SetWatchCallStatus(true);
- // hfp_hf_calls_info_t call;
- // CallChangeIncomePro(&call);
}
free(call_data);
NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
- //CallerLogModel::GetInstance()->SetNotifyFlag(true);
- #ifdef FD230
- //NotificationManager::GetInstance()->ShowNotify(CalldialNotify, (uint16_t)topic, true);
- #endif
-
}
+//电话结束处理函数
void MsgCenterNotifyCat1CallEndedProc(const Topic topic, Request* req)
{
unused(topic);
return;
}
cat1_phone_state_change_cb(OPERATE_WATCH_FINISH);
-
- SetMicMute(false);
- // if (CallerLogModel::GetInstance()->GetNotifyFlag() == true) {
- // NotificationManager::GetInstance()->StopNotify();
- // addcalllog();
- // }
- NotificationManager::GetInstance()->SetWatchCallStatus(false);
-
-
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetWatchCallStatus false");
}
// pview->setcat1msg(msg);
// }
// }
-
-
}
+
void MsgCenterNotifyCat1PowerOffProc(const Topic topic, Request* req)
{
unused(topic);
{TOPIC_EVENT_HFP_WATCH_TO_PHONE, MsgCenterNotifyHfpPhoneProc},
{TOPIC_EVENT_HFP_WATCH_ACTIVE, MsgCenterNotifyHfpWatchProc},
{TOPIC_EVENT_HFP_PHONE_TO_WATCH, MsgCenterNotifyHfpWatchProc},
+ {TOPIC_EVENT_HFP_HINT, MsgCenterNotifyHfpWatchHintProc},
+
#ifdef CYWEE_SPORT
{TOPIC_EVENT_ACTIVITY_UPDATE, MsgCenterNotifyActivityProc},
{TOPIC_EVENT_ACTIVITY_EXTRA_INFO_UPDATE, MsgCenterNotifyActivityExtraInfoProc},
#include "string/osal_string.h"
#include "components/ui_label_ext.h"
#include "components/ui_label_button_ext.h"
+#include "vibrator_service.h"
+#include "../../../../../../../drivers/peripheral/config/include/ConfigModel.h"
+#include "osal_timer.h"
+#include "cmsis_os2.h"
// #define NOTIFY_THREE_SECONDS 3000
// #define NOTIFY_ONE_SECOND 1000
static UILabelExt *button_UILabel=nullptr;
static UILabelButtonExt *alarm_labelbutton=nullptr;
+UIViewGroup* HintView = nullptr;
+static UILabelExt *Hint_UILabel=nullptr;
// typedef struct {
// char name[NAME_SIZE];
// unsigned char nameLen;
}
}
+void hintdialtimerCallBack(int data)
+{
+ NotificationManager::GetInstance()->StopNotify();
+}
+
+
+
+static osTimerId_t CALL_INCOMING_HINT_timer= NULL;
+
+void FreehintView(void)
+{
+ if (HintView != nullptr) {
+
+ HintView->RemoveAll();
+ if(Hint_UILabel)
+ {
+ delete Hint_UILabel;
+ Hint_UILabel=nullptr;
+ }
+
+ if(CALL_INCOMING_HINT_timer)
+ {
+ osTimerStop(CALL_INCOMING_HINT_timer);
+ osStatus_t ret = osTimerDelete(CALL_INCOMING_HINT_timer);
+ if (ret != osOK) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Disatransmitting_timer failed ret = %lx!", ret);
+ return;
+ }
+ CALL_INCOMING_HINT_timer = nullptr;
+ }
+
+
+ RootView::GetInstance()->Remove(HintView);
+ delete HintView;
+ HintView = nullptr;
+ }
+}
+
+
+UIViewGroup* CALL_INCOMING_HINT(void)
+{
+ HintView = new UIViewGroup();
+ if (HintView == nullptr) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateCallingView callingView null!");
+ return nullptr;
+ }
+ HintView->SetPosition(MATH_ZERO, MATH_ZERO);
+ HintView->SetWidth(Screen::GetInstance().GetWidth());
+ HintView->SetHeight(Screen::GetInstance().GetHeight());
+ HintView->SetStyle(STYLE_BACKGROUND_OPA, 0);
+
+ if (Hint_UILabel == nullptr) {
+ Hint_UILabel = new UILabelExt();
+ }
+ Hint_UILabel->SetPosition(62, 199); // widget's left position and top position
+ Hint_UILabel->Resize(340, 30); // widget's width and height
+ Hint_UILabel->SetViewId("label3");// Set style
+ Hint_UILabel->SetStyle(STYLE_BACKGROUND_COLOR, 0xffAAAAAA);
+ Hint_UILabel->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ Hint_UILabel->SetStyle(STYLE_BORDER_RADIUS, 27);
+ Hint_UILabel->SetStyle(STYLE_TEXT_FONT, 33);
+ Hint_UILabel->SetStyle(STYLE_LINE_SPACE, 0);
+
+ // Set additional property
+ Hint_UILabel->SetText("手机新来电");
+ Hint_UILabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+ Hint_UILabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ Hint_UILabel->SetRollSpeed(0);
+ Hint_UILabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 33);
+
+ HintView->Add(Hint_UILabel);
+ Hint_UILabel->SetVisible(true);
+ Hint_UILabel->LayoutCenterOfParent();
+
+ uint32_t tick;
+ osStatus_t retTimer;
+
+ CALL_INCOMING_HINT_timer = osTimerNew((osTimerFunc_t)hintdialtimerCallBack, osTimerPeriodic, NULL, NULL);
+ tick =2000;// osMs2Tick(1000);
+ retTimer = osTimerStart(CALL_INCOMING_HINT_timer, tick);
+ if (retTimer != osOK && CALL_INCOMING_HINT_timer != NULL) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"StartCallTimer osTimerStart failed, ret = %lx!!", retTimer);
+ osTimerDelete(CALL_INCOMING_HINT_timer);
+ CALL_INCOMING_HINT_timer = NULL;
+ return NULL;
+ }
+
+ NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreehintView);
+
+ return HintView;
+
+}
+
+
UIViewGroup* SOS_cant_dial(void)
{
SOSView = new UIViewGroup();
}
+static osTimerId_t Waiting_timer=NULL;
+
+static void RejectIncomingCall_Timer_CallBack(int data)
+{
+ if(RejectIncomingCall() != 0) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[HintsHandupClick] RejectIncomingCall error");
+ return ;
+ }
+ cat1_call_hungup();
+ osTimerDelete(Waiting_timer);
+ Waiting_timer = NULL;
+ CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone);
+ CallerLogModel::GetInstance()->SetCallStatus(true);
+ CallerLogModel::GetInstance()->SetWaitingStatus(false);
+
+ std::string hfp_number= CallerLogModel::GetInstance()->GettempPhoneNumber();
+ CallerLogModel::GetInstance()->SetoperateNumber(hfp_number.c_str(),hfp_number.length());
+
+ NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID,
+ PRIORITY_ONE);
+}
+
static void WaitingOpreate()
{
+
+ if(NotificationManager::GetInstance()->GetWatchCallStatus())
+ {
+ if(!CallerLogModel::GetInstance()->get_RejectIncomingCall_falg())
+ {
+ CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
+ uint32_t tick;
+ osStatus_t retTimer;
+ if(Waiting_timer!=NULL)
+ {
+ cat1_call_hungup();
+ osTimerDelete(Waiting_timer);
+ Waiting_timer = NULL;
+ return;
+ }
+ Waiting_timer = osTimerNew((osTimerFunc_t)RejectIncomingCall_Timer_CallBack, osTimerOnce, NULL, NULL);
+ tick =3000;// osMs2Tick(1000);
+ retTimer = osTimerStart(Waiting_timer, tick);
+ if (retTimer != osOK && Waiting_timer != NULL) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"StartCallTimer osTimerStart failed, ret = %lx!!", retTimer);
+ osTimerDelete(Waiting_timer);
+ Waiting_timer = NULL;
+ return ;
+ }
+ CallerLogModel::GetInstance()->set_RejectIncomingCall_falg(1);
+
+ }
+ else
+ {
+ cat1_call_hungup();
+ std::string hfp_number= CallerLogModel::GetInstance()->GettempPhoneNumber();
+ CallerLogModel::GetInstance()->SetoperateNumber(hfp_number.c_str(),hfp_number.length());
+
+ return;
+ }
+
+ }
CallerLogModel::GetInstance()->SetCallStatus(false);
CallerLogModel::GetInstance()->SetWaitingStatus(true);
- // If the call is handling in the notification, the slice is not switched
+
+
NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID,
- PRIORITY_ONE);
-
+ PRIORITY_ONE);
}
static void WatchActiveHandle()
DisableCallTimer(CallTimerType::NOTIFY_PHONE_DIAL_DISPLAY);
CallerLogModel::GetInstance()->SetCallStatus(true);
CallerLogModel::GetInstance()->SetWaitingStatus(false);
+
}
sos_falg_add();
}
else
- StatusReset();
+ {
+ if(CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourcePhone)
+ {
+
+ }
+ else
+ {
+ PhoneServiceScreenCtr(false);
+
+ addcalllog();
+ StatusReset();
+ }
+ }
+
}
-
-
DisableCallTimer(CallTimerType::NOTIFY_PHONE_DIAL_DISPLAY);
}
switch (g_callOperate) {
case OPERATE_DIALING:
// 显示正在呼出界面
+ PhoneServiceScreenCtr(true);
DialingHandle();
call_stat=0;
break;
case OPERATE_INCOMING:
// 显示电话呼入
+ PhoneServiceScreenCtr(true);
IncomingHandle();
calllog_info_init();
+ if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
+ {
+ ui_api_vibrate_once_func();
+ }
call_stat=2;
break;
case OPERATE_WAITING:
// 震动一下,提示有新电话呼入 还未对齐
+ calllog_info_init();
+ call_stat=2;
+ addcalllog();
WaitingOpreate();
return;
// 手表接听,显示界面
if(call_stat==2)
call_stat=1;
+ PhoneServiceScreenCtr(true);
sos_falg_clean();
WatchActiveHandle();
break;
return;
case OPERATE_WATCH_FINISH:
- addcalllog();
WatchFinishHandle();
return;
case OPERATE_WATCH_REJECT: