commit
70726ee3e9
|
@ -224,7 +224,7 @@ static void ec20_power_off(struct at_device *device)
|
|||
/* set ec20 network interface device status and address information */
|
||||
static int ec20_netdev_set_info(struct netdev *netdev)
|
||||
{
|
||||
#define EC20_IEMI_RESP_SIZE 32
|
||||
#define EC20_IMEI_RESP_SIZE 32
|
||||
#define EC20_IPADDR_RESP_SIZE 64
|
||||
#define EC20_DNS_RESP_SIZE 96
|
||||
#define EC20_INFO_RESP_TIMO rt_tick_from_millisecond(300)
|
||||
|
@ -248,7 +248,7 @@ static int ec20_netdev_set_info(struct netdev *netdev)
|
|||
netdev_low_level_set_link_status(netdev, RT_TRUE);
|
||||
netdev_low_level_set_dhcp_status(netdev, RT_TRUE);
|
||||
|
||||
resp = at_create_resp(EC20_IEMI_RESP_SIZE, 0, EC20_INFO_RESP_TIMO);
|
||||
resp = at_create_resp(EC20_IMEI_RESP_SIZE, 0, EC20_INFO_RESP_TIMO);
|
||||
if (resp == RT_NULL)
|
||||
{
|
||||
LOG_E("no memory for resp create.");
|
||||
|
@ -256,41 +256,41 @@ static int ec20_netdev_set_info(struct netdev *netdev)
|
|||
goto __exit;
|
||||
}
|
||||
|
||||
/* set network interface device hardware address(IEMI) */
|
||||
/* set network interface device hardware address(IMEI) */
|
||||
{
|
||||
#define EC20_NETDEV_HWADDR_LEN 8
|
||||
#define EC20_IEMI_LEN 15
|
||||
#define EC20_IMEI_LEN 15
|
||||
|
||||
char iemi[EC20_IEMI_LEN] = {0};
|
||||
char imei[EC20_IMEI_LEN] = {0};
|
||||
int i = 0, j = 0;
|
||||
|
||||
/* send "AT+GSN" commond to get device IEMI */
|
||||
/* send "AT+GSN" commond to get device IMEI */
|
||||
if (at_obj_exec_cmd(device->client, resp, "AT+GSN") < 0)
|
||||
{
|
||||
result = -RT_ERROR;
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
if (at_resp_parse_line_args(resp, 2, "%s", iemi) <= 0)
|
||||
if (at_resp_parse_line_args(resp, 2, "%s", imei) <= 0)
|
||||
{
|
||||
LOG_E("%s device prase \"AT+GSN\" cmd error.", device->name);
|
||||
result = -RT_ERROR;
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
LOG_D("%s device IEMI number: %s", device->name, iemi);
|
||||
LOG_D("%s device IMEI number: %s", device->name, imei);
|
||||
|
||||
netdev->hwaddr_len = EC20_NETDEV_HWADDR_LEN;
|
||||
/* get hardware address by IEMI */
|
||||
for (i = 0, j = 0; i < EC20_NETDEV_HWADDR_LEN && j < EC20_IEMI_LEN; i++, j+=2)
|
||||
/* get hardware address by IMEI */
|
||||
for (i = 0, j = 0; i < EC20_NETDEV_HWADDR_LEN && j < EC20_IMEI_LEN; i++, j+=2)
|
||||
{
|
||||
if (j != EC20_IEMI_LEN - 1)
|
||||
if (j != EC20_IMEI_LEN - 1)
|
||||
{
|
||||
netdev->hwaddr[i] = (iemi[j] - '0') * 10 + (iemi[j + 1] - '0');
|
||||
netdev->hwaddr[i] = (imei[j] - '0') * 10 + (imei[j + 1] - '0');
|
||||
}
|
||||
else
|
||||
{
|
||||
netdev->hwaddr[i] = (iemi[j] - '0');
|
||||
netdev->hwaddr[i] = (imei[j] - '0');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -408,7 +408,7 @@ __retry:
|
|||
/* waiting result event from AT URC, the device default connection timeout is 75 seconds, but it set to 10 seconds is convenient to use.*/
|
||||
if (ec20_socket_event_recv(device, SET_EVENT(device_socket, 0), 10 * RT_TICK_PER_SECOND, RT_EVENT_FLAG_OR) < 0)
|
||||
{
|
||||
LOG_E("%s device socket(%d) wait connect URC timeout.", device->name, device_socket);
|
||||
LOG_E("%s device socket(%d) wait connect result timeout.", device->name, device_socket);
|
||||
result = -RT_ETIMEOUT;
|
||||
goto __exit;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ static void m26_power_off(struct at_device *device)
|
|||
/* set m26 network interface device status and address information */
|
||||
static int m26_netdev_set_info(struct netdev *netdev)
|
||||
{
|
||||
#define M26_IEMI_RESP_SIZE 32
|
||||
#define M26_IMEI_RESP_SIZE 32
|
||||
#define M26_IPADDR_RESP_SIZE 32
|
||||
#define M26_DNS_RESP_SIZE 96
|
||||
#define M26_INFO_RESP_TIMO rt_tick_from_millisecond(300)
|
||||
|
@ -117,7 +117,7 @@ static int m26_netdev_set_info(struct netdev *netdev)
|
|||
netdev_low_level_set_status(netdev, RT_TRUE);
|
||||
netdev_low_level_set_dhcp_status(netdev, RT_TRUE);
|
||||
|
||||
resp = at_create_resp(M26_IEMI_RESP_SIZE, 0, M26_INFO_RESP_TIMO);
|
||||
resp = at_create_resp(M26_IMEI_RESP_SIZE, 0, M26_INFO_RESP_TIMO);
|
||||
if (resp == RT_NULL)
|
||||
{
|
||||
LOG_E("no memory for resp create.");
|
||||
|
@ -125,41 +125,41 @@ static int m26_netdev_set_info(struct netdev *netdev)
|
|||
goto __exit;
|
||||
}
|
||||
|
||||
/* set network interface device hardware address(IEMI) */
|
||||
/* set network interface device hardware address(IMEI) */
|
||||
{
|
||||
#define M26_NETDEV_HWADDR_LEN 8
|
||||
#define M26_IEMI_LEN 15
|
||||
#define M26_IMEI_LEN 15
|
||||
|
||||
char iemi[M26_IEMI_LEN] = {0};
|
||||
char imei[M26_IMEI_LEN] = {0};
|
||||
int i = 0, j = 0;
|
||||
|
||||
/* send "AT+GSN" commond to get device IEMI */
|
||||
/* send "AT+GSN" commond to get device IMEI */
|
||||
if (at_obj_exec_cmd(client, resp, "AT+GSN") < 0)
|
||||
{
|
||||
result = -RT_ERROR;
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
if (at_resp_parse_line_args(resp, 2, "%s", iemi) <= 0)
|
||||
if (at_resp_parse_line_args(resp, 2, "%s", imei) <= 0)
|
||||
{
|
||||
LOG_E("%s device prase \"AT+GSN\" cmd error.", device->name);
|
||||
result = -RT_ERROR;
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
LOG_D("%s device IEMI number: %s", device->name, iemi);
|
||||
LOG_D("%s device IMEI number: %s", device->name, imei);
|
||||
|
||||
netdev->hwaddr_len = M26_NETDEV_HWADDR_LEN;
|
||||
/* get hardware address by IEMI */
|
||||
for (i = 0, j = 0; i < M26_NETDEV_HWADDR_LEN && j < M26_IEMI_LEN; i++, j+=2)
|
||||
/* get hardware address by IMEI */
|
||||
for (i = 0, j = 0; i < M26_NETDEV_HWADDR_LEN && j < M26_IMEI_LEN; i++, j+=2)
|
||||
{
|
||||
if (j != M26_IEMI_LEN - 1)
|
||||
if (j != M26_IMEI_LEN - 1)
|
||||
{
|
||||
netdev->hwaddr[i] = (iemi[j] - '0') * 10 + (iemi[j + 1] - '0');
|
||||
netdev->hwaddr[i] = (imei[j] - '0') * 10 + (imei[j + 1] - '0');
|
||||
}
|
||||
else
|
||||
{
|
||||
netdev->hwaddr[i] = (iemi[j] - '0');
|
||||
netdev->hwaddr[i] = (imei[j] - '0');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ static void sim76xx_power_off(struct at_device *device)
|
|||
/* set sim76xx network interface device status and address information */
|
||||
static int sim76xx_netdev_set_info(struct netdev *netdev)
|
||||
{
|
||||
#define SIM76XX_IEMI_RESP_SIZE 256
|
||||
#define SIM76XX_IMEI_RESP_SIZE 256
|
||||
#define SIM76XX_IPADDR_RESP_SIZE 64
|
||||
#define SIM76XX_DNS_RESP_SIZE 96
|
||||
#define SIM76XX_INFO_RESP_TIMO rt_tick_from_millisecond(300)
|
||||
|
@ -121,7 +121,7 @@ static int sim76xx_netdev_set_info(struct netdev *netdev)
|
|||
netdev_low_level_set_link_status(netdev, RT_TRUE);
|
||||
netdev_low_level_set_dhcp_status(netdev, RT_TRUE);
|
||||
|
||||
resp = at_create_resp(SIM76XX_IEMI_RESP_SIZE, 0, SIM76XX_INFO_RESP_TIMO);
|
||||
resp = at_create_resp(SIM76XX_IMEI_RESP_SIZE, 0, SIM76XX_INFO_RESP_TIMO);
|
||||
if (resp == RT_NULL)
|
||||
{
|
||||
LOG_E("no memory for resp create.");
|
||||
|
@ -129,41 +129,41 @@ static int sim76xx_netdev_set_info(struct netdev *netdev)
|
|||
goto __exit;
|
||||
}
|
||||
|
||||
/* set network interface device hardware address(IEMI) */
|
||||
/* set network interface device hardware address(IMEI) */
|
||||
{
|
||||
#define SIM76XX_NETDEV_HWADDR_LEN 8
|
||||
#define SIM76XX_IEMI_LEN 15
|
||||
#define SIM76XX_IMEI_LEN 15
|
||||
|
||||
char iemi[SIM76XX_IEMI_LEN] = {0};
|
||||
char imei[SIM76XX_IMEI_LEN] = {0};
|
||||
int i = 0, j = 0;
|
||||
|
||||
/* send "ATI" commond to get device IEMI */
|
||||
/* send "ATI" commond to get device IMEI */
|
||||
if (at_obj_exec_cmd(device->client, resp, "ATI") < 0)
|
||||
{
|
||||
result = -RT_ERROR;
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
if (at_resp_parse_line_args_by_kw(resp, "IMEI:", "IMEI: %s", iemi) <= 0)
|
||||
if (at_resp_parse_line_args_by_kw(resp, "IMEI:", "IMEI: %s", imei) <= 0)
|
||||
{
|
||||
LOG_E("%s device prase \"ATI\" cmd error.", device->name);
|
||||
result = -RT_ERROR;
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
LOG_D("%s device IEMI number: %s", device->name, iemi);
|
||||
LOG_D("%s device IMEI number: %s", device->name, imei);
|
||||
|
||||
netdev->hwaddr_len = SIM76XX_NETDEV_HWADDR_LEN;
|
||||
/* get hardware address by IEMI */
|
||||
for (i = 0, j = 0; i < SIM76XX_NETDEV_HWADDR_LEN && j < SIM76XX_IEMI_LEN; i++, j += 2)
|
||||
/* get hardware address by IMEI */
|
||||
for (i = 0, j = 0; i < SIM76XX_NETDEV_HWADDR_LEN && j < SIM76XX_IMEI_LEN; i++, j += 2)
|
||||
{
|
||||
if (j != SIM76XX_IEMI_LEN - 1)
|
||||
if (j != SIM76XX_IMEI_LEN - 1)
|
||||
{
|
||||
netdev->hwaddr[i] = (iemi[j] - '0') * 10 + (iemi[j + 1] - '0');
|
||||
netdev->hwaddr[i] = (imei[j] - '0') * 10 + (imei[j + 1] - '0');
|
||||
}
|
||||
else
|
||||
{
|
||||
netdev->hwaddr[i] = (iemi[j] - '0');
|
||||
netdev->hwaddr[i] = (imei[j] - '0');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ static void sim800c_power_off(struct at_device *device)
|
|||
/* set sim800c network interface device status and address information */
|
||||
static int sim800c_netdev_set_info(struct netdev *netdev)
|
||||
{
|
||||
#define SIM800C_IEMI_RESP_SIZE 32
|
||||
#define SIM800C_IMEI_RESP_SIZE 32
|
||||
#define SIM800C_IPADDR_RESP_SIZE 32
|
||||
#define SIM800C_DNS_RESP_SIZE 96
|
||||
#define SIM800C_INFO_RESP_TIMO rt_tick_from_millisecond(300)
|
||||
|
@ -122,7 +122,7 @@ static int sim800c_netdev_set_info(struct netdev *netdev)
|
|||
netdev_low_level_set_link_status(netdev, RT_TRUE);
|
||||
netdev_low_level_set_dhcp_status(netdev, RT_TRUE);
|
||||
|
||||
resp = at_create_resp(SIM800C_IEMI_RESP_SIZE, 0, SIM800C_INFO_RESP_TIMO);
|
||||
resp = at_create_resp(SIM800C_IMEI_RESP_SIZE, 0, SIM800C_INFO_RESP_TIMO);
|
||||
if (resp == RT_NULL)
|
||||
{
|
||||
LOG_E("no memory for resp create.");
|
||||
|
@ -130,41 +130,41 @@ static int sim800c_netdev_set_info(struct netdev *netdev)
|
|||
goto __exit;
|
||||
}
|
||||
|
||||
/* set network interface device hardware address(IEMI) */
|
||||
/* set network interface device hardware address(IMEI) */
|
||||
{
|
||||
#define SIM800C_NETDEV_HWADDR_LEN 8
|
||||
#define SIM800C_IEMI_LEN 15
|
||||
#define SIM800C_IMEI_LEN 15
|
||||
|
||||
char iemi[SIM800C_IEMI_LEN] = {0};
|
||||
char imei[SIM800C_IMEI_LEN] = {0};
|
||||
int i = 0, j = 0;
|
||||
|
||||
/* send "AT+GSN" commond to get device IEMI */
|
||||
/* send "AT+GSN" commond to get device IMEI */
|
||||
if (at_obj_exec_cmd(device->client, resp, "AT+GSN") < 0)
|
||||
{
|
||||
result = -RT_ERROR;
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
if (at_resp_parse_line_args(resp, 2, "%s", iemi) <= 0)
|
||||
if (at_resp_parse_line_args(resp, 2, "%s", imei) <= 0)
|
||||
{
|
||||
LOG_E("%s device prase \"AT+GSN\" cmd error.", device->name);
|
||||
result = -RT_ERROR;
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
LOG_D("%s device IEMI number: %s", device->name, iemi);
|
||||
LOG_D("%s device IMEI number: %s", device->name, imei);
|
||||
|
||||
netdev->hwaddr_len = SIM800C_NETDEV_HWADDR_LEN;
|
||||
/* get hardware address by IEMI */
|
||||
for (i = 0, j = 0; i < SIM800C_NETDEV_HWADDR_LEN && j < SIM800C_IEMI_LEN; i++, j += 2)
|
||||
/* get hardware address by IMEI */
|
||||
for (i = 0, j = 0; i < SIM800C_NETDEV_HWADDR_LEN && j < SIM800C_IMEI_LEN; i++, j += 2)
|
||||
{
|
||||
if (j != SIM800C_IEMI_LEN - 1)
|
||||
if (j != SIM800C_IMEI_LEN - 1)
|
||||
{
|
||||
netdev->hwaddr[i] = (iemi[j] - '0') * 10 + (iemi[j + 1] - '0');
|
||||
netdev->hwaddr[i] = (imei[j] - '0') * 10 + (imei[j + 1] - '0');
|
||||
}
|
||||
else
|
||||
{
|
||||
netdev->hwaddr[i] = (iemi[j] - '0');
|
||||
netdev->hwaddr[i] = (imei[j] - '0');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue