Table of Contents

Class DeviceObservation<TSnapshot>

Namespace
PanasonicComfortCloudClient
Assembly
PanasonicComfortCloudClient.dll

Tracks typed observations explicitly for an application, replacing the upstream mutable-device load/change helpers.

public sealed class DeviceObservation<TSnapshot> where TSnapshot : class

Type Parameters

TSnapshot

The modeled state or energy type.

Inheritance
DeviceObservation<TSnapshot>
Inherited Members

Remarks

Updates and individual property reads are synchronized. Current returns an independent coherent snapshot. No background work, disk storage or events are created. Use one tracker for one device and one response family; do not concurrently mutate caller-owned input models during an update.

Constructors

DeviceObservation(DeviceInfo)

Tracks typed observations explicitly for an application, replacing the upstream mutable-device load/change helpers.

public DeviceObservation(DeviceInfo device)

Parameters

device DeviceInfo

The device whose state this object owns.

Remarks

Updates and individual property reads are synchronized. Current returns an independent coherent snapshot. No background work, disk storage or events are created. Use one tracker for one device and one response family; do not concurrently mutate caller-owned input models during an update.

Properties

Current

Gets an independent copy of the latest accepted snapshot.

public TSnapshot? Current { get; }

Property Value

TSnapshot

The typed state, or null before the first observation.

Device

Gets the device description.

public DeviceInfo Device { get; }

Property Value

DeviceInfo

The explicitly supplied discovery model.

HasChanged

Gets whether the most recent update changed the modeled state.

public bool HasChanged { get; }

Property Value

bool

False before the first update, then the result of the latest update.

LastChanged

Gets when the modeled snapshot most recently changed.

public DateTimeOffset? LastChanged { get; }

Property Value

DateTimeOffset?

The first observation or latest changed-state instant, independent of polling frequency.

ObservedAt

Gets the latest observation time.

public DateTimeOffset? ObservedAt { get; }

Property Value

DateTimeOffset?

The supplied UTC receipt instant, or null before an observation.

Methods

Update(TSnapshot, DateTimeOffset)

Loads a typed snapshot without aliasing the caller's mutable object.

public bool Update(TSnapshot snapshot, DateTimeOffset observedAt)

Parameters

snapshot TSnapshot

The newly read state.

observedAt DateTimeOffset

Its receipt instant.

Returns

bool

True on the first observation or a changed serialized state.