-
-
Notifications
You must be signed in to change notification settings - Fork 889
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NP- 327 emscripten communication (#2131)
- Loading branch information
Showing
18 changed files
with
317 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright (c) 2024 UltiMaker | ||
// CuraEngine is released under the terms of the AGPLv3 or higher | ||
|
||
#ifndef EMSCRIPTENCOMMUNICATION_H | ||
#define EMSCRIPTENCOMMUNICATION_H | ||
#ifdef __EMSCRIPTEN__ | ||
|
||
#include "communication/CommandLine.h" | ||
|
||
namespace cura | ||
{ | ||
|
||
/** | ||
* \class EmscriptenCommunication | ||
* \brief A class for handling communication in an Emscripten environment. | ||
* | ||
* This class extends the CommandLine class and provides specific implementations | ||
* for sending progress and handling slice information in an Emscripten environment. | ||
*/ | ||
class EmscriptenCommunication : public CommandLine | ||
{ | ||
private: | ||
std::string progress_handler_; ///< Handler for progress messages. | ||
std::string gcode_header_handler_; ///< Handler for getting the GCode handler. | ||
std::string slice_info_handler_; ///< Handler for slice information messages. | ||
|
||
/** | ||
* \brief Creates a message containing slice information. | ||
* \return A string containing the slice information message. | ||
*/ | ||
[[nodiscard]] static std::string createSliceInfoMessage(); | ||
|
||
public: | ||
/** | ||
* \brief Constructor for EmscriptenCommunication. | ||
* \param arguments A vector of strings containing the command line arguments. | ||
*/ | ||
EmscriptenCommunication(const std::vector<std::string>& arguments); | ||
|
||
/** | ||
* \brief Sends the progress of the current operation. | ||
* \param progress A double representing the progress percentage. | ||
*/ | ||
void sendProgress(double progress) const override; | ||
|
||
/** | ||
* \brief Sends GcodeHeader | ||
*/ | ||
void sendGCodePrefix(const std::string& prefix) const override; | ||
|
||
/** | ||
* \brief Initiates the slicing of the next item. | ||
*/ | ||
void sliceNext() override; | ||
|
||
bool isSequential() const override | ||
{ | ||
return false; | ||
} | ||
}; | ||
|
||
} // namespace cura | ||
|
||
#endif // __EMSCRIPTEN__ | ||
#endif // EMSCRIPTENCOMMUNICATION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.