当前位置: 首页>>代码示例>>C#>>正文


C# DeviceMode类代码示例

本文整理汇总了C#中DeviceMode的典型用法代码示例。如果您正苦于以下问题:C# DeviceMode类的具体用法?C# DeviceMode怎么用?C# DeviceMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DeviceMode类属于命名空间,在下文中一共展示了DeviceMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: XForwarder

 /// <summary>
 /// Initializes a new instance of the <see cref="XForwarder"/> class.
 /// </summary>
 /// <param name="context">The <see cref="NetMQContext"/> to use when creating the sockets.</param>
 /// <param name="frontendBindAddress">The endpoint used to bind the frontend socket.</param>
 /// <param name="backendBindAddress">The endpoint used to bind the backend socket.</param>
 /// <param name="mode">The <see cref="DeviceMode"/> for the device.</param>
 public XForwarder(NetMQContext context, string frontendBindAddress, string backendBindAddress,
                   DeviceMode mode = DeviceMode.Threaded)
     : base(context.CreateXSubscriberSocket(), context.CreateXPublisherSocket(), mode)
 {
     this.FrontendSetup.Bind(frontendBindAddress);
     this.BackendSetup.Bind(backendBindAddress);
 }
开发者ID:yonglehou,项目名称:Daytona,代码行数:14,代码来源:XForwarder.cs

示例2: DeviceBase

        /// <summary>
        /// Create a new instance of the <see cref="DeviceBase"/> class.
        /// </summary>
        /// <param name="poller">the <see cref="INetMQPoller"/> to use for detecting when messages are available</param>
        /// <param name="frontendSocket">
        /// A <see cref="NetMQSocket"/> that will pass incoming messages to <paramref name="backendSocket"/>.
        /// </param>
        /// <param name="backendSocket">
        /// A <see cref="NetMQSocket"/> that will receive messages from (and optionally send replies to) <paramref name="frontendSocket"/>.
        /// </param>
        /// <param name="mode">the <see cref="DeviceMode"/> (either Blocking or Threaded) for this device</param>
        /// <exception cref="ArgumentNullException">frontendSocket must not be null.</exception>
        /// <exception cref="ArgumentNullException">backendSocket must not be null.</exception>
        protected DeviceBase(INetMQPoller poller,  NetMQSocket frontendSocket,  NetMQSocket backendSocket, DeviceMode mode)
        {
            m_isInitialized = false;

            if (frontendSocket == null)
                throw new ArgumentNullException("frontendSocket");

            if (backendSocket == null)
                throw new ArgumentNullException("backendSocket");

            FrontendSocket = frontendSocket;
            BackendSocket = backendSocket;

            FrontendSetup = new DeviceSocketSetup(FrontendSocket);
            BackendSetup = new DeviceSocketSetup(BackendSocket);

            m_poller = poller;

            FrontendSocket.ReceiveReady += FrontendHandler;
            BackendSocket.ReceiveReady += BackendHandler;

            m_poller.Add(FrontendSocket);
            m_poller.Add(BackendSocket);

            m_runner = mode == DeviceMode.Blocking
                ? new DeviceRunner(this)
                : new ThreadedDeviceRunner(this);
        }
开发者ID:awb99,项目名称:netmq,代码行数:41,代码来源:DeviceBase.cs

示例3: ForwarderDevice

 /// <summary>
 /// Initializes a new instance of the <see cref="ForwarderDevice"/> class.
 /// </summary>
 /// <param name="poller">The <see cref="INetMQPoller"/> to use.</param>
 /// <param name="frontendBindAddress">The endpoint used to bind the frontend socket.</param>
 /// <param name="backendBindAddress">The endpoint used to bind the backend socket.</param>
 /// <param name="mode">The <see cref="DeviceMode"/> for the device.</param>
 public ForwarderDevice(INetMQPoller poller, string frontendBindAddress, string backendBindAddress,
     DeviceMode mode = DeviceMode.Threaded)
     : base(poller, new SubscriberSocket(), new PublisherSocket(), mode)
 {
     FrontendSetup.Bind(frontendBindAddress);
     BackendSetup.Bind(backendBindAddress);
 }
开发者ID:NetMQ,项目名称:NetMQ3-x,代码行数:14,代码来源:ForwarderDevice.cs

示例4: ForwarderDevice

 /// <summary>
 /// Initializes a new instance of the <see cref="ForwarderDevice"/> class.
 /// </summary>
 /// <param name="context">The <see cref="NetMQContext"/> to use when creating the sockets.</param>
 /// <param name="poller">The <see cref="Poller"/> to use.</param>
 /// <param name="frontendBindAddress">The endpoint used to bind the frontend socket.</param>
 /// <param name="backendBindAddress">The endpoint used to bind the backend socket.</param>
 /// <param name="mode">The <see cref="DeviceMode"/> for the device.</param>		
 public ForwarderDevice(NetMQContext context, Poller poller, string frontendBindAddress, string backendBindAddress,
     DeviceMode mode = DeviceMode.Threaded)
     : base(poller, context.CreateSubscriberSocket(), context.CreatePublisherSocket(), mode)
 {
     FrontendSetup.Bind(frontendBindAddress);
     BackendSetup.Bind(backendBindAddress);
 }
开发者ID:EugenDueck,项目名称:netmq,代码行数:15,代码来源:ForwarderDevice.cs

示例5: XForwarderDevice

 /// <summary>
 /// Initializes a new instance of the <see cref="ForwarderDevice"/> class.
 /// </summary>
 /// <param name="context">The <see cref="ZmqContext"/> to use when creating the sockets.</param>
 /// <param name="frontendBindAddr">The address used to bind the frontend socket.</param>
 /// <param name="backendBindAddr">The endpoint used to bind the backend socket.</param>
 /// <param name="mode">The <see cref="DeviceMode"/> for the current device.</param>
 public XForwarderDevice(ZmqContext context, string frontendBindAddr, string backendBindAddr, DeviceMode mode)
     : this(context, mode)
 {
     FrontendSetup.Bind(frontendBindAddr);
     FrontendSetup.SubscribeAll();
     BackendSetup.Bind(backendBindAddr);
 }
开发者ID:eudaimos,项目名称:WaterBucket,代码行数:14,代码来源:XForwarderDevice.cs

示例6: QueueDevice

        /// <summary>
        /// Initializes a new instance of the <see cref="QueueDevice"/> class.
        /// </summary>
        /// <param name="context">The <see cref="NetMQContext"/> to use when creating the sockets.</param>
        /// <param name="poller">The <see cref="Poller"/> to use.</param>
        /// <param name="frontendBindAddress">The endpoint used to bind the frontend socket.</param>
        /// <param name="backendBindAddress">The endpoint used to bind the backend socket.</param>
        /// <param name="mode">The <see cref="DeviceMode"/> for the device.</param>
        public QueueDevice(NetMQContext context, Poller poller, string frontendBindAddress, string backendBindAddress,
			DeviceMode mode = DeviceMode.Threaded)
            : base(poller, context.CreateRouterSocket(), context.CreateDealerSocket(), mode)
        {
            FrontendSetup.Bind(frontendBindAddress);
            BackendSetup.Bind(backendBindAddress);
        }
开发者ID:bubbafat,项目名称:netmq,代码行数:15,代码来源:QueueDevice.cs

示例7: StreamerDevice

 /// <summary>
 /// Initializes a new instance of the <see cref="StreamerDevice"/> class.
 /// </summary>
 /// <param name="poller">The <see cref="INetMQPoller"/> to use.</param>
 /// <param name="frontendBindAddress">The endpoint used to bind the frontend socket.</param>
 /// <param name="backendBindAddress">The endpoint used to bind the backend socket.</param>
 /// <param name="mode">The <see cref="DeviceMode"/> for the device.</param>
 public StreamerDevice(INetMQPoller poller, string frontendBindAddress, string backendBindAddress,
     DeviceMode mode = DeviceMode.Threaded)
     : base(poller, new PullSocket(), new PushSocket(), mode)
 {
     FrontendSetup.Bind(frontendBindAddress);
     BackendSetup.Bind(backendBindAddress);
 }
开发者ID:NetMQ,项目名称:NetMQ3-x,代码行数:14,代码来源:StreamerDevice.cs

示例8: StreamerDevice

 /// <summary>
 /// Initializes a new instance of the <see cref="StreamerDevice"/> class.
 /// </summary>
 /// <param name="context">The <see cref="NetMQContext"/> to use when creating the sockets.</param>
 /// <param name="poller">The <see cref="Poller"/> to use.</param>
 /// <param name="frontendBindAddress">The endpoint used to bind the frontend socket.</param>
 /// <param name="backendBindAddress">The endpoint used to bind the backend socket.</param>
 /// <param name="mode">The <see cref="DeviceMode"/> for the device.</param>		
 public StreamerDevice(NetMQContext context, Poller poller, string frontendBindAddress, string backendBindAddress,
     DeviceMode mode = DeviceMode.Threaded)
     : base(poller, context.CreatePullSocket(), context.CreatePushSocket(), mode)
 {
     FrontendSetup.Bind(frontendBindAddress);
     BackendSetup.Bind(backendBindAddress);
 }
开发者ID:wangkai2014,项目名称:netmq,代码行数:15,代码来源:StreamerDevice.cs

示例9: Generate

        /// <summary>
        /// 画面を指定量回転させるためのオブジェクトを生成
        /// </summary>
        /// <param name="monitorID">ディスプレイのデバイス番号</param>
        /// <returns>生成に失敗した場合はnull</returns>
        public static DisplayRotate Generate(int monitorID)
        {
            var mode = new DeviceMode(monitorID);

            return mode.IsSucceeded
                ? new DisplayRotate(mode)
                : null;
        }
开发者ID:Boredbone,项目名称:MultiMonitorTools,代码行数:13,代码来源:DisplayRotate.cs

示例10: HidDeviceMode

 public HidDeviceMode(DeviceMode readMode, DeviceMode writeMode, ShareMode shareMode)
 {
     if (!_needChangeStatus) return;
     /* 
     If the flag is "false", then we have the previous values of the attributes.
     Update the values is not required. 
     */
     ReadMode = readMode;
     WriteMode = writeMode;
     ShareMode = shareMode;
     _needChangeStatus = false;
 }
开发者ID:winstondiz,项目名称:HidLibrary,代码行数:12,代码来源:HidDeviceMode.cs

示例11: BMP085

        public BMP085(byte address, DeviceMode deviceMode)
        {
            Address = address;
            _slaveConfig = new I2CDevice.Configuration(address, ClockRateKHz);
            _oversamplingSetting = (byte)deviceMode;

            // Get calibration data that will be used for future measurement taking.
            GetCalibrationData();

            // Take initial measurements.
            TakeMeasurements();

        }
开发者ID:NicolasFatoux,项目名称:NfxLab.MicroFramework,代码行数:13,代码来源:BMP085.cs

示例12: OpenDeviceIO

        internal static IntPtr OpenDeviceIO(string devicePath, DeviceMode deviceMode, uint deviceAccess)
        {
            var security = new NativeMethods.SECURITY_ATTRIBUTES();
            var flags = 0;

            if (deviceMode == DeviceMode.Overlapped) flags = NativeMethods.FILE_FLAG_OVERLAPPED;

            security.lpSecurityDescriptor = IntPtr.Zero;
            security.bInheritHandle = true;
            security.nLength = Marshal.SizeOf(security);

            return NativeMethods.CreateFile(devicePath, deviceAccess, NativeMethods.FILE_SHARE_READ | NativeMethods.FILE_SHARE_WRITE, ref security, NativeMethods.OPEN_EXISTING, flags, 0);
        }
开发者ID:HaKDMoDz,项目名称:GNet,代码行数:13,代码来源:Device.Static.cs

示例13: OpenDevice

        public void OpenDevice(DeviceMode readMode, DeviceMode writeMode, ShareMode shareMode)
        {
            if (IsOpen) return;

            _deviceReadMode = readMode;
            _deviceWriteMode = writeMode;

            try
            {
                Handle = OpenDeviceIO(_devicePath, readMode, NativeMethods.GENERIC_READ | NativeMethods.GENERIC_WRITE, shareMode);
            }
            catch (Exception exception)
            {
                IsOpen = false;
                throw new Exception("Error opening HID device.", exception);
            }

            IsOpen = Handle.ToInt32() != NativeMethods.INVALID_HANDLE_VALUE;
        }
开发者ID:macaba,项目名称:HidLibrary,代码行数:19,代码来源:HidDevice.cs

示例14: HidDevice

        public HidDevice(HidDeviceInfo info, DeviceMode devideReadMode, DeviceMode deviceWriteMode)
        {
            Path = info.Path;
            Description = info.Description;
            ReportID = 0x0;
            DeviceReadMode = devideReadMode;
            DeviceWriteMode = deviceWriteMode;
            Timeout = 30;

            try
            {
                Handle = OpenDeviceIO();
                GetDeviceAttributes();
                GetDeviceCapabilities();
            }
            catch
            {
                Dispose();
                throw;
            }
        }
开发者ID:Cliveburr,项目名称:AutoHome,代码行数:21,代码来源:HidDevice.cs

示例15: Device

        /// <summary>
        /// Initializes a new instance of the <see cref="Device"/> class.
        /// </summary>
        /// <param name="frontendSocket">
        /// A <see cref="ZmqSocket"/> that will pass incoming messages to <paramref name="backendSocket"/>.
        /// </param>
        /// <param name="backendSocket">
        /// A <see cref="ZmqSocket"/> that will receive messages from (and optionally send replies to) <paramref name="frontendSocket"/>.
        /// </param>
        /// <param name="mode">The <see cref="DeviceMode"/> for the current device.</param>
        protected Device(ZmqSocket frontendSocket, ZmqSocket backendSocket, DeviceMode mode)
        {
            if (frontendSocket == null)
            {
                throw new ArgumentNullException("frontendSocket");
            }

            if (backendSocket == null)
            {
                throw new ArgumentNullException("backendSocket");
            }

            FrontendSocket = frontendSocket;
            BackendSocket = backendSocket;
            FrontendSetup = new DeviceSocketSetup(FrontendSocket);
            BackendSetup = new DeviceSocketSetup(BackendSocket);
            DoneEvent = new ManualResetEvent(false);

            _poller = new Poller();
            _runner = mode == DeviceMode.Blocking ? new DeviceRunner(this) : new ThreadedDeviceRunner(this);
        }
开发者ID:krageon,项目名称:clrzmq,代码行数:31,代码来源:Device.cs


注:本文中的DeviceMode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。