AliOS Things API HAL WiFi Guide - Shaofa/AliOS-Things-Certification-Manual GitHub Wiki

API INDEX


1-hal_wifi_get_default_module

hal_wifi_module_t *hal_wifi_get_default_module(void)
  • Description

    Get the default wifi instance. The system may have more than one wifi instance, this API returns the default one.

  • Parameters

    None.

  • Returns

    Instance pointer, or NULL if no instance registered.

2-hal_wifi_register_module

void hal_wifi_register_module(hal_wifi_module_t *m)
  • Description

    Regster a wifi instance to the HAL framework.

  • Parameters

    IN/OUT NAME DESC
    [in] m the wifi instance.
  • Returns

    None.

3-hal_wifi_init

int hal_wifi_init(void)
  • Description

    Initialize wifi instances.

  • Parameters

    None.

  • Returns

    0 on success, otherwise failure.

4-hal_wifi_get_mac_addr

void hal_wifi_get_mac_addr(hal_wifi_module_t *m, uint8_t *mac)
  • Description

    Get the MAC address of the specified wifi instance.

  • Parameters

    IN/OUT NAME DESC
    [in] m the wifi instance, NULL if default.
    [out] mac the place to hold the result.
  • Returns

    None.

5-hal_wifi_start

int hal_wifi_start(hal_wifi_module_t *m, hal_wifi_init_type_t *init_para)
  • Description

    Start the wifi instance.

  • Parameters

    IN/OUT NAME DESC
    [in] m the wifi instance, NULL if default.
    [in] init_para the config used to start the wifi.
  • Returns

    0 on success, otherwise failure.
    

6-hal_wifi_start_adv

int hal_wifi_start_adv(hal_wifi_module_t *m, hal_wifi_init_type_adv_t *init_para_adv)
  • Description

    Start the wifi instance in anvanced way (more config specified).

  • Parameters

    IN/OUT NAME DESC
    [in] m the wifi instance, NULL if default.
    [in] init_para_adv the advanced config used to start the wifi.
  • Returns

    0 on success, otherwise failure.
    

7-hal_wifi_get_ip_stat

int hal_wifi_get_ip_stat(hal_wifi_module_t *m,
                          hal_wifi_ip_stat_t *out_net_para, hal_wifi_type_t wifi_type)
  • Description

    Get the status of the specified wifi instance, e.g. the IP, mask, dhcp mode, etc.

  • Parameters

    IN/OUT NAME DESC
    [in] m the wifi instance, NULL if default.
    [out] out_net_para the place to hold the results.
    [in] wifi_type SOFT_AP or STATION.
  • Returns

    0 on success, otherwise failure.
    

8-hal_wifi_get_link_stat

int hal_wifi_get_link_stat(hal_wifi_module_t *m, hal_wifi_link_stat_t *out_stat)
  • Description

    Get the link status of the wifi instance ,e.g. ssid, bssid, channel, rssi, etc.

  • Parameters

    IN/OUT NAME DESC
    [in] m the wifi instance, NULL if default.
    [out] out_stat the place to hold the results.
  • Returns

    0 on success, otherwise failure.
    

9-hal_wifi_start_scan

void hal_wifi_start_scan(hal_wifi_module_t *m)
  • Description

    Start the scanning of the specified wifi instance.

  • Parameters

    IN/OUT NAME DESC
    [in] m the wifi instance, NULL if default.
  • Returns

    None.

10-hal_wifi_start_scan_adv

void hal_wifi_start_scan_adv(hal_wifi_module_t *m)
  • Description

    Start the scanning of the specified wifi instance in advanced way.

  • Parameters

    IN/OUT NAME DESC
    [in] m the wifi instance, NULL if default.
  • Returns

    None.

11-hal_wifi_power_off

int hal_wifi_power_off(hal_wifi_module_t *m)
  • Description

    Power off the wifi instance.

  • Parameters

    IN/OUT NAME DESC
    [in] m the wifi instance, NULL if default.
  • Returns

    0 on success, otherwise failure.

12-hal_wifi_power_on

int hal_wifi_power_on(hal_wifi_module_t *m)
  • Description

    Power on the wifi instance.

  • Parameters

    IN/OUT NAME DESC
    [in] m the wifi instance, NULL if default.
  • Returns

    0 on success, otherwise failure.

13-hal_wifi_suspend

int hal_wifi_suspend(hal_wifi_module_t *m)
  • Description

    Suspend the wifi instance.

  • Parameters

    IN/OUT NAME DESC
    [in] m the wifi instance, NULL if default.
  • Returns

    0 on success, otherwise failure.

14-hal_wifi_suspend_station

int hal_wifi_suspend_station(hal_wifi_module_t *m)
  • Description

    Suspend the wifi instance in station mode.

  • Parameters

    IN/OUT NAME DESC
    [in] m the wifi instance, NULL if default.
  • Returns

    0 on success, otherwise failure.

15-hal_wifi_suspend_soft_ap

int hal_wifi_suspend_soft_ap(hal_wifi_module_t *m)
  • Description

    Suspend the wifi instance in soft_ap mode.

  • Parameters

    IN/OUT NAME DESC
    [in] m the wifi instance, NULL if default.
  • Returns

    0 on success, otherwise failure.

16-hal_wifi_set_channel

int hal_wifi_set_channel(hal_wifi_module_t *m, int ch)
  • Description

    Set the channel of the wifi instance.

  • Parameters

    IN/OUT NAME DESC
    [in] m the wifi instance, NULL if default.
  • Returns

    0 on success, otherwise failure.

17-hal_wifi_start_wifi_monitor

void hal_wifi_start_wifi_monitor(hal_wifi_module_t *m)
  • Description

    Start the monitor mode of the wifi instance.

  • Parameters

    IN/OUT NAME DESC
    [in] m the wifi instance, NULL if default.
  • Returns

    None.

18-hal_wifi_stop_wifi_monitor

void hal_wifi_stop_wifi_monitor(hal_wifi_module_t *m)
  • Description

    Stop the monitor mode of the wifi instance.

  • Parameters

    IN/OUT NAME DESC
    [in] m The wifi instance, NULL if default.
  • Returns

    None.

19-hal_wifi_register_monitor_cb

void hal_wifi_register_monitor_cb(hal_wifi_module_t *m, monitor_data_cb_t fn)
  • Description

    Register the montior callback on the wifi instance.

  • Parameters

    IN/OUT NAME DESC
    [in] m the wifi instance, NULL if default.
    [in] fn the callback function.
  • Returns

    None.

20-hal_wifi_install_event

void hal_wifi_install_event(hal_wifi_module_t *m, const hal_wifi_event_cb_t *cb)
  • Description

    Set the event callback function array for the wifi. Please don't do time consuming work in these callbacks.

  • Parameters

    IN/OUT NAME DESC
    [in] m the wifi instance, NULL for default.
    [in] cb the event callback function info.
  • Returns

    None.

⚠️ **GitHub.com Fallback** ⚠️