mirror of
https://github.com/BotChain-Robots/control.git
synced 2026-03-10 00:32:26 +01:00
Formatting, add remote calling to c library
This commit is contained in:
38
examples/rpc_call/include/rpc/RemoteManagement.h
Normal file
38
examples/rpc_call/include/rpc/RemoteManagement.h
Normal file
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// Created by Johnathon Slightham on 2026-02-16.
|
||||
//
|
||||
|
||||
#ifndef REMOTEMANAGEMENT_H
|
||||
#define REMOTEMANAGEMENT_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
|
||||
#include "flatbuffers/OTAPacketBuilder.h"
|
||||
#include "libcontrol.h"
|
||||
|
||||
class RemoteManagement {
|
||||
public:
|
||||
RemoteManagement(uint8_t module_id, const std::string &path,
|
||||
std::shared_ptr<RobotController> controller)
|
||||
: m_module_id(module_id), m_file(path, std::ios::binary),
|
||||
m_builder(std::make_unique<Flatbuffers::OTAPacketBuilder>()),
|
||||
m_robot_controller(controller) {
|
||||
}
|
||||
bool perform_ota();
|
||||
void restart();
|
||||
|
||||
private:
|
||||
bool start_ota();
|
||||
bool write_ota(std::vector<uint8_t> &transmit_buffer);
|
||||
bool ota_end();
|
||||
|
||||
uint16_t m_sequence_num = 0;
|
||||
uint8_t m_module_id;
|
||||
std::ifstream m_file;
|
||||
std::unique_ptr<Flatbuffers::OTAPacketBuilder> m_builder;
|
||||
std::shared_ptr<RobotController> m_robot_controller;
|
||||
};
|
||||
|
||||
#endif // REMOTEMANAGEMENT_H
|
||||
Reference in New Issue
Block a user