Module: DeviceEvent

DeviceEvent

DeviceEvent Provider
Author:
  • Marco Lehmann <marco.lehmann (at) kiwigrid.com>
Source:

Classes

DeviceEvent
DeviceEventInstance
ketaDeviceEventProvider

Members

<inner, constant> CREATED

Type for created event.

Source:
Example
angular.module('exampleApp', ['keta.services.DeviceEvent'])
    .controller('ExampleController', function(ketaDeviceEvent) {
        if (type === ketaDeviceEvent.CREATED) {
            // ...
        }
    });

<inner, constant> DELETED

Type for deleted event.

Source:
Example
angular.module('exampleApp', ['keta.services.DeviceEvent'])
    .controller('ExampleController', function(ketaDeviceEvent) {
        if (type === ketaDeviceEvent.DELETED) {
            // ...
        }
    });

<inner, constant> UPDATED

Type for updated event.

Source:
Example
angular.module('exampleApp', ['keta.services.DeviceEvent'])
    .controller('ExampleController', function(ketaDeviceEvent) {
        if (type === ketaDeviceEvent.UPDATED) {
            // ...
        }
    });

Methods

<inner> create(type, device) → {DeviceEventInstance}

Creates a DeviceEventInstance with given type and Device instance.

Parameters:
Name Type Description
type string DeviceEvent type
device DeviceInstance Device instance
Source:
Returns:
DeviceEventInstance DeviceEventInstance created
Example
angular.module('exampleApp', ['keta.services.Device', 'keta.services.DeviceEvent'])
    .controller('ExampleController', function(ketaDevice, ketaDeviceEvent) {
        var device = ketaDevice.create(eventBus, {
            tagValues: {
                IdName: {
                    name: 'IdName',
                    value: 'Device',
                    oca: 0,
                    timestamp: 123456789
                }
            }
        });
        var deviceEvent = ketaDeviceEvent.create(DeviceEvent.TYPE_CREATED, device);
    });

<inner> getDevice() → {DeviceInstance}

Returns device of DeviceEvent.

Source:
Returns:
DeviceInstance device
Example
angular.module('exampleApp', ['keta.services.Device', 'keta.services.DeviceEvent'])
    .controller('ExampleController', function(ketaDevice, ketaDeviceEvent) {
        var device = ketaDevice.create({
            guid: 'guid'
        });
        var deviceEvent = ketaDeviceEvent.create(ketaDeviceEvent.TYPE_CREATED, device);
        var deviceEventDevice = deviceEvent.getDevice();
    });

<inner> getType() → {string}

Returns type of DeviceEvent.

Source:
Returns:
string type
Example
angular.module('exampleApp', ['keta.services.Device', 'keta.services.DeviceEvent'])
    .controller('ExampleController', function(ketaDevice, ketaDeviceEvent) {
        var device = ketaDevice.create({
            guid: 'guid'
        });
        var deviceEvent = ketaDeviceEvent.create(ketaDeviceEvent.TYPE_CREATED, device);
        var deviceEventType = deviceEvent.getType();
    });