~aleteoryx/muditaos

ref: 6b3fdbc99f17803845fa355ddf29a3a94720a746 muditaos/module-bsp/bsp/cellular/bsp_cellular.cpp -rw-r--r-- 1.1 KiB
6b3fdbc9 — tomaszkrosnowski [EGD-6613] Audio assets tags are not displayed 4 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "bsp_cellular.hpp"

#if defined(TARGET_RT1051)
#include "board/rt1051/bsp/cellular/rt1051_cellular.hpp"
#elif defined(TARGET_Linux)
#include "cellular/linux_cellular.hpp"
#else
#error "Unsupported target"
#endif


namespace bsp{

    std::optional<std::unique_ptr<Cellular>> Cellular::Create(
            [[maybe_unused]] const char* term, uint32_t portSpeed) {

        std::unique_ptr<Cellular> inst;

#if defined(TARGET_RT1051)
        inst = std::make_unique<bsp::RT1051Cellular>();
#elif defined(TARGET_Linux)
        inst = std::make_unique<bsp::LinuxCellular>(term, portSpeed);
#else
#error "Unsupported target"
#endif

        if(inst->isInitialized){
            return inst;
        }

        return {};
    }

    [[nodiscard]] auto Cellular::GetCellularDevice() const noexcept -> std::shared_ptr<devices::Device>
    {
        return driverLPUART;
    }

    [[nodiscard]] auto Cellular::GetLastCommunicationTimestamp() const noexcept -> TickType_t
    {
    	return lastCommunicationTimestamp;
    }

    [[nodiscard]] auto Cellular::IsCellularInSleepMode() const noexcept -> bool
    {
    	return isInSleepMode;
    }

}