<commit_before>/* mbed Microcontroller Library
 * Copyright (c) 2018-2018 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 BLE_GAP_EVENTS_H
#define BLE_GAP_EVENTS_H

#include "ble/blecommon.h"
#include "ble/BLETypes.h"
#include "platform/Span.h"

namespace ble {

/**
 * @addtogroup ble
 * @{
 * @addtogroup gap
 * @{
 */

/**
 * Event generated when an advertising packet is seen during passive scanning
 * or a scan response is received during active scanning.
 *
 * @see ble::Gap::EventHandler::onPeriodicAdvertisingReport()
 */
struct AdvertisingReportEvent {
#if !defined(DOXYGEN_ONLY)

    /** Create an advertising report event.
     *
     * @param type Type of advertising used.
     * @param peerAddressType Peer address type of advertiser.
     * @param peerAddress Peer address of advertiser.
     * @param primaryPhy PHY used on the primary channels.
     * @param secondaryPhy PHY used on secondary channels.
     * @param SID Set identification number.
     * @param txPower Transmission power reported by the packet.
     * @param rssi Measured signal strength.
     * @param periodicInterval Interval of periodic advertising.
     * @param directAddressType Directed advertising target address type.
     * @param directAddress Directed advertising target address.
     * @param advertisingData Advertising payload.
     */
    AdvertisingReportEvent(
        const advertising_event_t &type,
        const peer_address_type_t &peerAddressType,
        const address_t &peerAddress,
        const phy_t &primaryPhy,
        const phy_t &secondaryPhy,
        advertising_sid_t SID,
        advertising_power_t txPower,
        rssi_t rssi,
        periodic_interval_t periodicInterval,
        const peer_address_type_t &directAddressType,
        const address_t &directAddress,
        const mbed::Span<const uint8_t> &advertisingData
    ) :
        type(type),
        peerAddressType(peerAddressType),
        peerAddress(peerAddress),
        primaryPhy(primaryPhy),
        secondaryPhy(secondaryPhy),
        SID(SID),
        txPower(txPower),
        rssi(rssi),
        periodicInterval(periodicInterval),
        directAddressType(directAddressType),
        directAddress(directAddress),
        advertisingData(advertisingData)
    {
    }

#endif

    /** Get event type. */
    const advertising_event_t &getType() const
    {
        return type;
    }

    /** Get peer address type. */
    const peer_address_type_t &getPeerAddressType() const
    {
        return peerAddressType;
    }

    /** Get peer address. */
    const address_t &getPeerAddress() const
    {
        return peerAddress;
    }

    /** Get primary PHY. */
    const phy_t &getPrimaryPhy() const
    {
        return primaryPhy;
    }

    /** Get secondary PHY. */
    const phy_t &getSecondaryPhy() const
    {
        return secondaryPhy;
    }

    /** Get advertising set identifier. */
    advertising_sid_t getSID() const
    {
        return SID;
    }

    /** Get TX power. */
    advertising_power_t getTxPower() const
    {
        return txPower;
    }

    /** Get received signal strength. */
    rssi_t getRssi() const
    {
        return rssi;
    }

    /** Get interval. */
    periodic_interval_t getPeriodicInterval() const
    {
        return periodicInterval;
    }

    /** Get target address type in directed advertising. */
    const peer_address_type_t &getDirectAddressType() const
    {
        return directAddressType;
    }

    /** Get target address in directed advertising. */
    const address_t &getDirectAddress() const
    {
        return directAddress;
    }

    /** Get payload. */
    const mbed::Span<const uint8_t> &getAdvertisingData() const
    {
        return advertisingData;
    }
<commit_msg>BLE: rename AdvertisingReportEvent::getAdvertisingData into getPayload.<commit_after>/* mbed Microcontroller Library
 * Copyright (c) 2018-2018 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 BLE_GAP_EVENTS_H
#define BLE_GAP_EVENTS_H

#include "ble/blecommon.h"
#include "ble/BLETypes.h"
#include "platform/Span.h"

namespace ble {

/**
 * @addtogroup ble
 * @{
 * @addtogroup gap
 * @{
 */

/**
 * Event generated when an advertising packet is seen during passive scanning
 * or a scan response is received during active scanning.
 *
 * @see ble::Gap::EventHandler::onPeriodicAdvertisingReport()
 */
struct AdvertisingReportEvent {
#if !defined(DOXYGEN_ONLY)

    /** Create an advertising report event.
     *
     * @param type Type of advertising used.
     * @param peerAddressType Peer address type of advertiser.
     * @param peerAddress Peer address of advertiser.
     * @param primaryPhy PHY used on the primary channels.
     * @param secondaryPhy PHY used on secondary channels.
     * @param SID Set identification number.
     * @param txPower Transmission power reported by the packet.
     * @param rssi Measured signal strength.
     * @param periodicInterval Interval of periodic advertising.
     * @param directAddressType Directed advertising target address type.
     * @param directAddress Directed advertising target address.
     * @param advertisingData Advertising payload.
     */
    AdvertisingReportEvent(
        const advertising_event_t &type,
        const peer_address_type_t &peerAddressType,
        const address_t &peerAddress,
        const phy_t &primaryPhy,
        const phy_t &secondaryPhy,
        advertising_sid_t SID,
        advertising_power_t txPower,
        rssi_t rssi,
        periodic_interval_t periodicInterval,
        const peer_address_type_t &directAddressType,
        const address_t &directAddress,
        const mbed::Span<const uint8_t> &advertisingData
    ) :
        type(type),
        peerAddressType(peerAddressType),
        peerAddress(peerAddress),
        primaryPhy(primaryPhy),
        secondaryPhy(secondaryPhy),
        SID(SID),
        txPower(txPower),
        rssi(rssi),
        periodicInterval(periodicInterval),
        directAddressType(directAddressType),
        directAddress(directAddress),
        advertisingData(advertisingData)
    {
    }

#endif

    /** Get event type. */
    const advertising_event_t &getType() const
    {
        return type;
    }

    /** Get peer address type. */
    const peer_address_type_t &getPeerAddressType() const
    {
        return peerAddressType;
    }

    /** Get peer address. */
    const address_t &getPeerAddress() const
    {
        return peerAddress;
    }

    /** Get primary PHY. */
    const phy_t &getPrimaryPhy() const
    {
        return primaryPhy;
    }

    /** Get secondary PHY. */
    const phy_t &getSecondaryPhy() const
    {
        return secondaryPhy;
    }

    /** Get advertising set identifier. */
    advertising_sid_t getSID() const
    {
        return SID;
    }

    /** Get TX power. */
    advertising_power_t getTxPower() const
    {
        return txPower;
    }

    /** Get received signal strength. */
    rssi_t getRssi() const
    {
        return rssi;
    }

    /** Get interval. */
    periodic_interval_t getPeriodicInterval() const
    {
        return periodicInterval;
    }

    /** Get target address type in directed advertising. */
    const peer_address_type_t &getDirectAddressType() const
    {
        return directAddressType;
    }

    /** Get target address in directed advertising. */
    const address_t &getDirectAddress() const
    {
        return directAddress;
    }

    /** Get payload. */
    const mbed::Span<const uint8_t> &getPayload() const
    {
        return advertisingData;
    }

{'fraction_non_alphanumeric': 0.08273464658169177, 'fraction_numerical': 0.0032444959443800694, 'mean_word_length': 2.713855421686747, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1770724', 'n_tokens_mistral': 2466, 'n_tokens_neox': 2384, 'n_words': 742}