From: SnickerSun Date: Sat, 2 Mar 2024 06:31:03 +0000 (+0800) Subject: cat1 service指令解析+notify处理函数示例,当下与cat1交互已经正常 X-Git-Tag: release_V1.2.70_20241020_135402~1274^2~38^2~8 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=f11572b417ad1fa6c1f4b97d05544f3bdf2a860d;p=mirrors%2FFD230.git cat1 service指令解析+notify处理函数示例,当下与cat1交互已经正常 --- diff --git a/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerLogModel.h b/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerLogModel.h index 4069b2b0b..a62120e0d 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerLogModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerLogModel.h @@ -42,7 +42,12 @@ namespace OHOS { using namespace std; class CallerLogModel { + public: + typedef enum { + CallSourcePhone, + CallSourceCat1, + } CallSource; void InitPhoneService(); static CallerLogModel *GetInstance(void); @@ -73,6 +78,15 @@ public: bool GetNotifyFlag(void); void SetNotifyFlag(bool flag); + + CallSource GetCallSource(void) + { + return callsrc; + } + void SetCallSource(CallSource source) + { + callsrc = source; + } private: CallerLogModel(); CallerLogModel(const CallerLogModel &); @@ -89,6 +103,8 @@ private: bool phoneStatus{false}; // 判断是拨打界面还是呼入界面 bool callStatus{false}; // 判断是否正在接听电话 bool notifyFlag{false}; // 判断是否来电呼入 由notify生成界面 + + CallSource callsrc{CallSourcePhone}; //电话来源 }; } #ifdef __cplusplus diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index e9b5b5a8e..eb38dcbfa 100755 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -182,6 +182,7 @@ void MsgCenterNotifyHfpIncomingProc(const Topic topic, Request* req) // Prevent this from happening: // When the incoming call view is displayed, the calling number is not set in CallerLogModel. CallerLogModel::GetInstance()->SetoperateNumber(call_data.number, call_data.number_len); + CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone); } NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); CallerLogModel::GetInstance()->SetNotifyFlag(true); @@ -293,7 +294,22 @@ void MsgCenterNotifyStopSPO2MonitoringProc(const Topic topic, Request* req) void MsgCenterNotifyCatIncomingCallProc(const Topic topic, Request* req) { unused(topic); - unused(req); + unused(topic); + if (req == NULL) return ; + char* call_data = (char*)malloc(req->len); + 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. + CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len); + CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1); + } + free(call_data); + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); + CallerLogModel::GetInstance()->SetNotifyFlag(true); + NotificationManager::GetInstance()->ShowNotify(showPhoneCallNotify, (uint16_t)topic, true); } void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req) { diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp index 50f5ee09a..80c4ee23d 100755 --- a/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp @@ -17,7 +17,9 @@ #include "VolumeSettingView.h" #include "VolumeSettingPresenter.h" #include "ui_resource_image.h" - +#ifdef SUPPORT_CAT1_SERVICE +#include "cat1_server.h" +#endif #define NOTIFY_THREE_SECONDS 3000 #define NOTIFY_ONE_SECOND 1000 #define NOTIFY_THIRTY_SECONDS 30000 @@ -510,26 +512,46 @@ bool CallViewEventListener::OnClick(UIView& view, const ClickEvent& event) { UNUSED(event); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MakephoneNotify ClickListener %s", view.GetViewId()); +// + if (strcmp(view.GetViewId(), "answer") == 0) { // watch answer the call - if (AcceptIncomingCall() != 0) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AcceptIncomingCall() fail"); - return false; + + if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) + { + #ifdef SUPPORT_CAT1_SERVICE + cat1_call_answer(); + #endif + + }else{ + if (AcceptIncomingCall() != 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AcceptIncomingCall() fail"); + return false; + } } + return true; } else if (strcmp(view.GetViewId(), "displayHandUp") == 0 || strcmp(view.GetViewId(), "callingHandUp") == 0) { if (strcmp(view.GetViewId(), "displayHandUp") == 0) { // The watch rejects the call - if (RejectIncomingCall() != 0) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RejectIncomingCall() fail"); - return false; + if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) + { + #ifdef SUPPORT_CAT1_SERVICE + cat1_call_hungup(); + #endif + + }else{ + if (RejectIncomingCall() != 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RejectIncomingCall() fail"); + return false; + } + if (FinishCall() != 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FinishCall() fail"); + return false; + } } - } - if (FinishCall() != 0) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FinishCall() fail"); - return false; - } + } return true; } else if (strcmp(view.GetViewId(), "microphoneChange") == 0) { if (changeImage == 0) { @@ -545,6 +567,7 @@ bool CallViewEventListener::OnClick(UIView& view, const ClickEvent& event) } else if (strcmp(view.GetViewId(), "volumeSwitch") == 0) { HonrsViewChange(); } +// #endif return true; } } // namespace OHOS \ No newline at end of file diff --git a/code/sdk/build/script/parse_tool/config.py b/code/sdk/build/script/parse_tool/config.py index c743b05ba..39f16aaab 100755 --- a/code/sdk/build/script/parse_tool/config.py +++ b/code/sdk/build/script/parse_tool/config.py @@ -2,7 +2,7 @@ # coding:utf-8 # Copyright (c) @CompanyNameMagicTag 2022-2023. All rights reserved. -LOSCFG_BASE_IPC_QUEUE_LIMIT = 30 +LOSCFG_BASE_IPC_QUEUE_LIMIT = 40 LOSCFG_BASE_CORE_SWTMR_LIMIT = 50 LOSCFG_BASE_IPC_SEM_LIMIT = 30 LOSCFG_PLATFORM_HWI_LIMIT = 96 diff --git a/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h b/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h index b60dff1bc..2189c377a 100755 --- a/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h +++ b/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h @@ -10,7 +10,9 @@ #include "pinctrl_porting.h" #include "gpio_porting.h" #include "platform_types.h" - +#ifdef SUPPORT_CAT1_SERVICE +#include "cat1_ctl.h" +#endif /** * @addtogroup connectivity_config_boards * @{ @@ -231,7 +233,7 @@ const hal_pio_config_t g_pio_function_config[PIN_MAX_NUMBER] = { */ -#define DEFAULT_POWERON_CAT1 0 +#define DEFAULT_POWERON_CAT1 1 //需要配置默认输出的,以及需要配置默认输入中断函数的。 const hal_gpio_config_t g_gpio_function_config[PIN_MAX_NUMBER] = { @@ -277,6 +279,11 @@ const hal_gpio_config_t g_gpio_function_config[PIN_MAX_NUMBER] = { { S_AGPIO_L19, HAL_GPIO_DIRECTION_INPUT, HAL_GPIO_LEVEL_HIGH, 0, NULL }, /**S_AGPIO_R1 GPO alipay默认resetpin*/ { S_AGPIO_R1, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_HIGH, 0, NULL }, +#ifdef SUPPORT_CAT1_SERVICE + /**cat1 ring input key*/ + { S_AGPIO_L31, HAL_GPIO_DIRECTION_INPUT, HAL_GPIO_LEVEL_HIGH, GPIO_INTERRUPT_DEDGE, cat1_ring_isr_callback}, +#endif + }; /** * @} diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_at_cmd.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_at_cmd.cpp index 7d0f12bc2..f4c6f30d7 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_at_cmd.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_at_cmd.cpp @@ -73,11 +73,18 @@ static uint32_t cat1_power(uint8_t *para, uint32_t paraLen, char *strCommonCmd) printf("CAT1TEST ATCMD power enable %d \n",enabled); - + if(enabled == 0) + { + uapi_cat1_power_on(1); + uapi_cat1_reset(0); + }else{ + uapi_cat1_power_on(0); + uapi_cat1_reset(1); + } return ERRCODE_SUCC; } -static uint32_t cat1_dial(uint8_t *para, uint32_t paraLen, char *strCommonCmd) +static uint32_t at_cat1_dial(uint8_t *para, uint32_t paraLen, char *strCommonCmd) { UNUSED(strCommonCmd); uint8_t argv[PPG_MAX_ARGC][PPG_MAX_ARGV_LEN] = { 0 }; @@ -97,19 +104,19 @@ static uint32_t cat1_dial(uint8_t *para, uint32_t paraLen, char *strCommonCmd) printf("CAT1TEST ATCMD dial %s \n",phoneno); - + cat1_call_dial(phoneno); return ERRCODE_SUCC; } -static uint32_t cat1_answer(uint8_t *para, uint32_t paraLen, char *strCommonCmd) +static uint32_t at_cat1_answer(uint8_t *para, uint32_t paraLen, char *strCommonCmd) { UNUSED(strCommonCmd); printf("CAT1TEST ATCMD answer \n"); - + cat1_call_answer(); return ERRCODE_SUCC; } -static uint32_t cat1_hungup(uint8_t *para, uint32_t paraLen, char *strCommonCmd) +static uint32_t at_cat1_hungup(uint8_t *para, uint32_t paraLen, char *strCommonCmd) { UNUSED(strCommonCmd); @@ -117,17 +124,30 @@ static uint32_t cat1_hungup(uint8_t *para, uint32_t paraLen, char *strCommonCmd) printf("CAT1TEST ATCMD hungup \n"); + cat1_call_hungup(); + return ERRCODE_SUCC; +} + +static uint32_t at_cat1_gettime(uint8_t *para, uint32_t paraLen, char *strCommonCmd) +{ + UNUSED(strCommonCmd); + + + printf("CAT1TEST ATCMD gettime \n"); + + cat1_gettime(); return ERRCODE_SUCC; } -static uint32_t cat1_getsignal(uint8_t *para, uint32_t paraLen, char *strCommonCmd) + +static uint32_t at_cat1_getsignal(uint8_t *para, uint32_t paraLen, char *strCommonCmd) { UNUSED(strCommonCmd); printf("CAT1TEST ATCMD getsignal \n"); - + cat1_getsignal(); return ERRCODE_SUCC; } @@ -142,13 +162,51 @@ static uint32_t cat1_nettest(uint8_t *para, uint32_t paraLen, char *strCommonCmd return ERRCODE_SUCC; } + +#include "lwip/api_shell.h" +static uint32_t cat1_ping(uint8_t *para, uint32_t paraLen, char *strCommonCmd) +{ + UNUSED(strCommonCmd); + uint8_t argv[PPG_MAX_ARGC][PPG_MAX_ARGV_LEN] = { 0 }; + uint32_t argc = 0; + + int ret = ConvertCmdToParam(para, paraLen, argv, &argc); + if (ret != PPG_SUCCESS) { + printf("CAT1TEST ATCMD Convert Command Failed\n"); + return ERRCODE_FAIL; + } + + u32_t sret= OsShellPing( argc, (const char *)argv[0]); + printf("CAT1TEST ATCMD ping ret = 0x%X\n",sret); + + return ERRCODE_SUCC; +} +static uint32_t cat1_ifconfig(uint8_t *para, uint32_t paraLen, char *strCommonCmd) +{ + UNUSED(strCommonCmd); + uint8_t argv[PPG_MAX_ARGC][PPG_MAX_ARGV_LEN] = { 0 }; + uint32_t argc = 0; + + int ret = ConvertCmdToParam(para, paraLen, argv, &argc); + if (ret != PPG_SUCCESS) { + printf("CAT1TEST ATCMD Convert Command Failed\n"); + return ERRCODE_FAIL; + } + u32_t sret = lwip_ifconfig( argc, (const char**)argv); + printf("CAT1TEST ATCMD ifconfig ret = 0x%X\n",sret); + + return ERRCODE_SUCC; +} static const at_cmd_table_t g_cat1_cmd[] = { { (char *)"AT^CAT1POWER", cat1_power, (char *)"1" }, - { (char *)"AT^CAT1DIAL", cat1_dial, (char *)"1" }, - { (char *)"AT^CAT1ANSWER", cat1_answer, (char *)"1" }, - { (char *)"AT^CAT1HUNGUP", cat1_hungup, (char *)"1" }, - { (char *)"AT^CAT1GETSIGNAL", cat1_getsignal, (char *)"1" }, + { (char *)"AT^CAT1DIAL", at_cat1_dial, (char *)"1" }, + { (char *)"AT^CAT1ANSWER", at_cat1_answer, (char *)"1" }, + { (char *)"AT^CAT1HUNGUP", at_cat1_hungup, (char *)"1" }, + { (char *)"AT^CAT1GETSIGNAL", at_cat1_getsignal, (char *)"1" }, + { (char *)"AT^CAT1GETTIME", at_cat1_gettime, (char *)"1" }, { (char *)"AT^CAT1NETTEST", cat1_nettest, (char *)"1" }, + { (char *)"AT^PING", cat1_ping, (char *)"1" }, + { (char *)"AT^IFCONFIG", cat1_ifconfig, (char *)"1" }, }; at_cmd_table_t *get_cat1_cmd_table(uint32_t *cmd_count) diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.cpp index 918dc05b8..04765f904 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.cpp @@ -6,9 +6,29 @@ #include "cat1_ctl.h" #include "gpio.h" #include "gpio_porting.h" + +#include "voice_call_volte_sample_wrapper.h" + +#include "wearable_log.h" + + + +// int32_t VoiceCallVolteSample(int32_t argc, const char *argv[]) + +// static FuncsMap g_voiceCallVolteFuncs[] = { +// { "start", StartVoiceCall }, VoiceCallVolteSample(1,(char *[]){"start"}) +// { "stop", StopVoiceCall }, VoiceCallVolteSample(1,(char *[]){"stop"}) +// { "setvolume", VoiceCallSetVolume }, VoiceCallVolteSample(2,(char *[]){"setvolume","100"}) +// { "seaenable", VoiceCAllSeaEnable }, VoiceCallVolteSample(2,(char *[]){"seaenable","100"}) +// { "mute", VoiceCallMicMute }, +// }; #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ + +#include "pm.h" +#include "pm_veto.h" + uint32_t uapi_cat1_power_on(uint32_t pwron) { @@ -40,7 +60,63 @@ uint32_t uapi_cat1_reset(uint32_t pwron) return 0; } +void uapi_cat1_start_volte_voice(void) +{ + char *argv[]={"start"}; + VoiceCallVolteSample(1,(const char**)argv); +} +void uapi_cat1_stop_volte_voice(void) +{ + char *argv[]={"stop"}; + VoiceCallVolteSample(1,(const char**)argv); +} + +void uapi_cat1_remove_audio_vote(void) +{ + uint8_t cnt = pm_veto_get_id_cnt(PM_ID_AUDIO); + if (cnt == 1) { + uapi_pm_remove_sleep_veto(PM_ID_AUDIO); + } else { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"CAT1 SERVICE MCU has delete pm_id_audio vote\r\n"); + } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"\r\nCAT1 SERVICE MCU SLEEP SUCCESS\r\n"); +} +void uapi_cat1_add_audio_vote(void) +{ + uint8_t cnt = pm_veto_get_id_cnt(PM_ID_AUDIO); + if (cnt == 0) { + uapi_pm_add_sleep_veto(PM_ID_AUDIO); + } else { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"CAT1 SERVICE MCU has got pm_id_audio vote\r\n"); + } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"\r\nCAT1 SERVICE MCU WAKEUP SUCCESS\r\n"); +} +void cat1_ring_isr_callback(pin_t pin, uintptr_t param) +{ + // WEARABLE_LOGW(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1_ring_isr_callback %d 0x%X\n",pin,param); + uapi_cat1_add_audio_vote(); +} + +void uapi_cat1_wakeup_cat1(uint8_t wakeup) +{ + if( wakeup == 0) + { + uapi_gpio_set_dir(S_AGPIO_L30, GPIO_DIRECTION_OUTPUT); + uapi_gpio_set_val(S_AGPIO_L30, GPIO_LEVEL_HIGH); + // wstp_print("wakeup Cat1! L30 high \r\n"); + }else{ + uapi_gpio_set_dir(S_AGPIO_L30, GPIO_DIRECTION_OUTPUT); + uapi_gpio_set_val(S_AGPIO_L30, GPIO_LEVEL_LOW); + // wstp_print("sleep Cat1! L30 low\r\n"); + } +} + +void uapi_cat1_pre_init(void) +{ + char *argv[]={"setvolume","100"}; + VoiceCallVolteSample(2,(const char**)argv); +} #ifdef __cplusplus } diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.h b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.h index ac9b349c8..72a97d60f 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.h +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.h @@ -3,6 +3,7 @@ #define __CAT1_CTL_H #include "stdint.h" +#include "platform_core.h" #ifdef __cplusplus #if __cplusplus @@ -11,6 +12,12 @@ extern "C" { #endif /* __cplusplus */ uint32_t uapi_cat1_power_on(uint32_t pwron); uint32_t uapi_cat1_reset(uint32_t pwron); +void cat1_ring_isr_callback(pin_t pin, uintptr_t param); +void uapi_cat1_start_volte_voice(void); +void uapi_cat1_stop_volte_voice(void); +void uapi_cat1_remove_audio_vote(void); +void uapi_cat1_add_audio_vote(void); + #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp index 62aa42150..2e9ee2b0b 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp @@ -45,32 +45,33 @@ extern "C" { #include "uart_slip.h" #include "cat1_server.h" #include "cat1_server_hal.h" +#include "cat1_ctl.h" #include "tcxo.h" + + + #define PEER_IP "172.16.1.2" #define PEER_PORT 5000 - +#define SERVER_IP "172.16.1.5" #define PORT 1000 -#define SSID_LENGTH 32 -#define PASSWORD_LENGTH 64 - +//"F"UDP_COMMAND_HEAD , len ,data enum UDP_COMMAND_HEAD { - UDP_CHANGE_WEB_NETWORK = '0', // web config - UDP_WIFI_STATUS = '1', // status - UDP_CHANGE_AP = '2', // ap mode - UDP_CHANGE_STATION = '3', // station mode - UDP_OTA_UPDATE = '4', // ota upgrade - UDP_APP_VERSION = '5', // app version - UDP_SMART_CONFIG = '6', // smartconfig - UDP_CONFIG_QUERY = '7', // config query - UDP_EVENT_REPORT = 'F' // auto report -}; -// current work station -enum SSS_WORKING_STATUS { - SSS_WORKING_NONE = 0, // do nothing - SSS_WORKING_REINIT, // reinit uart slip - SSS_WORKING_RESTART, // restart device - SSS_WORKING_OTA // ota ing + UDP_CMD_GET_CAT1VER = '0', // 获取 Cat1 版本号 + UDP_CMD_DIAL_NUMB = '1', // 拨打电话 + UDP_CMD_HUNGUP = '2', // 挂断电话 + UDP_CMD_ANSWER = '3', // 接听电话 + UDP_CMD_CAT1_OTA_UPDATE = '4', // 触发Cat1 OTA升级,mcu提供url + UDP_CMD_SEND_SMS = '5', // 发送SMS短信,mcu提供电话号及短信内容 + UDP_CMD_GET_TIME = '6', // 获取Cat1 时间 ,YYYYMMDD HHmmss zone + UDP_CMD_GET_NETWORKSTAT = '7', //获取Cat1 信号信息,VOLTE信息,信号强度,SIM卡状态 + UDP_MSG_SMS = '8', // CAT1接收到的SMS信息给MCU,包含电话号及短信内容 + UDP_MSG_NETWORKSTAT = '9', // 内容同UDP_CMD_GET_NETWORKSTAT,CAT主动发给MCU + UDP_MSG_CALL_CONNECTED = 'A', // CAT1 电话接听消息 + UDP_MSG_CALL_DISCONNECTED = 'B', // CAT1 电话挂断消息 + UDP_MSG_COMMING_CALL = 'C' , // CAT1 来电消息,包含电话号 + UDP_MSG_TIMESYNC = 'D' , // CAT1 来电消息,包含电话号 + UDP_MSG_MAX = 'F' // }; // static char *msg_wifi_resp[] = @@ -102,7 +103,7 @@ struct sockaddr_in sourceAddr = {0}; static struct tcp_msg_t *unpack_tlv_format(char *rx_buffer, int length) { - char temp[8]; + char temp[8]={0}; struct tcp_msg_t *msg = (struct tcp_msg_t *)rx_buffer; strncpy(temp, (char *)&msg->length, 4); temp[4] = '\0'; @@ -121,7 +122,7 @@ static int pack_tlv_format(char *tx_buffer, char *head, char *content) struct tcp_msg_t *msg = (struct tcp_msg_t *)tx_buffer; strncpy(msg->head, head, 2); - //sprintf((char *)(&msg->length), "%04d", (unsigned char)content_length); + sprintf((char *)(&msg->length), "%04d", (unsigned char)content_length); sprintf(&tx_buffer[2], "%04d", content_length); strcpy(msg->buffer, content); @@ -143,106 +144,156 @@ static void udp_send_response(char *tx_buffer, char *head, char *content) } } -void udp_ota_update(char *content) +void udp_send_msg_toCat1(char cmd,char *content) { - char ota_tx_buffer[128] = {0}; - char ota_head[2] = {0}; - ota_head[0] = 'F'; - ota_head[1] = UDP_EVENT_REPORT; - udp_send_response(ota_tx_buffer, ota_head, content); -} - -void udp_station_update(char *content) -{ - char station_tx_buffer[128] = {0}; + char station_tx_buffer[256] = {0}; char station_head[2] = {0}; if( sourceAddr.sin_port != 0 ) { station_head[0] = 'F'; - station_head[1] = UDP_EVENT_REPORT; + station_head[1] = cmd; udp_send_response(station_tx_buffer, station_head, content); } } -static int resolve_config_query(struct tcp_msg_t *msg) +void cat1_call_hungup(void) { - int index = -1; - char config_tx_buffer[256] = {0}; - char buffer[128]; - if( msg->buffer == NULL && msg->buffer[0] != '0') return 1; - - // memset(buffer, 0x00, sizeof(buffer)); - // index = quec_config_query_entry(msg->buffer, buffer); - // if( index == 0 ) { - // udp_send_response(config_tx_buffer, msg->head, buffer); - // } else { - // index = 1; - // } + udp_send_msg_toCat1(UDP_CMD_HUNGUP,"0"); +} - return index; +void cat1_call_answer(void) +{ + udp_send_msg_toCat1(UDP_CMD_ANSWER,"0"); + +} +void cat1_ota_update(char *url) +{ + udp_send_msg_toCat1(UDP_CMD_CAT1_OTA_UPDATE,url); } -static int resolve_msg_ota(struct tcp_msg_t *msg) +void cat1_call_dial(char* phonenum) { - int index = 0; - if( msg->buffer == NULL ) return 1; -#ifdef QUECTEL_CONFIG_OTA_SUPPORT - extern int ota_app_main(char *ota_server); - //printf("ota url = %s\n", msg->buffer); - int ret = ota_app_main(msg->buffer); - if( ret != 0 ) { - index = 1; + udp_send_msg_toCat1(UDP_CMD_DIAL_NUMB,phonenum); +} + +void cat1_getsignal(void) +{ + udp_send_msg_toCat1(UDP_CMD_GET_NETWORKSTAT,"0"); +} +void cat1_gettime(void) +{ + udp_send_msg_toCat1(UDP_CMD_GET_TIME,"0"); +} +void cat1_getver(void) +{ + udp_send_msg_toCat1(UDP_CMD_GET_CAT1VER,"0"); +} +void cat1_call_sms_send(char* phonenum,char* sms_txtdata) +{ + if(phonenum==NULL||sms_txtdata==NULL) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 send sms param error!\n"); + return ; + } + int len_smstxt=strlen(phonenum)+strlen(sms_txtdata)+2; + + char *msg_tmp =(char*) malloc(len_smstxt); + if (msg_tmp!=NULL) + { + memset_s(msg_tmp,len_smstxt,0,len_smstxt); + sprintf_s(msg_tmp,len_smstxt,"%s,%s",phonenum,sms_txtdata); + udp_send_msg_toCat1(UDP_CMD_SEND_SMS,msg_tmp); } -#else - index = 1; -#endif - return index; } -const char* build_sdk = "602"; -const char* build_model = "debug"; -const char* build_version = "v1.0"; -const char* build_time = "240222"; -static int resolve_msg_app_version(struct tcp_msg_t *msg) +int cat1_handle_call_incomming(struct tcp_msg_t *msg) { - int index = -1; - char version_tx_buffer[256] = {0}; - if( msg->buffer == NULL && msg->buffer[0] != '0') return 1; - char version[128] = {0}; - snprintf(version, 128, "sdk: %s\nmodel: %s\nversion: %s\ntime: %s", - build_sdk, build_model, build_version, build_time); - - udp_send_response(version_tx_buffer, msg->head, version); - return index; + char* phonenum = msg->buffer; + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 incomming call %s\n",phonenum); + incomingcall_event_sendmsg_toUI(phonenum); + uapi_cat1_start_volte_voice(); + return 1; +} + +int cat1_handle_networ_msg(struct tcp_msg_t *msg) +{ + char* networkmsg=msg->buffer; + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 cat1_handle_networ_msg %s\n",networkmsg); + //显示UI 信号 + return 1; +} +int cat1_handle_sms(struct tcp_msg_t *msg) +{ + char* smsmsg=msg->buffer; + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 cat1_handle_sms %s\n",smsmsg); + //添加到消息列表里 + return 1; } +int cat1_handle_timesync(struct tcp_msg_t *msg) +{ + char* timesync=msg->buffer; + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 cat1_handle_timesync %s\n",timesync); + + // ('24/03/01 07:15:36 8 0', 1709277336, 0) + //TODO:设置时间 + + return 1; +} + +int cat1_handle_call_connected(struct tcp_msg_t *msg) +{ + + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 call connected\n"); + uapi_cat1_start_volte_voice(); + return 1; +} +int cat1_handle_call_disconnected(struct tcp_msg_t *msg) +{ + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 call disconnected\n"); + //TODO: 关闭声音 + uapi_cat1_stop_volte_voice(); + return 1; +} static int udp_packet_parse(char *rx_buffer, int len) { struct tcp_msg_t *msg = unpack_tlv_format(rx_buffer, len); int index = 0; - if( msg->head[1] != UDP_WIFI_STATUS ) { // ota only status check - return 1; - } + // if( msg->head[1] != UDP_WIFI_STATUS ) { // ota only status check + // return 1; + // } if( msg != NULL ) { switch (msg->head[1]) { - case UDP_OTA_UPDATE: - index = resolve_msg_ota(msg); + case UDP_MSG_COMMING_CALL: + index = cat1_handle_call_incomming(msg); + break; + case UDP_MSG_NETWORKSTAT: + index = cat1_handle_networ_msg(msg); + break; + case UDP_MSG_SMS: + index = cat1_handle_sms(msg); + break; + case UDP_MSG_TIMESYNC: + index = cat1_handle_timesync(msg); break; - case UDP_APP_VERSION: - index = resolve_msg_app_version(msg); + case UDP_MSG_CALL_CONNECTED: + index = cat1_handle_call_connected(msg); break; - case UDP_CONFIG_QUERY: - index = resolve_config_query(msg); + case UDP_MSG_CALL_DISCONNECTED: + index = cat1_handle_call_disconnected(msg); break; default: printf("error message: %s\n", rx_buffer); index = 1; break; } + if (index > 0) //需要反馈的指令才返回OK + udp_send_msg_toCat1( msg->head[1], "OK"); } else { printf("wrong format msg and exit\n"); index = 1; } + return index; } @@ -255,7 +306,7 @@ static int udp_socket_init() char addr_str[128]; // destAddr.sin_addr.s_addr = htonl(INADDR_ANY); - destAddr.sin_addr.s_addr = inet_addr("172.16.1.5"); + destAddr.sin_addr.s_addr = inet_addr(SERVER_IP); destAddr.sin_family = AF_INET; destAddr.sin_port = htons(PORT); addr_family = AF_INET; @@ -304,10 +355,6 @@ int cat1_server_task(void *pvParameters) memset(rx_buffer, 0, sizeof(rx_buffer)); - - // uapi_tcxo_delay_ms(1000); - // continue; - int len = recvfrom(g_listen_sock, rx_buffer, sizeof(rx_buffer) - 1, 0, (struct sockaddr *)&sourceAddr, &addrLen); // Error occured during receiving if (len < 0) { @@ -321,21 +368,11 @@ int cat1_server_task(void *pvParameters) rx_buffer[len] = '\0'; // Null-terminate whatever we received and treat like a string printf("Received %d bytes, rx_buffer: %s\n", len, rx_buffer); index = udp_packet_parse(rx_buffer, len); - if( index >= 0 ) { - udp_send_response(tx_buffer, rx_buffer, "OK"/* msg_wifi_resp[index]*/); - } - - // if( quec_wifi_status.s_status == SSS_WORKING_RESTART ) { - // //station_wifi_set_info("",""); - - // tcp_device_restart(); - // } else if( quec_wifi_status.s_status == SSS_WORKING_REINIT ) { - // user_netif_deinit(); - // // vTaskDelay(1000/portTICK_RATE_MS); - // user_netif_init(); - // quec_wifi_status.s_status = SSS_WORKING_NONE; - // break; + // if( index >= 0 ) { + // udp_send_response(tx_buffer, rx_buffer, "OK"/* msg_wifi_resp[index]*/); // } + + } } return 0; @@ -361,7 +398,7 @@ void wifi_status() #include "common_def.h" #include "los_printf.h" -#define CAT1_SERVICE_TASK_SIZE 0x800 +#define CAT1_SERVICE_TASK_SIZE (0x800*5) #define CAT1_SERVICE_TASK_PRIO 5 errcode_t cat1_server_init(void) diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.h b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.h index a9435a431..3b2096a13 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.h +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.h @@ -14,7 +14,17 @@ extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ -void udp_ota_update(char *content); +/*send cmd msg to cat1**/ +void cat1_ota_update(char *url); +void cat1_call_hungup(void); +void cat1_call_answer(void); + +void cat1_getsignal(void); +void cat1_call_dial(char* phonenum); +void cat1_call_sms_send(char* phonenum,char* sms_txt); +void cat1_gettime(void); +void cat1_getver(void); + errcode_t cat1_server_init(void); diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp index 8a19fc8f0..7b5d82161 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp @@ -81,7 +81,7 @@ static void CustomEventPublish(uint16_t topic, uint8_t *data , uint32_t size) static errcode_t incomingcall_event_notify(char* callno) { - CustomEventPublish(TOPIC_EVENT_STEPDATA_UPDATE,(uint8_t*)callno,strlen(callno)); + CustomEventPublish(TOPIC_EVENT_CAT1_INCOMMING,(uint8_t*)callno,strlen(callno)); return 0; } errcode_t incomingcall_event_sendmsg_toUI(char* callno) diff --git a/code/sdk/drivers/peripheral/slip/slipif.c b/code/sdk/drivers/peripheral/slip/slipif.c index 8b5cd2e50..f91f234b0 100644 --- a/code/sdk/drivers/peripheral/slip/slipif.c +++ b/code/sdk/drivers/peripheral/slip/slipif.c @@ -265,7 +265,8 @@ slipif_rxbyte(struct netif *netif, u8_t c) if (priv->p == NULL) { /* allocate a new pbuf */ LWIP_DEBUGF(SLIP_DEBUG, ("slipif_input: alloc\n")); - priv->p = pbuf_alloc(PBUF_LINK, (PBUF_POOL_BUFSIZE - PBUF_LINK_HLEN - PBUF_LINK_ENCAPSULATION_HLEN), PBUF_RAM); +// priv->p = pbuf_alloc(PBUF_LINK, (PBUF_POOL_BUFSIZE - PBUF_LINK_HLEN - PBUF_LINK_ENCAPSULATION_HLEN), PBUF_RAM); + priv->p = pbuf_alloc(PBUF_LINK, (PBUF_POOL_BUFSIZE - PBUF_LINK_HLEN - PBUF_LINK_ENCAPSULATION_HLEN), PBUF_POOL); if (priv->p == NULL) { LINK_STATS_INC(link.drop); diff --git a/code/sdk/drivers/peripheral/slip/uart_slip.c b/code/sdk/drivers/peripheral/slip/uart_slip.c index 6129c2430..041c89d5d 100644 --- a/code/sdk/drivers/peripheral/slip/uart_slip.c +++ b/code/sdk/drivers/peripheral/slip/uart_slip.c @@ -15,17 +15,12 @@ #include #include #include -// #include "freertos/FreeRTOS.h" -// #include "freertos/task.h" -// #include "freertos/queue.h" #include "driver/uart.h" -// #include "esp_log.h" #include "lwip/ip.h" #include "lwip/netif.h" #include "netif/slipif.h" #include "lwip/init.h" -// #include "lwip/lwip_napt.h" #include "lwip/inet_chksum.h" #include "pinctrl.h" @@ -79,8 +74,7 @@ static void uart_event_task(void const *arg) uint32_t msgsize = (uint32_t)sizeof(slip_uart_cmd_t); ret = user_netif_init(); - // if( ret != 0 ) return -1; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_MAIN_SERVICE,"user_netif_init ret=0x%02X! \r\n",ret); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_MAIN_SERVICE,"user_netif_init ret=0x%02X! \r\n",ret); while (1) { @@ -94,35 +88,9 @@ static void uart_event_task(void const *arg) if (mail.cmd == UART_SLIP_CMD_MSG_READ_DATA) { - // case UART_DATA: - // len = uart_read_bytes(EX_UART_NUM, dtmp, event.size, 0); - //xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT); - // ESP_LOGI(TAG, "[DATA EVT]:"); WEARABLE_LOGD(WEARABLE_LOG_MODULE_MAIN_SERVICE,"recv size=%d! %s \r\n",mail.size,mail.buffer); - slipif_received_bytes(&sl_netif, mail.buffer, mail.size); - // // slipif_process_rxqueue(&sl_netif); - // break; - // // Event of HW FIFO overflow detected - // case UART_FIFO_OVF: - // //uart_get_buffered_data_len(EX_UART_NUM, &remain_len); - // //printf("event.size = %d, remain_len=%d\n", event.size, remain_len); - // //printf("hw fifo overflow\n"); - // // If fifo overflow happened, you should consider adding flow control for your application. - // // The ISR has already reset the rx FIFO, - // // As an example, we directly flush the rx buffer here in order to read more data. - // uart_flush_input(EX_UART_NUM); - // xQueueReset(uart0_queue); - // break; - - // // Event of UART ring buffer full - // case UART_BUFFER_FULL: - // printf("ring buffer full\n"); - // // If buffer full happened, you should consider encreasing your buffer size - // // As an example, we directly flush the rx buffer here in order to read more data. - // uart_flush_input(EX_UART_NUM); - // xQueueReset(uart0_queue); - // break; + // slipif_process_rxqueue(&sl_netif); } osal_kfree(mail.buffer); @@ -130,11 +98,6 @@ static void uart_event_task(void const *arg) } void user_netif_deinit(void) { - ip_addr_t ipaddr; - IP_ADDR4(&ipaddr, 172, 16, 1, 5); - // if(sl_netif.napt == 1 ) { - // ip_napt_enable(ipaddr.addr, 0); - // } netif_set_link_down(&sl_netif); netif_set_down(&sl_netif); netif_remove(&sl_netif); @@ -156,7 +119,7 @@ int user_netif_init(void) IP_ADDR4(&ipaddr, 172, 16, 1, 5); IP_ADDR4(&netmask, 255, 255, 255, 0); - IP_ADDR4(&gw, 172, 16, 1, 1); + IP_ADDR4(&gw, 172, 16, 1, 2); temp = netif_add(&sl_netif, &ipaddr, &netmask, &gw, &int_no, slipif_init, ip_input); if( temp == NULL ) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"fail to netif init\n"); @@ -169,7 +132,7 @@ int user_netif_init(void) // if( mode == 1 ) { // ip_napt_enable(ipaddr.addr, 1); // } else if(mode == 2) { - netif_set_default(&sl_netif); + netif_set_default(&sl_netif); // } slipif_initialled = true; return 0; diff --git a/code/sdk/kernel/liteos/liteos_v207.1.0/Huawei_LiteOS/.config b/code/sdk/kernel/liteos/liteos_v207.1.0/Huawei_LiteOS/.config index 8ece76e4d..2064dfb40 100755 --- a/code/sdk/kernel/liteos/liteos_v207.1.0/Huawei_LiteOS/.config +++ b/code/sdk/kernel/liteos/liteos_v207.1.0/Huawei_LiteOS/.config @@ -132,7 +132,7 @@ LOSCFG_BASE_CORE_SWTMR_LIMIT=20 LOSCFG_BASE_IPC_QUEUE=y # LOSCFG_QUEUE_STATIC_ALLOCATION is not set LOSCFG_QUEUE_DYNAMIC_ALLOCATION=y -LOSCFG_BASE_IPC_QUEUE_LIMIT=20 +LOSCFG_BASE_IPC_QUEUE_LIMIT=40 LOSCFG_BASE_IPC_EVENT=y LOSCFG_BASE_IPC_MUX=y LOSCFG_MUTEX_WAITMODE_PRIO=y @@ -164,7 +164,7 @@ LOSCFG_CPUP_HISTORY_RECORD_NUM=10 # LOSCFG_KERNEL_TRACE is not set # LOSCFG_BASE_CORE_SYS_RES_CHECK is not set # end of Kernel - +LOSCFG_KERNEL_TRACE=y # # Lib # diff --git a/code/sdk/kernel/liteos/liteos_v207.1.0/Huawei_LiteOS/tools/build/config/brandy.config b/code/sdk/kernel/liteos/liteos_v207.1.0/Huawei_LiteOS/tools/build/config/brandy.config index e5fc7ec65..1ea66c90e 100755 --- a/code/sdk/kernel/liteos/liteos_v207.1.0/Huawei_LiteOS/tools/build/config/brandy.config +++ b/code/sdk/kernel/liteos/liteos_v207.1.0/Huawei_LiteOS/tools/build/config/brandy.config @@ -134,7 +134,7 @@ LOSCFG_BASE_CORE_SWTMR_LIMIT=50 LOSCFG_BASE_IPC_QUEUE=y # LOSCFG_QUEUE_STATIC_ALLOCATION is not set LOSCFG_QUEUE_DYNAMIC_ALLOCATION=y -LOSCFG_BASE_IPC_QUEUE_LIMIT=30 +LOSCFG_BASE_IPC_QUEUE_LIMIT=40 LOSCFG_BASE_IPC_EVENT=y LOSCFG_BASE_IPC_MUX=y LOSCFG_MUTEX_WAITMODE_PRIO=y diff --git a/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/arch/cc.h b/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/arch/cc.h index c776b2fe5..289f750bc 100644 --- a/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/arch/cc.h +++ b/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/arch/cc.h @@ -94,7 +94,7 @@ #define LWIP_RAND rand #ifndef LWIP_LOGGER -#define LWIP_LOGGER(msg) +#define LWIP_LOGGER(msg) printf(msg) #endif extern void LwipLogPrintf(const char *fmt, ...); diff --git a/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/lwip/api_shell.h b/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/lwip/api_shell.h index 7e063a156..ff7bfaf52 100644 --- a/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/lwip/api_shell.h +++ b/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/lwip/api_shell.h @@ -40,8 +40,12 @@ extern "C" { #endif u32_t lwip_ifconfig(int argc, const char **argv); -u32_t OsShellPing(int argc, const char **argv); -LWIP_STATIC int OsPingFunc(u32_t *parg); +u32_t OsShellPing(int argc, const char *argv); + +#ifndef LWIP_TESTBED +static +#endif +int OsPingFunc(u32_t *parg); #if defined (__cplusplus) && __cplusplus } diff --git a/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/lwip/lwipopts.h b/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/lwip/lwipopts.h index 8191880e3..6a4bfc1d8 100644 --- a/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/lwip/lwipopts.h +++ b/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/include/lwip/lwipopts.h @@ -33,45 +33,45 @@ #define _LWIP_PORTING_LWIPOPTS_H_ // lwIP debug options, comment the ones you don't want -#define LWIP_DEBUG 1 +#define LWIP_DEBUG 0 #if LWIP_DEBUG #define ETHARP_DEBUG LWIP_DBG_OFF -#define NETIF_DEBUG LWIP_DBG_OFF +#define NETIF_DEBUG LWIP_DBG_ON #define PBUF_DEBUG LWIP_DBG_OFF #define API_LIB_DEBUG LWIP_DBG_OFF #define API_MSG_DEBUG LWIP_DBG_OFF -#define SOCKETS_DEBUG LWIP_DBG_OFF +#define SOCKETS_DEBUG LWIP_DBG_ON #define ICMP_DEBUG LWIP_DBG_OFF #define IGMP_DEBUG LWIP_DBG_OFF #define INET_DEBUG LWIP_DBG_OFF -#define IP_DEBUG LWIP_DBG_OFF -#define DRIVERIF_DEBUG LWIP_DBG_OFF -#define IP_REASS_DEBUG LWIP_DBG_OFF -#define RAW_DEBUG LWIP_DBG_OFF -#define MEM_DEBUG LWIP_DBG_OFF -#define MEMP_DEBUG LWIP_DBG_OFF -#define SYS_DEBUG LWIP_DBG_OFF +#define IP_DEBUG LWIP_DBG_ON +#define DRIVERIF_DEBUG LWIP_DBG_ON +#define IP_REASS_DEBUG LWIP_DBG_ON +#define RAW_DEBUG LWIP_DBG_ON +#define MEM_DEBUG LWIP_DBG_ON +#define MEMP_DEBUG LWIP_DBG_ON +#define SYS_DEBUG LWIP_DBG_ON #define TIMERS_DEBUG LWIP_DBG_OFF -#define TCP_DEBUG LWIP_DBG_OFF -#define TCP_ERR_DEBUG LWIP_DBG_OFF -#define TCP_INPUT_DEBUG LWIP_DBG_OFF +#define TCP_DEBUG LWIP_DBG_ON +#define TCP_ERR_DEBUG LWIP_DBG_ON +#define TCP_INPUT_DEBUG LWIP_DBG_ON #define TCP_FR_DEBUG LWIP_DBG_OFF #define TCP_RTO_DEBUG LWIP_DBG_OFF #define TCP_CWND_DEBUG LWIP_DBG_OFF #define TCP_WND_DEBUG LWIP_DBG_OFF -#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF +#define TCP_OUTPUT_DEBUG LWIP_DBG_ON #define TCP_RST_DEBUG LWIP_DBG_OFF #define TCP_QLEN_DEBUG LWIP_DBG_OFF #define TCP_SACK_DEBUG LWIP_DBG_OFF #define TCP_TLP_DEBUG LWIP_DBG_OFF -#define UDP_DEBUG LWIP_DBG_OFF -#define TCPIP_DEBUG LWIP_DBG_OFF -#define SLIP_DEBUG LWIP_DBG_OFF +#define UDP_DEBUG LWIP_DBG_ON +#define TCPIP_DEBUG LWIP_DBG_ON +#define SLIP_DEBUG LWIP_DBG_ON #define DHCP_DEBUG LWIP_DBG_OFF #define AUTOIP_DEBUG LWIP_DBG_OFF -#define DNS_DEBUG LWIP_DBG_OFF +#define DNS_DEBUG LWIP_DBG_ON #define TFTP_DEBUG LWIP_DBG_OFF -#define SYS_ARCH_DEBUG LWIP_DBG_OFF +#define SYS_ARCH_DEBUG LWIP_DBG_ON #define SNTP_DEBUG LWIP_DBG_OFF #define IP6_DEBUG LWIP_DBG_OFF #define DHCP6_DEBUG LWIP_DBG_OFF diff --git a/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/src/api_shell.c b/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/src/api_shell.c index b62966b24..b313127ed 100644 --- a/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/src/api_shell.c +++ b/code/sdk/open_source/openharmony/third_party/lwip/port/lwip-2.1/porting/src/api_shell.c @@ -337,7 +337,7 @@ LWIP_STATIC int OsPingFunc(u32_t *parg) iecho_len = sizeof(struct icmp_echo_hdr) + data_len; sfd = lwip_socket(PF_INET, SOCK_RAW, IPPROTO_ICMP); if (sfd < 0) { - perror("Ping socket"); + PRINTK("Ping socket\n"); return -1; } pbuf_resp = pbuf_alloc(PBUF_RAW, IP_HLEN + sizeof(struct icmp_echo_hdr), PBUF_RAM); @@ -527,10 +527,10 @@ static void ping_cmd(u32_t *parg) ping_taskid = -1; } -u32_t OsShellPing(int argc, const char **argv) +u32_t OsShellPing(int argc, const char *argv) { int ret; - u32_t i = 0; + // u32_t i = 0; u32_t count; int count_set = 0; u32_t interval = 1000; /* default ping interval */ @@ -552,8 +552,12 @@ u32_t OsShellPing(int argc, const char **argv) if (argc <= 0) { goto ping_error; } + // printf("%s %d\n",__func__,__LINE__); + printf("%s %d name %s\n",__func__,__LINE__,argv); + #if LWIP_DNS - dst_ipaddr.addr = get_hostip(argv[i]); + dst_ipaddr.addr = get_hostip(argv); + printf("%s %d dst_ip 0x%X\n",__func__,__LINE__,dst_ipaddr.addr); #endif /* LWIP_DNS */ if (dst_ipaddr.addr == IPADDR_NONE || dst_ipaddr.addr == IPADDR_ANY) { @@ -597,7 +601,7 @@ u32_t OsShellPing(int argc, const char **argv) 2, ping task create failed; */ if (OsPingFunc(parg) < 0) { - PRINTK("Ping cmd failed due some errors\n"); + PRINTK("222Ping cmd failed due some errors\n"); } free(parg);