#include "notification_manager.h"
#include "osal_timer.h"
#include "cmsis_os2.h"
+#include "custom_utils.h"
+#include "ConfigModel.h"
+#include "vibrator_service.h"
+#include "custom_runtime.h"
#ifdef __cplusplus
extern "C" {
}
-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()
{
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 ;
+ if(RejectIncomingCall() != 0) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[HintsHandupClick] RejectIncomingCall error");
+ return ;
}
CallerLogModel::GetInstance()->set_RejectIncomingCall_falg(1);
-
+ CustomEventPublish(TOPIC_EVENT_HFP_HINT,NULL,0);
}
else
{
}
return;
}
-
}
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[WaitingOpreate] WaitingOpreate");
- CallerLogModel::GetInstance()->SetCallStatus(false);
- CallerLogModel::GetInstance()->SetWaitingStatus(true);
- // If the call is handling in the notification, the slice is not switched
- if (!CallerLogModel::GetInstance()->GetNotifyFlag()) {
- NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID,
- PRIORITY_ONE);
- } else {
- g_isWatchCallView = true;
- }
}
static void WatchActiveHandle(const PhoneCallInfo *phoneCall)
namespace OHOS {
class MainCallingView;
class MainCallingPresenter : public Presenter<MainCallingView>,
+ public RootView::OnKeyActListener,
public UIView::OnClickListener ,
public UIView::OnDragListener{
public:
bool CallingViewDisplay();
bool InitPointerValue();
bool OnClick(UIView& view, const ClickEvent& event) override;
+ bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件
bool OnDragEnd(UIView &view, const DragEvent &event) override;
VolumeSettingView *GetvolumeSetting();
return true;
}
+bool MainCallingPresenter::OnKeyAct(UIView &view, const KeyEvent &event) // 增加按键事件
+{
+ return true;
+}
+
VolumeSettingView *MainCallingPresenter::GetvolumeSetting()
{
return volumeSetting;
if (InitPointerValue() == false) {
return;
}
+ RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::MainCallingPresenter::GetInstance();
+ RootView::GetInstance()->SetOnKeyActListener(keyactListener);
RootView::GetInstance()->Add(displayGroup);
RootView::GetInstance()->Add(callingGroup);
{
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)
// {
}
if ((topic == TOPIC_EVENT_HFP_FINISHED && GetCurrCallNum() == 0) ||
topic == TOPIC_EVENT_HFP_PHONE_ACTIVE || topic == TOPIC_EVENT_HFP_WATCH_TO_PHONE) {
- NotificationManager::GetInstance()->StopNotify();
+ //NotificationManager::GetInstance()->StopNotify();
if( CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSource::CallSourcePhone)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetWatchCallStatus false");
// Prevent this from happening:
// When the incoming call view is displayed, the calling number is not set in CallerLogModel.
//uapi_hfp_disconnect();
-
- if(uapi_dev_runtime_get_train_status())
+ if((NotificationManager::GetInstance()->GetWatchCallStatus() &&
+ (CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourcePhone)) || uapi_dev_runtime_get_train_status())
{
- CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len);
- cat1_call_hungup();
- free(call_data);
-
- return;
- }
-
- if(NotificationManager::GetInstance()->GetWatchCallStatus() &&
- (CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourcePhone))
- {
- std::string hfp_number= CallerLogModel::GetInstance()->GetPhoneNumber();
-
- CallerLogModel::GetInstance()->tempSetoperateNumberCAT1(hfp_number.c_str(),hfp_number.length());
-
- CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len);
+ CallerLogModel::GetInstance()->tempSetoperateNumberCAT1(call_data,req->len);
cat1_phone_state_change_cb(OPERATE_WAITING);
-
free(call_data);
return;
return;
}
SetMicMute(false);
- // AlarmClockModel::GetInstance()->AlarmPlayerStop()
- AlarmViewEventListener::GetInstance()->CancelAlarmRing();
+ AlarmClockModel::GetInstance()->AlarmPlayerStop();
+ //AlarmViewEventListener::GetInstance()->CancelAlarmRing();
NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
cat1_phone_state_change_cb(OPERATE_WATCH_ACTIVE);
CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
unused(topic);
unused(req);
// just stop the notify
- // AlarmClockModel::GetInstance()->AlarmPlayerStop();
- AlarmViewEventListener::GetInstance()->CancelAlarmRing();
+ AlarmClockModel::GetInstance()->AlarmPlayerStop();
+ // AlarmViewEventListener::GetInstance()->CancelAlarmRing();
if(!NotificationManager::GetInstance()->GetWatchCallStatus())
{
return;
SOSView = nullptr;
}
}
-
+uint8_t CALL_INCOMING_HINT_timer_FALG=0;
void hintdialtimerCallBack(int data)
{
- NotificationManager::GetInstance()->StopNotify();
+ CALL_INCOMING_HINT_timer_FALG--;
+ if(CALL_INCOMING_HINT_timer_FALG)
+ {
+ if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
+ {
+ ui_api_vibrate_once_func();
+ }
+ }
+ if(CALL_INCOMING_HINT_timer_FALG==0)
+ {
+ NotificationManager::GetInstance()->StopNotify();
+ }
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hintdialtimerCallBack ??????!");
+
}
uint32_t tick;
osStatus_t retTimer;
-
+ CALL_INCOMING_HINT_timer_FALG=3;
CALL_INCOMING_HINT_timer = osTimerNew((osTimerFunc_t)hintdialtimerCallBack, osTimerPeriodic, NULL, NULL);
- tick =2000;// osMs2Tick(1000);
+ tick =osMs2Tick(1000);// 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);
}
CallLogInfo info;
-void calllog_info_init()
+void calllog_info_init(uint8_t type)
{
strcpy(info.name,"xxx");
info.nameLen=3;
- int len=strlen(CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
- memcpy_s(info.tel,20,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),len+1);
+ int len;
+ if(type==0)
+ {
+ len=strlen(CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+ memcpy_s(info.tel,20,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),len+1);
+ }
+ else
+ {
+ len=strlen(CallerLogModel::GetInstance()->GettempPhoneNumber().c_str());
+ memcpy_s(info.tel,20,CallerLogModel::GetInstance()->GettempPhoneNumber().c_str(),len+1);
+ }
+
+
uint32_t tmptime=0;
uapi_get_timestampe_ss(&tmptime);
info.creationTime = tmptime;
}
-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())
{
- 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;
- }
-
+ cat1_call_hungup();
+ CustomEventPublish(TOPIC_EVENT_HFP_HINT,NULL,0);
+ CallerLogModel::GetInstance()->set_RejectIncomingCall_falg(1);
+ return;
+ }
+ else
+ {
+ cat1_call_hungup();
+ return;
}
-
- CallerLogModel::GetInstance()->SetCallStatus(false);
- CallerLogModel::GetInstance()->SetWaitingStatus(true);
-
-
- NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID,
- PRIORITY_ONE);
}
static void WatchActiveHandle()
{
if(CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourcePhone)
{
-
+ addcalllog();
}
else if(uapi_dev_runtime_get_train_status())
{
- calllog_info_init();
- call_stat=2;
addcalllog();
}
else
DialingHandle();
call_stat=0;
- calllog_info_init();
+ calllog_info_init(0);
break;
case OPERATE_ALERTING:
// 显示对方响铃
// 显示电话呼入
PhoneServiceScreenCtr(true);
IncomingHandle();
- calllog_info_init();
+ calllog_info_init(0);
if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
{
ui_api_vibrate_once_func();
break;
case OPERATE_WAITING:
// 震动一下,提示有新电话呼入 还未对齐
- calllog_info_init();
- call_stat=2;
- addcalllog();
WaitingOpreate();
-
+ call_stat=2;
+ calllog_info_init(1);
return;
case OPERATE_WATCH_ACTIVE:
// 手表接听,显示界面
g_phoneView->SetDraggable(true);
g_phoneView->SetTouchable(true);
call_stat=2;
- calllog_info_init();
+ calllog_info_init(0);
NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreePhoneCallView);
return g_phoneView;
}
StartCallTimer(CallTimerType::NOTIFY_PHONE_DIAL_DISPLAY, (int32_t)NOTIFY_ONE_SECOND);
call_stat=0;
- calllog_info_init();
+ calllog_info_init(0);
NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeCalldialView);