~aleteoryx/muditaos

ref: master muditaos/module-cellular/modem/BaseChannel.hpp -rw-r--r-- 1.4 KiB
2cd0e472 — Lefucjusz [BH-000] Update Harmony 2.10.0 changelog 2 months 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
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/blob/master/LICENSE.md

#pragma once

#include <string>
#include <vector>
#include <at/Commands.hpp>
#include <at/Result.hpp>
#include <bsp/cellular/CellularResult.hpp>

namespace at
{
    struct Cmd;

    class BaseChannel
    {
      public:
        virtual ~BaseChannel() = default;
        /// @defgroup Channel OS dependent methods
        /// {

        /// waits till ok or timeout
        virtual auto cmd(const std::string &cmd,
                         std::chrono::milliseconds timeout = at::default_timeout,
                         size_t rxCount                    = 0) -> Result = 0;
        virtual auto cmd(const at::AT &at) -> Result   = 0;
        virtual auto cmd(const at::Cmd &at) -> Result  = 0;
        /// }

        /// @defgroup Channel Platform independent methods
        /// {
        virtual void cmdLog(std::string cmd, const Result &result, std::chrono::milliseconds timeout)
        {}
        virtual void cmdInit()                                                               = 0;
        virtual void cmdSend(std::string cmd)                                                = 0;
        virtual size_t cmdReceive(std::uint8_t *buffer, std::chrono::milliseconds timeoutMs) = 0;
        virtual void cmdPost()                                                               = 0;
        /// }
    };
} // namespace at