Пример #1
0
        public void GetStatusTest()
        {

            using (var manager = new IpModuleManager(module))
            {
                manager.Login();
                manager.GetAlarmInformation();
                manager.GetStatus();
                manager.Logout();
            }

        }
        public void Md5HashTest()
        {
            var module = new IpModule(new Url("http://192.168.1.199"), 8888,"TESThash")
            {
                Module = IpModuleType.Ip150,
                Session = Session,
            };

            var manager = new IpModuleManager(module);
            var hash = manager.GetMd5Hash();

            Assert.AreEqual(ExpectedHash, module.PasswordHash);
        }
Пример #3
0
        public void StayArmTest()
        {

            using (var manager = new IpModuleManager(module))
            {
                manager.Login();
                manager.GetAlarmInformation();
                manager.AlarmAction(PartitionNumber.Two, AlarmMode.RegularArm);
                manager.Logout();

            }

        }
Пример #4
0
        public void GetSystemDataTest()
        {
            using (var manager = new IpModuleManager(module))
            {
                manager.Login();
                manager.GetAlarmInformation();
                manager.Logout();

                Assert.IsNotEmpty(manager.TroubleCodes);
                Assert.IsNotEmpty(manager.Devices);
                Assert.IsNotEmpty(manager.Partitions);
            }

        }
        public void Rc4Test()
        {
            var module = new IpModule(new Url("http://192.168.1.199"), 8888, "TESThash")
            {
                Module = IpModuleType.Ip150,
                Session = Session,
                PasswordHash = ExpectedHash,
                PasswordFirstHash = ExpectedFirstHash,
            };

            var manager = new IpModuleManager(module);
            var rc4 = manager.GetRc4AsHexString();

            Assert.AreEqual(ExpectedRc4, module.UserKey);
        }
        public override void Configure(Container container)
        {
            GlobalResponseFilters.Add((req, res, dto) =>
            {
                res.AddHeader("X-Paradox", ServiceName);
            });

            JsConfig.EmitCamelCaseNames = true;
            Plugins.Add(new SwaggerFeature());

            bool smartThingsEnabled = Convert.ToBoolean(ConfigurationManager.AppSettings["enableSmartThings"]);
            if (smartThingsEnabled)
            {
                Plugins.Add(new SmartThingsPlugin());
            }

            var manager = new IpModuleManager(module);

            // try one attempt to logout/login if can't login initially
            if (!manager.Login())
            {
                logger.Warn("Couldn't login. Attempting to logout then login to alarm module.");
                manager.Logout();
                manager.Login();
            }

            try
            {
                manager.GetAlarmInformation();
            }
            catch (Exception)
            {
                logger.Error("Problem logging in and getting alarm information. Services will start but Alarm host will not be connected.");
            }

            container.Register(manager);

            alarmStatusCheckThread = new Thread(manager.StartStatusUpdates);
            container.Register(alarmStatusCheckThread);
            alarmStatusCheckThread.Start();

        }
Пример #7
0
        public void GetVersionInfoTest()
        {
            using (var manager = new IpModuleManager(module))
            {
                manager.Login();
                manager.GetVersionInformation();
                manager.Logout();
            }

            //NOTE: fill in with your own values.
            Assert.That(module.AlarmPanelVersion.Type, Is.EqualTo(ConfigurationManager.AppSettings["moduleIp"]));
            Assert.That(module.AlarmPanelVersion.SerialNumber, Is.EqualTo("03 00 61 3B"));
            Assert.That(module.AlarmPanelVersion.FirmwareVersion, Is.EqualTo("1.10"));

            Assert.That(module.IpModuleVersion.FirmwareVersion, Is.EqualTo("1.26.01"));
            Assert.That(module.IpModuleVersion.HardwareVersion, Is.EqualTo("010"));
            Assert.That(module.IpModuleVersion.Eco, Is.EqualTo("M009"));
            Assert.That(module.IpModuleVersion.SerialBoot, Is.EqualTo("N/A"));
            Assert.That(module.IpModuleVersion.IpBoot, Is.EqualTo("2.12"));
            Assert.That(module.IpModuleVersion.SerialNumber, Is.EqualTo("71 00 4A C9"));
            Assert.That(module.IpModuleVersion.MacAddress, Is.EqualTo("00:19:BA:02:16:9D"));
        }
 public ParadoxService(IpModuleManager manager, Thread statusThread, IParadoxEventCallbacks callbacks)
 {
     this.manager = manager;
     this.statusThread = statusThread;
     this.callbacks = callbacks;
 }
Пример #9
0
        public void StatusEventTest()
        {

            using (var manager = new IpModuleManager(module))
            {
                manager.Login();
                manager.GetAlarmInformation();
                manager.AlarmStatusUpdate += (sender, args) => Console.Write("raised");
                manager.MonitorEvents();
                manager.GetStatus();
                Thread.Sleep(1500);
                manager.GetStatus();

                manager.ShouldRaise("AlarmStatusUpdate");

                manager.Logout();

            }

        }
Пример #10
0
 public void LoginTest()
 {
     var manager = new IpModuleManager(module);
     Assert.IsTrue(manager.Login());
     manager.Logout();
 }