예제 #1
0
        private void MakeDiscoverable(string name)
        {
            if (_ssdpServer == null)
            {
                var _configuration = new UPNPConfiguration()
                {
                    UdpListnerPort  = _uPnPListenerPort,
                    FriendlyName    = name,
                    Manufacture     = "Tampa IoT Dev",
                    ModelName       = Constants.TankBotModelName,
                    DefaultPageHtml = @"<html>
<head>
<title>SoccerBot</title>
<link rel=""stylesheet"" href=""https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"" integrity=""sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"" crossorigin=""anonymous"">
</head>
<body>
<h1>Tampa IoT TankBot SSDP (uPnP) Listener Page</h1>
</body>
</html>"
                };

                try
                {
                    _ssdpServer = NetworkServices.GetSSDPServer();
                    _ssdpServer.MakeDiscoverable(9500, _configuration);
                }
                catch (Exception ex)
                {
                    _logger.NotifyUserError("ConnectionManager_MakeDiscoverable", ex.Message);
                }
            }
        }
예제 #2
0
        public async Task MakeDiscoverableAsync(int metaDataPort, UPNPConfiguration config)
        {
            _ssdpDiscoveryListener = new DatagramSocket();
            _ssdpDiscoveryListener.MessageReceived += _socket_MessageReceived;

            _webListener = new StreamSocketListener();
            _webListener.ConnectionReceived += ProcessRequestAsync;

            _config = config;

            _metaDataPort = metaDataPort;

            try
            {
                await _webListener.BindServiceNameAsync(metaDataPort.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("Attempt to start Web Listener Failed on Port: " + metaDataPort.ToString(), ex);
            }

            try
            {
                await _ssdpDiscoveryListener.BindEndpointAsync(null, _config.UdpListnerPort.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("Attempt to SSDP Listener Failed on Port: " + _config.UdpListnerPort.ToString(), ex);
            }

            try
            {
                _ssdpDiscoveryListener.JoinMulticastGroup(new HostName("239.255.255.250"));
            }
            catch (Exception ex)
            {
                throw new Exception("Attempt to Join Multi Cast Group Failed", ex);
            }
        }
예제 #3
0
        public void MakeDiscoverable(string name)
        {
            var _configuration = new UPNPConfiguration()
            {
                UdpListnerPort  = 1900,
                FriendlyName    = name,
                Manufacture     = "Tampa IoT Dev",
                ModelName       = "SoccerBot-mBot",
                DefaultPageHtml = @"<html>
<head>
<title>SoccerBot</title>
<link rel=""stylesheet"" href=""https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"" integrity=""sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"" crossorigin=""anonymous"">
</head>
<body>
<h1>Soccer Bot SSDP (uPnP) Listener Page</h1>
</body>
</html>"
            };


            _ssdpServer = NetworkServices.GetSSDPServer();
            _ssdpServer.MakeDiscoverable(9500, _configuration);
        }
예제 #4
0
 public void MakeDiscoverable(int metaDataPort, UPNPConfiguration config)
 {
     throw new NotImplementedException();
 }