|
|
@ -65,7 +65,7 @@ AT_STATUS at_cmd_test(unsigned char *p, unsigned char len) |
|
|
|
AT_STATUS at_cmd_ip(unsigned char *p, unsigned char len) |
|
|
|
{ |
|
|
|
ip4_addr_t int_addr; |
|
|
|
char *ip_address; |
|
|
|
char ip_address[16]; |
|
|
|
|
|
|
|
if (*p == '?') |
|
|
|
{ |
|
|
@ -73,14 +73,18 @@ AT_STATUS at_cmd_ip(unsigned char *p, unsigned char len) |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
ip_address = (char *)malloc(len+1); |
|
|
|
if (len >= sizeof(ip_address)) |
|
|
|
{ |
|
|
|
printf("AT+ERR\r\n"); |
|
|
|
return AT_ERR; |
|
|
|
} |
|
|
|
strncpy(ip_address, (const char *)p, len); |
|
|
|
ip_address[len] = 0; |
|
|
|
printf("ip_address:%s\r\n", ip_address); |
|
|
|
inet_aton(ip_address, &int_addr); |
|
|
|
printf("int_addr:%d\r\n", int_addr.addr); |
|
|
|
// printf("ip address:%s\r\n", p); |
|
|
|
printf("AT+OK\r\n"); |
|
|
|
free(ip_address); |
|
|
|
} |
|
|
|
return AT_SUCCESS; |
|
|
|
} |
|
|
|