Merge "[Feature][ZXW-257]wifi status acquisition api added"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-wifi/liblynq-qser-wifi.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-wifi/liblynq-qser-wifi.bb
index 82f7925..abda323 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-wifi/liblynq-qser-wifi.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-wifi/liblynq-qser-wifi.bb
@@ -5,7 +5,7 @@
#LICENSE = "Mobiletek""
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = "file://LICENSE;md5=4f60c98fa94e02f659ef5939f67fa8ae"
-DEPENDS += "bootchart libupi-ab openssl libsctel"
+DEPENDS += "bootchart liblynq-log libupi-ab openssl libsctel"
#inherit workonsrc
WORKONSRC = "${TOPDIR}/../src/lynq/lib/liblynq-qser-wifi/"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/lynq-wifi-demo.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/lynq-wifi-demo.cpp
index b26121e..3e3e049 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/lynq-wifi-demo.cpp
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/lynq-wifi-demo.cpp
@@ -19,21 +19,44 @@
{
if (argc == 2 )
{
- if(strcmp(argv[1], "1") == 0){
+ if(strcmp(argv[1], "0") == 0){
+ qser_wifi_enable(); //enable wifi
+ qser_wifi_ap_stop(LYNQ_WIFI_AP_INDEX_AP0); //Disable ap mode for wlan0
+ qser_wifi_disable(); //Turn off WiFi
+ }
+ else if(strcmp(argv[1], "1") == 0){
char pw[65] = {0};
sprintf(pw, "lynq123456");
qser_wifi_enable(); //enable wifi
- qser_wifi_ap_ssid_set(0,"hello"); //Set the ssid of wlan0 to hello
- qser_wifi_ap_max_sta_set(0,22); //Example Set the maximum number of connections to 22
- qser_wifi_ap_channel_set(0,"CN",13); //Set the country code to CN and channel to 13
- qser_wifi_ap_mode_set(0,LYNQ_WIFI_MODE_80211BGN); //Set the working protocol mode of wlan0 to 80211BGN
- qser_wifi_ap_auth_set(0,LYNQ_WIFI_AUTH_WPA2_PSK,pw); //Set the authentication of wlan0 to wpa2 and the password to lynq123456
- qser_wifi_ap_start(0); //Set the ap mode of wlan0
+ qser_wifi_ap_ssid_set(LYNQ_WIFI_AP_INDEX_AP0,"hello"); //Set the ssid of wlan0 to hello
+ qser_wifi_ap_max_sta_set(LYNQ_WIFI_AP_INDEX_AP0,22); //Example Set the maximum number of connections to 22
+ qser_wifi_ap_channel_set(LYNQ_WIFI_AP_INDEX_AP0,"CN",13); //Set the country code to CN and channel to 13
+ qser_wifi_ap_mode_set(LYNQ_WIFI_AP_INDEX_AP0,LYNQ_WIFI_MODE_80211BGN); //Set the working protocol mode of wlan0 to 80211BGN
+ qser_wifi_ap_auth_set(LYNQ_WIFI_AP_INDEX_AP0,LYNQ_WIFI_AUTH_WPA2_PSK,pw); //Set the authentication of wlan0 to wpa2 and the password to lynq123456
+ qser_wifi_ap_start(LYNQ_WIFI_AP_INDEX_AP0); //Set the ap mode of wlan0
}
- else if(strcmp(argv[1], "0") == 0){
+ else if(strcmp(argv[1], "2") == 0){
+ char pw[65] = {0};
+ char ssid[33] = {0};
+ char country_code[12] = {0};
+ int channel, max_sta_num;
+ lynq_wifi_mode_type_e mode;
+ lynq_wifi_auth_e auth_mode;
+ lynq_wifi_bandwidth_type_e bandwidth;
+ int ret = -1;
qser_wifi_enable(); //enable wifi
- qser_wifi_ap_stop(0); //Disable ap mode for wlan0
- qser_wifi_disable(); //Turn off WiFi
+ ret = qser_wifi_ap_ssid_get(LYNQ_WIFI_AP_INDEX_AP0,ssid); //Gets the ssid of wlan0
+ printf("[lynq-wifi-demo] ssid=%s ret = %d\n",ssid, ret);
+ ret = qser_wifi_ap_max_sta_get(LYNQ_WIFI_AP_INDEX_AP0,&max_sta_num); //Gets the maximum sta number for wlan0
+ printf("[lynq-wifi-demo] max_sta_num = %d ret = %d\n",max_sta_num, ret);
+ ret = qser_wifi_ap_mode_get(LYNQ_WIFI_AP_INDEX_AP0,&mode); //Gets the working protocol mode for wlan0
+ printf("[lynq-wifi-demo] mode = %d ret = %d\n",mode, ret);
+ ret = qser_wifi_ap_auth_get(LYNQ_WIFI_AP_INDEX_AP0,&auth_mode,pw); //Get wlan0's password security authentication and password
+ printf("[lynq-wifi-demo] pw = %s auth_mode = %d ret = %d\n",pw, auth_mode, ret);
+ ret = qser_wifi_ap_channel_get(LYNQ_WIFI_AP_INDEX_AP0,country_code,&channel); //Get the country code and channel of wlan0
+ printf("[lynq-wifi-demo] country_code = %s channel = %d ret = %d\n",country_code, channel, ret);
+ ret = qser_wifi_ap_bandwidth_get(LYNQ_WIFI_AP_INDEX_AP0,&bandwidth); //Gets the bandwidth of wlan0
+ printf("[lynq-wifi-demo] bandwidth = %d ret = %d\n",bandwidth, ret);
}
else{
printf(" [lynq-wifi-demo]Parameter error, please re-enter\n");
@@ -41,7 +64,8 @@
}
else
{
- printf("[lynq-wifi-demo]Please enter parameter 0 or 1\n");
+ printf("[lynq-wifi-demo]Please enter one of the parameters 0,1,2\n");
+ printf(" [lynq-wifi-demo]2: View information such as ssid, password, and channel in ap mode\n");
printf(" [lynq-wifi-demo]1: initializes wifi and enables and sets ap mode\n");
printf(" [lynq-wifi-demo]0: indicates off.\n");
return 0;
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/include/lynq-qser-wifi.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/include/lynq-qser-wifi.h
index 734d1b4..fa021c0 100644
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/include/lynq-qser-wifi.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/include/lynq-qser-wifi.h
@@ -15,6 +15,11 @@
extern "C" {
#endif
+typedef enum {
+ LYNQ_WIFI_AP_INDEX_AP0 = 0, /* Index 0 of AP/AP-STA/AP-AP Mode */
+ LYNQ_WIFI_AP_INDEX_AP1 /* Index 1 of AP/AP-STA/AP-AP Mode */
+} lynq_wifi_ap_index_e;
+
typedef enum
{
LYNQ_WIFI_MODE_MIN = -1,
@@ -51,15 +56,21 @@
int qser_wifi_enable(void);
int qser_wifi_disable(void);
-int qser_wifi_ap_ssid_set(int idx, const char *ssid);
-int qser_wifi_ap_mode_set(int idx, lynq_wifi_mode_type_e mode);
-int qser_wifi_ap_bandwidth_set(int idx, lynq_wifi_bandwidth_type_e bandwidth);
-int qser_wifi_ap_channel_set(int idx, const char *country_code, int channel);
-int qser_wifi_ap_auth_set(int idx, lynq_wifi_auth_e auth_mode, const char * auth_passwd);
-int qser_wifi_ap_max_sta_set(int idx, int max_sta_num);
-int qser_wifi_ap_start(int idx);
-int qser_wifi_ap_stop(int idx);
-int qser_wifi_ap_restart(int idx);
+int qser_wifi_ap_ssid_set(lynq_wifi_ap_index_e idx, const char *ssid);
+int qser_wifi_ap_ssid_get(lynq_wifi_ap_index_e idx, char *ssid);
+int qser_wifi_ap_mode_set(lynq_wifi_ap_index_e idx, lynq_wifi_mode_type_e mode);
+int qser_wifi_ap_mode_get(lynq_wifi_ap_index_e idx, lynq_wifi_mode_type_e *mode);
+int qser_wifi_ap_bandwidth_set(lynq_wifi_ap_index_e idx, lynq_wifi_bandwidth_type_e bandwidth);
+int qser_wifi_ap_bandwidth_get(lynq_wifi_ap_index_e idx, lynq_wifi_bandwidth_type_e *bandwidth);
+int qser_wifi_ap_channel_set(lynq_wifi_ap_index_e idx, const char *country_code, int channel);
+int qser_wifi_ap_channel_get(lynq_wifi_ap_index_e idx, char *country_code, int *channel);
+int qser_wifi_ap_auth_set(lynq_wifi_ap_index_e idx, lynq_wifi_auth_e auth_mode, const char * auth_passwd);
+int qser_wifi_ap_auth_get(lynq_wifi_ap_index_e idx, lynq_wifi_auth_e *auth_mode, char * auth_passwd);
+int qser_wifi_ap_max_sta_set(lynq_wifi_ap_index_e idx, int max_sta_num);
+int qser_wifi_ap_max_sta_get(lynq_wifi_ap_index_e idx, int *max_sta_num);
+int qser_wifi_ap_start(lynq_wifi_ap_index_e idx);
+int qser_wifi_ap_stop(lynq_wifi_ap_index_e idx);
+int qser_wifi_ap_restart(lynq_wifi_ap_index_e idx);
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/lynq-qser-wifi.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/lynq-qser-wifi.cpp
index c14ce3a..91f1112 100644
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/lynq-qser-wifi.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/lynq-qser-wifi.cpp
@@ -1,7 +1,7 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-
+#include "liblog/lynq_deflog.h"
#ifdef __cplusplus
extern "C" {
@@ -20,12 +20,22 @@
*********************************************************************/
int qser_wifi_enable(void)
{
- int ret = sc_wifi_init();
+ int ret = -1;
+ ret = sc_wifi_init();
if (0 != ret)
{
- return -1;
+ LYERRLOG("[%s ] init : %d ret = %d\n", __func__,ret);
+ return ret;
}
- return sc_wifi_enable();
+
+ ret = sc_wifi_enable();
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] enable : %d ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ]\n", __func__);
+ return 0;
}
/********************************************************************
@@ -37,12 +47,22 @@
*********************************************************************/
int qser_wifi_disable(void)
{
- int ret = sc_wifi_disable();
+ int ret = -1;
+ ret = sc_wifi_disable();
if (0 != ret)
{
- return -1;
+ LYERRLOG("[%s ] disable : %d ret = %d\n", __func__,ret);
+ return ret;
}
- return sc_wifi_uninit();
+
+ ret = sc_wifi_uninit();
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] uninit: %d ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ]\n", __func__);
+ return 0;
}
/********************************************************************
@@ -54,9 +74,46 @@
* @see: NA
* @warning: NA
*********************************************************************/
-int qser_wifi_ap_ssid_set(int idx, const char *ssid)
+int qser_wifi_ap_ssid_set(lynq_wifi_ap_index_e idx, const char *ssid)
{
- return sc_wifi_ap_ssid_set((sc_wifi_ap_index_e)idx, ssid);
+ int ret = -1;
+ if (ssid == NULL)
+ {
+ LYERRLOG("[%s ] Null pointer ssid = 0x%p \n", __func__, ssid);
+ return ret;
+ }
+ ret = sc_wifi_ap_ssid_set((sc_wifi_ap_index_e)idx, ssid);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] idx = %d ssid = %s \n", __func__, idx, ssid);
+ return 0;
+}
+
+/********************************************************************
+* @brief: qser_wifi_ap_ssid_get, Get the name of the ssid of wlan0 or wlan1
+* @param idx [IN]: int, Set wlan0 or wlan1
+* @param ssid [OUT]: char *, Get the ssid name
+* @return : int, If equal to 0 succeeds, others fail
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_wifi_ap_ssid_get(lynq_wifi_ap_index_e idx, char *ssid)
+{
+ int ret = -1;
+ sc_wifi_ap_param_t param = {0};
+ ret = sc_wifi_ap_param_get((sc_wifi_ap_index_e)idx, ¶m);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] idx = %d ssid = %s \n", __func__, idx, param.ssid);
+ strncpy(ssid, param.ssid, sizeof(param.ssid) - 1);
+ return 0;
}
/********************************************************************
@@ -68,8 +125,9 @@
* @see: NA
* @warning: NA
*********************************************************************/
-int qser_wifi_ap_mode_set(int idx, lynq_wifi_mode_type_e mode)
+int qser_wifi_ap_mode_set(lynq_wifi_ap_index_e idx, lynq_wifi_mode_type_e mode)
{
+ int ret = -1;
sc_wifi_ap_mode_type_e type;
switch(mode)
{
@@ -83,7 +141,56 @@
type = SC_WIFI_AP_MODE_MIN;
break;
}
- return sc_wifi_ap_mode_set((sc_wifi_ap_index_e)idx, type);
+ ret = sc_wifi_ap_mode_set((sc_wifi_ap_index_e)idx, type);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] idx = %d mode = %d \n", __func__, idx, mode);
+ return 0;
+}
+
+/********************************************************************
+* @brief: qser_wifi_ap_mode_get, Get the working protocol mode of wlan0 or wlan1
+* @param idx [IN]: int, Set wlan0 or wlan1
+* @param mode [OUT]: lynq_wifi_mode_type_e *, Get the working protocol mode
+* @return : int, If equal to 0 succeeds, others fail
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_wifi_ap_mode_get(lynq_wifi_ap_index_e idx, lynq_wifi_mode_type_e *mode)
+{
+ int ret = -1;
+ sc_wifi_ap_param_t param = {0};
+ if (mode == NULL)
+ {
+ LYERRLOG("[%s ] Null pointer mode = 0x%p \n", __func__, mode);
+ return ret;
+ }
+ ret = sc_wifi_ap_param_get((sc_wifi_ap_index_e)idx, ¶m);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] idx = %d mode = %d \n", __func__, idx, param.mode);
+ lynq_wifi_mode_type_e type;
+ switch(param.mode)
+ {
+ case SC_WIFI_AP_MODE_80211BGN:
+ type = LYNQ_WIFI_MODE_80211BGN;
+ break;
+ case SC_WIFI_AP_MODE_80211BGNAX_2G:
+ type = LYNQ_WIFI_MODE_80211BGNAX_2G;
+ break;
+ default:
+ type = LYNQ_WIFI_MODE_MIN;
+ break;
+ }
+ *mode = type;
+ return 0;
}
/********************************************************************
@@ -95,9 +202,46 @@
* @see: NA
* @warning: NA
*********************************************************************/
-int qser_wifi_ap_bandwidth_set(int idx, lynq_wifi_bandwidth_type_e bandwidth)
+int qser_wifi_ap_bandwidth_set(lynq_wifi_ap_index_e idx, lynq_wifi_bandwidth_type_e bandwidth)
{
- return sc_wifi_ap_bandwidth_set((sc_wifi_ap_index_e)idx, (sc_wifi_bandwidth_e)bandwidth);
+ int ret = -1;
+ ret = sc_wifi_ap_bandwidth_set((sc_wifi_ap_index_e)idx, (sc_wifi_bandwidth_e)bandwidth);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] idx = %d bandwidth = %d \n", __func__, idx, bandwidth);
+ return 0;
+}
+
+/********************************************************************
+* @brief: qser_wifi_ap_bandwidth_get, Get the bandwidth of wlan0 or wlan1
+* @param idx [IN]: int, Set wlan0 or wlan1
+* @param bandwidth [OUT]: lynq_wifi_bandwidth_type_e *, Get the bandwidth
+* @return : int, If equal to 0 succeeds, others fail
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_wifi_ap_bandwidth_get(lynq_wifi_ap_index_e idx, lynq_wifi_bandwidth_type_e *bandwidth)
+{
+ int ret = -1;
+ sc_wifi_ap_param_t param = {0};
+ if (bandwidth == NULL)
+ {
+ LYERRLOG("[%s ] Null pointer bandwidth = 0x%p \n", __func__, bandwidth);
+ return ret;
+ }
+ ret = sc_wifi_ap_param_get((sc_wifi_ap_index_e)idx, ¶m);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] idx = %d bandwidth = %d \n", __func__, idx, param.bandwidth);
+ *bandwidth = (lynq_wifi_bandwidth_type_e)param.bandwidth;
+ return 0;
}
/********************************************************************
@@ -110,9 +254,53 @@
* @see: NA
* @warning: NA
*********************************************************************/
-int qser_wifi_ap_channel_set(int idx, const char *country_code, int channel)
+int qser_wifi_ap_channel_set(lynq_wifi_ap_index_e idx, const char *country_code, int channel)
{
- return sc_wifi_ap_cc_ch_set((sc_wifi_ap_index_e)idx, country_code, channel);
+ int ret = -1;
+ if (country_code == NULL)
+ {
+ LYERRLOG("[%s ] Null pointer country_code = 0x%p \n", __func__, country_code);
+ return ret;
+ }
+ ret = sc_wifi_ap_cc_ch_set((sc_wifi_ap_index_e)idx, country_code, channel);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] idx = %d country_code = %s channel = %d\n", __func__, idx, country_code, channel);
+ return 0;
+}
+
+/********************************************************************
+* @brief: qser_wifi_ap_channel_get, Get the channel for wlan0 or wlan1
+* @param idx [IN]: int, Set wlan0 or wlan1
+* @param country_code [OUT]: char *, Get country code
+* @param channel [OUT]: int *, Get the channel
+* @return : int, If equal to 0 succeeds, others fail
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_wifi_ap_channel_get(lynq_wifi_ap_index_e idx, char *country_code, int *channel)
+{
+ int ret = -1;
+ sc_wifi_ap_param_t param = {0};
+ if (country_code == NULL || channel == NULL)
+ {
+ LYERRLOG("[%s ] Null pointer country_code = 0x%p channel = 0x%p\n", __func__, country_code, channel);
+ return ret;
+ }
+ ret = sc_wifi_ap_param_get((sc_wifi_ap_index_e)idx, ¶m);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] idx = %d country_code = %s channel = %d\n", __func__, idx, param.countrycode, param.channel);
+ strncpy(country_code, param.countrycode, sizeof(param.countrycode) - 1);
+ *channel = param.channel;
+ return 0;
}
/********************************************************************
@@ -125,9 +313,15 @@
* @see: NA
* @warning: NA
*********************************************************************/
-int qser_wifi_ap_auth_set(int idx, lynq_wifi_auth_e auth_mode, const char *auth_passwd)
+int qser_wifi_ap_auth_set(lynq_wifi_ap_index_e idx, lynq_wifi_auth_e auth_mode, const char *auth_passwd)
{
+ int ret = -1;
sc_wifi_auth_e type;
+ if (auth_passwd == NULL)
+ {
+ LYERRLOG("[%s ] Null pointer auth_passwd = 0x%p\n", __func__, auth_passwd);
+ return ret;
+ }
switch (auth_mode)
{
case LYNQ_WIFI_AUTH_OPEN:
@@ -152,7 +346,67 @@
sc_wifi_ap_auth_t auth;
auth.auth = (sc_wifi_auth_e)type;
strncpy(auth.passwd, auth_passwd, sizeof(auth.passwd) - 1);
- return sc_wifi_ap_auth_set((sc_wifi_ap_index_e)idx, &auth);
+ ret = sc_wifi_ap_auth_set((sc_wifi_ap_index_e)idx, &auth);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] idx = %d auth_mode = %d auth_passwd = %s\n", __func__, idx, auth_mode, auth_passwd);
+ return 0;
+}
+
+/********************************************************************
+* @brief: qser_wifi_ap_auth_get, Get the security authentication mode and password of wlan0 or wlan1
+* @param idx [IN]: int, Set wlan0 or wlan1
+* @param auth_mode [OUT]: lynq_wifi_auth_e *, Get the security authentication mode
+* @param auth_passwd [OUT]: char *, Get password
+* @return : int, If equal to 0 succeeds, others fail
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_wifi_ap_auth_get(lynq_wifi_ap_index_e idx, lynq_wifi_auth_e *auth_mode, char *auth_passwd)
+{
+ int ret = -1;
+ sc_wifi_ap_param_t param = {0};
+ if (auth_mode == NULL || auth_passwd == NULL)
+ {
+ LYERRLOG("[%s ] Null pointer auth_mode = 0x%p auth_passwd = 0x%p\n", __func__, auth_mode, auth_passwd);
+ return ret;
+ }
+ ret = sc_wifi_ap_param_get((sc_wifi_ap_index_e)idx, ¶m);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] idx = %d auth_mode = %d auth_passwd = %s \n", __func__, idx, param.auth.auth, param.auth.passwd);
+ strncpy(auth_passwd, param.auth.passwd, sizeof(param.auth.passwd) - 1);
+ lynq_wifi_auth_e type;
+ switch (param.auth.auth)
+ {
+ case SC_WIFI_AUTH_OPEN:
+ type = LYNQ_WIFI_AUTH_OPEN;
+ break;
+ case SC_WIFI_AUTH_WPA2_PSK:
+ type = LYNQ_WIFI_AUTH_WPA2_PSK;
+ break;
+ case SC_WIFI_AUTH_WPA_WPA2_PSK_BOTH:
+ type = LYNQ_WIFI_AUTH_WPA_WPA2_PSK_BOTH;
+ break;
+ case SC_WIFI_AUTH_WPA3_PSK:
+ type = LYNQ_WIFI_AUTH_WPA3_PSK;
+ break;
+ case SC_WIFI_AUTH_WPA2_WPA3_PSK_BOTH:
+ type = LYNQ_WIFI_AUTH_WPA2_WPA3_PSK_BOTH;
+ break;
+ default:
+ type = LYNQ_WIFI_AUTH_MIN;
+ break;
+ }
+ *auth_mode = type;
+ return 0;
}
/********************************************************************
@@ -164,9 +418,46 @@
* @see: NA
* @warning: NA
*********************************************************************/
-int qser_wifi_ap_max_sta_set(int idx, int max_sta_num)
+int qser_wifi_ap_max_sta_set(lynq_wifi_ap_index_e idx, int max_sta_num)
{
- return sc_wifi_ap_max_sta_num_set((sc_wifi_ap_index_e)idx, max_sta_num);
+ int ret = -1;
+ ret = sc_wifi_ap_max_sta_num_set((sc_wifi_ap_index_e)idx, max_sta_num);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] idx = %d max_sta_num = %d \n", __func__, idx, max_sta_num);
+ return 0;
+}
+
+/********************************************************************
+* @brief: qser_wifi_ap_max_sta_get, Get the maximum number of STAs for wlan0 or wlan1
+* @param idx [IN]: int, Set wlan0 or wlan1
+* @param max_sta_num [OUT]: int *, Get the maximum number
+* @return : int, If equal to 0 succeeds, others fail
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_wifi_ap_max_sta_get(lynq_wifi_ap_index_e idx, int *max_sta_num)
+{
+ int ret = -1;
+ sc_wifi_ap_param_t param = {0};
+ if (max_sta_num == NULL)
+ {
+ LYERRLOG("[%s ] Null pointer max_sta_num = 0x%p\n", __func__,max_sta_num);
+ return ret;
+ }
+ ret = sc_wifi_ap_param_get((sc_wifi_ap_index_e)idx, ¶m);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] idx = %d max_sta_num = %d \n", __func__, idx, param.max_sta_num);
+ *max_sta_num = param.max_sta_num;
+ return 0;
}
/********************************************************************
@@ -177,9 +468,17 @@
* @see: NA
* @warning: NA
*********************************************************************/
-int qser_wifi_ap_start(int idx)
+int qser_wifi_ap_start(lynq_wifi_ap_index_e idx)
{
- return sc_wifi_ap_start((sc_wifi_ap_index_e)idx);
+ int ret = -1;
+ ret = sc_wifi_ap_start((sc_wifi_ap_index_e)idx);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] idx = %d \n", __func__, idx);
+ return 0;
}
/********************************************************************
@@ -190,9 +489,17 @@
* @see: NA
* @warning: NA
*********************************************************************/
-int qser_wifi_ap_stop(int idx)
+int qser_wifi_ap_stop(lynq_wifi_ap_index_e idx)
{
- return sc_wifi_ap_stop((sc_wifi_ap_index_e)idx);
+ int ret = -1;
+ ret = sc_wifi_ap_stop((sc_wifi_ap_index_e)idx);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] idx = %d \n", __func__, idx);
+ return 0;
}
/********************************************************************
@@ -203,17 +510,26 @@
* @see: NA
* @warning: NA
*********************************************************************/
-int qser_wifi_ap_restart(int idx)
+int qser_wifi_ap_restart(lynq_wifi_ap_index_e idx)
{
- int ret = sc_wifi_ap_stop((sc_wifi_ap_index_e)idx);
+ int ret = -1;
+ ret = sc_wifi_ap_stop((sc_wifi_ap_index_e)idx);
if (0 != ret)
{
- return -1;
+ LYERRLOG("[%s ] stop: %d ret = %d\n", __func__,ret);
+ return ret;
}
- return sc_wifi_ap_start((sc_wifi_ap_index_e)idx);
+ ret = sc_wifi_ap_start((sc_wifi_ap_index_e)idx);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] start: %d ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] idx = %d \n", __func__, idx);
+ return 0;
}
-//DEFINE_LYNQ_LIB_LOG(LYNQ_WIFI)
+DEFINE_LYNQ_LIB_LOG(LYNQ_WIFI)
#ifdef __cplusplus
}
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/makefile
index 5d2fc23..6707cdd 100644
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/makefile
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/makefile
@@ -13,11 +13,14 @@
-I. \
-I$(LOCAL_PATH)/include \
-I$(LOCAL_PATH)/ \
+ -I$(ROOT)$(includedir)/logger \
+ -I$(ROOT)$(includedir)/liblog \
LOCAL_LIBS := \
-L. \
-ldl \
-lstdc++ \
+ -llynq-log \
-lsctel \
SOURCES = lynq-qser-wifi.cpp