namespace SddpViewer
{
using System;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using Rssdp;
public partial class DiscoveredDeviceViewModel : ObservableObject
{
private readonly DiscoveredSsdpDevice device;
public DiscoveredDeviceViewModel(DiscoveredSsdpDevice device)
{
this.device = device;
}
///
/// Sets or returns the type of notification, being either a uuid, device type, service type or upnp:rootdevice.
///
public string NotificationType => this.device.NotificationType;
///
/// Sets or returns the universal service name (USN) of the device.
///
public string Usn => this.device.Usn;
///
/// Sets or returns a URL pointing to the device description document for this device.
///
public Uri DescriptionLocation => this.device.DescriptionLocation;
///
/// Sets or returns the length of time this information is valid for (from the time).
///
public TimeSpan CacheLifetime => this.device.CacheLifetime;
///
/// Sets or returns the date and time this information was received.
///
public DateTimeOffset AsAt => this.device.AsAt;
[ObservableProperty]
private string _friendlyName = "";
public async Task GetFurtherInformationAsync()
{
var ssdpDevice = await this.device.GetDeviceInfo().ConfigureAwait(false);
FriendlyName = ssdpDevice.FriendlyName;
}
}
}