ThinkingHome.DeviceModel.FluentApi
ThinkingHome.DeviceModel.FluentApi
DeviceHostExtensions Class
Вход во fluent API — сахар над IDeviceHost. Любая цепочка сводится к пяти членам ядра, поэтому одинаково работает с локальным хостом и с прокси на хабе и не добавляет семантики: каждый метод — ровно один вызов ядра.
csharp
public static class DeviceHostExtensionsInheritance System.Object → DeviceHostExtensions
Methods
DeviceHostExtensions.Device(this IDeviceHost, string) Method
Хендл устройства — адрес, а не снимок: без I/O и без проверки существования (она всё равно ничего не гарантирует к моменту вызова). Отсутствие устройства обнаруживается на вызовах.
csharp
public static ThinkingHome.DeviceModel.FluentApi.DeviceHandle Device(this ThinkingHome.DeviceModel.IDeviceHost host, string deviceId);Parameters
host IDeviceHost
deviceId System.String
Returns
DeviceHostExtensions.OnChanged(this IDeviceHost, Action<StateChange>) Method
Подписка на изменения всех устройств хоста; отписка — Dispose.
csharp
public static System.IDisposable OnChanged(this ThinkingHome.DeviceModel.IDeviceHost host, System.Action<ThinkingHome.DeviceModel.State.StateChange> handler);Parameters
host IDeviceHost
handler System.Action<StateChange>