AtCore  1.0.70
AtCore is a API to manage the serial connection between the computer and 3D Printers.
Classes | Public Types | Signals | Public Member Functions | Static Public Member Functions | Properties | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
MachineInfo Class Reference

#include <machineinfo.h>

Inheritance diagram for MachineInfo:

Classes

struct  keyInfo
 used to hold MachineInfo::KEY name and defaultValues. More...
 

Public Types

enum  KEY {
  KEY::NAME = 0, KEY::BAUDRATE, KEY::FIRMWARE, KEY::MAXBEDTEMP,
  KEY::MAXEXTTEMP, KEY::POSTPAUSE, KEY::ISCARTESIAN, KEY::XMAX,
  KEY::YMAX, KEY::ZMAX, KEY::AUTOTEMPREPORT
}
 KEYS enum Possible keys for the printer settings. More...
 

Signals

void profilesChanged () const
 A profile has changed. More...
 

Public Member Functions

QObject * qmlSingletonRegister (QQmlEngine *engine, QJSEngine *scriptEngine)
 Register The MachineInfo Singleton for QML. More...
 
Q_INVOKABLE QVariantMap readProfile (const QString &profileName) const
 Read a full profile. More...
 
Q_INVOKABLE QVariant readKey (const QString &profileName, const MachineInfo::KEY key) const
 Read a key from a profile. More...
 
void storeProfile (const QMap< MachineInfo::KEY, QVariant > &profile) const
 Store a new profile, Must be used for new profiles. More...
 
Q_INVOKABLE void storeProfile (const QVariantMap &profile) const
 Store a new profile, Must be used for new profiles or to override a profile. More...
 
Q_INVOKABLE bool storeKey (const QString &profileName, const MachineInfo::KEY key, const QVariant &value) const
 Store a key to an existing profile, Sending a key of Key::NAME will rename the profile. More...
 
Q_INVOKABLE bool copyProfile (const QString &srcProfile, const QString &destProfile, bool rmSrc=false) const
 copyies a profile and optionally deletes the src profile More...
 
Q_INVOKABLE bool removeProfile (const QString &profileName) const
 Remove a full profile. More...
 
QStringList profileNames () const
 Get a list of all the profile names. More...
 
Q_INVOKABLE QString keyName (const MachineInfo::KEY key) const
 Translate a key enum to string. More...
 

Static Public Member Functions

static MachineInfoinstance ()
 Get the MachineInfo Instance. More...
 

Properties

QStringList profileNames
 

Private Member Functions

MachineInfooperator= (MachineInfo &other)=delete
 
 MachineInfo (const MachineInfo &other)=delete
 
 MachineInfo (QObject *parent=nullptr)
 
 ~MachineInfo ()=default
 

Private Attributes

QSettings * m_settings = nullptr
 m_settings our settings object. More...
 

Static Private Attributes

static const QMap< MachineInfo::KEY, MachineInfo::keyInfodecoderMap
 Map of MachineInfo::KEY , KeyString and DefaultValue. More...
 

Member Enumeration Documentation

◆ KEY

enum MachineInfo::KEY
strong

KEYS enum Possible keys for the printer settings.

Enumerator
NAME 

Profile Name.

BAUDRATE 

Machine BAUD Rate.

FIRMWARE 

Firmware name.

MAXBEDTEMP 

Maximum Bed Temperature.

MAXEXTTEMP 

Maximum Extruder Temperature.

POSTPAUSE 

Post Pause Commands.

ISCARTESIAN 

Is the machine Cartesian.

XMAX 

X Size for Cartesian machines, Radius for Deltas.

YMAX 

Y Size.

ZMAX 

Z Size for Cartesian machines, Height for Deltas.

AUTOTEMPREPORT 

Supports AutoTemp Reporting.

Constructor & Destructor Documentation

◆ MachineInfo() [1/2]

MachineInfo::MachineInfo ( const MachineInfo other)
privatedelete

◆ MachineInfo() [2/2]

MachineInfo::MachineInfo ( QObject *  parent = nullptr)
explicitprivate

◆ ~MachineInfo()

MachineInfo::~MachineInfo ( )
privatedefault

Member Function Documentation

◆ copyProfile()

bool MachineInfo::copyProfile ( const QString &  srcProfile,
const QString &  destProfile,
bool  rmSrc = false 
) const

copyies a profile and optionally deletes the src profile

Parameters
srcProfileprofiles Current Name
destProfileprofiles New Name
rmSrcdelete srcProfile (defalut false)
Returns
true if successful

◆ instance()

MachineInfo * MachineInfo::instance ( )
static

Get the MachineInfo Instance.

See also
qmlSingletonRegister()

◆ keyName()

QString MachineInfo::keyName ( const MachineInfo::KEY  key) const

Translate a key enum to string.

Parameters
keyname of the key to be translated.
Returns
key string if successful.

◆ operator=()

MachineInfo* MachineInfo::operator= ( MachineInfo other)
privatedelete

◆ profileNames()

QStringList MachineInfo::profileNames ( ) const

Get a list of all the profile names.

Returns
QStringList containing the stored profile names.

◆ profilesChanged

void MachineInfo::profilesChanged ( ) const
signal

A profile has changed.

◆ qmlSingletonRegister()

QObject * MachineInfo::qmlSingletonRegister ( QQmlEngine *  engine,
QJSEngine *  scriptEngine 
)

Register The MachineInfo Singleton for QML.

◆ readKey()

QVariant MachineInfo::readKey ( const QString &  profileName,
const MachineInfo::KEY  key 
) const

Read a key from a profile.

Parameters
profileNamename of the profile you want to read from.
keythe Key you want to read
Returns
The value of the requested Key
See also
readProfile()

◆ readProfile()

QVariantMap MachineInfo::readProfile ( const QString &  profileName) const

Read a full profile.

Parameters
profileNamename of the profile you want to read.
Returns
A full map of the profile
See also
readKey()

◆ removeProfile()

bool MachineInfo::removeProfile ( const QString &  profileName) const

Remove a full profile.

Parameters
profileNamename of the profile you want to remove.
Returns
true if successful.

◆ storeKey()

bool MachineInfo::storeKey ( const QString &  profileName,
const MachineInfo::KEY  key,
const QVariant &  value 
) const

Store a key to an existing profile, Sending a key of Key::NAME will rename the profile.

Parameters
profileNameprofile to write into
keyThe key you will write to
valueThe value you will store.
Returns
true if successful
See also
storeProfile()

◆ storeProfile() [1/2]

void MachineInfo::storeProfile ( const QMap< MachineInfo::KEY, QVariant > &  profile) const

Store a new profile, Must be used for new profiles.

Parameters
profileA complete machine profile or one that at very least has MachineInfo::Name and any other valid Key.
See also
storeKey()

◆ storeProfile() [2/2]

void MachineInfo::storeProfile ( const QVariantMap &  profile) const

Store a new profile, Must be used for new profiles or to override a profile.

Parameters
profileA complete machine profile or one that at very least has a profile Name and any other valid Key.
See also
storeKey()

Member Data Documentation

◆ decoderMap

const QMap< MachineInfo::KEY, MachineInfo::keyInfo > MachineInfo::decoderMap
staticprivate
Initial value:
= {{KEY::NAME, {QStringLiteral("Name"), QStringLiteral("ProfileName")}},
{KEY::BAUDRATE, {QStringLiteral("bps"), 115200}},
{KEY::FIRMWARE, {QStringLiteral("firmware"), QStringLiteral("Auto-Detect")}},
{KEY::MAXBEDTEMP, {QStringLiteral("maximumTemperatureBed"), 0}},
{KEY::MAXEXTTEMP, {QStringLiteral("maximumTemperatureExtruder"), 0}},
{KEY::POSTPAUSE, {QStringLiteral("postPause"), QString()}},
{KEY::ISCARTESIAN, {QStringLiteral("isCartesian"), false}},
{KEY::XMAX, {QStringLiteral("dimensionX"), 200}},
{KEY::YMAX, {QStringLiteral("dimensionY"), 200}},
{KEY::ZMAX, {QStringLiteral("dimensionZ"), 180}},
{KEY::AUTOTEMPREPORT, {QStringLiteral("autoReportTemp"), false}}}

Map of MachineInfo::KEY , KeyString and DefaultValue.

◆ m_settings

QSettings* MachineInfo::m_settings = nullptr
private

m_settings our settings object.

Property Documentation

◆ profileNames

QStringList MachineInfo::profileNames
read

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