Ultimaker / CuraEngine

Powerful, fast and robust engine for converting 3D models into g-code instructions for 3D printers. It is part of the larger open source project Cura.
https://ultimaker.com/en/products/cura-software
GNU Affero General Public License v3.0
1.67k stars 880 forks source link

CURA 10618 broadcast settings to engine plugins #1889

Closed jellespijker closed 1 year ago

jellespijker commented 1 year ago

Description

It is now possible to Broadcast the Settings as provided by Cura to all plugins, provided that plugin subscribes to the channel. This information has to be given by the front-end.

Adding a new Broadcast requires the following steps:

  1. CuraEngine_grpc_defintions a. Add a BroadcastService<Name>Request message b. Add a new RPC to all Slot Services rpc Broadcast<Name>(cura.plugins.v0.BroadcastService<Name>Request) returns (google.protobuf.Empty) {}
  2. CuraEngine a. Add Converter for the BroadcastService<Name>Request from the Native types to plugins/converters.h called broadcast_<name>_request b. Add a factory function to plugins/broadcasts.h which will return the converter
     template<CharRangeLiteral BroadcastChannel>
     requires is_broadcast_channel_v<BroadcastChannel, "Broadcast<Name>">
     constexpr auto broadcast_request_message_factory(auto&&... args)
     {
         return broadcast_<name>_request{}(std::forward<decltype(args)>(args)...);
     };

    c. Add a factory function to plugins/broadcast.h which will return the RPC

      template<class Stub, CharRangeLiteral BroadcastChannel>
      requires is_broadcast_channel_v<BroadcastChannel, "Broadcast<Name>">
      constexpr auto broadcast_request_factory()
      {
          return agrpc::RPC<&Stub::PrepareAsyncBroadcast<Name>>{};
      }

    d. Usage of in the engine will then be: slots::instance().broadcast<"Broadcast<Name>">(<args>);

See also PR:

github-actions[bot] commented 1 year ago

Unit Test Results

26 tests  ±0   26 :heavy_check_mark: ±0   13s :stopwatch: +4s   1 suites ±0     0 :zzz: ±0    1 files   ±0     0 :x: ±0 

Results for commit 1060ba9a. ± Comparison against base commit 536fcbf6.

:recycle: This comment has been updated with latest results.

jellespijker commented 1 year ago

Superseded by #1900