uint8_t get_stcak_size();
void symbol_stack_top_uddata(char data);
void clean_stack();
+ void symbol_stack_pop(void);
private:
CalculatorModel();
CalculatorModel(const CalculatorModel &);
UILabel *number{nullptr};
UILabelExt *hint{nullptr};
- std::string number_string="";
+ std::string number_string=" ";
UIView::OnClickListener* clickLeftListener{nullptr};
UIView:: OnDragListener* dragListener{nullptr};
}
}
+
+void CalculatorModel:: symbol_stack_pop(void)
+{
+ if(!symbolStack.empty())
+ {
+ symbolStack.pop();
+ }
+}
+
uint8_t CalculatorModel::get_stcak_size()
{
return numberStack.size();
#include "calculator/include/CalculatorModel.h"
#include "wearable_log.h"
#include <math.h>
+#include <iostream>
+#include <iomanip>
namespace OHOS {
double number_float=strtod(text_buf,NULL);
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%lf %s",number_float,text_buf);
+ char new_buf_[64]={0};
+ sprintf_s(new_buf_,64,"%.010lf",number_float);
+ number_float=strtod(new_buf_,NULL);
+
CalculatorModel::GetInstance()->number_push_stack(number_float);
if( CalculatorModel::GetInstance()->get_stcak_size()>=2)
char new_buf[64]={0};
- const char*text_buf=number_string.c_str();
+ char*text_buf=(char *)number_string.c_str();
double number_float=strtod(text_buf,NULL);
if(buf[0]=='C')
}
else if (buf[0]=='D')
{
- number_float=0;
- sprintf_s(new_buf,16,"%.00lf",number_float);
-
- number_string=new_buf;
- number->SetText(new_buf);
- number_falg=2;
+ // number_float=0;
+ // sprintf_s(new_buf,16,"%.00lf",number_float);
+ text_buf[number_string.length()-1]='\0';
+ number_string=text_buf;
+ number->SetText(text_buf);
+ if(number_falg==0)
+ {
+ CalculatorModel::GetInstance()->symbol_stack_pop();
+ number_falg=1;
+ }
+ else
+ {
+ number_falg=1;
+ }
+
+
RootView::GetInstance()->Invalidate();
}
char new_buf[64]={0};
const char*text_buf=number_string.c_str();
+ double number_float=0;
- double number_float=strtod(text_buf,NULL);
-
- CalculatorModel::GetInstance()->number_push_stack(number_float);
+ if(text_buf[0]>='0' && text_buf[0]<='9')
+ {
+ number_float=strtod(text_buf,NULL);
+ char new_buf_[64]={0};
+ sprintf_s(new_buf_,64,"%.010lf",number_float);
+ number_float=strtod(new_buf_,NULL);
+ CalculatorModel::GetInstance()->number_push_stack(number_float);
+ }
+
number_float =CalculatorModel::GetInstance()->calculate_stack();
+ char new_buf_[64]={0};
+ sprintf_s(new_buf_,64,"%.010lf",number_float);
+ number_float=strtod(new_buf_,NULL);
+
double number_float_=number_float;
int decimal_places = 0;
double frac;
}
}
+#include "dial_sos_c.h"
+
/* 状态复位 */
void StatusReset(void)
{
CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone);
DisshakeTimer();
+
+
// If the call is handling in the notification, the slice is not switched
if (!CallerLogModel::GetInstance()->GetNotifyFlag())
{
PhoneServiceScreenCtr(false);
if(NativeAbility::GetInstance().GetCurSliceId() == VIEW_INCOMING_CALL)
{
+
NativeAbility::GetInstance().Back_CountSlice_make_phone();
}
if (GetCurrCallNum() == 0) {
g_phoneStatus = PHONE_SINGLE_STATUS;
}
+
+ if(get_falg_SOS())
+ {
+ sos_falg_add();
+ }
}
static void WatchFinishHandle(void)
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "??????????????????????");
}
g_phoneStatus = PHONE_SINGLE_STATUS;
+
+ if(get_falg_SOS())
+ {
+ sos_falg_add();
+ }
}
void CAT1_ChangeStatusScreendisplay(int lastStatus)
void CallerLogModel::SetCallStatus(bool status)
{
callStatus = status;
+ if(status)
+ sos_falg_clean();
}
bool CallerLogModel::GetCallStatus()
bool get_phone_addrss_name(char *name,const char *phone,uint8_t *sex)
{
+
+ for(int i=0;i<get_sos_number_count();i++)
+ {
+ if(addrss_strcmp((char *)phone,sos_number_data[i].number))
+ {
+ strcpy_s(name,NAME_LEN+1,sos_number_data[i].name);
+ if(sex!=NULL)
+ *sex= sos_number_data[i].sex==0 ? 1:2;
+ return true;
+ }
+ }
+
+
for(int i=0;i<addressbook_t.num;i++)
{
//if(strcmp(phone,addressbook_t.Contact_t[i].phone_number_t[0].number)==0)
}
}
}
+
strcpy_s(name,NAME_LEN+1,"未知");
return false;
}
\r
printf("设置步数:%d %d %d %d \r\n",targetStep,ringOn,vibration,notify);\r
\r
+ set_goal_stepcount(targetStep);\r
+ \r
\r
if(ringOn &&vibration && notify)\r
set_goal_step_notification(1);\r
void sos_falg_clean(void);
+uint8_t get_falg_SOS(void);
+
+
#ifdef __cplusplus
#if __cplusplus
}
#define SOS_TEST_FLAG 0
-#define SOS_HFP_FALG 0
+#define SOS_HFP_FALG 1
#define DIAL_TIME 30
{
if(sos_dail_falg)
{
-
+ printf("sos dial %d\r\n",sos_dail_falg);
#if SOS_TEST_FLAG
if(1)
#else
calldial_event_sendmsg_toUI("SOS");
}
sos_dail_falg++;
- if(sos_dail_falg>=9)
+ if(sos_dail_falg>=OHOS::get_sos_number_count()*3)
{
sos_dail_falg=0;
}
#if SOS_HFP_FALG
else if(uapi_hfp_connect_state())
{
- DialCall((unsigned char *)sos_dail_buf,osal_strlen((const char*)sos_dail_buf));
+ DialCall((unsigned char *)OHOS::get_sos_number(0),osal_strlen((const char*)OHOS::get_sos_number(0)));
sos_dail_falg=1;
}
#endif
{
if (NotificationManager::GetInstance()->GetWatchCallStatus())
{
- if(get_falg_SOS())
+ if(get_falg_SOS())
{
addcalllog();
sos_falg_add();
}
else
{
- if(CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourcePhone)
- {
- addcalllog();
- }
- else if(uapi_dev_runtime_get_train_status() || transmittingISShow())
- {
- addcalllog();
- StatusReset();
- }
- else
- {
- uapi_cat1_stop_volte_voice();
-
- addcalllog();
- StatusReset();
- }
+ if(CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourcePhone)
+ {
+ addcalllog();
}
-
+ else if(uapi_dev_runtime_get_train_status() || transmittingISShow())
+ {
+ addcalllog();
+ StatusReset();
+ }
+ else
+ {
+ uapi_cat1_stop_volte_voice();
+
+ addcalllog();
+ StatusReset();
+}
+ }
+
}
DisableCallTimer(CallTimerType::NOTIFY_PHONE_DIAL_DISPLAY);
}
if(call_stat==2)
call_stat=1;
PhoneServiceScreenCtr(true);
- sos_falg_clean();
WatchActiveHandle();
break;
case OPERATE_PHONE_HOLD: