Device Provider
- Copyright:
- Kiwigrid GmbH 2014-2015
- Source:
Classes
Methods
- <inner> $delete() → {promise}
- <inner> $reset() → {undefined}
- <inner> $update() → {promise}
- <inner> create(eventBus, properties) → {DeviceInstance}
-
<inner> $delete() → {promise}
-
Deletes a remote DeviceInstance from local one the method is called on.
- Source:
Returns:
promise promiseExample
angular.module('exampleApp', ['keta.services.Device']) .controller('ExampleController', function(ketaDevice) { var device = ketaDevice.create({ guid: 'guid' }); device.$delete() .then(function(reply) { // success handler // ... }, function(reply) { // error handler // ... }); });
-
<inner> $reset() → {undefined}
-
Resets a DeviceInstance to it's $pristine state.
- Source:
Returns:
undefined nothingExample
angular.module('exampleApp', ['keta.services.Device']) .controller('ExampleController', function(ketaDevice) { var device = ketaDevice.create({ guid: 'guid', tagValues: { IdName: { name: 'IdName', value: 'Device', oca: 0, timestamp: 123456789 } } }); device.tagValues.IdName.value = 'Modified Device'; device.$update() .then(function(reply) { // success handler // ... }, function(reply) { // error handler device.$reset(); }); });
-
<inner> $update() → {promise}
-
Updates a remote DeviceInstance from local one the method is called on.
Only value changes in
tagValues
property will be recognized as changes.- Source:
Returns:
promise promiseExample
angular.module('exampleApp', ['keta.services.Device']) .controller('ExampleController', function(ketaDevice) { var device = ketaDevice.create({ guid: 'guid', tagValues: { IdName: { name: 'IdName', value: 'Device', oca: 0, timestamp: 123456789 } } }); device.tagValues.IdName.value = 'Modified Device'; device.$update() .then(function(reply) { // success handler // ... }, function(reply) { // error handler // ... }); });
-
<inner> create(eventBus, properties) → {DeviceInstance}
-
Creates a DeviceInstance with given EventBus instance and properties.
Parameters:
Name Type Description eventBus
EventBus EventBus instance to use for communication properties
Object Properties to set upon DeviceInstance creation - Source:
Returns:
DeviceInstance DeviceInstance createdExample
angular.module('exampleApp', ['keta.services.Device']) .controller('ExampleController', function(ketaDevice) { var device = ketaDevice.create(eventBus, { tagValues: { IdName: { name: 'IdName', value: 'Device', oca: 0, timestamp: 123456789 } } }); });