myZoneC

(last updated: 2016-08-01)

Purpose: A Java application that primarily runs in the task tray and notifies the user with popup messages and sounds that an alert message has been received.

Overview

myZoneC is a component of the myZone system. The Java application runs on a Windows or Linux PC that is on the same network as the ZoneController PC, and it communicates with the ZoneController app via network sockets. It is a limited function application since it will be running all the time on the PC. The functions available include:

  • Show alerts by popup message when they arrive (alert messages are pushed by the ZoneController App)
  • View all active alerts
  • Set an override for the security mode, or revert to scheduled mode

***snapshot image

Specifications

  • Changes the task tray icon depending on alerts received (none, NOTE and NOTE alerts, WARN alerts, WARN alerts with acknowledgement neeed = flash icon).
  • Play a sound file when an alert is received.
  • Popup menu when tray icon is right-clicked
  • Menu:
    • Mute sounds
    • Do not show popup messages for NOTE and NOTICE alerts
    • Set security mode
    • Send "ack" command to acknowledge alerts.
    • Open a window to view active alerts
    • Tooltip (mouse hover over tray icon) shows number of active alerts and the most recently received alert message.

Technical Details

  • Java application
  • NetBeans 8.1 project
  • Uses the TrayIcon class to show an icon in the task tray, show popup messages, and handle a menu.
  • ActionsListener/ActionEvent is used to present events to an actionPerformed() handler defined at the top application level (Main.java)
  • Socket object is used to open a client socket connection to the socket server running in the ZoneController App.
  • When data arrives via the socket, it is parsed for System Messages. System Messages include a 3 byte message id followed by a defined number of bytes. The supported message ids are matched to the keys in a ConcurrentHashMap object. The object associated with the key is a class which includes an action to perform when the the key is matched. For example, when the bytes received start with "ALT", and there number of received bytes is >= the number of bytes in an alert message, then the "ALT" key is given to the Hash Map and the associated object is obtained. The "action" function is executed, which in this case creates an AlertItemC object and adds it to another Hash Map used to store the alerts.
  • Uses javax.sound.sampled.* AudioInputStream/AudioSystem/AudioFormat to play sound files.
  • Uses java.awt.PopupMenu, MenuItem, and Menu

Notes:

1) This application does NOT provide full featured interactivity with the ZoneController App. It is desired that only features that indicate important information (alerts) should be included so that the resource footprint is small (since the application is always running on the PC). Apps like this that run all the time are probably left to a native application (since running the JRE all the time is not ideal).