internal InsteonDevice(InsteonNetwork network, InsteonAddress address, InsteonIdentity identity)
 {
     this.network  = network;
     this.Address  = address;
     this.Identity = identity;
     this.ackTimer = new Timer(new TimerCallback(PendingCommandTimerCallback), null, Timeout.Infinite, Constants.deviceAckTimeout);
 }
Esempio n. 2
0
 internal InsteonDevice(InsteonNetwork network, InsteonAddress address, InsteonIdentity identity)
 {
     this.network = network;
     this.Address = address;
     this.Identity = identity;
     this.ackTimer = new Timer(new TimerCallback(this.PendingCommandTimerCallback), null, Timeout.Infinite, Constants.deviceAckTimeout);
 }
        public void TearDown()
        {
            if (network != null && network.IsConnected)
                network.Close();

            network = null;
        }
Esempio n. 4
0
 static InsteonService()
 {
     string logPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), @"Mayhem\Logs");
     if (Directory.Exists(logPath))
         InsteonNetwork.SetLogPath(logPath);
     Network = new InsteonNetwork();
     Application.Current.Exit += Application_Exit;
 }
        public void VerifyInsteonNetworkTest()
        {
            network = new InsteonNetwork();
            var connected = network.TryConnect();

            Assert.IsTrue(connected);
            Assert.IsTrue(network.VerifyConnection());
            network.Close();
        }
        public void SimpleConnectAnySerialPortTest()
        {
            network = new InsteonNetwork();
            var connected = network.TryConnect();

            Assert.IsTrue(connected);
            Assert.AreEqual(network.Connection.Address.Value, InsteonAddress.Parse(ConfigurationManager.AppSettings["plmIdentityTest"]).Value);
            network.Close();
        }
Esempio n. 7
0
        public InsteonMessenger(InsteonNetwork network)
        {
            if (network == null)
                throw new ArgumentNullException("network");

            this.network = network;
            this.bridge = new InsteonNetworkBridge(this);
            this.ControllerProperties = new Dictionary<PropertyKey, int>();
        }
        public CommandResponse ProcessCommand(CommandRequest commandRequest)
        {
            var network = new InsteonNetwork();
            var connection = new InsteonConnection(InsteonConnectionType.Net, "");
            network.Connect(connection);
            
            
            return new CommandResponse();

        }
        private InsteonController(InsteonNetwork network, InsteonAddress address, InsteonIdentity identity)
        {
            this.network  = network;
            this.Address  = address;
            this.Identity = identity;

            this.timer.Interval  = 4 * 60 * 1000; // 4 minutes
            this.timer.AutoReset = false;
            this.timer.Elapsed  += new System.Timers.ElapsedEventHandler(timer_Elapsed);
        }
 internal InsteonController(InsteonNetwork network)
     : this(
         network,
         new InsteonAddress(network.Messenger.ControllerProperties[PropertyKey.Address]),
         new InsteonIdentity(
             (byte)network.Messenger.ControllerProperties[PropertyKey.DevCat],
             (byte)network.Messenger.ControllerProperties[PropertyKey.SubCat],
             (byte)network.Messenger.ControllerProperties[PropertyKey.FirmwareVersion]
             )
         ) { }
Esempio n. 11
0
 private InsteonController(InsteonNetwork network, InsteonAddress address, InsteonIdentity identity)
 {
     this.network = network;
     this.Address = address;
     this.Identity = identity;
     
     this.timer.Interval = 4 * 60* 1000; // 4 minutes
     this.timer.AutoReset = false;
     this.timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
 }
Esempio n. 12
0
        public InsteonMessenger(InsteonNetwork network)
        {
            if (network == null)
            {
                throw new ArgumentNullException("network");
            }

            this.network         = network;
            bridge               = new InsteonNetworkBridge(this);
            ControllerProperties = new Dictionary <PropertyKey, int>();
        }
        public void SimpleConnectKnownSerialPortTest()
        {
            InsteonConnection connection;
            Assert.IsTrue(InsteonConnection.TryParse(insteonSource, out connection));
            network = new InsteonNetwork();
            var connected = network.TryConnect(connection);

            Assert.IsTrue(connected);
            Assert.AreEqual(connection.Address.Value, InsteonAddress.Parse(ConfigurationManager.AppSettings["plmIdentityTest"]).Value);
            network.Close();
        }
 internal InsteonController(InsteonNetwork network)
     : this(
         network,
         new InsteonAddress(network.Messenger.ControllerProperties[PropertyKey.Address]),
         new InsteonIdentity(
             (byte)network.Messenger.ControllerProperties[PropertyKey.DevCat],
             (byte)network.Messenger.ControllerProperties[PropertyKey.SubCat],
             (byte)network.Messenger.ControllerProperties[PropertyKey.FirmwareVersion]
             )
         )
 {
 }
Esempio n. 15
0
        private InsteonController(InsteonNetwork network, InsteonAddress address, InsteonIdentity identity)
        {
            this.network = network;
            Address      = address;
            Identity     = identity;

            timer.Interval  = 4 * 60 * 1000; // 4 minutes
            timer.AutoReset = false;
            timer.Elapsed  += (sender, args) =>
            {
                IsInLinkingMode = false;
                OnDeviceLinkTimeout();
            };
        }
        private InsteonController(InsteonNetwork network, InsteonAddress address, InsteonIdentity identity)
        {
            this.network = network;
            Address = address;
            Identity = identity;

            timer.Interval = 4 * 60 * 1000; // 4 minutes
            timer.AutoReset = false;
            timer.Elapsed += (sender, args) =>
                {
                    IsInLinkingMode = false;
                    OnDeviceLinkTimeout();
                };
            
        }
        public void GetLinksTest()
        {
            network = new InsteonNetwork();
            var connected = network.TryConnect();
            Assert.IsTrue(connected);
            var links = network.Controller.GetDeviceLinkRecords();

            foreach (var link in links)
            {
                Console.WriteLine(link.Address + ":" + link.RecordType);
            }

            Assert.IsNotEmpty(links);
            network.Close();
        }
        public InsteonManager(string insteonSource)
        {
            logger.Debug("Creating insteon manager");
            InsteonConnection iConnection;
            if (InsteonConnection.TryParse(insteonSource, out iConnection))
            {
                logger.DebugFormat("Parsed InsteonConnection to {0}", iConnection.ToString());
                Connection = iConnection;
            }
            else
            {
                throw new Exception("Could not create Insteon Connection type from " + insteonSource);
            }

            Network = new InsteonNetwork { AutoAdd = true };
        }
Esempio n. 19
0
 internal InsteonDeviceList(InsteonNetwork network)
 {
     this.network = network;
 }
        public void GetLinkIdentityTest()
        {
            network = new InsteonNetwork();
            var connected = network.TryConnect();
            Assert.IsTrue(connected);
            var links = network.Controller.GetDeviceLinkRecords();

            Assert.IsNotEmpty(links);


            var insteonAddresses = links.Select(l => l.Address).Distinct();


            foreach (var insteonAddress in insteonAddresses)
            {

                if (network.Devices.ContainsKey(insteonAddress))
                    continue;

                InsteonIdentity? id;
                if (network.Controller.TryGetLinkIdentity(insteonAddress, out id))
                {
                    if (id != null)
                    {
                        var d = network.Devices.Add(insteonAddress, id.Value);

                    }
                }
                else
                {
                    Console.WriteLine("Possibly a battery powered device.");
                }
            }

            network.Close();
        }