问题:更新sms api的log输出方式
原因:无
解决方案:无
影响:无
Change-Id: Id12db8cb6cff76e6414b2460dc48ac50b8064e77
diff --git a/mbtk/libmbtk_lib/ril/mbtk_info_api.c b/mbtk/libmbtk_lib/ril/mbtk_info_api.c
index 7823f3d..cf1d924 100755
--- a/mbtk/libmbtk_lib/ril/mbtk_info_api.c
+++ b/mbtk/libmbtk_lib/ril/mbtk_info_api.c
@@ -1841,7 +1841,7 @@
*/
int mbtk_sms_cmgf_set(mbtk_info_handle_t* handle, int mode)
{
- printf("mbtk_sms_cmgf_set()--------mode=:%d, len:%d", mode, sizeof(uint8));
+ LOGD("mbtk_sms_cmgf_set()--------mode=:%d, len:%d", mode, sizeof(uint8));
return info_item_process(handle, MBTK_INFO_ID_SMS_CMGF_REQ, (uint8*)&mode, sizeof(uint8), NULL) ? handle->info_err : 0;
}
@@ -1860,10 +1860,10 @@
*/
int mbtk_sms_cmgs_set(mbtk_info_handle_t* handle, char * cmgs, char *resp)
{
- printf("mbtk_sms_cmgs_set(1)--------cmgs=:%s, len:%d", cmgs, strlen(cmgs));
+ LOGD("mbtk_sms_cmgs_set(1)--------cmgs=:%s, len:%d", cmgs, strlen(cmgs));
// char req[20] = {0}
if(info_item_process(handle, MBTK_INFO_ID_SMS_CMGS_REQ, cmgs, strlen(cmgs), resp) > 0){
- printf("resp:%s\n", resp);
+ LOGD("resp:%s", resp);
return 0;
}else{
return handle->info_err;
diff --git a/mbtk/mbtk_rild/src/mbtk_sms.c b/mbtk/mbtk_rild/src/mbtk_sms.c
index 92b2903..79752e7 100755
--- a/mbtk/mbtk_rild/src/mbtk_sms.c
+++ b/mbtk/mbtk_rild/src/mbtk_sms.c
@@ -16,6 +16,7 @@
#include "at_tok.h"
#include "mbtk_utils.h"
#include "info_data.h"
+#include "mbtk_log.h"
void pack_rsp_send(int fd, int info_id, const void* data, int data_len);
@@ -63,8 +64,8 @@
*/
static int req_cmgf_set(int state, int *cme_err)
{
- printf("req_cmgf_set()-------------start\n");
- printf("state:%d\n",state);
+ LOGD("req_cmgf_set()-------------start");
+ LOGD("state:%d",state);
ATResponse *response = NULL;
char cmd[30] = {0};
if(state)
@@ -76,7 +77,7 @@
strcpy(cmd, "AT+CMGF=0");
}
- printf("req_cmgf_set()----cmd:%s\n", cmd);
+ LOGD("req_cmgf_set()----cmd:%s", cmd);
int err = at_send_command(cmd, &response);
if (err < 0 || response->success == 0) {
@@ -226,8 +227,8 @@
*/
static int req_cmgs_set(char *cmgs, char *reg, int len, int *cme_err)
{
- printf("req_cmgs_set()----------------start\n");
- printf("cmgs:%s\n", cmgs);
+ LOGD("req_cmgs_set()----------------start");
+ LOGD("cmgs:%s", cmgs);
ATResponse *response = NULL;
char cmd[30] = {0};
char data[218] = {0};
@@ -239,24 +240,28 @@
char *src = strstr(cmgs, ",");
if(src != NULL)
{
- //LOG("[XIAORUI]req_cmgs_set()----------------src=%s",src);
- //LOG("[XIAORUI]req_cmgs_set()----------------ptr=%s",ptr);
memcpy(pnum, ptr, src - ptr);
- //LOG("[XIAORUI]req_cmgs_set()----------------pnum=%s",pnum);
src++;
int data_len = 0;
data_len = len - (src - ptr);
memcpy(data, src, data_len);
- //LOG("[XIAORUI]req_cmgs_set()----------------data %s",data);
+
}
-
+ else
+ {
+ LOGD("cmgs param is error");
+ return -1;
+ }
+ LOGD("num:%s", pnum);
+ LOGD("data:%s", data);
+
sprintf(cmd, "AT+CMGS=%s", pnum);
- LOG("cmd:%s,data:%s---------", cmd,data);
-
+ LOGD("cmd:%s", cmd);
+
if(strlen(cmd) > 0)
{
int err = at_send_command_sms(cmd, data, "+CMGS: ", &response);
- printf("err:%d, response:%d\n", err, response->success);
+ LOGD("err:%d, response:%d", err, response->success);
if (err < 0 || response->success == 0) {
*cme_err = at_get_cme_error(response);
@@ -265,7 +270,7 @@
char *line;
line = response->p_intermediates->line;
memcpy(reg, line, strlen(line));
- printf("line:%s\n", line);
+ LOGD("line:%s", line);
}
err = 0;
@@ -814,7 +819,7 @@
} else {
err = MBTK_INFO_ERR_UNKNOWN;
}
- LOG("Get SMS CMGF fail.");
+ LOGD("Get SMS CMGF fail.");
}
else
{
@@ -827,7 +832,7 @@
if(pack->data_len != sizeof(uint8) || (mode != 0 && mode != 1))
{
err = MBTK_INFO_ERR_REQ_PARAMETER;
- LOG("Set SMS CMGF parameter error.");
+ LOGD("Set SMS CMGF parameter error.");
break;
}
@@ -838,14 +843,14 @@
} else {
err = MBTK_INFO_ERR_UNKNOWN;
}
- LOG("Set SMS CMGF fail.");
+ LOGD("Set SMS CMGF fail.");
}
else
{
pack_rsp_send(cli_info->fd, MBTK_INFO_ID_SMS_CMGF_RSP, NULL, 0);
// Restart is required to take effect.
- LOG("Will reboot system...");
+ LOGD("Will reboot system...");
}
}
break;
@@ -933,7 +938,7 @@
char *cmgs = (char*)pack->data;
int len = pack->data_len;
char reg[50] ={0};
- printf("mbtk_sms,cmgs:%s,len:%d\n", cmgs, len);
+ LOGD("mbtk_sms,cmgs:%s,len:%d", cmgs, len);
if(req_cmgs_set(cmgs,reg,len, &cme_err) || cme_err != MBTK_INFO_ERR_CME_NON)
{
@@ -942,14 +947,14 @@
} else {
err = MBTK_INFO_ERR_UNKNOWN;
}
- LOG("Set SMS CMGF fail.");
+ LOGD("Set SMS CMGS fail.");
}
else
{
pack_rsp_send(cli_info->fd, MBTK_INFO_ID_SMS_CMGS_RSP, reg, strlen(reg));
// Restart is required to take effect.
- LOG("Will reboot system...");
+ LOGD("Will reboot system...");
}
}