/// <summary> /// Removes all the port translations in the given range /// </summary> /// <param name="multiplexPort">starting of range of ports to remove</param> /// <param name="length">length of range</param> public void RemoveIoManager(byte multiplexPort, byte length) { // Validate length if (multiplexPort + length > 256) throw new ArgumentOutOfRangeException("length"); // Erase all ports in that range for (int i = multiplexPort; i < multiplexPort + length; i++) translations[i] = new PortTranslation(); }
/// <summary> /// Adds an IO manager to the multiplexer /// </summary> /// <param name="ioManager">io manager to add</param> /// <param name="multiplexPort">start of the range of multiplexer ports to allocate</param> /// <param name="destPort">start of the range of destination ports to use</param> /// <param name="length">number of ports to allocate to this io manager</param> /// <remarks> /// Any existing io managers at these locations will be overwritten /// </remarks> public void AddIoManager(IInputOutputManager ioManager, byte multiplexPort, byte destPort, byte length) { // Validate length if (multiplexPort + length > 256 || destPort + length > 256) throw new ArgumentOutOfRangeException("length"); // Add the nessesary translations for (int i = 0; i < length; i++) { translations[multiplexPort + i] = new PortTranslation(ioManager, (byte) (destPort + i)); } }
/// <summary> /// Removes all the port translations belonging to the given io manager /// </summary> /// <param name="ioManager">io manager to remove translations for</param> public void RemoveIoManager(IInputOutputManager ioManager) { for (int i = 0; i < 256; i++) { if (translations[i].IoManager == ioManager) translations[i] = new PortTranslation(); } }
public PortAttribute(string Name, PortTranslation Translation, int Group) { m_name = Name; m_translation = Translation; m_group = Group; }