4646 ((unsigned char *)&addr)[2], \
4747 ((unsigned char *)&addr)[3]
4848
49- #ifdef AT_DEVICE_NOT_SELECTED
49+ #if !defined( AT_DEVICE_SOCKETS_NUM ) || defined( AT_DEVICE_NOT_SELECTED )
5050#error The AT socket device is not selected, please select it through the env menuconfig.
5151#endif
5252
@@ -398,7 +398,7 @@ int at_closesocket(int socket)
398398
399399 if (last_state == AT_SOCKET_CONNECT )
400400 {
401- if (at_dev_ops -> close (socket ) != 0 )
401+ if (at_dev_ops -> at_closesocket (socket ) != 0 )
402402 {
403403 LOG_E ("AT socket (%d) closesocket failed!" , socket );
404404 }
@@ -424,7 +424,7 @@ int at_shutdown(int socket, int how)
424424
425425 if (sock -> state == AT_SOCKET_CONNECT )
426426 {
427- if (at_dev_ops -> close (socket ) != 0 )
427+ if (at_dev_ops -> at_closesocket (socket ) != 0 )
428428 {
429429 LOG_E ("AT socket (%d) shutdown failed!" , socket );
430430 }
@@ -535,7 +535,7 @@ int at_connect(int socket, const struct sockaddr *name, socklen_t namelen)
535535 socketaddr_to_ipaddr_port (name , & remote_addr , & remote_port );
536536 ipaddr_to_ipstr (name , ipstr );
537537
538- if (at_dev_ops -> connect (socket , ipstr , remote_port , sock -> type , RT_TRUE ) < 0 )
538+ if (at_dev_ops -> at_connect (socket , ipstr , remote_port , sock -> type , RT_TRUE ) < 0 )
539539 {
540540 LOG_E ("AT socket(%d) connect failed!" , socket );
541541 result = -1 ;
@@ -545,8 +545,8 @@ int at_connect(int socket, const struct sockaddr *name, socklen_t namelen)
545545 sock -> state = AT_SOCKET_CONNECT ;
546546
547547 /* set AT socket receive data callback function */
548- at_dev_ops -> set_event_cb (AT_SOCKET_EVT_RECV , at_recv_notice_cb );
549- at_dev_ops -> set_event_cb (AT_SOCKET_EVT_CLOSED , at_closed_notice_cb );
548+ at_dev_ops -> at_set_event_cb (AT_SOCKET_EVT_RECV , at_recv_notice_cb );
549+ at_dev_ops -> at_set_event_cb (AT_SOCKET_EVT_CLOSED , at_closed_notice_cb );
550550
551551__exit :
552552
@@ -593,7 +593,7 @@ int at_recvfrom(int socket, void *mem, size_t len, int flags, struct sockaddr *f
593593 socketaddr_to_ipaddr_port (from , & remote_addr , & remote_port );
594594 ipaddr_to_ipstr (from , ipstr );
595595
596- if (at_dev_ops -> connect (socket , ipstr , remote_port , sock -> type , RT_TRUE ) < 0 )
596+ if (at_dev_ops -> at_connect (socket , ipstr , remote_port , sock -> type , RT_TRUE ) < 0 )
597597 {
598598 LOG_E ("AT socket UDP connect failed!" );
599599 result = -1 ;
@@ -719,7 +719,7 @@ int at_sendto(int socket, const void *data, size_t size, int flags, const struct
719719 goto __exit ;
720720 }
721721
722- if ((len = at_dev_ops -> send (sock -> socket , (const char * ) data , size , sock -> type )) < 0 )
722+ if ((len = at_dev_ops -> at_send (sock -> socket , (const char * ) data , size , sock -> type )) < 0 )
723723 {
724724 result = -1 ;
725725 goto __exit ;
@@ -736,7 +736,7 @@ int at_sendto(int socket, const void *data, size_t size, int flags, const struct
736736 socketaddr_to_ipaddr_port (to , & remote_addr , & remote_port );
737737 ipaddr_to_ipstr (to , ipstr );
738738
739- if (at_dev_ops -> connect (socket , ipstr , remote_port , sock -> type , RT_TRUE ) < 0 )
739+ if (at_dev_ops -> at_connect (socket , ipstr , remote_port , sock -> type , RT_TRUE ) < 0 )
740740 {
741741 LOG_E ("AT socket (%d) UDP connect failed!" , socket );
742742 result = -1 ;
@@ -745,7 +745,7 @@ int at_sendto(int socket, const void *data, size_t size, int flags, const struct
745745 sock -> state = AT_SOCKET_CONNECT ;
746746 }
747747
748- if ((len = at_dev_ops -> send (sock -> socket , (char * ) data , size , sock -> type )) < 0 )
748+ if ((len = at_dev_ops -> at_send (sock -> socket , (char * ) data , size , sock -> type )) < 0 )
749749 {
750750 result = -1 ;
751751 goto __exit ;
@@ -940,7 +940,7 @@ struct hostent *at_gethostbyname(const char *name)
940940
941941 if (idx < strlen (name ))
942942 {
943- if (at_dev_ops -> domain_resolve (name , ipstr ) < 0 )
943+ if (at_dev_ops -> at_domain_resolve (name , ipstr ) < 0 )
944944 {
945945 LOG_E ("AT domain (%s) resolve error!" , name );
946946 return RT_NULL ;
@@ -1040,7 +1040,7 @@ int at_getaddrinfo(const char *nodename, const char *servname,
10401040
10411041 if (idx < strlen (nodename ))
10421042 {
1043- if (at_dev_ops -> domain_resolve ((char * ) nodename , ip_str ) != 0 )
1043+ if (at_dev_ops -> at_domain_resolve ((char * ) nodename , ip_str ) != 0 )
10441044 {
10451045 return EAI_FAIL ;
10461046 }
@@ -1129,10 +1129,10 @@ void at_freeaddrinfo(struct addrinfo *ai)
11291129void at_scoket_device_register (const struct at_device_ops * ops )
11301130{
11311131 RT_ASSERT (ops );
1132- RT_ASSERT (ops -> connect );
1133- RT_ASSERT (ops -> close );
1134- RT_ASSERT (ops -> send );
1135- RT_ASSERT (ops -> domain_resolve );
1136- RT_ASSERT (ops -> set_event_cb );
1132+ RT_ASSERT (ops -> at_connect );
1133+ RT_ASSERT (ops -> at_closesocket );
1134+ RT_ASSERT (ops -> at_send );
1135+ RT_ASSERT (ops -> at_domain_resolve );
1136+ RT_ASSERT (ops -> at_set_event_cb );
11371137 at_dev_ops = (struct at_device_ops * ) ops ;
11381138}
0 commit comments