|
@@ -372,6 +372,7 @@ executing the device script.
|
372
|
372
|
void JavaScriptDevice::start()
|
373
|
373
|
{
|
374
|
374
|
QScriptValue object = scriptengine->newQObject(this);
|
|
375
|
+ @<Expose device settings as object property@>@;
|
375
|
376
|
QScriptContext *context = scriptengine->currentContext();
|
376
|
377
|
QScriptValue oldThis = context->thisObject();
|
377
|
378
|
context->setThisObject(object);
|
|
@@ -381,6 +382,20 @@ void JavaScriptDevice::start()
|
381
|
382
|
context->setThisObject(oldThis);
|
382
|
383
|
}
|
383
|
384
|
|
|
385
|
+@ Device settings are only needed from the device script itself. As such, these
|
|
386
|
+are presented under a settings property available from the |this| object when
|
|
387
|
+the script is run.
|
|
388
|
+
|
|
389
|
+@<Expose device settings as object property@>=
|
|
390
|
+QScriptValue settingsObject = scriptengine->newObject();
|
|
391
|
+QVariantMap::const_iterator i = deviceSettings.constBegin();
|
|
392
|
+while(i != deviceSettings.constEnd())
|
|
393
|
+{
|
|
394
|
+ settingsObject.setProperty(i.key(), i.value().toString());
|
|
395
|
+ i++;
|
|
396
|
+}
|
|
397
|
+object.setProperty("settings", settingsObject);
|
|
398
|
+
|
384
|
399
|
@ Currently we require wrapper functions to work with channels in the host
|
385
|
400
|
environment.
|
386
|
401
|
|