/* Function:
    DRV_WIFI_SecurityWpaSet(DRV_WIFI_WPA_CONTEXT *p_context)

  Summary:
    Sets WiFi security to use WPA or WPA2.

  Description:
    This function sets the WiFi security to WPA or WPA2.  One can only connect to
    an AP that is running the same WPA mode.

  Parameters:
    p_context - Desired WPA context.  See DRV_WIFI_WPA_CONTEXT structure.

 Returns:
    None.
 */
void DRV_WIFI_SecurityWpaSet(DRV_WIFI_WPA_CONTEXT *p_context)
{
#if defined(WF_ERROR_CHECKING)
    uint32_t errorCode;

    errorCode = UdSetSecurityWpa(p_context);
    if (errorCode != UD_SUCCESS)
    {
        EventEnqueue(WF_EVENT_ERROR, errorCode);
        return;
    }
#endif /* WF_ERROR_CHECKING */
    SetSecurity(p_context->wpaSecurityType,
                p_context->keyInfo.key,
                p_context->keyInfo.keyLength);
}
//============================================================================
void WF_SecurityWpaSet(t_wpaContext* p_context)
{
#if defined(WF_ERROR_CHECKING)
    uint32_t errorCode;

    errorCode = UdSetSecurityWpa(p_context);
    if (errorCode != UD_SUCCESS)
    {
        EventEnqueue(WF_EVENT_ERROR, errorCode);
        return;
    }
#endif /* WF_ERROR_CHECKING */

    WF_SetSecurity(p_context->wpaSecurityType,
                   0, // not used
                   p_context->keyInfo.key,
                   p_context->keyInfo.keyLength);
}