Disruptive Documentation

Structure Temperature​Event

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.

%321 TemperatureEvent TemperatureEvent PublishableEvent PublishableEvent TemperatureEvent->PublishableEvent Equatable Equatable TemperatureEvent->Equatable Codable Codable TemperatureEvent->Codable

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

celsius

public let celsius: Float

The temperature value in celsius.

fahrenheit

public let fahrenheit: Float

The temperature value in fahrenheit.

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.

event​Type

public var eventType: EventType  

Methods

encode(to:​)

public func encode(to encoder: Encoder) throws