Motion Master
Loading...
Searching...
No Matches
flash.h
Go to the documentation of this file.
1#pragma once
2
3#include <chrono>
4#include <functional>
5#include <map>
6#include <vector>
7
9#include "motion-master.pb.h"
10
11class EthercatSlave;
14
15class Flash {
16 public:
28 Flash(VirtualDeviceManager& vdm, uint32_t device_address, const char* data,
29 size_t size, bool skip_sii_installation,
30 std::vector<std::string> skip_files);
31
42
44 motionmaster::MotionMasterMessage::Status*>&
46
47 private:
49 EthercatSlave* slave_;
50
51 uint32_t device_address_;
52 std::vector<uint8_t> zip_data_;
53 std::map<std::string, std::vector<uint8_t>> unzipped_files_;
54 std::string sii_file_name_;
55 std::string app_file_name_;
56 std::string com_file_name_;
57
58 bool skip_sii_installation_ = false;
59
60 std::vector<std::string> skip_files_;
61
62 std::pair<uint8_t, uint8_t> progress_range_;
63 uint8_t progress_percentage_ = 0;
64 std::string progress_message_;
65
67 motionmaster::MotionMasterMessage::Status*>
68 outgoing_status_message_queue_;
69
70 std::function<void(uint8_t)> progress_callback_;
71
80 MotionMasterError flash_bin_file(const std::string& file_name,
81 const std::vector<uint8_t>& content);
82
89 void send_progress(uint8_t percentage, const std::string& message = "");
90
97 void send_warning(motionmaster::MotionMasterMessage::Status::
98 DeviceFirmwareInstallation::Warning::Code warning_code,
99 const std::string& message);
100};
Definition ethercat_slave.h:11
mm::core::containers::ThreadSafeQueue< motionmaster::MotionMasterMessage::Status * > & get_status_message_queue()
Definition flash.cc:376
MotionMasterError start()
Start the installation of the package files.
Definition flash.cc:144
Flash(VirtualDeviceManager &vdm, uint32_t device_address, const char *data, size_t size, bool skip_sii_installation, std::vector< std::string > skip_files)
Unpack the ZIP file and validate the files inside.
Definition flash.cc:20
Definition motion_master_error.h:6
Definition virtual_device_manager.h:16
Thread-safe FIFO queue with optional capacity limit.
Definition thread_safe_queue.h:23