예제 #1
0
        /// <summary>
        /// Establishes the actual device connection by building the control point's proxy device tree corresponding to the
        /// device contained in the given <paramref name="rootDescriptor"/> specified by its <paramref name="deviceUUID"/>.
        /// </summary>
        /// <param name="rootDescriptor">Root descriptor which contains the device to build.</param>
        /// <param name="deviceUUID">UUID of the device to connect.</param>
        /// <param name="dataTypeResolver">Delegate method to resolve extended datatypes.</param>
        private void BuildDeviceProxy(RootDescriptor rootDescriptor, string deviceUUID, DataTypeResolverDlgt dataTypeResolver)
        {
            if (rootDescriptor.State != RootDescriptorState.Ready)
            {
                throw new ArgumentException("Root descriptor is not ready - cannot connect");
            }
            DeviceDescriptor rootDeviceDescriptor = DeviceDescriptor.CreateRootDeviceDescriptor(rootDescriptor);
            DeviceDescriptor deviceDescriptor     = rootDeviceDescriptor.FindDevice(deviceUUID);

            _device = CpDevice.ConnectDevice(this, deviceDescriptor, dataTypeResolver);
        }