Example #1
0
        public bool TryConnect(InsteonConnection connection)
        {
            if (connection != null)
            {
                try
                {
                    Log.WriteLine("Trying connection '{0}'...", connection.ToString());

                    lock (bridge)
                    {
                        ControllerProperties = bridge.Connect(connection);
                    }
                    Log.WriteLine("Connected to '{0}'", connection);

                    // rdw: deadman
                    byte[] message = { 0x6B, 0x48 }; // disable deadman
                    // byte[] message = { 0x6B, 0x40 }; // disable deadman
                    TrySend(message);

                    return(true);
                }
                catch (Exception ex)
                {
                    Log.WriteLine("ERROR: Could not connect to '{0}'. {1}", connection.ToString(), ex.Message);
                }
            }
            return(false);
        }
Example #2
0
        public bool TryConnect(InsteonConnection connection)
        {
            if (connection != null)
            {
                try
                {
                    Log.WriteLine("Trying connection '{0}'...", connection.ToString());

                    lock (this.bridge)
                    {
                        this.ControllerProperties = this.bridge.Connect(connection);
                    }
                    Log.WriteLine("Connected to '{0}'", connection);

                    byte[] message = { 0x6B, 0x48 }; // disable deadman
                    this.TrySend(message);

                    return true;
                }
                catch (Exception ex)
                {
                    Log.WriteLine("ERROR: Could not connect to '{0}'. {1}", connection.ToString(), ex.Message);
                }
            }
            return false;
        }