Firmware  0.4.1
Loading...
Searching...
No Matches
service.hpp
Go to the documentation of this file.
1// Copyright (C) 2025 Vincent Hamp
2//
3// This program is free software: you can redistribute it and/or modify
4// it under the terms of the GNU General Public License as published by
5// the Free Software Foundation, either version 3 of the License, or
6// (at your option) any later version.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with this program. If not, see <https://www.gnu.org/licenses/>.
15
16#pragma once
17
18#include <esp_task.h>
19#include <queue>
20#include "intf/http/message.hpp"
21
22namespace mw::zimo::mdu {
23
24class Service {
25public:
26 Service();
27
28 esp_err_t zppSocket(intf::http::Message& msg);
29 esp_err_t zsuSocket(intf::http::Message& msg);
30
31private:
32 esp_err_t socket(intf::http::Message& msg, State mdu_state);
33 [[noreturn]] void taskFunction(void*);
34 void loop();
35 std::array<uint8_t, 2uz> transmit(std::vector<uint8_t> const& payload) const;
36 void close();
37
38 std::queue<intf::http::Message> _queue{};
39 std::array<uint8_t, 2uz> _acks{};
40};
41
42} // namespace mw::zimo::mdu
esp_err_t zsuSocket(intf::http::Message &msg)
Definition service.cpp:38
void close()
Definition service.cpp:132
std::queue< intf::http::Message > _queue
Definition service.hpp:38
void loop()
Definition service.cpp:73
esp_err_t socket(intf::http::Message &msg, State mdu_state)
Definition service.cpp:43
std::array< uint8_t, 2uz > _acks
Definition service.hpp:39
esp_err_t zppSocket(intf::http::Message &msg)
Definition service.cpp:33
std::array< uint8_t, 2uz > transmit(std::vector< uint8_t > const &payload) const
Definition service.cpp:113
Service()
Definition service.cpp:28
void taskFunction(void *)
Definition service.cpp:63
State
System state.
Definition config.hpp:149
HTTP websocket message.
Definition config.hpp:576
Definition message.hpp:29