Structure
Device
public struct Device: Decodable, Equatable
Represents a Sensor or Cloud Connector from Disruptive Technologies.
Functions relevant for Device
s are implemented on the Disruptive
struct:
Relationships
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 benil
.
Conforms To
Decodable
Equatable
Initializers
init(identifier:displayName:projectID:labels:type:productNumber:reportedEvents:isEmulatedDevice:)
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.
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.
productNumber
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.
reportedEvents
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
.
isEmulatedDevice
public let isEmulatedDevice: Bool
Indicates whether the device is a real physical device or an emulated one.