emmellsoft / WinIoTCoreListener

A support library for discovering Windows IoT Core devices on a network, just like the WinIoTCoreWatcher application.
MIT License
6 stars 1 forks source link

Not working with Windows 10 IoT Core version 10.0.14393.187 #2

Open cristianst85 opened 7 years ago

cristianst85 commented 7 years ago

After updating Windows 10 IoT Core to the latest version (10.0.14393.187) the device is now sending packets with the length of 446 bytes.

Also, the WindowsIoTCoreWatcher utility is not listing the device anymore.

For some unknown reason I cannot attach the sample packet, but it can be download from here (the MAC address was eddited to ff:ff:ff:ff:ff:ff).

Thanks!

dotMorten commented 7 years ago

Discovery/Advertising of the portal is documented here: https://docs.microsoft.com/en-us/windows/uwp/debug-test-perf/device-portal#service-features-and-notes

dotMorten commented 7 years ago

here's a snippet for finding device portals and generating the url:

        private void FindDevices()
        {
            // Doc: https://docs.microsoft.com/en-us/windows/uwp/debug-test-perf/device-portal#service-features-and-notes
            var aqsFilter = "System.Devices.AepService.ProtocolId:={4526e8c1-8aac-4153-9b16-55e86ada0e54} AND System.Devices.Dnssd.Domain:=\"local\" AND System.Devices.Dnssd.ServiceName:=\"_wdp._tcp\"";
            var properties = new[] {
                "System.Devices.Dnssd.HostName",
                "System.Devices.Dnssd.ServiceName",
                "System.Devices.Dnssd.PortNumber",
                "System.Devices.Dnssd.TextAttributes",
                "System.Devices.IpAddress",
            };
            var watcher = DeviceInformation.CreateWatcher(aqsFilter, properties, DeviceInformationKind.AssociationEndpointService);
            watcher.Added += (sender, args) =>
            {
                Debug.WriteLine("Added: " + args.Name);
                var ipAddresses = args.Properties["System.Devices.IpAddress"] as string[];
                var remotePort = args.Properties["System.Devices.Dnssd.PortNumber"].ToString();
                var textAttributes = args.Properties["System.Devices.Dnssd.TextAttributes"] as string[];
                Debug.WriteLine($"\t{ipAddresses.FirstOrDefault()}:{remotePort} : {string.Join(",", textAttributes)}");
                string securePort = textAttributes.Where(t => t.StartsWith("S=")).Select(t => t.Substring(2)).FirstOrDefault() ?? "0";
                string scheme = "http";
                if (securePort != "0")
                {
                    scheme = "https";
                    remotePort = securePort;
                }
                string devicePortalUrl = $"{scheme}://{ipAddresses.FirstOrDefault()}:{remotePort}";"?";

            };
            watcher.Updated += (sender, args) =>  Debug.WriteLine("Updated: " + args.Id);
            watcher.EnumerationCompleted += (sender, args) => Debug.WriteLine("EnumerationCompleted");
            watcher.Start(); 
        }
cristianst85 commented 7 years ago

@dotMorten, thanks for feedback,

I also had an issue opened with MS, but they were not very helpful. I'll just leave the link here for further references: https://github.com/ms-iot/iot-utilities/issues/31.