|
|
@ -75,15 +75,19 @@ AT_STATUS at_cmd_ip(unsigned char *p, unsigned char len) |
|
|
|
{ |
|
|
|
if (len >= sizeof(ip_address)) |
|
|
|
{ |
|
|
|
/* 长度判断 */ |
|
|
|
printf("AT+ERR\r\n"); |
|
|
|
return AT_ERR; |
|
|
|
} |
|
|
|
/* 拷贝len有效字符长度的字符串到ip_address中 */ |
|
|
|
strncpy(ip_address, (const char *)p, len); |
|
|
|
ip_address[len] = 0; |
|
|
|
printf("ip_address:%s\r\n", ip_address); |
|
|
|
ip_address[len] = 0; /* 这个必须要加,否则转换会出错 */ |
|
|
|
inet_aton(ip_address, &int_addr); |
|
|
|
printf("int_addr:%d\r\n", int_addr.addr); |
|
|
|
// printf("ip address:%s\r\n", p); |
|
|
|
|
|
|
|
config_get()->ip = int_addr.addr; |
|
|
|
|
|
|
|
config_dump_config(); |
|
|
|
|
|
|
|
printf("AT+OK\r\n"); |
|
|
|
} |
|
|
|
return AT_SUCCESS; |
|
|
|