-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfile.cs
More file actions
44 lines (42 loc) · 1.36 KB
/
file.cs
File metadata and controls
44 lines (42 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Net;
using System.Net.Sockets;
using System.Net.Http;
using System.IO;
using System.Text;
using System.Timers;
using System.Collections.Generic;
using Rssdp;
namespace webos_discovery
{
public class Webos
{
private HashSet<string> ips = new HashSet<string>();
public HashSet<string> find_devices()
{
using (var deviceLocator = new SsdpDeviceLocator())
{
deviceLocator.NotificationFilter = "urn:schemas-upnp-org:device:MediaRenderer:1";
var foundDevices = deviceLocator.SearchAsync();
while (!foundDevices.IsCompleted)
{
System.Threading.Thread.Sleep(100);
}
foreach (var foundDevice in foundDevices.Result)
{
var FullDevice = foundDevice.GetDeviceInfo();
while (!FullDevice.IsCompleted)
{
System.Threading.Thread.Sleep(100);
}
var full_device = FullDevice.Result;
if (full_device.ManufacturerUrl.ToString().ToLower().Contains("lg"))
{
ips.Add(foundDevice.DescriptionLocation.Host.ToString());
}
}
}
return ips;
}
}
}