~aleteoryx/muditaos

ref: fe708cdf31392bc009227c63ceb091ac450d6a78 muditaos/module-bluetooth/Bluetooth/interface/profiles/GAP/Devices.hpp -rw-r--r-- 877 bytes
fe708cdf — Adam Wulkiewicz [MOS-670] Change clang-format AlwaysBreakTemplateDeclarations to Yes 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once
#include <Bluetooth/Device.hpp>
#include <list>
#include <vector>
#include <functional>

namespace bluetooth::gap
{
    /// class to store and get devices in GAP operations
    class Devices
    {
        std::list<Devicei> devices;

      public:
        using iter = decltype(devices)::iterator;
        iter find(bd_addr_t &addr);
        iter find(DEVICE_STATE st);
        void for_each(const std::function<void(Devicei &)> &f);
        iter end();
        // adds element, if element already on list - remove and add anew
        iter put(Devicei &&dev);
        // same as above
        iter put(bd_addr_t &addr);
        void clear();
        auto getList() -> std::vector<Devicei>;
    };
} // namespace bluetooth::gap