Turn on json and enable socket.close
This commit is contained in:
parent
430530c74b
commit
b3a449c276
|
@ -31,7 +31,7 @@
|
||||||
#define CIRCUITPY_INTERNAL_NVM_SIZE (0)
|
#define CIRCUITPY_INTERNAL_NVM_SIZE (0)
|
||||||
#define MICROPY_NLR_THUMB (0)
|
#define MICROPY_NLR_THUMB (0)
|
||||||
|
|
||||||
#define MICROPY_PY_UJSON (0)
|
#define MICROPY_PY_UJSON (1)
|
||||||
#define MICROPY_USE_INTERNAL_PRINTF (0)
|
#define MICROPY_USE_INTERNAL_PRINTF (0)
|
||||||
|
|
||||||
#include "py/circuitpy_mpconfig.h"
|
#include "py/circuitpy_mpconfig.h"
|
||||||
|
|
|
@ -155,32 +155,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket___exit___obj, 4, 4,
|
||||||
//| """Closes this Socket and makes its resources available to its SocketPool."""
|
//| """Closes this Socket and makes its resources available to its SocketPool."""
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t socketpool_socket_close(mp_obj_t self_in) {
|
STATIC mp_obj_t socketpool_socket_close(mp_obj_t self_in) {
|
||||||
// mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||||
|
common_hal_socketpool_socket_close(self);
|
||||||
// // create new socket object
|
|
||||||
// // starts with empty NIC so that finaliser doesn't run close() method if accept() fails
|
|
||||||
// mod_network_socket_obj_t *socket2 = m_new_obj_with_finaliser(mod_network_socket_obj_t);
|
|
||||||
// socket2->base.type = &socket_type;
|
|
||||||
// socket2->nic = MP_OBJ_NULL;
|
|
||||||
// socket2->nic_type = NULL;
|
|
||||||
|
|
||||||
// // accept incoming connection
|
|
||||||
// uint8_t ip[MOD_NETWORK_IPADDR_BUF_SIZE];
|
|
||||||
// mp_uint_t port;
|
|
||||||
// int _errno;
|
|
||||||
// if (self->nic_type->accept(self, socket2, ip, &port, &_errno) != 0) {
|
|
||||||
// mp_raise_OSError(_errno);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // new socket has valid state, so set the NIC to the same as parent
|
|
||||||
// socket2->nic = self->nic;
|
|
||||||
// socket2->nic_type = self->nic_type;
|
|
||||||
|
|
||||||
// // make the return value
|
|
||||||
// mp_obj_tuple_t *client = MP_OBJ_TO_PTR(mp_obj_new_tuple(2, NULL));
|
|
||||||
// client->items[0] = MP_OBJ_FROM_PTR(socket2);
|
|
||||||
// client->items[1] = netutils_format_inet_addr(ip, port, NETUTILS_BIG);
|
|
||||||
|
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(socketpool_socket_close_obj, socketpool_socket_close);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(socketpool_socket_close_obj, socketpool_socket_close);
|
||||||
|
|
|
@ -35,5 +35,6 @@ void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t* self, mp_u
|
||||||
bool common_hal_socketpool_socket_connect(socketpool_socket_obj_t* self, const char* host, size_t hostlen, mp_int_t port);
|
bool common_hal_socketpool_socket_connect(socketpool_socket_obj_t* self, const char* host, size_t hostlen, mp_int_t port);
|
||||||
mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len);
|
mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len);
|
||||||
mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len);
|
mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t* self, const uint8_t* buf, mp_uint_t len);
|
||||||
|
void common_hal_socketpool_socket_close(socketpool_socket_obj_t* self);
|
||||||
|
|
||||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL_SOCKET_H
|
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL_SOCKET_H
|
||||||
|
|
Loading…
Reference in New Issue