Add mbtk gnss callback.
Change-Id: I5c720e8e742648aade43f02eae1fa2274ce361ea
diff --git a/mbtk/test/others/mbtk_gnss_cli.c b/mbtk/test/others/mbtk_gnss_cli.c
index 40d827c..8699a39 100755
--- a/mbtk/test/others/mbtk_gnss_cli.c
+++ b/mbtk/test/others/mbtk_gnss_cli.c
@@ -26,6 +26,7 @@
#include "mbtk_log.h"
#include "mbtk_type.h"
+#include "mbtk_gnss.h"
#define GNSS_SOCK_PATH "/tmp/mbtk_gnss_sock"
@@ -91,35 +92,43 @@
write(sock_listen_fd, buff, strlen(buff));
int len = 0;
+ char *rsp = NULL;
while(1) {
memset(buff, 0, sizeof(buff));
len = read(sock_listen_fd, buff, sizeof(buff));
if(len > 0) {
- printf("RSP : %s\n", buff);
+ rsp = buff;
+ if(rsp[len - 1] == MBTK_IND_END_FLAG) {
+ rsp[len - 1] = '\0';
+ }
+ if(rsp[0] == MBTK_IND_START_FLAG) {
+ rsp++;
+ }
+ printf("RSP : %s\n", rsp);
if(cmd == GNSS_CMD_INIT) {
- if(memcmp(buff, "gnss_init", 9) == 0) {
- return atoi(buff + 10);
+ if(memcmp(rsp, "gnss_init", 9) == 0) {
+ return atoi(rsp + 10);
} else {
printf("gnss_init response error.\n");
return -1;
}
} else if(cmd == GNSS_CMD_DEINIT) {
- if(memcmp(buff, "gnss_deinit", 11) == 0) {
- return atoi(buff + 12);
+ if(memcmp(rsp, "gnss_deinit", 11) == 0) {
+ return atoi(rsp + 12);
} else {
printf("gnss_deinit response error.\n");
return -1;
}
} else if(cmd == GNSS_CMD_SETTING) {
- if(memcmp(buff, "gnss_setting", 12) == 0) {
- return atoi(buff + 13);
+ if(memcmp(rsp, "gnss_setting", 12) == 0) {
+ return atoi(rsp + 13);
} else {
printf("gnss_setting response error.\n");
return -1;
}
} else if(cmd == GNSS_CMD_DL) {
- if(memcmp(buff, "gnss_dl", 7) == 0) {
- return atoi(buff + 8);
+ if(memcmp(rsp, "gnss_dl", 7) == 0) {
+ return atoi(rsp + 8);
} else {
printf("gnss_dl response error.\n");
return -1;