24 #include "GrblPlatformDevice.hpp"
26 #include <ccut/async.hpp>
28 #include "GrblPlatform.hpp"
29 #include "util/grbl/GrblParser.hpp"
31 using namespace logger;
33 using namespace smc::internal;
37 GrblPlatformDevice::GrblPlatformDevice(
38 const std::string &uid,
39 const std::shared_ptr<GrblPlatform> &grbl) :
44 std::future<std::set<std::string>> GrblPlatformDevice::listConfig()
const
48 std::shared_ptr<GrblPlatform> grbl(m_grbl.lock());
50 throw Exception(ErrorCode::Canceled,
"platform stopped (deleted)");
52 return grbl->run<std::set<std::string>>([](
ImmediateCmd &cmd,
54 cmd.prom->get<std::set<std::string>>().set_value(ctx.listConfig());
59 return ccut::make_future_error<std::set<std::string>>(ex);
64 const std::string &name)
const
68 std::shared_ptr<GrblPlatform> grbl(m_grbl.lock());
70 throw Exception(ErrorCode::Canceled,
"platform stopped (deleted)");
72 return grbl->run<std::string>(
75 GrblPlatform::LocalSettingMap::const_iterator itls =
76 ctx.localSetting.find(name);
77 if (itls != ctx.localSetting.end())
78 ret = itls->second.get(ctx);
80 ret = ctx._sendGetSetting(ctx.findSetting(name).id);
81 cmd.prom->get<std::string>().set_value(ret);
86 return ccut::make_future_error<std::string>(ex);
91 const std::string &value)
const
95 std::shared_ptr<GrblPlatform> grbl(m_grbl.lock());
97 throw Exception(ErrorCode::Canceled,
"platform stopped (deleted)");
99 return grbl->run<
void>(
101 ctx.setSetting(name, value);
102 cmd.prom->get<
void>().set_value();
107 return ccut::make_future_error(ex);
Exception thrown by MotionController in case of issues with command.
main motion-lib namespace