54 lines
1.7 KiB
C#
54 lines
1.7 KiB
C#
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;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sets or returns the type of notification, being either a uuid, device type, service type or upnp:rootdevice.
|
|
/// </summary>
|
|
public string NotificationType => this.device.NotificationType;
|
|
|
|
/// <summary>
|
|
/// Sets or returns the universal service name (USN) of the device.
|
|
/// </summary>
|
|
public string Usn => this.device.Usn;
|
|
|
|
/// <summary>
|
|
/// Sets or returns a URL pointing to the device description document for this device.
|
|
/// </summary>
|
|
public Uri DescriptionLocation => this.device.DescriptionLocation;
|
|
|
|
/// <summary>
|
|
/// Sets or returns the length of time this information is valid for (from the <see cref="P:Rssdp.DiscoveredSsdpDevice.AsAt" /> time).
|
|
/// </summary>
|
|
public TimeSpan CacheLifetime => this.device.CacheLifetime;
|
|
|
|
/// <summary>
|
|
/// Sets or returns the date and time this information was received.
|
|
/// </summary>
|
|
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;
|
|
}
|
|
}
|
|
}
|