public UPnPClientControlPoint(string homeServerSystemId)
 {
   _homeServerSystemId = homeServerSystemId;
   CPData cpData = new CPData();
   _networkTracker = new UPnPNetworkTracker(cpData);
   _controlPoint = new UPnPControlPoint(_networkTracker);
   _networkTracker.RootDeviceAdded += OnUPnPRootDeviceAdded;
 }
 public UPnPServerControlPoint()
 {
   CPData cpData = new CPData();
   _networkTracker = new UPnPNetworkTracker(cpData);
   _controlPoint = new UPnPControlPoint(_networkTracker);
   _networkTracker.RootDeviceAdded += OnUPnPRootDeviceAdded;
   _networkTracker.RootDeviceRemoved += OnUPnPRootDeviceRemoved;
 }
Esempio n. 3
0
 /// <summary>
 /// Creates a new <see cref="DeviceConnection"/> to the UPnP device contained in the given
 /// <paramref name="rootDescriptor"/> with the given <paramref name="deviceUuid"/>.
 /// </summary>
 /// <param name="controlPoint">Control point hosting the new device connection instance.</param>
 /// <param name="rootDescriptor">Root descriptor containing the description of the UPnP device to connect.</param>
 /// <param name="deviceUuid">UUID of the UPnP device to connect.</param>
 /// <param name="cpData">Shared control point data structure.</param>
 /// <param name="dataTypeResolver">Delegate method to resolve extended datatypes.</param>
 public DeviceConnection(UPnPControlPoint controlPoint, RootDescriptor rootDescriptor, string deviceUuid,
                         CPData cpData, DataTypeResolverDlgt dataTypeResolver)
 {
     _controlPoint         = controlPoint;
     _cpData               = cpData;
     _rootDescriptor       = rootDescriptor;
     _deviceUUID           = deviceUuid;
     _genaClientController = new GENAClientController(_cpData, this, rootDescriptor.SSDPRootEntry.PreferredLink.Endpoint, rootDescriptor.SSDPRootEntry.UPnPVersion);
     BuildDeviceProxy(rootDescriptor, deviceUuid, dataTypeResolver);
     _genaClientController.Start();
 }
 public ClientConnection(UPnPControlPoint controlPoint, DeviceConnection connection, ClientDescriptor clientDescriptor)
 {
   _controlPoint = controlPoint;
   _connection = connection;
   _clientDescriptor = clientDescriptor;
   _connection.DeviceDisconnected += OnUPnPDeviceDisconnected;
   try
   {
     CpService ccsStub = connection.Device.FindServiceByServiceId(UPnPTypesAndIds.CLIENT_CONTROLLER_SERVICE_ID);
     if (ccsStub == null)
       throw new InvalidDataException("ClientController service not found in device '{0}' of type '{1}:{2}'",
           clientDescriptor.MPFrontendServerUUID,
           UPnPTypesAndIds.FRONTEND_SERVER_DEVICE_TYPE, UPnPTypesAndIds.FRONTEND_SERVER_DEVICE_TYPE_VERSION);
     lock (_connection.CPData.SyncObj)
       _clientController = new UPnPClientControllerServiceProxy(ccsStub);
     // TODO: other services
   }
   catch (Exception)
   {
     _connection.DeviceDisconnected -= OnUPnPDeviceDisconnected;
     throw;
   }
 }
Esempio n. 5
0
 /// <summary>
 /// Creates a new <see cref="DeviceConnection"/> to the UPnP device contained in the given
 /// <paramref name="rootDescriptor"/> with the given <paramref name="deviceUuid"/>.
 /// </summary>
 /// <param name="controlPoint">Control point hosting the new device connection instance.</param>
 /// <param name="rootDescriptor">Root descriptor containing the description of the UPnP device to connect.</param>
 /// <param name="deviceUuid">UUID of the UPnP device to connect.</param>
 /// <param name="cpData">Shared control point data structure.</param>
 /// <param name="dataTypeResolver">Delegate method to resolve extended datatypes.</param>
 /// <param name="useHttpKeepAlive"><c>True</c> to set the HTTP keep-alive header in action requests sent over the connection, otherwise <c>false</c>.</param>
 public DeviceConnection(UPnPControlPoint controlPoint, RootDescriptor rootDescriptor, string deviceUuid,
     CPData cpData, DataTypeResolverDlgt dataTypeResolver, bool useHttpKeepAlive = true)
 {
   _controlPoint = controlPoint;
   _cpData = cpData;
   _rootDescriptor = rootDescriptor;
   _deviceUUID = deviceUuid;
   _useHttpKeepAlive = useHttpKeepAlive;
   _genaClientController = new GENAClientController(_cpData, this, rootDescriptor.SSDPRootEntry.PreferredLink.Endpoint, rootDescriptor.SSDPRootEntry.UPnPVersion);
   BuildDeviceProxy(rootDescriptor, deviceUuid, dataTypeResolver);
   _genaClientController.Start();
 }
 public RemoteResourceInformationService()
 {
   _networkTracker = new UPnPNetworkTracker(new CPData());
   _controlPoint = new UPnPControlPoint(_networkTracker);
 }
Esempio n. 7
0
    /// <summary>
    /// Constructor.
    /// </summary>
    /// <param name="listener">A listener that wishes to be notified about device events.</param>
    public DeviceDetector(IDeviceEventListener listener)
    {
      _deviceEventListener = listener;

      // Setup UPnP device detection.
      UPnPConfiguration.LOGGER = new Tve3Logger();
      _upnpControlPointData = new CPData();
      _upnpAgent = new UPnPNetworkTracker(_upnpControlPointData);
      _upnpAgent.RootDeviceAdded += OnUpnpRootDeviceAdded;
      _upnpAgent.RootDeviceRemoved += OnUpnpRootDeviceRemoved;
      _upnpControlPoint = new UPnPControlPoint(_upnpAgent);

      // Setup other (BDA, PBDA, WDM) device detection.
      try
      {
        InitBdaDetectionGraph();
      }
      catch (Exception ex)
      {
        Log.Log.Error("Failed to initialise the BDA device detection graph!\r\n{0}", ex);
        throw;
      }
      _systemDeviceChangeEventWatcher = new ManagementEventWatcher();
      // EventType 2 and 3 are device arrival and removal. See:
      // http://msdn.microsoft.com/en-us/library/windows/desktop/aa394124%28v=vs.85%29.aspx
      _systemDeviceChangeEventWatcher.Query = new WqlEventQuery("SELECT * FROM Win32_DeviceChangeEvent WHERE EventType = 2 OR EventType = 3");
      _systemDeviceChangeEventWatcher.EventArrived += OnSystemDeviceConnectedOrDisconnected;
    }
Esempio n. 8
0
    /// <summary>
    /// Initialise a new instance of the <see cref="TunerDri"/> class.
    /// </summary>
    /// <param name="descriptor">The device description. Essentially an XML document describing the device interface.</param>
    /// <param name="controlPoint">The control point to use to connect to the device.</param>
    public TunerDri(DeviceDescriptor descriptor, UPnPControlPoint controlPoint)
      : base(null)
    {
      _descriptor = descriptor;
      _controlPoint = controlPoint;
      _name = descriptor.FriendlyName;
      _devicePath = descriptor.DeviceUDN;   // unique device name is as good as a device path for a unique identifier
      _eventSignalLock = new ManualResetEvent(false);
      _isCetonDevice = _name.Contains("Ceton");

      GetPreloadBitAndCardId();
      GetSupportsPauseGraph();
    }