修改cat1拨号,增加超时重拨
authorhcj <1224667075@qq.com>
Tue, 11 Feb 2025 01:53:28 +0000 (09:53 +0800)
committerhcj <1224667075@qq.com>
Tue, 11 Feb 2025 01:53:28 +0000 (09:53 +0800)
code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp
code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp
code/sdk/drivers/peripheral/utils/custom_audio_gate.c [new file with mode: 0644]
code/sdk/drivers/peripheral/utils/custom_runtime.h

index c59fc5b..0185671 100644 (file)
@@ -91,7 +91,7 @@ namespace OHOS
                                 }
                                 else
                                 {
-                                    uint8_t time=0;
+                                    uint8_t time=200;
                                     do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_CONNECT, &time, sizeof(uint8_t));
                                 }
                             }
index de1b199..6901e18 100644 (file)
@@ -267,6 +267,11 @@ static osTimerId_t g_timer_time_answer = NULL;
 
 static osTimerId_t g_timer_time_Dial = NULL;
 
+#define  DIAL_OVERTIME 3000
+
+void cat1_rep_call_dial(void);
+
+static uint8_t dial_count=0;
 /**如果 
  * g_python_updated == 0 && 
  * g_py_ver >= PY_SRV_VER_SUPORT_PY_OTA_MINI_VER &&
@@ -867,6 +872,28 @@ void cat1_ota_update(char *url)
 {
     udp_send_msg_toCat1(UDP_CMD_CAT1_OTA_UPDATE,url);
 }
+ 
+static char *dial_phonenum=NULL;
+
+void cat1_rep_call_dial(void)
+{
+    bool volte = OHOS::ConfigModel::GetInstance()->GetVoLTE_Call();
+    if (volte == true){
+         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"cat1_call_dial %s\n",dial_phonenum);
+        // #if PY_SRV_VER_CURRENT >=16
+        if(g_py_ver>=16)
+        {
+            if(osTimerIsRunning(g_timer_time_Dial)==0  )
+            {
+                osStatus_t ret = osTimerStart(g_timer_time_Dial,5000); 
+                WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 g_timer_time_Dial timer ret %d\n",ret);
+            }
+        }
+        udp_send_msg_toCat1(UDP_CMD_DIAL_NUMB,dial_phonenum);
+    }
+
+
+}
 
 void cat1_call_dial(char* phonenum)
 {
@@ -878,12 +905,20 @@ void cat1_call_dial(char* phonenum)
         {
             if(osTimerIsRunning(g_timer_time_Dial)==0  )
             {
-                osStatus_t ret = osTimerStart(g_timer_time_Dial,5000); 
+                osStatus_t ret = osTimerStart(g_timer_time_Dial,DIAL_OVERTIME); 
                 WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 g_timer_time_Dial timer ret %d\n",ret);
             }
         }
+
           
         // #endif
+        if(dial_phonenum)
+        free(dial_phonenum);
+
+        dial_phonenum=(char *)malloc(strlen(phonenum)+1);
+        memset(dial_phonenum,0,strlen(phonenum)+1);
+        memcpy_s(dial_phonenum,30,phonenum,strlen(phonenum));
+        dial_count=0;
 
         udp_send_msg_toCat1(UDP_CMD_DIAL_NUMB,phonenum);
     }
@@ -1159,13 +1194,29 @@ static void time_answer_func(void)
      WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"time_answer_func\n");
     cat1_handle_call_disconnected("callfail");
 }
+#define CAT1_DAIL_REP
+#define CAT1_DAIL_REP_COUNT 1
 
 //电话接听超时
 static void time_dial_func(void)
 {
     osTimerStop(g_timer_time_Dial);
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"time_dial_func\n");
+    #ifdef CAT1_DAIL_REP
+    if(dial_count<CAT1_DAIL_REP_COUNT)
+    {
+        cat1_rep_call_dial();
+        dial_count++;
+    }
+    else
+    {
+
+    #else
     cat1_handle_call_disconnected("callfail");
+    #endif
+
+    }
+    
 }
 
 int cat1_handle_call_connected(char* phonenum)
diff --git a/code/sdk/drivers/peripheral/utils/custom_audio_gate.c b/code/sdk/drivers/peripheral/utils/custom_audio_gate.c
new file mode 100644 (file)
index 0000000..4c2fe92
--- /dev/null
@@ -0,0 +1,83 @@
+#include "custom_runtime.h"
+#include "chip_system_time.h"
+#include <stdint.h>
+
+#include "audio_base_type.h"
+
+typedef enum
+{
+    TYPE_DEFAULT = -1,
+    /** Media */
+    TYPE_PHONE = 0,
+}Audio_runtime_status;
+
+
+typedef enum
+{
+    TYPE_DEFAULT = 0,
+    /** Media */
+    TYPE_WATCH ,
+    TYPE_A2DP ,
+    TYPE_HFP,
+}Audio_Output_type;
+
+typedef enum
+{
+    TYPE_DEFAULT = -1,
+    /** Media */
+    TYPE_A2DP = 0,
+    TYPE_HFP,
+    TYPE_HFP,
+}Audio_Input_type;
+
+typedef struct 
+{
+    AudioStreamType  AudioStreamType;
+    Audio_runtime_status runtime_status;
+    char *source;
+    Audio_Input_type  Input_type;
+    Audio_Output_type  Output_type;
+    bool mixture;
+}Audio_status_t;
+
+
+static Audio_status_t g_audio_gate={0};
+
+
+void uapi_updata_audio_gate(uint32_t AudioStreamType,uint32_t runtime_status,bool mixture)
+{
+    g_audio_gate.AudioStreamType=AudioStreamType;
+    g_audio_gate.runtime_status=runtime_status;
+    g_audio_gate.mixture=mixture;
+}
+
+
+void uapi_updata_audio_gate_source(char *source)
+{
+    if( g_audio_gate.source)
+    {
+        free(g_audio_gate.source);
+        g_audio_gate.source=NULL;
+    }
+    g_audio_gate.source=(char *)malloc(strlen(source)+1);
+    memset(g_audio_gate.source,0,strlen(source)+1);
+    memcpy(g_audio_gate.source,source,strlen(source)+1);;
+
+}
+
+void uapi_updata_audio_gate_type(uint32_t Input_type,uint32_t Output_type)
+{
+    g_audio_gate.Input_type=Input_type;
+    g_audio_gate.Output_type=Output_type;
+}
+
+
+uint32_t uapi_get_gate_AudioStreamType_status(void)
+{
+   return g_audio_gate.AudioStreamType;
+}
+
+bool uapi_get_gate_mixture_status(void)
+{
+   return g_audio_gate.mixture;
+}
\ No newline at end of file
index 1f414c9..0fb18c4 100644 (file)
@@ -13,7 +13,7 @@
 #include <stdio.h>
 #include "errcode.h"
 #include "soc_osal.h"
-
+#include "stdbool.h"
 #ifdef __cplusplus
 #if __cplusplus
 extern "C" {
@@ -321,6 +321,17 @@ void uapi_dev_runtime_atuoota_status_status(uint8_t data);
 
 uint8_t uapi_dev_runtime_get_atuoota_status(void);
 
+
+void uapi_updata_audio_gate(uint32_t AudioStreamType,uint32_t runtime_status,bool mixture);
+
+void uapi_updata_audio_gate_source(char *source);
+
+void uapi_updata_audio_gate_type(uint32_t Input_type,uint32_t Output_type);
+
+uint32_t uapi_get_gate_AudioStreamType_status(void);
+
+bool uapi_get_gate_mixture_status(void);
+
 #ifdef __cplusplus
 #if __cplusplus
 }