public void LoginTest()
        {
            var manager = new IpModuleManager(module);

            Assert.IsTrue(manager.Login());
            manager.Logout();
        }
 public void StayArmTest()
 {
     using (var manager = new IpModuleManager(module))
     {
         manager.Login();
         manager.GetAlarmInformation();
         manager.AlarmAction(PartitionNumber.Two, AlarmMode.RegularArm);
         manager.Logout();
     }
 }
 public void GetStatusTest()
 {
     using (var manager = new IpModuleManager(module))
     {
         manager.Login();
         manager.GetAlarmInformation();
         manager.GetStatus();
         manager.Logout();
     }
 }
        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();
        }
        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 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();
            }
        }
 private void BtnConnect_Click(object sender, RoutedEventArgs e)
 {
     ipmm.Logout();
     BtnConnect.IsEnabled = false;
     if (!ipmm.IsLoggedIn)
     {
         ipmm.Login();
     }
     ipmm.GetAlarmInformation();
     BtnGetAlarmInfo.IsEnabled    = true;
     BtnGetDeviceStatus.IsEnabled = true;
     BtnGetVersionInfo.IsEnabled  = true;
     CmbArming.IsEnabled          = true;
     ipmm.DeviceStatusChanged    += Ipmm_DeviceStatusChanged;
     AllDevices             = new ObservableCollection <Device>(ipmm.Devices);
     LstDevices.ItemsSource = AllDevices;
     dt.Interval            = new TimeSpan(0, 0, 0, 1, 50);
     dt.Start();
     dt.Tick += Dt_Tick;
 }
        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"));
        }