public void CheckMessage() { if (Zone != null) { eZoneStatus currentStatus = myPanel.GetZoneObject(Zone.GetZoneNumber).GetZoneStatus; if (lastStatus != currentStatus) { CrestronConsole.PrintLine("Firing Next Update for Zone {0} status changed to {1}", Zone.GetZoneName, Zone.GetZoneStatus); eAreaArmedStatus areaArmedStatus = currentArea.GetAreaArmedStatus; string devicesToSend = string.Join(",", handler.CheckZoneNotificationProperty(zoneNumber, areaArmedStatus)); myPanel.SendDebug(String.Format("Zone Devices to send count {0} - {1}", devicesToSend.Length, devicesToSend)); if (devicesToSend.Length > 0 && !String.IsNullOrEmpty(devicesToSend)) { myPanel.SendDebug( String.Format("NotificationMessageHandler: Building Message *{0} - {1}:{2} to Devices {3}", areaName, zoneName, currentStatus, devicesToSend)); PushoverManager.Instance.SendMessage(devicesToSend, String.Format("{0} - {1}", areaName, zoneName), String.Format("{0}", currentStatus)); } lastStatus = currentStatus; RestartTimeout(); } } }
//Public Functions ------------------------------------------------------- public void SetArmLevel(eAreaArmSet arm) { if (myPw.IsValidCodeEntered()) { char al = '0'; al += (char)(int)arm; string pw = myPw.getPassword(); string cmdStr = string.Format("a{0}{1}{2}00", al, areaNumber, pw); myPanel.SendDebug(string.Format("Area {0} - SetArmLevel = {1} ({2})", areaNumber, arm, cmdStr)); myPanel.Enqueue(cmdStr); } }
//Public Functions ------------------------------------------------------- public void BypassRequest() { if (myPanel.Areas.ContainsKey(areaAssignment) && areaAssignment > 0) { if (myPanel.Areas[areaAssignment].myPw.IsValidCodeEntered()) { string cmdStr = string.Format("zb{0:000}{1}{2}00", zoneNumber, areaAssignment, myPanel.Areas[areaAssignment].myPw.getPassword()); myPanel.SendDebug(string.Format("Zone {0} - BypassRequest = {1}", zoneNumber, cmdStr)); myPanel.Enqueue(cmdStr); } } else { ErrorLog.Error("ElkPanel {0} - Zone {1} doesnt have internal area assignment set.", myPanel.getPanelId, zoneNumber); } }
public void SelectUserDevice(ushort userDevice) { userDevice = (ushort)(userDevice - 1); try { if (userDevice >= 0 && userDevice <= myNotificationManager.notificationDevices.Count) { myNotificationDevice = myNotificationManager.notificationDevices.ElementAt(userDevice).Value; if (newUserDeviceChange != null) { newUserDeviceChange(myNotificationDevice.DeviceName); } } } catch (Exception ex) { myPanel.SendDebug(String.Format("Pushover Notification Manager Error Selecting User Device: {0}", ex.ToString())); } }
private void ElkNotificationMessageHandler_ElkAreaEvent(object sender, ElkAreaEventArgs e) { if (!myElkNotificationManager.managerReady) { return; } ElkArea currentArea = myPanel.GetAreaObject(e.Area); string areaName = currentArea.GetAreaName.TrimEnd(); switch (e.EventUpdateType) { case eElkAreaEventUpdateType.ArmedStatusChange: eAreaArmedStatus status = currentArea.GetAreaArmedStatus; string devicesToSendArmed = string.Join(",", CheckAreaNotificationProperty(currentArea, e.EventUpdateType)); if (devicesToSendArmed.Length > 0 && !String.IsNullOrEmpty(devicesToSendArmed)) { PushoverManager.Instance.SendMessage(devicesToSendArmed, String.Format("{0} - {1}", areaName, status), String.Format("Area {0}", status)); myPanel.SendDebug( String.Format("NotificationMessageHandler: Building Message *{0} - {1} to Devices {2}", areaName, status, devicesToSendArmed)); } break; case eElkAreaEventUpdateType.AlarmStateChange: eAreaAlarmState alarmStatus = currentArea.GetAlarmStatus; string devicesToSendAlarm = string.Join(",", CheckAreaNotificationProperty(currentArea, e.EventUpdateType)); if (devicesToSendAlarm.Length > 0 && !String.IsNullOrEmpty(devicesToSendAlarm)) { PushoverManager.Instance.SendMessage(devicesToSendAlarm, String.Format("{0} - {1}", areaName, alarmStatus), String.Format("Area {0}", alarmStatus)); myPanel.SendDebug( String.Format("NotificationMessageHandler: Building Message *{0} - {1} to Devices {2}", areaName, alarmStatus, devicesToSendAlarm)); } break; } }
//Public Functions ------------------------------------------------------- public void SetOutputOn(int _sec) { myPanel.SendDebug(string.Format("Output {0} - SetOutputOn, seconds: {1}", outputNumber, _sec)); myPanel.Enqueue(string.Format("cn{0:000}{1:00000}00", outputNumber, _sec)); }
//Public Functions ------------------------------------------------------- public void KeypadFunctionPress(string key) { string cmdStr = String.Format("kf{0}{1}00", areaNumber.ToString("D2"), key); myPanel.SendDebug(string.Format("Area {0} - KeypadFunctionPress = {1} ({2})", areaNumber, key, cmdStr)); myPanel.Enqueue(cmdStr); }
public void LoadNotificationConfig() { if (string.IsNullOrEmpty(configFileName)) { return; } try { FileInfo info = new FileInfo(configFileName); if (info.Exists) { _stream = new FileStream(configFileName, FileMode.Open); _reader = new StreamReader(_stream); string text = _reader.ReadToEnd(); _reader.Dispose(); _stream.Dispose(); notificationDevices = JsonConvert.DeserializeObject <Dictionary <string, NotificationDevice> >(text); configExists = true; BuildNotificationConfig(); } else { configExists = false; myPanel.SendDebug("Notification Config Does not exist, building new config"); BuildNotificationConfig(); } } catch (Exception ex) { myPanel.SendDebug(String.Format("Exception Reading Notification Config: {0}", ex.ToString())); } }