コード例 #1
0
ファイル: FireAlarmMonitor.cs プロジェクト: uxav/lib2-devices
 public FireAlarmMonitor(int port, int maxConnections, DigitalInput digitalInput)
 {
     _ioPort = digitalInput;
     digitalInput.StateChange += DigitalInputOnStateChange;
     _socket = new FireAlarmServerSocket(port, maxConnections);
     _socket.ClientConnected += SocketOnClientConnected;
 }
コード例 #2
0
ファイル: FireAlarmMonitor.cs プロジェクト: uxav/lib2-devices
 public FireAlarmMonitor(int port, int maxConnections, Versiport ioPort)
 {
     _ioPort = ioPort;
     ioPort.SetVersiportConfiguration(eVersiportConfiguration.DigitalInput);
     ioPort.VersiportChange += VersiportOnVersiportChange;
     _socket = new FireAlarmServerSocket(port, maxConnections);
     _socket.ClientConnected += SocketOnClientConnected;
 }
コード例 #3
0
 /// <summary>
 /// Attempts device registration, passing feedback to the console and error log if it fails.
 /// </summary>
 /// <param name="dev">The device to register.</param>
 /// <param name="deviceDescriptor">A description of the device for use if it fails and an error is printed.</param>
 /// <returns>Returns true if the registration succeeds, false if it fails for any reason.</returns>
 public static bool Register(this PortDevice dev, string deviceDescriptor)
 {
     if (dev == null)
     {
         CrestronConsole.PrintLine("Couldn't register {0}, the device was null.", deviceDescriptor);
         ErrorLog.Error("Coudln't reigster {0}, the device was null.", deviceDescriptor);
         return(false);
     }
     if (dev.Register() != eDeviceRegistrationUnRegistrationResponse.Success)
     {
         CrestronConsole.PrintLine("Couldn't register {0} for the reason: {1}", deviceDescriptor, dev.DeviceRegistrationFailureString);
         ErrorLog.Error("Coudln't reigster {0} for the reason: {1}.", deviceDescriptor, dev.DeviceRegistrationFailureString);
         return(false);
     }
     CrestronConsole.PrintLine("Registered: {0}", deviceDescriptor);
     return(true);
 }
コード例 #4
0
        /// <summary>
        /// Returns a single port device enum based on the port address
        /// (for IN operations)
        /// https://web.archive.org/web/20090808085929/http://www.cepece.info/amstrad/docs/iopord.html
        /// http://www.cpcwiki.eu/index.php/I/O_Port_Summary
        /// </summary>
        protected virtual PortDevice DecodeINPort(ushort port)
        {
            PortDevice dev = PortDevice.Unknown;

            if (!port.Bit(15) && port.Bit(14))
            {
                dev = PortDevice.GateArray;
            }

            else if (!port.Bit(15))
            {
                dev = PortDevice.RAMManagement;
            }

            else if (!port.Bit(14))
            {
                dev = PortDevice.CRCT;
            }

            else if (!port.Bit(13))
            {
                dev = PortDevice.ROMSelect;
            }

            else if (!port.Bit(12))
            {
                dev = PortDevice.Printer;
            }

            else if (!port.Bit(11))
            {
                dev = PortDevice.PPI;
            }

            else if (!port.Bit(10))
            {
                dev = PortDevice.Expansion;
            }

            return(dev);
        }