# API

Source: [https://docs.qualcomm.com/doc/80-58740-4/topic/api.html](https://docs.qualcomm.com/doc/80-58740-4/topic/api.html)

## wifi\_sta\_connect

- Command-line
                    entry

        void wifi_connect_cmd(int argc, char **argv);Copy to clipboard
- API

        int wifi_mgmr_sta_connect(const wifi_mgmr_sta_connect_params_t *config);
        
        Brief:
        Station connects to AP.
        
        Parameters:
        typedef struct {
          /* SSID of target AP */
          char ssid[MGMR_SSID_LEN];
          /* password of target AP */
          char key[MGMR_KEY_LEN];
          /* BSSID of target AP */
          char bssid_str[MGMR_BSSID_LEN];
          /* AKM of target AP, must be in uppercase,
          * OPEN: For open AP
          * WPA: For AP with WPA/PSK security (pre WPA2)
          * RSN or WPA2: For AP with WPA2/PSK security
          * SAE or WPA3: For AP with WPA3/PSK security
          */
          char akm_str[MGMR_BSSID_LEN];
          /* two frequencies can be specified on which AP will be scanned*/
          uint16_t freq1;
          uint16_t freq2;
          /* configurations for protected management frames */
          uint8_t pmf_cfg;
          /* whether to use the dhcp server provided by AP */
          uint8_t use_dhcp;
          /* listen interval for beacon */
          uint8_t listen_interval;
          /* 0 – quick scan and connect to the first matched AP
          *1 – scan on all channels, which is the default option
          */
          uint8_t scan_mode;
          /* 0 – normal connect, 1 – quick connect */
          uint8_t quick_connect;
          /* timeout of connection process */
          int timeout_ms;
        };Copy to clipboard

- Return
    - 0 on success, a negative number otherwise.

## wifi\_scan

- Command-line
                    entry

        void wifi_scan_cmd(int argc, char **argv);Copy to clipboard
- API

        int wifi_mgmr_sta_scan(const wifi_mgmr_scan_params_t *config)
        
        Brief:
        Start the process of scan.
        
        Parameters:
        typedef struct {
          /*
          * if specified, only scan the AP whose SSID matches ssid_array
          */
          uint8_t ssid_array[MGMR_SSID_LEN];
          /*
          * if specified, only scan the AP whose BSSID matches bssid
          *c/
          uint8_t bssid[6];
          /* indicate channels on which scan is performed */
          uint8_t channels[MAX_FIXED_CHANNELS_LIMIT];
          /* duration in microseconds for which channel is scanned, default 220000 */
          uint32_t duration;
          } wifi_mgmr_scan_params_t;Copy to clipboard

- Return
    - 0 on success, a negative number otherwise.

## ping

- Command-line
                    entry

        components/net/lwip/lwip_apps/ping/ping.c:
        void ping_cmd(char *buf, int len, int argc, char **argv);Copy to clipboard
- API
    - Refer to LWIP raw API.

## wifi\_sta\_info

- Command-line
                    entry

        void wifi_sta_info_cmd(int argc, char **argv);Copy to clipboard

- API

        int wifi_sta_ip4_addr_get(uint32_t *addr, uint32_t *mask, uint32_t *gw, uint32_t *dns);
        
        Brief:
        Get IP information of the station.
        
        Parameters:
        addr - the IP address
        mask – network mask
        gw – gateway address
        dns – DNS server address
        
        Return:
        0 on success, a negative number otherwise.Copy to clipboard

        int wifi_mgmr_sta_rssi_get(int *rssi);
        
        Brief:
        Get wifi RSSI.
        
        Parameters:
        rssi – WiFi RSSI
        
        Return:
        0 on success, a negative number otherwise.Copy to clipboard

        int wifi_mgmr_tpc_pwr_get(rf_prw_table_t *power_table);
        
        Brief:
        get wifi power table
        
        Parameters:
        typedef struct rf_pwr_table {
            int8_t pwr_11b[4];
            int8_t pwr_11g[8];
            int8_t pwr_11n_ht20[8];
            int8_t pwr_11n_ht40[8];
            int8_t pwr_11ac_vht20[10];
            int8_t pwr_11ac_vht40[10];
            int8_t reserved[10];
            int8_t pwr_11ax_he20[12];
            int8_t pwr_11ax_he40[12];
            int8_t reserved2[12];
            int8_t reserved3[12];
        } rf_pwr_table_t;
        
        Return:
        0 on success, a negative number otherwise.Copy to clipboard

## wifi\_state

- Command-line
                    entry

        void cmd_wifi_state_get(int argc, char **argv);Copy to clipboard

- API

        int wifi_mgmr_state_get(void);
        
        Brief:
        Dump station/ap information.
        
        Return:
        0 on success, a negative number otherwise.Copy to clipboard

## wifi\_sta\_rssi

- Command-line
                    entry

        void cmd_wifi_state_get(int argc, char **argv);Copy to clipboard

- API
    - Refer to `wifi_sta_info`

## wifi\_sta\_disconnect

- Command-line
                    entry

        void wifi_disconnect_cmd(int argc, char **argv);Copy to clipboard

- API

        int wifi_sta_disconnect(void);
        
        Brief:
        Station disconnects from its AP.Copy to clipboard

- Return
    - 0 on success, a negative number otherwise.

## wifi\_ap\_start

- Command-line
                    entry

        void wifi_mgmr_ap_start_cmd(int argc, char **argv);Copy to clipboard

- API

        int wifi_mgmr_ap_start(const wifi_mgmr_ap_params_t *config);
        
        Brief:
        Start wifi AP.
        
        Parameters:
        typedef struct {
            /* the SSID of the AP */
            char *ssid;
            /* if both key and akm are NULL, the default key is 12345678 */
            char *key;
            /* OPEN/WPA/WPA2 */
            char *akm;
            /* default channel is 6 */
            uint8_t channel;
            /* channel type */
            uint8_t type;
            /* whether start dhcpd */
            bool use_dhcpd;
            /* dhcpd pool start */
            int start;
            /* dhcpd pool limit */
            int limit;
            /* AP IP address */
            uint32_t ap_ipaddr;
            /* AP IP network mask */
            uint32_t ap_mask;
            /* STA max inactivity when connected */
            uint32_t ap_max_inactivity;
            /* whether use hidden SSID */
            bool hidden_ssid;
            /* whether enable isolation */
            bool isolation;
        };Copy to clipboard

- Return
    - 0 on success, a negative number otherwise.

## wifi\_ap\_stop

- Command-line
                    entry

        void wifi_mgmr_ap_stop_cmd(int argc, char **argv);Copy to clipboard

- API

        int wifi_mgmr_ap_stop(void);
        
        Brief:
        Stop wifi AP.Copy to clipboard

- Return
    - 0 on success, a negative number otherwise.

## wifi\_ap\_conf\_max\_sta

- Command-line
                    entry

        void cmd_wifi_ap_conf_max_sta(int argc, char **argv);Copy to clipboard

- API

        int wifi_mgmr_conf_max_sta(uint8_t max_sta_supported);
        
        Brief:
        Set the maximum number of station.
        
        Parameters:
        max_sta_supported – the maximum number of station.Copy to clipboard

- Return
    - 0 on success, a negative number otherwise.

## wifi\_ap\_mac\_get

- Command-line
                    entry

        void cmd_wifi_ap_mac_get(int argc, char **argv);Copy to clipboard

- API

        int wifi_mgmr_ap_mac_get(uint8_t mac[6]);
        
        Brief:
        Get mac address of AP.
        
        Parameters:
        mac – MAC address of the AP.Copy to clipboard

- Return
    - 0 on success, a negative number otherwise.

## wifi\_sta\_list

- Command-line
                    entry

        void wifi_ap_sta_list_get_cmd(int argc, char **argv);Copy to clipboard

- API

        int wifi_mgmr_ap_sta_info_get(struct wifi_sta_basic_info *sta_info, uint8_t idx);
        
        Brief: get basic information of station.
        
        Parameters:
        sta_info:
        typedef struct wifi_sta_basic_info {
            uint8_t sta_idx;
            uint8_t is_used;
            uint8_t sta_mac[6];
            uint16_t aid;
        } wifi_sta_basic_info_t;
        
        idx – the index of stationCopy to clipboard

- Return
    - 0 on success, a negative number otherwise.

## wifi\_sniffer\_on

- Command-line
                    entry

        void cmd_wifi_sniffer_on(int argc, char **argv);Copy to clipboard

- API

        Int wifi_mgmr_sniffer_enable(wifi_mgmr_sniffer_item_t sniffer_item);
        
        Brief:
        Enable wifi sniffer.
        
        Parameters:
        sniffer_item –
        typedef struct wifi_mgmr_sniffer_item {
            /* interface index */
            char *itf;
            /* channel type */
            uint8_t type;
            /* frequency for Primary 20MHz channel (in MHz) */
            uint16_t prim20_freq;
            /* frequency center of the contiguous channel or center of primary 80+80 (in MHz) */
            uint16_t center1_freq;
            /* frequency center of the non-contiguous secondary 80+80 (in MHz) */
            uint16_t center2_freq;
            /* frame received callback. */
            void *cb;
            /* parameter for the monitor callback. */
            void *cb_arg;
        } wifi_mgmr_sniffer_item_t;
        Copy to clipboard

- Return
    - 0 on success, a negative number otherwise.

## wifi\_sniffer\_off

- Command-line
                    entry

        void cmd_wifi_sniffer_off(int argc, char **argv);Copy to clipboard

- API

        int wifi_mgmr_sniffer_disable(wifi_mgmr_sniffer_item_t sniffer_item);
        
        Brief:
        Disable wifi sniffer.
        
        Parameters:
        Please refer to wifi_sniffer_onCopy to clipboard

- Return
    - 0 on success, a negative number otherwise.

**Parent Topic:** [Wi-Fi 6](https://docs.qualcomm.com/doc/80-58740-4/topic/wifi6.html)

Last Published: Feb 10, 2025

[Previous Topic
Wi-Fi 6](https://docs.qualcomm.com/bundle/publicresource/80-58740-4/topics/wifi6.md) [Next Topic
CLI commands](https://docs.qualcomm.com/bundle/publicresource/80-58740-4/topics/cli-commands_1.md)