Exemplo n.º 1
0
        /**
         * Initialization. Called by CSpect.
         * Returns a list with the ports to be registered.
         */
        public List <sIO> Init(iCSpect _CSpect)
        {
            string version = typeof(Main).Assembly.GetName().Version.ToString();

            ProgramName  = typeof(Main).Assembly.GetName().Name;
            ProgramName += " v" + version;
            string dzrpVersion = Commands.GetDzrpVersion();

            Log.WriteLine("v{0} started. DZRP v{1}.", version, dzrpVersion);

            CSpect = _CSpect;

            // Read settings file (port)
            Settings    = Settings.Load();
            Log.Enabled = Settings.LogEnabled;


            //Server.Listen(Settings.Port);
            CSpectSocket.Port = Settings.Port;
            CSpectSocket.StartListening();

            // No ports
            List <sIO> ports = new List <sIO>();

            return(ports);
        }
        // **********************************************************************
        /// <summary>
        ///     Init the device
        /// </summary>
        /// <returns>
        ///     List of ports we're registering
        /// </returns>
        // **********************************************************************
        public List <sIO> Init(iCSpect _CSpect)
        {
            Debug.WriteLine("NULL i2C device Added");

            CSpect = _CSpect;

            // create a list of the ports we're interested in
            List <sIO> ports = new List <sIO>();

            ports.Add(new sIO(PORT_CLOCK, eAccess.Port_Read));
            ports.Add(new sIO(PORT_DATA, eAccess.Port_Read));
            ports.Add(new sIO(PORT_CLOCK, eAccess.Port_Write));
            ports.Add(new sIO(PORT_DATA, eAccess.Port_Write));
            return(ports);
        }