Repository: raspberrypi/pico-sdk
File: src/rp2_common/pico_cyw43_arch/include/pico/cyw43_arch.h (C/C++)

Code before:
 * \ingroup pico_cyw43_arch
 *
 * \param ssid the network name to connect to
 * \param pw the network password or NULL if there is no password required
 * \param auth the authorization type to use when the password is enabled. Values are \ref CYW43_AUTH_WPA_TKIP_PSK,
 *             \ref CYW43_AUTH_WPA2_AES_PSK, or \ref CYW43_AUTH_WPA2_MIXED_PSK (see \ref CYW43_AUTH_)
 * \param timeout how long to wait in milliseconds for a connection to succeed before giving up
 *
 * \return 0 if the connection is successful. PICO_ERROR_TIMEOUT is returned if the timeout is reached before a successful connection.
 * PICO_ERROR_BADAUTH is returned if the WiFi password is wrong.
 * PICO_ERROR_CONNECT_FAILED is returned if the connection failed for some other reason.
 */
int cyw43_arch_wifi_connect_timeout_ms(const char *ssid, const char *pw, uint32_t auth, uint32_t timeout);

/*!
 * \brief Attempt to connect to a wireless access point specified by SSID and BSSID, blocking until the network is joined, a failure is detected or a timeout occurs
 * \ingroup pico_cyw43_arch
 *
 * \param ssid the network name to connect to
 * \param bssid the network BSSID to connect to or NULL if ignored
 * \param pw the network password or NULL if there is no password required
 * \param auth the authorization type to use when the password is enabled. Values are \ref CYW43_AUTH_WPA_TKIP_PSK,
 *             \ref CYW43_AUTH_WPA2_AES_PSK, or \ref CYW43_AUTH_WPA2_MIXED_PSK (see \ref CYW43_AUTH_)
 * \param timeout how long to wait in milliseconds for a connection to succeed before giving up
 *
 * \return 0 if the connection is successful. PICO_ERROR_TIMEOUT is returned if the timeout is reached before a successful connection.
 * PICO_ERROR_BADAUTH is returned if the WiFi password is wrong.
 * PICO_ERROR_CONNECT_FAILED is returned if the connection failed for some other reason.
 */
int cyw43_arch_wifi_connect_bssid_timeout_ms(const char *ssid, const uint8_t *bssid, const char *pw, uint32_t auth, uint32_t timeout);

/*!
 * \brief Start attempting to connect to a wireless access point
 * \ingroup pico_cyw43_arch
 *
 * This method tells the CYW43 driver to start connecting to an access point. You should subsequently check the
 * status by calling \ref cyw43_wifi_link_status.
 *
 * \param ssid the network name to connect to
 * \param pw the network password or NULL if there is no password required
 * \param auth the authorization type to use when the password is enabled. Values are \ref CYW43_AUTH_WPA_TKIP_PSK,
 *             \ref CYW43_AUTH_WPA2_AES_PSK, or \ref CYW43_AUTH_WPA2_MIXED_PSK (see \ref CYW43_AUTH_)
 *
 * \return 0 if the scan was started successfully, an error code otherwise see \ref pico_error_codes
 */
int cyw43_arch_wifi_connect_async(const char *ssid, const char *pw, uint32_t auth);

/*!
 * \brief Start attempting to connect to a wireless access point specified by SSID and BSSID
 * \ingroup pico_cyw43_arch
 *

Review comment (suggestion):
```suggestion
 * \return 0 if the connection is successful.
 * PICO_ERROR_TIMEOUT is returned if the timeout is reached before a successful connection.
```

Code after:
 * \ingroup pico_cyw43_arch
 *
 * \param ssid the network name to connect to
 * \param pw the network password or NULL if there is no password required
 * \param auth the authorization type to use when the password is enabled. Values are \ref CYW43_AUTH_WPA_TKIP_PSK,
 *             \ref CYW43_AUTH_WPA2_AES_PSK, or \ref CYW43_AUTH_WPA2_MIXED_PSK (see \ref CYW43_AUTH_)
 * \param timeout how long to wait in milliseconds for a connection to succeed before giving up
 *
 * \return 0 if the connection is successful.
 * PICO_ERROR_TIMEOUT is returned if the timeout is reached before a successful connection.
 * PICO_ERROR_BADAUTH is returned if the WiFi password is wrong.
 * PICO_ERROR_CONNECT_FAILED is returned if the connection failed for some other reason.
 */
int cyw43_arch_wifi_connect_timeout_ms(const char *ssid, const char *pw, uint32_t auth, uint32_t timeout);

/*!
 * \brief Attempt to connect to a wireless access point specified by SSID and BSSID, blocking until the network is joined, a failure is detected or a timeout occurs
 * \ingroup pico_cyw43_arch
 *
 * \param ssid the network name to connect to
 * \param bssid the network BSSID to connect to or NULL if ignored
 * \param pw the network password or NULL if there is no password required
 * \param auth the authorization type to use when the password is enabled. Values are \ref CYW43_AUTH_WPA_TKIP_PSK,
 *             \ref CYW43_AUTH_WPA2_AES_PSK, or \ref CYW43_AUTH_WPA2_MIXED_PSK (see \ref CYW43_AUTH_)
 * \param timeout how long to wait in milliseconds for a connection to succeed before giving up
 *
 * \return 0 if the connection is successful.
 * PICO_ERROR_TIMEOUT is returned if the timeout is reached before a successful connection.
 * PICO_ERROR_BADAUTH is returned if the WiFi password is wrong.
 * PICO_ERROR_CONNECT_FAILED is returned if the connection failed for some other reason.
 */
int cyw43_arch_wifi_connect_bssid_timeout_ms(const char *ssid, const uint8_t *bssid, const char *pw, uint32_t auth, uint32_t timeout);

/*!
 * \brief Start attempting to connect to a wireless access point
 * \ingroup pico_cyw43_arch
 *
 * This method tells the CYW43 driver to start connecting to an access point. You should subsequently check the
 * status by calling \ref cyw43_wifi_link_status.
 *
 * \param ssid the network name to connect to
 * \param pw the network password or NULL if there is no password required
 * \param auth the authorization type to use when the password is enabled. Values are \ref CYW43_AUTH_WPA_TKIP_PSK,
 *             \ref CYW43_AUTH_WPA2_AES_PSK, or \ref CYW43_AUTH_WPA2_MIXED_PSK (see \ref CYW43_AUTH_)
 *
 * \return 0 if the scan was started successfully, an error code otherwise see \ref pico_error_codes
 */
int cyw43_arch_wifi_connect_async(const char *ssid, const char *pw, uint32_t auth);

/*!
 * \brief Start attempting to connect to a wireless access point specified by SSID and BSSID