Files
MuditaOS/module-cellular/Modem/ATCommon.hpp
Adam Dobrowolski 4a851263e8 [EGD-2656] All at commands gathered in one place
* at commands in one place, with timeouts set
* commands used with stream->cmd(...) have last execution time and result stored
2020-02-20 08:13:55 +00:00

46 lines
1.6 KiB
C++

#pragma once
#include <string>
#include <vector>
#include <FreeRTOS.h>
#include <at/Commands.hpp>
#include <at/Result.hpp>
#include <mutex.hpp>
#include <task.h>
namespace at
{
class Chanel
{
protected:
cpp_freertos::MutexStandard mutex;
TaskHandle_t blockedTaskHandle = nullptr;
public:
static const std::string OK;
static const std::string ERROR;
// /// other codes unused right now: Please see quectel QuectelEC2526EC21ATCommandsManualV1.3 page 21
// const std::string Chanel::CONNECT = "CONNECT";
// const std::string Chanel::RING = "RING";
// const std::string Chanel::NO_CARRIER = "NO CARRIER";
// const std::string Chanel::NO_DIALTONE = "NO DIALTONE";
// const std::string Chanel::BUSY = "BUSY";
// const std::string Chanel::NO_ANSVER = "NO ANSWER";
/// waits till ok or timeout
virtual auto cmd(const std::string cmd, uint32_t timeout = at::default_timeout, size_t rxCount = 0) -> Result final;
virtual auto cmd(const at::AT at) -> Result final;
virtual auto cmd(at::Cmd &at) -> Result final;
/// check for OK, ERROR in string in last token
virtual Result::Code at_check(const std::vector<std::string> &arr);
/// log result
virtual void cmd_log(std::string cmd, const Result &result, uint32_t timeout) final;
virtual void cmd_init() = 0;
virtual void cmd_send(std::string cmd) = 0;
virtual std::vector<std::string> cmd_receive() = 0;
virtual void cmd_post() = 0;
};
}; // namespace at