Add function com.telldus.core.controller() to the script engine to iterate over controllers
This commit is contained in:
parent
5238978d32
commit
d5166d26f8
2 changed files with 22 additions and 0 deletions
|
@ -136,6 +136,26 @@ QVariant TelldusCoreObject::sensorValue(const QString &protocol, const QString &
|
|||
return retval;
|
||||
}
|
||||
|
||||
QVariant TelldusCoreObject::controller() const {
|
||||
const int DATA_LENGTH = 255;
|
||||
char name[DATA_LENGTH];
|
||||
int controllerId = 0, available = 0, controllerType = 0;
|
||||
|
||||
if (tdController(&controllerId, &controllerType, name, DATA_LENGTH, &available) != TELLSTICK_SUCCESS) {
|
||||
qDebug() << "Return null";
|
||||
return 0;
|
||||
}
|
||||
|
||||
QVariantMap retval;
|
||||
|
||||
retval["id"] = controllerId;
|
||||
retval["type"] = controllerType;
|
||||
retval["name"] = name;
|
||||
retval["available"] = available;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void TelldusCoreObject::triggerError(int deviceId, int errorId) {
|
||||
char *errorString = tdGetErrorString( errorId );
|
||||
QString message = QString::fromUtf8( errorString );
|
||||
|
|
|
@ -32,6 +32,8 @@ public slots:
|
|||
QVariant sensor() const;
|
||||
QVariant sensorValue(const QString &protocol, const QString &model, int id, int dataType) const;
|
||||
|
||||
QVariant controller() const;
|
||||
|
||||
int turnOn( int deviceId );
|
||||
int turnOff( int deviceId );
|
||||
int up( int deviceId );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue