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
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 "http/message.hpp"
29
30namespace ota {
31
32class Service {
33public:
34 explicit Service(BaseType_t xCoreID);
35 ~Service();
36
37 esp_err_t socket(http::Message& msg);
38
39private:
40 // This gets called by FreeRTOS
41 void taskFunction(void*);
42
43 void loop();
44 uint8_t write(std::vector<uint8_t> const& payload);
45 void end();
46 void close();
47
48 std::queue<http::Message> _queue{};
49 esp_partition_t const* _partition{};
50 esp_ota_handle_t _handle{};
51 uint8_t _ack{};
52};
53
54} // namespace ota
Definition service.hpp:32
std::queue< http::Message > _queue
Definition service.hpp:48
void end()
Definition service.cpp:152
esp_ota_handle_t _handle
Definition service.hpp:50
~Service()
Definition service.cpp:47
uint8_t _ack
Definition service.hpp:51
void loop()
Definition service.cpp:83
Service(BaseType_t xCoreID)
Definition service.cpp:35
esp_partition_t const * _partition
Definition service.hpp:49
esp_err_t socket(http::Message &msg)
Definition service.cpp:52
uint8_t write(std::vector< uint8_t > const &payload)
Definition service.cpp:130
void taskFunction(void *)
Definition service.cpp:72
void close()
Definition service.cpp:163
HTTP websocket message.
Definition config.hpp:328
Definition message.hpp:29