Motion Master
Loading...
Searching...
No Matches
flash.h
Go to the documentation of this file.
1#pragma once
2
3#include <readerwriterqueue/readerwriterqueue.h>
4
5#include <chrono>
6#include <functional>
7#include <map>
8#include <vector>
9
10#include "motion-master.pb.h"
11
12class EthercatSlave;
15
16class Flash {
17 public:
29 Flash(VirtualDeviceManager &vdm, uint32_t device_address, const char *data,
30 size_t size, bool skip_sii_installation);
31
42
43 moodycamel::ReaderWriterQueue<motionmaster::MotionMasterMessage::Status *> &
45
46 private:
48 EthercatSlave *slave_;
49
50 std::map<std::string, std::vector<uint8_t>> unzipped_files_;
51 std::string sii_file_name_;
52 std::string app_file_name_;
53 std::string com_file_name_;
54
55 bool skip_sii_installation_ = false;
56
57 std::pair<uint8_t, uint8_t> progress_range_;
58 uint8_t progress_percentage_ = 0;
59 std::string progress_message_;
60
61 moodycamel::ReaderWriterQueue<motionmaster::MotionMasterMessage::Status *>
62 outgoing_status_message_queue_;
63
64 std::function<void(uint8_t)> progress_callback_;
65
74 MotionMasterError flash_bin_file(const std::string &file_name,
75 const std::vector<uint8_t> &content);
76
83 void send_progress(uint8_t percentage, const std::string &message = "");
84
91 void send_warning(motionmaster::MotionMasterMessage::Status::
92 DeviceFirmwareInstallation::Warning::Code warning_code,
93 const std::string &message = "");
94};
Definition: ethercat_slave.h:11
Definition: flash.h:16
moodycamel::ReaderWriterQueue< motionmaster::MotionMasterMessage::Status * > & get_status_message_queue()
Definition: flash.cc:284
MotionMasterError start()
Start the installation of the package files.
Definition: flash.cc:115
Definition: motion_master_error.h:6
Definition: virtual_device_manager.h:16