优化demo代码和api接口
Change-Id: I8748413432a38b9339d23799c97f2b0d8b4c545b
diff --git a/mbtk/liblynq_lib/src/lynq_gpio.c b/mbtk/liblynq_lib/src/lynq_gpio.c
index 59f8d55..344c011 100755
--- a/mbtk/liblynq_lib/src/lynq_gpio.c
+++ b/mbtk/liblynq_lib/src/lynq_gpio.c
@@ -200,27 +200,37 @@
//UNUSED(value);
UNUSED(pullsel);
+ if (direction != 1 || direction != 0)
+ {
+ LOGE("[lynq_gpio_init] direction fail.");
+ return -1;
+ }
+
+ if (value != 1 || value != 0)
+ {
+ LOGE("[lynq_gpio_init] value fail.");
+ return -1;
+ }
+
if(gpio_export(gpio))
{
- LOGE("[lynq_gpio_init]gpio_export() fail.");
+ LOGE("[lynq_gpio_init]gpio_export fail.");
return -1;
}
if(gpio_direct_set(gpio, direction == 0 ? "in" : "out"))
{
- LOGE("[lynq_gpio_init]gpio_direct_set() fail.");
+ LOGE("[lynq_gpio_init]gpio_direct_set fail.");
return -1;
}
if(gpio_value_set(gpio, value))
{
- LOGE("[lynq_gpio_init]gpio_value_set() fail.");
+ LOGE("[lynq_gpio_init]gpio_value_set fail.");
return -1;
}
-
-
return 0;
}
@@ -230,7 +240,7 @@
if(gpio_unexport(gpio))
{
- LOGE("[lynq_gpio_init]gpio_unexport() fail.");
+ LOGE("[lynq_gpio_deinit]gpio_unexport fail.");
return -1;
}
@@ -244,7 +254,7 @@
if(gpio_direct_set(gpio, direction == 0 ? "in" : "out"))
{
- LOGE("[lynq_gpio_init]gpio_direct_set() fail.");
+ LOGE("[lynq_gpio_direction_set]gpio_direct_set fail.");
return -1;
}
@@ -259,7 +269,7 @@
if(gpio_value_set(gpio, value))
{
- LOGE("[lynq_gpio_init]gpio_value_set() fail.");
+ LOGE("[lynq_gpio_value_set]gpio_value_set fail.");
return -1;
}
@@ -274,7 +284,7 @@
ret = gpio_value_get(gpio);
if (ret == -1)
{
- LOGE("[lynq_gpio_init]gpio_value_set() fail.");
+ LOGE("[lynq_gpio_value_get]gpio_value_get fail.");
return -1;
}
@@ -283,18 +293,45 @@
int lynq_gpio_pullsel_set(int gpio, int pullsel)
{
- UNUSED(gpio);
- UNUSED(pullsel);
+ //UNUSED(gpio);
+ //UNUSED(pullsel);
+ int ret = -1;
+ int value_t;
- return 0;
+ if (pullsel == 1)
+ value_t = 0;
+ else if (pullsel == 2)
+ value_t = 1;
+ else
+ {
+ LOGE("[lynq_gpio_pullsel_set] value_t fail.");
+ return -1;
+ }
+
+ ret = gpio_value_set(gpio, value_t);
+ if(ret == -1)
+ {
+ LOGE("[lynq_gpio_pullsel_set]gpio_value_set() fail.");
+ return -1;
+ }
+
+ return ret;
}
int lynq_gpio_pullsel_get(int gpio)
{
- UNUSED(gpio);
+ //UNUSED(gpio);
+ int ret = -1;
- return 0;
+ ret = gpio_value_get(gpio);
+ if (ret == -1)
+ {
+ LOGE("[lynq_gpio_pullsel_get]gpio_value_get() fail.");
+ return -1;
+ }
+
+ return ret + 1;
}
diff --git a/mbtk/liblynq_lib/src/lynq_voice_call.c b/mbtk/liblynq_lib/src/lynq_voice_call.c
index bc64b15..4125130 100755
--- a/mbtk/liblynq_lib/src/lynq_voice_call.c
+++ b/mbtk/liblynq_lib/src/lynq_voice_call.c
Binary files differ
diff --git a/mbtk/test/liblynq_lib/lynq_call_test.c b/mbtk/test/liblynq_lib/lynq_call_test.c
index 9bb9572..c68d92e 100755
--- a/mbtk/test/liblynq_lib/lynq_call_test.c
+++ b/mbtk/test/liblynq_lib/lynq_call_test.c
@@ -338,7 +338,7 @@
qser_voice_call_end(handle, voice_call_id);
break;
case 5:
- qser_voice_call_anser(handle, voice_call_id);
+ qser_voice_call_answer(handle, voice_call_id);
break;
case 6:
qser_voice_call_removestatehandle(handle);
diff --git a/mbtk/test/liblynq_lib_t106/lynq-qser-sms-demo.cpp b/mbtk/test/liblynq_lib_t106/lynq-qser-sms-demo.cpp
index dc8f9af..476e6da 100755
--- a/mbtk/test/liblynq_lib_t106/lynq-qser-sms-demo.cpp
+++ b/mbtk/test/liblynq_lib_t106/lynq-qser-sms-demo.cpp
@@ -103,7 +103,7 @@
ret = qser_sms_addrxmsghandler(qser_sms_handler, NULL);
if(ret == 0)
{
- printf("qser_sms_addrxmsghandler success");
+ printf("qser_sms_addrxmsghandler success\n");
}else{
printf("qser_sms_addrxmsghandler error, ret = %d\n", ret);
}
@@ -148,7 +148,7 @@
char msg[MSG_BUF] = {};
QSER_sms_info_t pt_sms_info;
// sprintf(telephony_num,"10086");//è¯·ç”¨æˆ·åŠ¡å¿…æ›¿æ¢æ¤å·ç ï¼Œéšæ„å‘è¿è¥å•†å‘çŸæ¶ˆæ¯æžæœ‰å¯èƒ½è¢«å°å·ã€‚
- sprintf(msg,"\"Chello worrld-7bit-mr!./\"");
+ sprintf(msg,"Chello worrld-7bit-mr!.");
strncpy(pt_sms_info.src_addr, argv[1], SMS_BUF);
strncpy(pt_sms_info.sms_data, msg, MSG_BUF);
pt_sms_info.format = QSER_SMS_7BIT;
@@ -161,7 +161,7 @@
ret = qser_sms_send_sms(h_sms, &pt_sms_info);
if(ret == 0)
{
- printf("send sms success");
+ printf("send sms success\n");
}else{
printf("send sms error, ret = %d\n", ret);
}
@@ -176,7 +176,7 @@
ret = qser_sms_client_deinit(h_sms);
if(ret == 0)
{
- printf("sms deinit success");
+ printf("sms deinit success\n");
}else{
printf("sms deinit error, ret = %d\n", ret);
}
diff --git a/mbtk/test/liblynq_lib_t106/lynq-qser-voice-demo.cpp b/mbtk/test/liblynq_lib_t106/lynq-qser-voice-demo.cpp
index d6ddaf1..9c55c7e 100755
--- a/mbtk/test/liblynq_lib_t106/lynq-qser-voice-demo.cpp
+++ b/mbtk/test/liblynq_lib_t106/lynq-qser-voice-demo.cpp
@@ -8,6 +8,7 @@
#include <stdint.h>
#include"lynq-qser-voice-demo.h"
+#include "mbtk_log.h"
typedef struct
{
@@ -82,6 +83,8 @@
int ret = 0;
int voice_call_id = 0;
voice_client_handle_type h_voice = 0;
+
+ mbtk_log_init("radio", "MBTK");
const char *lynqLibPath_Call = "/lib/liblynq-qser-voice.so";
dlHandle_call = dlopen(lynqLibPath_Call, RTLD_NOW);
@@ -91,7 +94,7 @@
exit(EXIT_FAILURE);
}
- qser_voice_call_client_init = (int(*)(voice_client_handle_type *ph_voice))dlsym(dlHandle_call, "qser_voice_call_client_init");
+ qser_voice_call_client_init = (int(*)(voice_client_handle_type *h_voice))dlsym(dlHandle_call, "qser_voice_call_client_init");
if(qser_voice_call_client_init == NULL)
{
printf("qser_voice_call_client_init not defined or exported in %s\n", lynqLibPath_Call);