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
21
22#pragma once
23
24#include <esp_err.h>
25#include <esp_ota_ops.h>
26#include <esp_partition.h>
27#include <queue>
28#include "intf/http/message.hpp"
29
30namespace mw::ota {
31
32class Service {
33public:
34 Service();
35
36 esp_err_t socket(intf::http::Message& msg);
37
38private:
39 // This gets called by FreeRTOS
40 [[noreturn]] void taskFunction(void*);
41
42 void loop();
43 uint8_t write(std::vector<uint8_t> const& payload);
44 void end();
45 void close();
46
47 std::queue<intf::http::Message> _queue{};
48 esp_partition_t const* _partition{};
49 esp_ota_handle_t _handle{};
50 uint8_t _ack{};
51};
52
53} // namespace mw::ota
uint8_t _ack
Definition service.hpp:50
void loop()
Definition service.cpp:70
void taskFunction(void *)
Definition service.cpp:61
esp_partition_t const * _partition
Definition service.hpp:48
void close()
Definition service.cpp:148
void end()
Definition service.cpp:137
Service()
Definition service.cpp:36
esp_err_t socket(intf::http::Message &msg)
Definition service.cpp:41
esp_ota_handle_t _handle
Definition service.hpp:49
std::queue< intf::http::Message > _queue
Definition service.hpp:47
uint8_t write(std::vector< uint8_t > const &payload)
Definition service.cpp:115
HTTP websocket message.
Definition config.hpp:529
Definition message.hpp:29