blob: 6c06efb2d600e531e7a87e15ec783bf17ca2385a [file] [log] [blame]
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <stdint.h>
typedef void(*AT_CALLBACK)(char input[],char output[],int out_max_size);
int32_t (*gsw_reg_atcmd)(const char *atcmd,AT_CALLBACK);
void *dlHandle_at;
char *lynqLib_at = "/lib/libgsw_lib.so";
void lynq_test_example(char input[], char output[], int out_max_size)
{
if(!strcmp(input, "AT+TEST1"))
{
memcpy(output, input, strlen(input));
}
else if(!strcmp(input, "AT+TEST2"))
{
memcpy(output, input, strlen(input));
}
else if(!strcmp(input, "AT+TEST3"))
{
memcpy(output, input, strlen(input));
}
else if(!strcmp(input, "AT+TEST4"))
{
memcpy(output, input, strlen(input));
}
else if(!strcmp(input, "AT+TEST5"))
{
memcpy(output, input, strlen(input));
}
return;
}
int main(void)
{
int ret;
dlHandle_at = dlopen(lynqLib_at, RTLD_NOW);
gsw_reg_atcmd=(int32_t(*)(const char *atcmd,AT_CALLBACK))dlsym(dlHandle_at, "gsw_reg_atcmd");
ret = gsw_reg_atcmd("AT+TEST1;AT+TEST2;AT+TEST3;AT+TEST4;AT+TEST5",lynq_test_example);
if (ret == 0)
printf("at add ok\n");
else
printf("at add fail\n");
while (1)
{
getchar();
}
dlclose(dlHandle_at);
dlHandle_at = NULL;
return 0;
}