<commit_before>/* WiFiInterface
 * Copyright (c) 2015 - 2016 ARM Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef WIFI_INTERFACE_H
#define WIFI_INTERFACE_H

#include <string.h>
#include "Callback.h"
#include "network-socket/NetworkInterface.h"

typedef struct wifi_ap {
    char ssid[33]; /* 32 is what 802.11 defines as longest possible name; +1 for the \0 */
    uint8_t bssid[6];
    nsapi_security_t security;
    int8_t rssi;
    uint8_t channel;
} wifi_ap_t;

/** WiFiInterface class
 *
 *  Common interface that is shared between WiFi devices
 */
class WiFiInterface: public NetworkInterface
{
public:
    /** WiFiInterface lifetime
     */
    WiFiInterface();
    virtual ~WiFiInterface();

    /** Set the WiFi network credentials
     *
     *  @param ssid     Name of the network to connect to
     *  @param pass     Security passphrase to connect to the network
     *  @param security Type of encryption for connection
     *                  (defaults to NSAPI_SECURITY_NONE)
     */
    virtual int set_credentials(const char *ssid, const char *pass, nsapi_security_t security = NSAPI_SECURITY_NONE);

    /** Start the interface
     *
     *  Attempts to connect to a WiFi network.
     *
     *  @param ssid      Name of the network to connect to
     *  @param pass      Security passphrase to connect to the network
     *  @param security  Type of encryption for connection (Default: NSAPI_SECURITY_NONE)
     *  @param channel   Channel on which the connection is to be made, or 0 for any (Default: 0)<commit_msg>WiFiInterface: change scope of wifi_ap_t structure<commit_after>/* WiFiInterface
 * Copyright (c) 2015 - 2016 ARM Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef WIFI_INTERFACE_H
#define WIFI_INTERFACE_H

#include <string.h>
#include "Callback.h"
#include "network-socket/NetworkInterface.h"

/** WiFiInterface class
 *
 *  Common interface that is shared between WiFi devices
 */
class WiFiInterface: public NetworkInterface
{
public:
    typedef struct wifi_ap {
        char ssid[33]; /* 32 is what 802.11 defines as longest possible name; +1 for the \0 */
        uint8_t bssid[6];
        nsapi_security_t security;
        int8_t rssi;
        uint8_t channel;
    } wifi_ap_t;

    /** WiFiInterface lifetime
     */
    WiFiInterface();
    virtual ~WiFiInterface();

    /** Set the WiFi network credentials
     *
     *  @param ssid     Name of the network to connect to
     *  @param pass     Security passphrase to connect to the network
     *  @param security Type of encryption for connection
     *                  (defaults to NSAPI_SECURITY_NONE)
     */
    virtual int set_credentials(const char *ssid, const char *pass, nsapi_security_t security = NSAPI_SECURITY_NONE);

    /** Start the interface
     *
     *  Attempts to connect to a WiFi network.
     *
     *  @param ssid      Name of the network to connect to
     *  @param pass      Security passphrase to connect to the network
     *  @param security  Type of encryption for connection (Default: NSAPI_SECURITY_NONE)
     *  @param channel   Channel on which the connection is to be made, or 0 for any (Default: 0)
{'fraction_non_alphanumeric': 0.07168373422243392, 'fraction_numerical': 0.01381281257442248, 'mean_word_length': 3.046242774566474, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5206257', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1155, 'n_words': 486}