@@ -59,15 +59,15 @@ mp_obj_t picowireless_init() {
59
59
60
60
mp_obj_t picowireless_get_network_data () {
61
61
if (wireless != nullptr ) {
62
- uint8_t *ip = nullptr ;
63
- uint8_t * mask = nullptr ;
64
- uint8_t * gwip = nullptr ;
65
- wireless->get_network_data (ip, mask, gwip);
62
+ IPAddress ip ;
63
+ IPAddress mask;
64
+ IPAddress gwip;
65
+ wireless->get_network_data (( uint8_t *)& ip, ( uint8_t *)& mask, ( uint8_t *)& gwip);
66
66
67
67
mp_obj_t tuple[3 ];
68
- tuple[0 ] = mp_obj_new_bytes (ip, WL_IPV4_LENGTH);
69
- tuple[1 ] = mp_obj_new_bytes (mask, WL_IPV4_LENGTH);
70
- tuple[2 ] = mp_obj_new_bytes (gwip, WL_IPV4_LENGTH);
68
+ tuple[0 ] = mp_obj_new_bytes (( uint8_t *)& ip, WL_IPV4_LENGTH);
69
+ tuple[1 ] = mp_obj_new_bytes (( uint8_t *)& mask, WL_IPV4_LENGTH);
70
+ tuple[2 ] = mp_obj_new_bytes (( uint8_t *)& gwip, WL_IPV4_LENGTH);
71
71
return mp_obj_new_tuple (3 , tuple);
72
72
}
73
73
else
@@ -86,13 +86,13 @@ mp_obj_t picowireless_get_remote_data(size_t n_args, const mp_obj_t *pos_args, m
86
86
mp_arg_val_t args[MP_ARRAY_SIZE (allowed_args)];
87
87
mp_arg_parse_all (n_args, pos_args, kw_args, MP_ARRAY_SIZE (allowed_args), allowed_args, args);
88
88
89
- uint8_t *ip = nullptr ;
90
- uint8_t * port = nullptr ;
91
- wireless->get_remote_data (args[ARG_sock].u_int , ip, port);
89
+ IPAddress ip ;
90
+ uint16_t port = 0 ;
91
+ wireless->get_remote_data (args[ARG_sock].u_int , ( uint8_t *)& ip, ( uint8_t *)& port);
92
92
93
93
mp_obj_t tuple[2 ];
94
- tuple[0 ] = mp_obj_new_bytes (ip, WL_IPV4_LENGTH);
95
- tuple[1 ] = mp_obj_new_int (( uint16_t ) port[ 0 ] << 8 | ( uint16_t )port[ 1 ] ); // TODO verify size and ordering of port
94
+ tuple[0 ] = mp_obj_new_bytes (( uint8_t *)& ip, WL_IPV4_LENGTH);
95
+ tuple[1 ] = mp_obj_new_int (port); // TODO verify size and ordering of port
96
96
return mp_obj_new_tuple (2 , tuple);
97
97
}
98
98
else
0 commit comments