Exemplo n.º 1
0
        public DeviceInstance CreateInstance(DeviceConfig devconf, Guid class_id, DeviceProperty devp)
        {
            /* クラスIDからクラスを検索 */
            var devd = FindClass(class_id);

            if (devd == null)
            {
                return(null);
            }

            /* インスタンス作成 */
            var devi = devd.CreateInstance(devconf, devp);

            if (devi == null)
            {
                return(null);
            }

            /* インスタンス登録 */
            lock (devi_list_) {
                devi_list_.Add(devi);

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

                /* 各インスタンスのリダイレクト先を更新 */
                UpdateRedirectMap();
            }

            /* デバイス処理開始 */
            devi.DeviceStart();

            return(devi);
        }
Exemplo n.º 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_;
        }
Exemplo n.º 3
0
        internal DeviceInstance CreateInstance(DeviceConfig devconf, DeviceProperty devp)
        {
            if (devp == null)
            {
                return(null);
            }
            if (devp.GetType() != GetPropertyType())
            {
                return(null);
            }

            return(OnCreateInstance(devconf, devp));
        }
Exemplo n.º 4
0
 protected virtual DeviceInstance OnCreateInstance(DeviceConfig devconf, DeviceProperty devp)
 {
     return(null);
 }
Exemplo n.º 5
0
 public DeviceInstance CreateDeviceObject(DeviceConfig devconf, Guid class_id, DeviceProperty devp)
 {
     return(CreateInstance(devconf, class_id, devp));
 }