Firmware  0.0.0
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 <ulf/decup_ein.hpp>
21#include "http/message.hpp"
22
23namespace decup {
24
25class Service : public ulf::decup_ein::rx::Base {
26public:
27 explicit Service(BaseType_t xCoreID);
28 ~Service();
29
30 esp_err_t zppSocket(http::Message& msg);
31 esp_err_t zsuSocket(http::Message& msg);
32
33private:
34 esp_err_t socket(http::Message& msg, State decup_state);
35 void taskFunction(void*);
36 void loop();
37
38 uint8_t transmit(std::span<uint8_t const> bytes) final;
39
40 void close();
41
42 std::queue<http::Message> _queue{};
43 std::optional<uint8_t> _ack{};
44};
45
46} // namespace decup
Definition service.hpp:25
~Service()
Definition service.cpp:39
esp_err_t socket(http::Message &msg, State decup_state)
Definition service.cpp:54
void taskFunction(void *)
Definition service.cpp:75
std::optional< uint8_t > _ack
Definition service.hpp:43
Service(BaseType_t xCoreID)
Definition service.cpp:27
esp_err_t zppSocket(http::Message &msg)
Definition service.cpp:44
std::queue< http::Message > _queue
Definition service.hpp:42
void close()
Definition service.cpp:144
esp_err_t zsuSocket(http::Message &msg)
Definition service.cpp:49
void loop()
Definition service.cpp:87
uint8_t transmit(std::span< uint8_t const > bytes) final
Definition service.cpp:130
State
System state.
Definition config.hpp:137
HTTP websocket message.
Definition config.hpp:286
Definition message.hpp:29