[Feature][ZXW-88]merge P50 version

Only Configure: No
Affected branch: master
Affected module: unknown
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: I34667719d9e0e7e29e8e4368848601cde0a48408
diff --git a/ap/app/include/at_msg.h b/ap/app/include/at_msg.h
index 5984e4a..943e126 100755
--- a/ap/app/include/at_msg.h
+++ b/ap/app/include/at_msg.h
@@ -245,8 +245,13 @@
 	MSG_CMD_AT_FILTER_REQ,                  //AP֪ͨCPÐèÒª¹ýÂËÖ÷¶¯Éϱ¨µÄATÃüÁî
 	MSG_CMD_SYNC_ATCMD_STREAM,              //AP²à·¢ÆðNVͬ²½£¬ÒòATÃüÁîÁ÷½Ï³¤ÇÒÃüÁ˫ÒýºÅ£¬µ¥¶Àͬ²½
 	MSG_CMD_ADD_MNET_WHITELIST,					//CP²à·¢ÆðÊ¡µç°×Ãûµ¥ÃüÁîÐÂÔö
+	MSG_CMD_ADD_MNET_WHITELIST_RSP,				//CP²à·¢ÆðÊ¡µç°×Ãûµ¥ÐÂÔöÃüÁîÏìÓ¦
 	MSG_CMD_DEL_MNET_WHITELIST,					//CP²à·¢ÆðÊ¡µç°×Ãûµ¥ÃüÁîɾ³ý
-	MSG_CMD_CLEAR_MNET_WHITELIST,				//CP²à·¢ÆðÊ¡µç°×Ãûµ¥¹Ø±Õ
+	MSG_CMD_DEL_MNET_WHITELIST_RSP,				//CP²à·¢ÆðÊ¡µç°×Ãûµ¥É¾³ýÃüÁîÏìÓ¦
+	MSG_CMD_GET_MNET_WHITELIST,					//CP²à·¢ÆðÊ¡µç°×Ãûµ¥ÃüÁî»ñÈ¡
+	MSG_CMD_GET_MNET_WHITELIST_RSP,				//CP²à·¢ÆðÊ¡µç°×Ãûµ¥»ñÈ¡ÃüÁîÏìÓ¦
+	MSG_CMD_CLEAR_MNET_WHITELIST,				//CP²à·¢ÆðÊ¡µç°×Ãûµ¥Çå³ý
+	MSG_CMD_CLEAR_MNET_WHITELIST_RSP,			//CP²à·¢ÆðÊ¡µç°×Ãûµ¥Çå³ýÃüÁîÏìÓ¦
 
 /**------------------------ÒÔÏÂÊÇOPENCPUµÄÏûÏ¢ID-----------------------------**/
 	MSG_CMD_PDP_ACT_REQ,		//pdp¼¤»îÒµÎñÇëÇ󣬶ÔÓ¦½á¹¹ÌåAT_PDP_ACT_INFO
diff --git a/ap/app/include/flags_api.h b/ap/app/include/flags_api.h
new file mode 100755
index 0000000..68ccdad
--- /dev/null
+++ b/ap/app/include/flags_api.h
@@ -0,0 +1,98 @@
+/**
+ * @file flags_api.h
+ * @brief flags·ÖÇø½Ó¿Ú
+ *
+ * Copyright (C) 2023 Sanechips Technology Co., Ltd.
+ * @author 
+ * @ingroup 
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation. £¨±ØÑ¡£ºGPLv2 Licence£©
+ *
+ */
+
+
+#ifndef FLAGS_API_H
+#define FLAGS_API_H
+
+
+/*******************************************************************************
+ *                           Include header files                              *
+ ******************************************************************************/
+#include "pub_flags.h"
+
+
+/*******************************************************************************
+ *                             Macro definitions                               *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ *                             Type definitions                                *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ *                       Global variable declarations                          *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ *                       Global function declarations                          *
+ ******************************************************************************/
+/**
+ * @brief  ³õʼ»¯flags·ÖÇø
+ * @param[out]  p_flags_info  flags³õʼ»¯Êý¾Ý
+ * @return  0 ³õʼ»¯³É¹¦, -1 ³õʼ»¯Ê§°Ü
+ * @note
+ */
+int flags_init();
+
+
+/**
+ * @brief  »ñÈ¡flags·ÖÇøÄÚÈÝ
+ * @param[out]  p_flags_info  flags·ÖÇøÄÚÈÝ
+ * @return  0 »ñÈ¡³É¹¦, -1 »ñȡʧ°Ü
+ * @note
+ */
+int flags_get(T_FLAGS_INFO *p_flags_info);
+
+
+/**
+ * @brief  ÉèÖÃflags·ÖÇøÄÚÈÝ
+ * @param[out]  p_flags_info  flags·ÖÇøÄÚÈÝ
+ * @return  0 ÉèÖóɹ¦, -1 ÉèÖÃʧ°Ü
+ * @note
+ */
+int flags_set(T_FLAGS_INFO *p_flags_info);
+
+
+/**
+ * @brief  »ñÈ¡flags·ÖÇøÖÐubifs״̬
+ * @param[out]  status  ubifs״̬
+ * @return  0 »ñÈ¡³É¹¦, -1 »ñȡʧ°Ü
+ * @note
+ */
+int flags_get_ubifs_status(T_UBIFS_STATUS *p_ubifs_status);
+
+
+/**
+ * @brief  ÉèÖÃflags·ÖÇøÖÐubifs״̬
+ * @param[in]  status  ubifs״̬
+ * @return  0 ÉèÖóɹ¦, -1 ÉèÖÃʧ°Ü
+ * @note
+ */
+int flags_set_ubifs_status(T_UBIFS_STATUS *p_ubifs_status);
+
+
+/**
+ * @brief  »ñÈ¡µ±Ç°ÏµÍ³
+ * @return  µ±Ç°ÔËÐÐϵͳ
+ * @note
+ */
+int flags_get_current_system();
+
+
+#endif // FLAGS_API_H
+
diff --git a/ap/app/include/message.h b/ap/app/include/message.h
index def1e19..375f9a9 100755
--- a/ap/app/include/message.h
+++ b/ap/app/include/message.h
@@ -88,6 +88,7 @@
 	MODULE_ID_IP_PROXY,             /*ip proxyÄ£¿éID*/
 
 	MODULE_ID_BIP,					/* BIPÓ¦ÓÃ */
+	MODULE_ID_MNET_WHITELIST,		//whitelistÄ£¿é
 
 	/* ----- ƽ̨ÄÚ²¿¾²Ì¬Ä£¿éIDµÄ½áβ£¬Æ½Ì¨ÄÚ²¿ÐÂÔöIDÐèÌí¼ÓÔÚÉÏ·½ ------ */
 	
@@ -147,6 +148,8 @@
     //voice
     MODULE_ID_VOICE_SERVER,
     MODULE_ID_VOICE_CLIENT,
+	MODULE_ID_WLAN_PROXY,		//cap²àwifi´úÀí
+	MODULE_ID_MNET_WHITELIST_PROXY,		//cap²àwhitelist´úÀí
 } T_AP_Module_ID;
 
 /* ------------- CPºË´æÔÚµÄÄ£¿éID£¬Æ½Ì¨ÄÚ²¿Ê¹Ó㬲»¿ª·Å¸ø¿Í»§ ------------- */
@@ -262,6 +265,10 @@
 	MSG_CMD_DRV_BASE 		= 0x6901,
 	MSG_CMD_DRV_END			= 0x7000,
 
+	/*wifi cap inter*/
+	MSG_CMD_WIFI_CAP_BASE 		= 0x7201,
+	MSG_CMD_WIFI_CAP_END		= 0x7400,
+
 	//kwatchtest
 	MSG_CMD_KWATCH_BASE      = 0x8001,
 	MSG_CMD_KWATCH_END      = 0x9000,
@@ -281,6 +288,10 @@
 	//absvr
 	MSG_CMD_ABSVR_BASE      = 0x9201,
 	MSG_CMD_ABSVR_END      = 0x9300,
+
+	//mnet_whitelist
+	MSG_CMD_MNET_WHITELIST_BASE      = 0x9301,
+	MSG_CMD_MNET_WHITELIST_END      = 0x9400,
 };
 #endif
 
diff --git a/ap/app/include/wifi_msg.h b/ap/app/include/wifi_msg.h
index 3cba081..83ae376 100755
--- a/ap/app/include/wifi_msg.h
+++ b/ap/app/include/wifi_msg.h
@@ -110,6 +110,12 @@
 	MSG_CMD_WIFI_STATION_DEBUG_DUMP,
 	MSG_CMD_WIFI_STATION_WPA_CMD,
 	MSG_CMD_WIFI_STATION_CONNECTED_ENABLE_AP_CMD, //apstaÁ¬½ÓÈȵã³É¹¦Æô¶¯ap
+	
+	//cap->ap
+	MSG_CMD_CAP_STA_SET_PARAM,	//sta ssid auth pw
+	MSG_CMD_CAP_STA_ENABLE, //ap on off
+	MSG_CMD_CAP_STA_SCAN, //scan
+	
 	MSG_CMD_WIFI_STATION_END,                      //apstationµÄÏûÏ¢·¶Î§end
 
 	//timing of sleep wake up
@@ -130,6 +136,29 @@
 	MSG_CMD_AP_STA_CONNECTED,
 	MSG_CMD_AP_STA_DISCONNECTED,
 
+	//cap recv
+	MSG_CMD_CAP_WIFI_STATUS,
+	MSG_CMD_CAP_AP_STATUS,
+	MSG_CMD_CAP_AP_STA_CHANGE,
+	MSG_CMD_CAP_STA_STATUS,
+	MSG_CMD_CAP_STA_SCAN_RES,
+	
+	//cap send
+	MSG_CMD_CAP_WIFI_ENABLE, 	//wifiÇý¶¯³õʼ»¯, wlan up
+	MSG_CMD_CAP_WIFI_DISABLE, 	//wifiÇý¶¯È¥³õʼ»¯, wlan down
+	MSG_CMD_CAP_WIFI_WORK_MODE, //wifi¹¤×÷ģʽÉèÖÃ
+	MSG_CMD_CAP_WIFI_SET_SSID,	//
+	MSG_CMD_CAP_WIFI_SET_HIDESSID,	//0 not hide, 1 hide
+	MSG_CMD_CAP_WIFI_SET_MODE,	//80211 mode bgn...
+	MSG_CMD_CAP_WIFI_SET_BANDWIDTH,	//0 20M, 1 20/40M
+	//MSG_CMD_CAP_WIFI_SET_CHANNEL,	//0 - 13
+	MSG_CMD_CAP_WIFI_SET_MAXSTANUM,	//0 - 32
+	MSG_CMD_CAP_WIFI_SET_CC_CH, //country code, channel
+	MSG_CMD_CAP_WIFI_SET_ACL,
+	MSG_CMD_CAP_WIFI_SET_AUTH, //wpa
+	MSG_CMD_CAP_WIFI_AP_ENABLE, //ap on off
+
+
 };
 
 
@@ -478,4 +507,200 @@
 
 } zte_wlan_set_e_flags;
 
+
+//cap:api->wlan_proxy->ap:wlan_server
+typedef enum
+{
+	IN_WIFI_STATUS_DEV_INIT_FAIL = 0,
+	IN_WIFI_STATUS_INVALID_MAC
+} inner_wifi_status_e;
+
+//nei bu zhuan huan yong
+//same as sc_wifi_ap_index_e
+typedef enum
+{
+	IN_WIFI_AP_INDEX_MIN = -1,
+	IN_WIFI_AP_INDEX_AP0 = 0,
+	//IN_WIFI_AP_INDEX_AP1,
+	IN_WIFI_AP_INDEX_MAX
+} inner_wifi_ap_id_e;
+
+typedef struct {
+	int idx; 			//refers to: wlan0,1... 
+	char ssid[WIFI_SSID_LEN]; 	//ssid should be less than 32 bytes
+} wlan_ap_ssid_t;
+
+typedef struct {
+	int idx; 			//refers to: wlan0,1... 
+	int ssid_hide; 				//0 not hide, 1 hide
+} wlan_ap_ssid_hide_t;
+
+typedef struct {
+	int idx; 			//refers to: wlan0,1... 
+	int wl_mode; 				//6 bgnax, 4 bgn
+} wlan_ap_wl_mode_t;
+
+typedef struct {
+	int idx; 			//refers to: wlan0,1... 
+	int htMode; 				//1 20/40M, 0 20M
+	//int force_40m;
+} wlan_ap_bandwidth_t;
+
+typedef struct {
+	int idx; 			//refers to: wlan0,1... 
+	int max_sta_num; 			//1-32
+} wlan_ap_max_sta_t;
+
+typedef struct {
+	int idx; 			//refers to: wlan0,1... 
+	char countrycode[3]; 		//default CN
+	int channel;  //0-13
+} wlan_ap_cc_ch_t;
+
+typedef struct {
+	int idx; 			//refers to: wlan0,1... 
+	int acl_rule; 				//0 none, 1 white, 2 black
+	char acl_list[360]; 		//max 10 mac1;mac2...
+} wlan_ap_acl_t;
+
+typedef struct {
+	int idx; 			//refers to: wlan0,1... 
+	char authmode[WLAN_SECURITY_LEN];
+	char encrypt[WLAN_ENCRYPT_LEN]; //realtek use
+	char pwd[WLAN_PSK_LEN];	 	//max 64
+} wlan_ap_auth_t;
+
+typedef struct {
+	int idx; 			//refers to: wlan0,1... 
+	int enable; 			//1 ap on , 0 ap off
+} wlan_ap_enable_t;
+
+//station
+typedef struct {
+	int enable; 			//1 ap on , 0 ap off
+} wlan_sta_enable_t;
+
+
+//ap->cap:ind 
+//½á¹¹Ìå,ºÃÀ©Õ¹
+typedef struct {
+	int wifi_status;
+} wlan_status_t;
+
+//same as sc_wifi_work_mode_e  to do: hu huan
+typedef enum
+{
+	IN_WIFI_WORK_MODE_MIN = -1,
+	IN_WIFI_WORK_MODE_AP0 = 0,
+	IN_WIFI_WORK_MODE_AP0_STA,
+	IN_WIFI_WORK_MODE_MAX
+} inner_wifi_work_mode_e;
+
+//same as sc_wifi_ap_status_e
+typedef enum
+{
+	IN_WIFI_AP_STATUS_NONE = 0,
+	IN_WIFI_AP_STATUS_IDLE, //or disable
+	IN_WIFI_AP_STATUS_ENABLING,
+	IN_WIFI_AP_STATUS_ENABLED,
+	IN_WIFI_AP_STATUS_DISABLING,
+	IN_WIFI_AP_STATUS_ERROR
+} inner_wifi_ap_status_e;
+
+typedef struct {
+	int idx;
+	int pre_status; //½öcap×ÔÐи³Öµ
+	int status;
+	char ifname[32];
+	//char bssid[18];
+} wlan_ap_status_t;
+
+//sc_wifi_sta_connect_status_t
+typedef struct {
+	int idx;
+	int is_connected;
+	char macaddr[18];
+} wlan_sta_connect_status_t;
+
+//cap station
+typedef struct {
+	char ssid[WIFI_SSID_LEN]; 	//ssid should be less than 32 bytes
+	char authmode[WLAN_SECURITY_LEN];
+	char encrypt[WLAN_ENCRYPT_LEN]; //realtek use
+	char pwd[WLAN_PSK_LEN];	 	//max 64
+} wlan_sta_param_t;
+
+//same as sc_wifi_sta_status_e
+typedef enum
+{
+	IN_WIFI_STA_STATUS_NONE, //close
+	IN_WIFI_STA_STATUS_IDLE,
+	IN_WIFI_STA_STATUS_CONNECTING, //Trying to associate with
+	IN_WIFI_STA_STATUS_ASSOCIATED, //dhcping
+	IN_WIFI_STA_STATUS_CONNECTED,
+	IN_WIFI_STA_STATUS_DISCONNECTED, 
+	IN_WIFI_STA_STATUS_ERROR
+} in_wifi_sta_status_e;
+
+//same as sc_wifi_reason_code_e
+typedef enum
+{
+	IN_WIFI_REASON_CODE_NONE,
+	IN_WIFI_REASON_CODE_WRONG_KEY,
+	IN_WIFI_REASON_CODE_AUTH_FAILED,
+	IN_WIFI_REASON_CODE_CONN_FAILED,
+	IN_WIFI_REASON_CODE_SET_FAILED,
+	IN_WIFI_REASON_CODE_DHCP_FAILED
+} in_wifi_reason_code_e;
+
+//same as sc_wifi_sta_status_t
+typedef struct {
+	int pre_status; //proxy record
+
+	int status; //in_wifi_sta_status_e
+	char ifname[32];
+	char ap_bssid[18]; //cur ap mac
+	//int rssi;
+	unsigned char signal_level;
+	unsigned char has_addr;
+	char str_addr[16]; //255.255.255.255 16
+	unsigned char has_addr6;
+	char str_addr6[48]; //0001:0002:0003:0004:0001:0002:0003:0004 40 (+8:, 48)
+	int reason_code; //in_wifi_reason_code_e	
+} wlan_sta_status_t;
+
+typedef struct {
+	int result;
+	wlan_sta_status_t status;
+} scwifi_sta_stat_res_t;
+
+
+#define CAP_WIFI_MAX_SCAN_CNT 30
+
+#define CAP_WIFI_AUTH_UNSUP -1 //"not support");
+#define CAP_WIFI_AUTH_OPEN 0 //"OPEN");
+#define CAP_WIFI_AUTH_WPA2 1 //"WPA2PSK");
+#define CAP_WIFI_AUTH_WPA3 2 //"WPA3Personal");
+#define CAP_WIFI_AUTH_WPA12 3 //"WPAPSKWPA2PSK");
+#define CAP_WIFI_AUTH_WPA23 4 //"WPA2WPA3");
+
+//sc_wifi_sta_scan_info_t
+typedef struct
+{
+	char bssid[18];//mac
+	char essid[33];
+	//int signal;
+	unsigned char signal_level; //0-5, max 5
+	//int frequency;
+	unsigned char channel; //1-13
+	unsigned char auth;
+} wlan_sta_scan_info_t;
+
+//sc_wifi_sta_scan_list_t
+typedef struct
+{
+	int cnt;
+	wlan_sta_scan_info_t info[CAP_WIFI_MAX_SCAN_CNT];
+} wlan_sta_scan_list_t;
+
 #endif