Open ztlchina opened 1 year ago
编译错误: ../../../components/net/at/at_socket/at_socket.c(771): error: cannot assign to non-static data member 'socket_ops' with const-qualified type 'const struct at_socket_ops *'
at_device.h:
struct at_device_class
{
uint16_t class_id; /* AT device class ID */
const struct at_device_ops *device_ops; /* AT device operaiotns */
#ifdef AT_USING_SOCKET
uint32_t socket_num; /* The maximum number of sockets support */
const struct at_socket_ops *socket_ops; /* AT device socket operations */
#endif
rt_slist_t list; /* AT device class list */
};
/* avoid use bottom driver to alloc "socket" */
store_at_socket_temporary = device->class->socket_ops->at_socket;
device->class->socket_ops->at_socket = RT_NULL;
new_sock = alloc_socket_by_device(device, AT_SOCKET_TCP);
if (new_sock == RT_NULL)
{
return;
}
new_sock->type = AT_SOCKET_TCP;
new_sock->state = AT_SOCKET_CONNECT;
/* set AT socket receive data callback function */
new_sock->ops->at_set_event_cb(AT_SOCKET_EVT_RECV, at_recv_notice_cb);
new_sock->ops->at_set_event_cb(AT_SOCKET_EVT_CLOSED, at_closed_notice_cb);
new_sock->ops->at_set_event_cb(AT_SOCKET_EVT_CONNECTED, at_connect_notice_cb);
device->class->socket_ops->at_socket = store_at_socket_temporary;
我直接把const去掉
直接把store_at_socket_temporary删了,没用
最新版本(2022-11-16 19:28:24) 开启了宏定义AT_USING_SOCKET_SERVER 与 atclient 包里的 const struct at_socket_ops socket_ops; / AT device socket operations */ 冲突了。
182
解决了182. 引起了新的问题。
按下葫芦浮起瓢。。。