예제 #1
0
        public bool AddDevice(DeviceClass devd)
        {
            if (devd == null)
            {
                return(false);
            }

            /* 重複IDをチェック */
            if (FindClass(devd.ID) != null)
            {
                return(false);
            }

            /* 新しいデバイスを追加 */
            lock (devd_list_) {
                devd_list_.Add(devd);

                /* 名前順にソート */
                devd_list_.Sort((a, b) => a.Name.CompareTo(b.Name));
            }

            DebugManager.MessageOut(DebugMessageSender.Device, DebugMessageType.ControlEvent, String.Format("Device Class Added. count = {0}", devd_list_.Count));

            return(true);
        }
예제 #2
0
        public DeviceInstance(DeviceConfig devconf, DeviceClass devd, DeviceProperty devp)
        {
            devconf_ = devconf;
            devd_    = devd;
            devp_    = devp;

            data_rate_timer_.Restart();

            /* イベント初期化 */
            device_poll_events_ = new WaitHandle[Enum.GetValues(typeof(DevicePollEventID)).Length];
            device_poll_events_[(int)DevicePollEventID.ActiveRequest]    = active_request_event_;
            device_poll_events_[(int)DevicePollEventID.DataRateSampling] = data_rate_sampling_request_event_;
        }