Skip to content

File WiFiEvents.h

File List > api > WiFi > WiFiEvents.h

Go to the documentation of this file.

/*
 * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#pragma once

#include "WiFiType.h"

typedef struct {
    uint32_t status; 
    uint8_t number;  
    uint8_t scan_id; 
} wifi_event_sta_scan_done_t;

typedef struct {
    uint8_t ssid[32];          
    uint8_t ssid_len;          
    uint8_t bssid[6];          
    uint8_t channel;           
    wifi_auth_mode_t authmode; 
} wifi_event_sta_connected_t;

typedef struct {
    uint8_t ssid[32]; 
    uint8_t ssid_len; 
    uint8_t bssid[6]; 
    uint8_t reason;   
} wifi_event_sta_disconnected_t;

typedef struct {
    wifi_auth_mode_t old_mode; 
    wifi_auth_mode_t new_mode; 
} wifi_event_sta_authmode_change_t;

typedef struct {
    uint8_t pin_code[8]; 
} wifi_event_sta_wps_er_pin_t;

typedef enum {
    WPS_FAIL_REASON_NORMAL = 0, 
    WPS_FAIL_REASON_RECV_M2D,   
    WPS_FAIL_REASON_MAX
} wifi_event_sta_wps_fail_reason_t;

#define MAX_SSID_LEN       32
#define MAX_PASSPHRASE_LEN 64
#define MAX_WPS_AP_CRED    3

typedef struct {
    uint8_t ap_cred_cnt; 
    struct {
        uint8_t ssid[MAX_SSID_LEN];             
        uint8_t passphrase[MAX_PASSPHRASE_LEN]; 
    } ap_cred[MAX_WPS_AP_CRED];                 
} wifi_event_sta_wps_er_success_t;

typedef struct {
    uint8_t mac[6];     
    uint8_t aid;        
    bool is_mesh_child; 
} wifi_event_ap_staconnected_t;

typedef struct {
    uint8_t mac[6];     
    uint8_t aid;        
    bool is_mesh_child; 
} wifi_event_ap_stadisconnected_t;

typedef struct {
    int rssi;       
    uint8_t mac[6]; 
} wifi_event_ap_probe_req_rx_t;

typedef enum {
    FTM_STATUS_SUCCESS = 0,   
    FTM_STATUS_UNSUPPORTED,   
    FTM_STATUS_CONF_REJECTED, 
    FTM_STATUS_NO_RESPONSE,   
    FTM_STATUS_FAIL,          
} wifi_ftm_status_t;

typedef struct {
    uint8_t dlog_token; 
    int8_t rssi;        
    uint32_t rtt;       
    uint64_t t1;        
    uint64_t t2;        
    uint64_t t3;        
    uint64_t t4;        
} wifi_ftm_report_entry_t;

typedef struct {
    uint8_t peer_mac[6];      
    wifi_ftm_status_t status; 
    uint32_t rtt_raw;         
    uint32_t rtt_est;         
    uint32_t dist_est;        
    wifi_ftm_report_entry_t
        *ftm_report_data;           
    uint8_t ftm_report_num_entries; 
} wifi_event_ftm_report_t;

#define WIFI_STATIS_BUFFER (1 << 0)
#define WIFI_STATIS_RXTX   (1 << 1)
#define WIFI_STATIS_HW     (1 << 2)
#define WIFI_STATIS_DIAG   (1 << 3)
#define WIFI_STATIS_PS     (1 << 4)
#define WIFI_STATIS_ALL    (-1)

typedef struct {
    int ifx;          
    uint32_t context; 
    uint8_t da[6];    
    uint8_t status;   
} wifi_event_action_tx_status_t;

typedef struct {
    uint32_t context; 
} wifi_event_roc_done_t;

typedef struct {
    esp_ip4_addr_t ip;      
    esp_ip4_addr_t netmask; 
    esp_ip4_addr_t gw;      
} esp_netif_ip_info_t;

typedef struct {
    esp_ip6_addr_t ip; 
} esp_netif_ip6_info_t;

typedef struct {
    int if_index;                
    void *esp_netif;             
    esp_netif_ip_info_t ip_info; 
    bool ip_changed;             
} ip_event_got_ip_t;

typedef struct {
    int if_index;                  
    void *esp_netif;               
    esp_netif_ip6_info_t ip6_info; 
    int ip_index;                  
} ip_event_got_ip6_t;

typedef struct {
    esp_ip4_addr_t ip; 
} ip_event_ap_staipassigned_t;