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 uint32_t device_address_;
51 std::vector<uint8_t> zip_data_;
52 std::map<std::string, std::vector<uint8_t>> unzipped_files_;
53 std::string sii_file_name_;
54 std::string app_file_name_;
55 std::string com_file_name_;
56
57 bool skip_sii_installation_ = false;
58
59 std::pair<uint8_t, uint8_t> progress_range_;
60 uint8_t progress_percentage_ = 0;
61 std::string progress_message_;
62
63 moodycamel::ReaderWriterQueue<motionmaster::MotionMasterMessage::Status *>
64 outgoing_status_message_queue_;
65
66 std::function<void(uint8_t)> progress_callback_;
67
76 MotionMasterError flash_bin_file(const std::string &file_name,
77 const std::vector<uint8_t> &content);
78
85 void send_progress(uint8_t percentage, const std::string &message = "");
86
93 void send_warning(motionmaster::MotionMasterMessage::Status::
94 DeviceFirmwareInstallation::Warning::Code warning_code,
95 const std::string &message = "");
96};
Definition: ethercat_slave.h:11
Definition: flash.h:16
moodycamel::ReaderWriterQueue< motionmaster::MotionMasterMessage::Status * > & get_status_message_queue()
Definition: flash.cc:361
MotionMasterError start()
Start the installation of the package files.
Definition: flash.cc:133
Definition: motion_master_error.h:6
Definition: virtual_device_manager.h:16