MotionLib  1.0.0
SamBuCa motion library
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
smc::internal::MGrblPlatform Class Reference
Inheritance diagram for smc::internal::MGrblPlatform:
Inheritance graph
[legend]
Collaboration diagram for smc::internal::MGrblPlatform:
Collaboration graph
[legend]

Classes

struct  Context
 
struct  ImmediateCmd
 

Public Types

typedef std::shared_ptr< MGrblPlatformShared
 
- Public Types inherited from smc::internal::PlatformBase
typedef std::shared_ptr< PlatformBaseShared
 
typedef std::set< DeviceBase::DeviceTypeDeviceTypeList
 
typedef std::list< DeviceBase::Shared > DeviceList
 

Public Member Functions

std::shared_ptr< MGrblPlatformshared_from_this ()
 
std::shared_ptr< const MGrblPlatformshared_from_this () const
 
DeviceTypeList getSupportedDevices () const override
 
DeviceList generateDevices (const DeviceTypeList &deviceType) override
 
void setNotificationWorker (const NotificationWorker::Shared &worker) override
 
std::future< mgrbl::Layout > getLayout ()
 retrieve current layout
 
void stop () override
 
void wake () override
 
void updateInstance (MGrblGpio &gpio) const
 update instance ptr related to the given gpio More...
 
void updateInstance (MGrblAxis &axis) const
 update instance ptr related to the given axis More...
 
void updateInstance (MGrblTrigger &trigger) const
 update instance ptr related to the given trigger More...
 
const std::string & mainTriggerUrl () const
 
std::shared_ptr< GrblPlatformgetFirstInstance () const
 return first instance More...
 
std::shared_ptr< GrblPlatformgetInstance (mgrbl::Instance instance) const
 get instance related to the given axis More...
 
void runOnInstance (Context &ctx, std::function< void(GrblPlatform::Shared &platform, GrblPlatform::Context &ctx)> fun, bool onlyFirst=false) const
 run the given lambda on all grbl sub-platforms More...
 
template<typename T >
std::future< T > run (std::function< void(ImmediateCmd &, Context &)> fun)
 
void loadLayout (Context &ctx)
 
void getBuildInfo (Context &ctx)
 
- Public Member Functions inherited from smc::internal::PlatformBase
void notify (const DeviceId &id)
 
void notify (std::set< DeviceId > &&ids)
 

Static Public Member Functions

static PlatformBase::Shared create (const ccut::yml::NodeRef &config)
 Create new instance of MGrblPlatform and return shared_ptr owning it.
 

Protected Member Functions

 MGrblPlatform (const ccut::yml::NodeRef &node, Context *data=nullptr)
 internal constructor to use this as a sub-platform (MGrblPlatform) More...
 
void processMessage (const std::string &message)
 
virtual MGrblAxis::Shared createAxis (const std::string &uid, const std::shared_ptr< GrblPlatform > &grbl)
 
void thread_func () override
 
virtual void processUpdate (Context &ctx)
 device status update function More...
 
bool processImmediate (Context &ctx)
 
void createPlatforms (Context &ctx)
 
void clearQueue (const std::string &msg)
 
std::vector< std::shared_ptr< GrblPlatform > > getPlatforms () const
 

Protected Attributes

std::unique_ptr< Contextm_ctx
 
std::mutex m_lock
 
std::vector< std::shared_ptr< GrblPlatform > > m_platforms
 
std::map< std::string, std::size_t > m_triggers
 
std::map< std::string, std::size_t > m_gpios
 
const std::string m_mainTriggerUrl
 
mgrbl::Layout m_layout
 
ccut::Connection m_dataConn
 
std::queue< ImmediateCmdm_immediate
 
- Protected Attributes inherited from smc::internal::PlatformBase
std::weak_ptr< NotificationWorkerm_notificationWorker
 

Detailed Description

Definition at line 53 of file MGrblPlatform.hpp.

Constructor & Destructor Documentation

◆ MGrblPlatform()

smc::internal::MGrblPlatform::MGrblPlatform ( const ccut::yml::NodeRef &  node,
Context data = nullptr 
)
explicitprotected

internal constructor to use this as a sub-platform (MGrblPlatform)

Parameters
prefixthe platform uri prefix to use
datathe internal data pointer
nodethe yaml configuration

Definition at line 52 of file MGrblPlatform.cpp.

Here is the caller graph for this function:

Member Function Documentation

◆ getFirstInstance()

GrblPlatform::Shared smc::internal::MGrblPlatform::getFirstInstance ( ) const

return first instance

used to run ImmediateCmd on controller

Exceptions
Exception(returned instance is always valid)

Definition at line 114 of file MGrblPlatform.cpp.

Here is the caller graph for this function:

◆ getInstance()

std::shared_ptr<GrblPlatform> smc::internal::MGrblPlatform::getInstance ( mgrbl::Instance  instance) const
inline

get instance related to the given axis

Exceptions
Exception(returned instance is always valid)

Definition at line 132 of file MGrblPlatform.hpp.

◆ processUpdate()

void smc::internal::MGrblPlatform::processUpdate ( Context ctx)
protectedvirtual

device status update function

updates device information must be called from processing thread

Reimplemented in smc::internal::MFEPlatform.

Definition at line 365 of file MGrblPlatform.cpp.

◆ runOnInstance()

void smc::internal::MGrblPlatform::runOnInstance ( Context ctx,
std::function< void(GrblPlatform::Shared &platform, GrblPlatform::Context &ctx)>  fun,
bool  onlyFirst = false 
) const

run the given lambda on all grbl sub-platforms

Parameters
ctxused to enforce this method to be called from thread context
funlambda to execute

Definition at line 183 of file MGrblPlatform.cpp.

Here is the call graph for this function:

◆ updateInstance() [1/3]

void smc::internal::MGrblPlatform::updateInstance ( MGrblAxis axis) const

update instance ptr related to the given axis

Exceptions
Exceptionon unknown object

Definition at line 124 of file MGrblPlatform.cpp.

Here is the call graph for this function:

◆ updateInstance() [2/3]

void smc::internal::MGrblPlatform::updateInstance ( MGrblGpio gpio) const

update instance ptr related to the given gpio

Exceptions
Exceptionon unknown object

Definition at line 162 of file MGrblPlatform.cpp.

Here is the call graph for this function:

◆ updateInstance() [3/3]

void smc::internal::MGrblPlatform::updateInstance ( MGrblTrigger trigger) const

update instance ptr related to the given trigger

Exceptions
Exceptionon unknown object

Definition at line 142 of file MGrblPlatform.cpp.

Here is the call graph for this function:

The documentation for this class was generated from the following files: