@aha_1980 i call setConfiguration parameter in my class constructor.
Here is my class header
#ifndef CANOPENDEVICE_H
#define CANOPENDEVICE_H
#include <QObject>
#include <QSettings>
#include <QQmlEngine>
#include "protocolmanager.h"
#include "ByteArrayQmlWrapper.h"
#include "objectdictionary.h"
#include "TypesQmlWrapper.h"
#include "QQmlVarPropertyHelpers.h"
#include "QQmlConstRefPropertyHelpers.h"
#include "QQmlPtrPropertyHelpers.h"
#include "edsreader.h"
#include "QQmlEnumClassHelper.h"
#include "QQmlObjectListModel.h"
#include "QQmlListPropertyHelper.h"
QML_ENUM_CLASS (CanOpenNmtCmd,
StartNode = 0x01,
StopNode = 0x02,
SetPreOp = 0x80,
ResetNode = 0x81,
ResetComm = 0x82,
NB_CMDS)
QML_ENUM_CLASS (CanOpenLssCommands,
SwitchState = 0x04,
ChangeNodeId = 0x11,
ChangeBitrate = 0x13,
StoreConfig = 0x17,
NB_CMDS)
class CanOpenDevice: public QObject
{
Q_OBJECT
QML_WRITABLE_VAR_PROPERTY(CanOpenNodeId,nodeId)
QML_WRITABLE_VAR_PROPERTY (bool, isMaster)
QML_WRITABLE_PTR_PROPERTY (QCanBusDevice, device)
QML_WRITABLE_PTR_PROPERTY(ProtocolManager,protocolManager)
QML_WRITABLE_VAR_PROPERTY (QString, edsFileName)
QML_WRITABLE_VAR_PROPERTY(QString,deviceName)
QML_WRITABLE_VAR_PROPERTY(QStringList,deviceInfo)
QML_WRITABLE_VAR_PROPERTY(QStringList,subEntriesList)
QML_WRITABLE_VAR_PROPERTY(QStringList,entries)
QML_WRITABLE_VAR_PROPERTY(QString, deviceProfile)
public:
explicit CanOpenDevice(QObject *parent=Q_NULLPTR);
CanOpenDevice(const CanOpenNodeId &nodeId,const QString &identNumber,QObject *parent=nullptr);
void init(void);
void start();
void stop(void);
void reset(void);
void createDevice(QString plugin,QString interface);
void setConfiguration(int key);
ProtocolManager * getProtocolManger();
ObjectDictionary * getObjectDictionary();
Q_INVOKABLE ByteArrayWrapper * createBufferFromInt8 (const QmlBiggestInt value);
Q_INVOKABLE ByteArrayWrapper * createBufferFromInt16 (const QmlBiggestInt value);
Q_INVOKABLE ByteArrayWrapper * createBufferFromInt32 (const QmlBiggestInt value);
Q_INVOKABLE ByteArrayWrapper * createBufferFromUInt8 (const QmlBiggestInt value);
Q_INVOKABLE ByteArrayWrapper * createBufferFromUInt16 (const QmlBiggestInt value);
Q_INVOKABLE ByteArrayWrapper * createBufferFromUInt32 (const QmlBiggestInt value);
Q_INVOKABLE ByteArrayWrapper * createBufferFromHex (const QString & hex);
Q_INVOKABLE ByteArrayWrapper * createBufferFromString (const QString & str);
Q_INVOKABLE ByteArrayWrapper * readValue (const int index, const int subIndex);
Q_INVOKABLE void changeValue (const int index, const int subIndex, ByteArrayWrapper * buffer);
Q_INVOKABLE void sendNmtChangeRequest (const int nodeId, const CanOpenNmtCmd::Type state);
Q_INVOKABLE void sendLssActionRequest (const CanOpenLssCommands::Type cmd, const int argument = 0);
Q_INVOKABLE void sendSdoReadRequest (const int nodeId, const int index, const int subIndex, const bool blockMode = false);
Q_INVOKABLE void sendSdoWriteRequest (const int nodeId, const int index, const int subIndex, ByteArrayWrapper * buffer);
Q_INVOKABLE void writeValuetoSubEntry(ObjDicIndex index,ObjDicSubIndex subIndex,QString value);
Q_INVOKABLE QString getParameterNameforSubEntry(QString subEntry);
void getWritableEntries();
Q_INVOKABLE QString entryParamName(QString idxStr);
Q_INVOKABLE QString getDefaultValue(QString subIdx);
Q_INVOKABLE void modifyValue(QString val,QString subEntry);
Q_INVOKABLE QStringList getSubEntries(QString entry);
Q_INVOKABLE void dataToCan(QString entry);
public slots:
Q_INVOKABLE void loadObjectDictionary(QString edsFilePath);
//Q_INVOKABLE bool writeValueToEntry();
protected slots:
//void onCanOpenParamChanged(void);
signals:
void initialized(quint32 bitRateKey,QString plugin="systeccan",QString interface = "can");
void started(void);
void stopped(void);
void reseting(void);
void EntryWritten();
void loaded(QString edsFilePath);
private:
bool m_ready;
bool m_running;
QString m_interface;
QString m_plugin;
EdsReader *m_edsReader;
QSettings *m_setting;
ObjectDictionary *m_obd;
};
#endif // CANOPENDEVICE_H