Skip to content

Commit 98946cf

Browse files
committed
Merge branch 'dev'
2 parents 25c7573 + 32bf419 commit 98946cf

File tree

7 files changed

+121
-30
lines changed

7 files changed

+121
-30
lines changed

src/erpc/rpc_wifi_api.h

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Generated by erpcgen 1.7.4 on Wed Nov 4 11:07:47 2020.
2+
* Generated by erpcgen 1.7.4 on Sat Nov 14 13:53:09 2020.
33
*
44
* AUTOGENERATED - DO NOT EDIT
55
*/
@@ -77,10 +77,11 @@ enum _rpc_wifi_drv_ids
7777
krpc_wifi_drv_rpc_wifi_get_band_type_id = 60,
7878
krpc_wifi_drv_rpc_wifi_set_tx_pause_data_id = 61,
7979
krpc_wifi_drv_rpc_wifi_get_reconnect_data_id = 62,
80-
krpc_wifi_drv_rpc_wifi_scan_start_id = 63,
81-
krpc_wifi_drv_rpc_wifi_is_scaning_id = 64,
82-
krpc_wifi_drv_rpc_wifi_scan_get_ap_records_id = 65,
83-
krpc_wifi_drv_rpc_wifi_scan_get_ap_num_id = 66,
80+
krpc_wifi_drv_rpc_wifi_clear_reconnect_data_id = 63,
81+
krpc_wifi_drv_rpc_wifi_scan_start_id = 64,
82+
krpc_wifi_drv_rpc_wifi_is_scaning_id = 65,
83+
krpc_wifi_drv_rpc_wifi_scan_get_ap_records_id = 66,
84+
krpc_wifi_drv_rpc_wifi_scan_get_ap_num_id = 67,
8485
};
8586

8687
/*! @brief rpc_wifi_tcpip identifiers */
@@ -300,6 +301,8 @@ int32_t rpc_wifi_set_tx_pause_data(uint32_t NewState);
300301

301302
int32_t rpc_wifi_get_reconnect_data(binary_t * wifi_info);
302303

304+
int32_t rpc_wifi_clear_reconnect_data(void);
305+
303306
int32_t rpc_wifi_scan_start(void);
304307

305308
bool rpc_wifi_is_scaning(void);
@@ -376,7 +379,7 @@ int32_t rpc_lwip_recv(int32_t s, binary_t * mem, uint32_t len, int32_t flags, ui
376379

377380
int32_t rpc_lwip_read(int32_t s, binary_t * mem, uint32_t len, uint32_t timeout);
378381

379-
int32_t rpc_lwip_recvfrom(int32_t s, binary_t * mem, uint32_t len, int32_t flags, const binary_t * from, uint32_t * fromlen, uint32_t timeout);
382+
int32_t rpc_lwip_recvfrom(int32_t s, binary_t * mem, uint32_t len, int32_t flags, binary_t * from, uint32_t * fromlen, uint32_t timeout);
380383

381384
int32_t rpc_lwip_send(int32_t s, const binary_t * dataptr, int32_t flags);
382385

src/erpc/rpc_wifi_api_client.cpp

+48-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Generated by erpcgen 1.7.4 on Wed Nov 4 11:07:47 2020.
2+
* Generated by erpcgen 1.7.4 on Sat Nov 14 13:53:09 2020.
33
*
44
* AUTOGENERATED - DO NOT EDIT
55
*/
@@ -2955,6 +2955,50 @@ int32_t rpc_wifi_get_reconnect_data(binary_t * wifi_info)
29552955
return result;
29562956
}
29572957

2958+
// rpc_wifi_drv interface rpc_wifi_clear_reconnect_data function client shim.
2959+
int32_t rpc_wifi_clear_reconnect_data(void)
2960+
{
2961+
erpc_status_t err = kErpcStatus_Success;
2962+
2963+
int32_t result;
2964+
2965+
// Get a new request.
2966+
RequestContext request = g_client->createRequest(false);
2967+
2968+
// Encode the request.
2969+
Codec * codec = request.getCodec();
2970+
2971+
if (codec == NULL)
2972+
{
2973+
err = kErpcStatus_MemoryError;
2974+
}
2975+
else
2976+
{
2977+
codec->startWriteMessage(kInvocationMessage, krpc_wifi_drv_service_id, krpc_wifi_drv_rpc_wifi_clear_reconnect_data_id, request.getSequence());
2978+
2979+
// Send message to server
2980+
// Codec status is checked inside this function.
2981+
g_client->performRequest(request);
2982+
2983+
codec->read(&result);
2984+
2985+
err = codec->getStatus();
2986+
}
2987+
2988+
// Dispose of the request.
2989+
g_client->releaseRequest(request);
2990+
2991+
// Invoke error handler callback function
2992+
g_client->callErrorHandler(err, krpc_wifi_drv_rpc_wifi_clear_reconnect_data_id);
2993+
2994+
if (err)
2995+
{
2996+
return -1;
2997+
}
2998+
2999+
return result;
3000+
}
3001+
29583002
// rpc_wifi_drv interface rpc_wifi_scan_start function client shim.
29593003
int32_t rpc_wifi_scan_start(void)
29603004
{
@@ -4652,7 +4696,7 @@ int32_t rpc_lwip_read(int32_t s, binary_t * mem, uint32_t len, uint32_t timeout)
46524696
}
46534697

46544698
// rpc_wifi_lwip interface rpc_lwip_recvfrom function client shim.
4655-
int32_t rpc_lwip_recvfrom(int32_t s, binary_t * mem, uint32_t len, int32_t flags, const binary_t * from, uint32_t * fromlen, uint32_t timeout)
4699+
int32_t rpc_lwip_recvfrom(int32_t s, binary_t * mem, uint32_t len, int32_t flags, binary_t * from, uint32_t * fromlen, uint32_t timeout)
46564700
{
46574701
erpc_status_t err = kErpcStatus_Success;
46584702

@@ -4678,8 +4722,6 @@ int32_t rpc_lwip_recvfrom(int32_t s, binary_t * mem, uint32_t len, int32_t flags
46784722

46794723
codec->write(flags);
46804724

4681-
write_binary_t_struct(codec, from);
4682-
46834725
codec->write(*fromlen);
46844726

46854727
codec->write(timeout);
@@ -4690,6 +4732,8 @@ int32_t rpc_lwip_recvfrom(int32_t s, binary_t * mem, uint32_t len, int32_t flags
46904732

46914733
read_binary_t_struct(codec, mem);
46924734

4735+
read_binary_t_struct(codec, from);
4736+
46934737
codec->read(fromlen);
46944738

46954739
codec->read(&result);

src/lwip/lwipopts.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include <time.h>
3737
#include <unistd.h>
3838
#include <sys/time.h>
39-
#include <sys/fcntl.h>
39+
//#include <sys/fcntl.h>
4040
//#include <sys/ioctl.h>
4141
#include <sys/types.h>
4242
//#include <sys/select.h>

src/lwip/sockets.c

+11-4
Original file line numberDiff line numberDiff line change
@@ -133,23 +133,30 @@ int lwip_read(int s, void *mem, size_t len)
133133
}
134134
FUNC_EXIT_RC(ret);
135135
}
136-
int lwip_recvfrom(int s, void *mem, size_t len, int flags,
137-
struct sockaddr *from, socklen_t *fromlen)
136+
137+
int lwip_recvfrom(int s, void *mem, size_t len, int flags,struct sockaddr *from, socklen_t *fromlen)
138138
{
139139
FUNC_ENTRY;
140140
binary_t b_mem;
141141
binary_t b_from;
142-
b_from.data = (uint8_t *)from;
143-
b_from.dataLength = sizeof(struct sockaddr);
142+
144143
int ret = rpc_lwip_recvfrom(s, &b_mem, len, flags, &b_from, fromlen, len * 10);
145144
if (ret > 0)
146145
{
147146
memcpy(mem, b_mem.data, b_mem.dataLength);
147+
memcpy(from,b_from.data,b_from.dataLength);
148148
}
149+
149150
if (b_mem.data != NULL)
150151
{
151152
erpc_free(b_mem.data);
152153
}
154+
155+
if (b_from.data != NULL)
156+
{
157+
erpc_free(b_from.data);
158+
}
159+
153160
FUNC_EXIT_RC(ret);
154161
}
155162
int lwip_send(int s, const void *dataptr, size_t size, int flags)

src/lwip/sockets.h

+2
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,8 @@ static inline int select(int maxfdp1,fd_set *readset,fd_set *writeset,fd_set *ex
625625
#endif /* ESP_HAS_SELECT */
626626
static inline int ioctlsocket(int s,long cmd,void *argp)
627627
{ return lwip_ioctl_r(s,cmd,argp); }
628+
static inline int fcntl(int s,int cmd,int val)
629+
{ return lwip_fcntl_r(s,cmd,val); }
628630

629631
#if LWIP_POSIX_SOCKETS_IO_NAMES
630632
static inline int read(int s,void *mem,size_t len)

src/rtl_wifi/rpc_wifi_api_hal.cpp

+49-15
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88
#include "esp/esp_lib_unified.h"
99
#include "rpc_wifi_api_hal.h"
1010

11+
int wifi_mode = RTW_MODE_NONE;
12+
13+
uint32_t wifi_get_netif(tcpip_adapter_if_t tcpip_if)
14+
{
15+
if(wifi_mode == RTW_MODE_STA_AP && tcpip_if == TCPIP_ADAPTER_IF_AP){
16+
return 1;
17+
}
18+
19+
return 0;
20+
}
1121
//! @name rpc_wifi_drv
1222
//@{
1323

@@ -236,16 +246,19 @@ int wifi_rf_off(void)
236246

237247
int wifi_on(rtw_mode_t mode)
238248
{
249+
wifi_mode = mode;
239250
RPC_FUN_RETURN_1(wifi_on, (uint32_t)mode, int);
240251
}
241252

242253
int wifi_off(void)
243254
{
255+
wifi_mode = RTW_MODE_NONE;
244256
RPC_FUN_RETURN_0(wifi_off, int);
245257
}
246258

247259
int wifi_set_mode(rtw_mode_t mode)
248260
{
261+
wifi_mode = mode;
249262
RPC_FUN_RETURN_1(wifi_set_mode, (uint32_t)mode, int);
250263
}
251264

@@ -489,6 +502,11 @@ int wifi_get_reconnect_data(wlan_fast_reconnect_profile_t *wifi_info)
489502
return ret;
490503
}
491504

505+
int wifi_clear_reconnect_data()
506+
{
507+
RPC_FUN_RETURN_0(wifi_clear_reconnect_data, int32_t);
508+
}
509+
492510
int32_t wifi_scan_start()
493511
{
494512
RPC_FUN_RETURN_0(wifi_scan_start, int32_t);
@@ -622,36 +640,43 @@ esp_err_t tcpip_adapter_ap_start(uint8_t *mac, tcpip_adapter_ip_info_t *ip_info)
622640

623641
esp_err_t tcpip_adapter_stop(tcpip_adapter_if_t tcpip_if)
624642
{
625-
RPC_FUN_RETURN_1(tcpip_adapter_stop, (uint32_t)tcpip_if, esp_err_t);
643+
uint32_t netif = wifi_get_netif(tcpip_if);
644+
645+
RPC_FUN_RETURN_1(tcpip_adapter_stop, (uint32_t)netif, esp_err_t);
626646
}
627647

628648
esp_err_t tcpip_adapter_up(tcpip_adapter_if_t tcpip_if)
629649
{
630-
RPC_FUN_RETURN_1(tcpip_adapter_up, (uint32_t)tcpip_if, esp_err_t);
650+
uint32_t netif = wifi_get_netif(tcpip_if);
651+
652+
RPC_FUN_RETURN_1(tcpip_adapter_up, (uint32_t)netif, esp_err_t);
631653
}
632654

633655
esp_err_t tcpip_adapter_down(tcpip_adapter_if_t tcpip_if)
634656
{
635-
RPC_FUN_RETURN_1(tcpip_adapter_down, (uint32_t)tcpip_if, esp_err_t);
657+
uint32_t netif = wifi_get_netif(tcpip_if);
658+
659+
RPC_FUN_RETURN_1(tcpip_adapter_down, (uint32_t)netif, esp_err_t);
636660
}
637661

638662
esp_err_t tcpip_adapter_get_ip_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_ip_info_t *ip_info)
639663
{
640664
FUNC_ENTRY;
665+
uint32_t netif = wifi_get_netif(tcpip_if);
641666
esp_err_t ret = ESP_OK;
642667
if (ip_info == NULL)
643668
{
644669
return ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS;
645670
}
646671
binary_t _ip_info;
647-
ret = (esp_err_t)rpc_tcpip_adapter_get_ip_info((uint32_t)tcpip_if, &_ip_info);
672+
ret = (esp_err_t)rpc_tcpip_adapter_get_ip_info((uint32_t)netif, &_ip_info);
648673
if (ret == ESP_OK)
649674
{
650675
memcpy(ip_info, _ip_info.data, sizeof(tcpip_adapter_ip_info_t));
651676
}
652677
// tcpip_adapter_ip_info_t *temp = (tcpip_adapter_ip_info_t *)_ip_info.data;
653-
// RPC_DEBUG("tcpip_if:%d ip_addr:%d netmask:%d, gw:%d", tcpip_if, ip_info->ip, ip_info->netmask, ip_info->gw);
654-
// RPC_DEBUG("tcpip_if:%d ip_addr:%d netmask:%d, gw:%d", tcpip_if, temp->ip, temp->netmask, temp->gw);
678+
// RPC_DEBUG("netif:%d ip_addr:%d netmask:%d, gw:%d", netif, ip_info->ip, ip_info->netmask, ip_info->gw);
679+
// RPC_DEBUG("netif:%d ip_addr:%d netmask:%d, gw:%d", netif, temp->ip, temp->netmask, temp->gw);
655680
if (_ip_info.data != NULL)
656681
{
657682
erpc_free(_ip_info.data);
@@ -664,6 +689,7 @@ esp_err_t tcpip_adapter_get_ip_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_i
664689
esp_err_t tcpip_adapter_set_ip_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_ip_info_t *ip_info)
665690
{
666691
FUNC_ENTRY;
692+
uint32_t netif = wifi_get_netif(tcpip_if);
667693
esp_err_t ret = ESP_OK;
668694
if (ip_info == NULL)
669695
{
@@ -672,7 +698,7 @@ esp_err_t tcpip_adapter_set_ip_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_i
672698
binary_t _ip_info;
673699
_ip_info.dataLength = sizeof(tcpip_adapter_ip_info_t);
674700
_ip_info.data = (uint8_t *)ip_info;
675-
ret = (esp_err_t)rpc_tcpip_adapter_set_ip_info((uint32_t)tcpip_if, &_ip_info);
701+
ret = (esp_err_t)rpc_tcpip_adapter_set_ip_info((uint32_t)netif, &_ip_info);
676702
FUNC_EXIT;
677703
return ret;
678704
}
@@ -681,28 +707,30 @@ esp_err_t tcpip_adapter_set_dns_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_
681707
{
682708
FUNC_ENTRY;
683709
esp_err_t ret = ESP_OK;
710+
uint32_t netif = wifi_get_netif(tcpip_if);
684711
if (dns == NULL)
685712
{
686713
return ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS;
687714
}
688715
binary_t _dns;
689716
_dns.dataLength = sizeof(tcpip_adapter_dns_info_t);
690717
_dns.data = (uint8_t *)dns;
691-
ret = (esp_err_t)rpc_tcpip_adapter_set_dns_info((uint32_t)tcpip_if, (uint32_t)type, &_dns);
718+
ret = (esp_err_t)rpc_tcpip_adapter_set_dns_info((uint32_t)netif, (uint32_t)type, &_dns);
692719
FUNC_EXIT;
693720
return ret;
694721
}
695722

696723
esp_err_t tcpip_adapter_get_dns_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_dns_type_t type, tcpip_adapter_dns_info_t *dns)
697724
{
698725
FUNC_ENTRY;
726+
uint32_t netif = wifi_get_netif(tcpip_if);
699727
esp_err_t ret = ESP_OK;
700728
if (dns == NULL)
701729
{
702730
return ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS;
703731
}
704732
binary_t _dns;
705-
ret = (esp_err_t)rpc_tcpip_adapter_get_dns_info((uint32_t)tcpip_if, (uint32_t)type, &_dns);
733+
ret = (esp_err_t)rpc_tcpip_adapter_get_dns_info((uint32_t)netif, (uint32_t)type, &_dns);
706734
if (ret == ESP_OK)
707735
{
708736
memcpy(dns, _dns.data, sizeof(tcpip_adapter_dns_info_t));
@@ -719,13 +747,14 @@ esp_err_t tcpip_adapter_get_dns_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_
719747
esp_err_t tcpip_adapter_get_mac(tcpip_adapter_if_t tcpip_if, uint8_t *mac)
720748
{
721749
FUNC_ENTRY;
750+
uint32_t netif = wifi_get_netif(tcpip_if);
722751
esp_err_t ret = ESP_OK;
723752
if (mac == NULL)
724753
{
725754
return ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS;
726755
}
727756
binary_t _mac;
728-
ret = (esp_err_t)rpc_tcpip_adapter_get_mac((uint32_t)tcpip_if, &_mac);
757+
ret = (esp_err_t)rpc_tcpip_adapter_get_mac((uint32_t)netif, &_mac);
729758
if (ret == ESP_OK)
730759
{
731760
memcpy(mac, _mac.data, _mac.dataLength);
@@ -742,6 +771,7 @@ esp_err_t tcpip_adapter_get_mac(tcpip_adapter_if_t tcpip_if, uint8_t *mac)
742771
esp_err_t tcpip_adapter_set_mac(tcpip_adapter_if_t tcpip_if, uint8_t *mac)
743772
{
744773
FUNC_ENTRY;
774+
uint32_t netif = wifi_get_netif(tcpip_if);
745775
esp_err_t ret = ESP_OK;
746776
if (mac == NULL)
747777
{
@@ -750,29 +780,33 @@ esp_err_t tcpip_adapter_set_mac(tcpip_adapter_if_t tcpip_if, uint8_t *mac)
750780
binary_t _mac;
751781
_mac.dataLength = strlen((char *)mac) + 1;
752782
_mac.data = (uint8_t *)mac;
753-
ret = (esp_err_t)rpc_tcpip_adapter_set_mac((uint32_t)tcpip_if, &_mac);
783+
ret = (esp_err_t)rpc_tcpip_adapter_set_mac((uint32_t)netif, &_mac);
754784
FUNC_EXIT;
755785
return ret;
756786
}
757787

758788
esp_err_t tcpip_adapter_dhcps_start(tcpip_adapter_if_t tcpip_if)
759789
{
760-
RPC_FUN_RETURN_1(tcpip_adapter_dhcps_start, (uint32_t)tcpip_if, esp_err_t);
790+
uint32_t netif = wifi_get_netif(tcpip_if);
791+
RPC_FUN_RETURN_1(tcpip_adapter_dhcps_start, (uint32_t)netif, esp_err_t);
761792
}
762793

763794
esp_err_t tcpip_adapter_dhcps_stop(tcpip_adapter_if_t tcpip_if)
764795
{
765-
RPC_FUN_RETURN_1(tcpip_adapter_dhcps_stop, (uint32_t)tcpip_if, esp_err_t);
796+
uint32_t netif = wifi_get_netif(tcpip_if);
797+
RPC_FUN_RETURN_1(tcpip_adapter_dhcps_stop, (uint32_t)netif, esp_err_t);
766798
}
767799

768800
esp_err_t tcpip_adapter_dhcpc_start(tcpip_adapter_if_t tcpip_if)
769801
{
770-
RPC_FUN_RETURN_1(tcpip_adapter_dhcpc_start, (uint32_t)tcpip_if, esp_err_t);
802+
uint32_t netif = wifi_get_netif(tcpip_if);
803+
RPC_FUN_RETURN_1(tcpip_adapter_dhcpc_start, (uint32_t)netif, esp_err_t);
771804
}
772805

773806
esp_err_t tcpip_adapter_dhcpc_stop(tcpip_adapter_if_t tcpip_if)
774807
{
775-
RPC_FUN_RETURN_1(tcpip_adapter_dhcpc_stop, (uint32_t)tcpip_if, esp_err_t);
808+
uint32_t netif = wifi_get_netif(tcpip_if);
809+
RPC_FUN_RETURN_1(tcpip_adapter_dhcpc_stop, (uint32_t)netif, esp_err_t);
776810
}
777811

778812
esp_err_t tcpip_adapter_set_hostname(tcpip_adapter_if_t tcpip_if, const char *hostname)

src/rtl_wifi/rpc_wifi_api_hal.h

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ typedef struct wlan_fast_reconnect
2525

2626
void system_event_callback_reg(system_event_cb_t system_event_cb);
2727
int wifi_get_reconnect_data(wlan_fast_reconnect_profile_t *wifi_info);
28+
int wifi_clear_reconnect_data();
2829

2930
bool wifi_is_scaning();
3031
uint16_t wifi_scan_get_ap_num();

0 commit comments

Comments
 (0)