Disruptive Documentation

Structure Device

public struct Device: Decodable, Equatable  

Represents a Sensor or Cloud Connector from Disruptive Technologies.

%329 Device Device Equatable Equatable Device->Equatable Decodable Decodable Device->Decodable

Nested Types

Device.DeviceType

Represents the type of a Device.

Device.ReportedEvents

Represents the latest known reported values for a Device. Any of the event types that is not available for that particular device type, or that have not yet received an event, will be nil.

Conforms To

Decodable
Equatable

Initializers

init(identifier:​display​Name:​project​ID:​labels:​type:​product​Number:​reported​Events:​is​Emulated​Device:​)

public init(identifier: String, displayName: String, projectID: String, labels: [String: String], type: DeviceType, productNumber: String?, reportedEvents: ReportedEvents, isEmulatedDevice: Bool) 

Creates a new Device. Creating a new device can be useful for testing purposes.

init(from:​)

public init(from decoder: Decoder) throws  

Properties

identifier

public let identifier: String

The unique identifier of the device. This will be different from the name field in the REST API in that it is just the identifier without the projects/*/devices/ prefix.

display​Name

public var displayName: String

The display name of the device.

project​ID

public let projectID: String

The identifier of the project the device is in.

labels

public let labels: [String: String] 

The labels that are currently set on the device. This will also include the displayName of the device as a label with the key name.

type

public let type: DeviceType

The type of the device. What type the device is determines which types of events it will receive.

product​Number

public let productNumber: String? 

The product number of the device. This is the same product number that can be found on the support pages for both Sensors and Cloud Connectors.

reported​Events

public var reportedEvents: ReportedEvents

The last known reported event for each available event type for the device. Which of these are available is dependent on the device type.

is​Emulated​Device

public let isEmulatedDevice: Bool

Indicates whether the device is a real physical device or an emulated one.