Пример #1
0
        public void RegisterDevice(IIOPDevice device)
        {
            foreach (byte port in device.ReadPorts)
            {
                if (_readDispatch[port] != null)
                {
                    throw new InvalidOperationException(String.Format("Read port collision {0:x2} when adding device {1}", port, device));
                }

                _readDispatch[port] = device;
            }

            foreach (byte port in device.WritePorts)
            {
                if (_writeDispatch[port] != null)
                {
                    throw new InvalidOperationException(String.Format("Write port collision {0:x2} when adding device {1}", port, device));
                }

                _writeDispatch[port] = device;
            }
        }
Пример #2
0
 public IOPIOBus()
 {
     _writeDispatch = new IIOPDevice[256];
     _readDispatch  = new IIOPDevice[256];
 }