| 469 | } |
| 470 | |
| 471 | static struct at_socket *alloc_socket(enum at_socket_type type) |
| 472 | { |
| 473 | extern struct netdev *netdev_default; |
| 474 | struct netdev *netdev = RT_NULL; |
| 475 | struct at_device *device = RT_NULL; |
| 476 | |
| 477 | if (netdev_default && netdev_is_up(netdev_default) && |
| 478 | netdev_family_get(netdev_default) == AF_AT) |
| 479 | { |
| 480 | netdev = netdev_default; |
| 481 | } |
| 482 | else |
| 483 | { |
| 484 | /* get network interface device by protocol family AF_AT */ |
| 485 | netdev = netdev_get_by_family(AF_AT); |
| 486 | if (netdev == RT_NULL) |
| 487 | { |
| 488 | return RT_NULL; |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | device = at_device_get_by_name(AT_DEVICE_NAMETYPE_NETDEV, netdev->name); |
| 493 | if (device == RT_NULL) |
| 494 | { |
| 495 | return RT_NULL; |
| 496 | } |
| 497 | |
| 498 | return alloc_socket_by_device(device, type); |
| 499 | } |
| 500 | |
| 501 | static void at_recv_notice_cb(struct at_socket *sock, at_socket_evt_t event, const char *buff, size_t bfsz); |
| 502 | static void at_closed_notice_cb(struct at_socket *sock, at_socket_evt_t event, const char *buff, size_t bfsz); |
no test coverage detected