OS  v1.7.5
Documentation
Loading...
Searching...
No Matches
response.hpp
1#ifndef QOS_RESPONSE
2#define QOS_RESPONSE
3
4#include "include/types.hpp"
5#include "include/timer.hpp"
6
7namespace qOS {
8
18 enum class responseStatus {
19 MISSING = 0,
20 SUCCESS,
21 TIMEOUT,
22 };
23
27 class response {
28 private:
29 char *pattern2Match{ nullptr };
30 timer timeout;
31 size_t maxStrLength{ 0U };
32 size_t patternLength{ 0U };
33 volatile size_t matchedCount{ 0U };
34 volatile bool responseReceived{ false };
35 response( response const& ) = delete;
36 void operator=( response const& ) = delete;
37 public:
38 response() = default;
40 virtual ~response() {}
49 bool setup( char *xLocBuff, const size_t nMax ) noexcept;
53 void reset( void ) noexcept;
64 responseStatus received( const char *pattern, const size_t n, const qOS::duration_t t = clock::IMMEDIATE ) noexcept;
71 bool isrHandler( const char rxChar ) noexcept;
77 bool isInitialized( void ) const noexcept;
78 };
79
81}
82
83#endif /*QOS_RESPONSE*/
static const qOS::duration_t IMMEDIATE
To specify a non-wait time value.
Definition clock.hpp:124
A Response Handler object.
Definition response.hpp:27
response()=default
void reset(void) noexcept
Reset the Response Handler.
bool setup(char *xLocBuff, const size_t nMax) noexcept
Initialize the instance of the response handler object.
bool isrHandler(const char rxChar) noexcept
ISR receiver for the response handler.
responseStatus received(const char *pattern, const size_t n, const qOS::duration_t t=clock::IMMEDIATE) noexcept
Non-Blocking response check.
bool isInitialized(void) const noexcept
Check if the response object is already initialized by using response::setup()
A non-blocking Timer object.
Definition timer.hpp:26
timeCount_t duration_t
The typedef that specified an time quantity, usually expressed in milliseconds.
Definition clock.hpp:18
responseStatus
A enum with the possible return status of a qOS::response object.
Definition response.hpp:18
OS/Kernel interfaces.
Definition bytebuffer.hpp:7