コード例 #1
0
        /// <summary>
        /// Method used to send an http Bye message to specified endpoint. Use for managed discovery.
        /// </summary>
        /// <param name="endpointAddress">A string containing the endpoint address of a listening client.</param>
        public void DirectedBye(string endpointAddress, DpwsDiscoGreeting greeting, ProtocolVersion version)
        {
            WsMessage greetingsMessage = greeting.BuildByeMessage(endpointAddress, null, null);

            Ws.Services.Transport.HTTP.WsHttpClient httpClient = new Ws.Services.Transport.HTTP.WsHttpClient(version);
            httpClient.SendRequestOneWay(greetingsMessage, new Uri(endpointAddress));
        }
コード例 #2
0
 /// <summary>
 /// Method used to send an http Bye message to specified endpoint. Use for managed discovery.
 /// </summary>
 /// <param name="endpointAddress">A string containing the endpoint address of a listening client.</param>
 public void DirectedBye(string endpointAddress)
 {
     byte[] greetingsMessage = DpwsDiscoGreeting.BuildByeMessage(endpointAddress, null, null);
     Ws.Services.Transport.HTTP.WsHttpClient httpClient = new Ws.Services.Transport.HTTP.WsHttpClient();
     httpClient.SendRequest(greetingsMessage, endpointAddress, true, false);
     return;
 }
コード例 #3
0
        /// <summary>
        /// Initializes the device. This method builds the colletion of internal device services, sets
        /// the devices transport address and adds DPWS required namespaces to the devices namespace collection.
        /// </summary>
        public static void Initialize(Binding binding, ProtocolVersion v)
        {
            m_binding = binding;

            string addr = binding.Transport.EndpointAddress.AbsoluteUri;
            int index = addr.LastIndexOf('/');
            m_address = "urn:uuid:" + addr.Substring(index+1);

            SubscriptionManager = new DpwsWseSubscriptionMgr(binding, v);

            if(v != null) 
            {            
                // Add disco services to udp service endpoints collection
                m_discoveryService = new DpwsDeviceDiscoService(v);
                m_discoGreeting = new DpwsDiscoGreeting(v);
                // Create a new udp service host and add the discovery endpoints
                WsUdpServiceHost.Instance.AddServiceEndpoint(m_discoveryService);
            }

            // Add metadata get service endpoint
            m_discoMexService = new DpwsDeviceMexService(v);
            m_hostedServices.Add(m_discoMexService);

            // Add direct probe service endpoint
            if(m_discoveryService != null) m_hostedServices.Add(m_discoveryService);

            // Create a new http service host and add hosted services endpoints
            m_httpServiceHost = new WsHttpServiceHost(m_binding, m_hostedServices);

            System.Ext.Console.Write("IP Address: " + WsNetworkServices.GetLocalIPV4Address());
        }
コード例 #4
0
 /// <summary>
 /// Method used to send an http Bye message to specified endpoint. Use for managed discovery.
 /// </summary>
 /// <param name="endpointAddress">A string containing the endpoint address of a listening client.</param>
 public void DirectedBye(string endpointAddress, DpwsDiscoGreeting greeting, ProtocolVersion version)
 {
     WsMessage greetingsMessage = greeting.BuildByeMessage(endpointAddress, null, null);
     Ws.Services.Transport.HTTP.WsHttpClient httpClient = new Ws.Services.Transport.HTTP.WsHttpClient(version);
     httpClient.SendRequestOneWay(greetingsMessage, new Uri(endpointAddress));
 }