Structure
TemperatureEvent
public struct TemperatureEvent: Codable, Equatable
A temperature event that is sent for temperature sensors every heartbeat, and whenever the sensor is touched.
See the Developer Website for more details.
Relationships
Nested Types
TemperatureEvent.TemperatureSample
Represents a temperature value sampled within a single heartbeat.
Conforms To
PublishableEvent
Used by event types (such as
TouchEvent
) to indicate that they can be published to the device emulator.Codable
Equatable
Initializers
init(celsius:timestamp:samples:)
public init(celsius: Float, timestamp: Date, samples: [TemperatureSample]? = nil)
Creates a new TemperatureEvent
using celsius.
init(fahrenheit:timestamp:samples:)
public init(fahrenheit: Float, timestamp: Date, samples: [TemperatureSample]? = nil)
Creates a new TemperatureEvent
using fahrenheit.
init(from:)
public init(from decoder: Decoder) throws
Properties
timestamp
public let timestamp: Date
The timestamp of when the temperature event was received by a Cloud Connector.
samples
public let samples: [TemperatureSample]
An array of temperature values sampled within a single heartbeat. The order is the same as the order of events, meaning newest is last.
eventType
public var eventType: EventType
Methods
encode(to:)
public func encode(to encoder: Encoder) throws