// Note: Instrumentation statements are highlighted in green 

#ifndef __HOME_CONTROLLER_HPP
#define __HOME_CONTROLLER_HPP

#include "devices.hpp"
#include "trash can.hpp"
#include <vutility.hpp>
#include <vobject.hpp>
#include <stl\vlist>

using namespace std;

///////////////////////////////////////////////////////////////////////////////
// System status flags
///////////////////////////////////////////////////////////////////////////////

const unsigned long  SYSTEM_NON_OPERATIONAL = 0x0001;
const unsigned long  SYSTEM_ACTIVE          = 0x0002;
const unsigned long  DOORS_LOCKED           = 0x0004;
const unsigned long  WINDOWS_LOCKED         = 0x0008;
const unsigned long  LIGHTS_ON              = 0x0010;
const unsigned long  MOTION_DETECTORS_ON    = 0x0020;
const unsigned long  SMOKE_DETECTORS_ON     = 0x0040;
const unsigned long  DOORS_ALARMS_ON        = 0x0080;
const unsigned long  WINDOWS_ALARMS_ON      = 0x0100;
const unsigned long  SYSTEM_SECURED         = 0x0200;
const unsigned long  SYSTEM_COMPROMISED     = 0x0400;
const unsigned long  SYSTEM_OK              = 0x8000;

///////////////////////////////////////////////////////////////////////////////
// System status bitset definition
///////////////////////////////////////////////////////////////////////////////

VBITSET_START(SystemStatus)
VINCLUSIVE_VALUE(SYSTEM_NON_OPERATIONAL , "Non operational", 0)
VINCLUSIVE_VALUE(SYSTEM_OK, "System OK", 0)
VINCLUSIVE_VALUE(SYSTEM_ACTIVE, "System active", 0)
VINCLUSIVE_VALUE(DOORS_LOCKED, "Doors locked", 0)
VINCLUSIVE_VALUE(WINDOWS_LOCKED, "Windows locked", 0)
VINCLUSIVE_VALUE(LIGHTS_ON, "Lights on", 0)
VINCLUSIVE_VALUE(MOTION_DETECTORS_ON, "Motion detectors on", 0)
VINCLUSIVE_VALUE(SMOKE_DETECTORS_ON, "Smoke detectors on", 0)
VINCLUSIVE_VALUE(DOORS_ALARMS_ON, "Door alarms on", 0)
VINCLUSIVE_VALUE(WINDOWS_ALARMS_ON, "Window alarms on", 0)
VINCLUSIVE_VALUE(SYSTEM_SECURED, "System secured", 0)
VINCLUSIVE_VALUE(SYSTEM_COMPROMISED, "System compromised", 0)
VBITSET_END


///////////////////////////////////////////////////////////////////////////////
// HomeController class 
///////////////////////////////////////////////////////////////////////////////

class HomeController : public VObject   // Add VObject to the inheritance chain
{
DECLARE_VISIBILITY(HomeController)      // Instrumentation statement

public:    // data
  DeviceList deviceList;
  DeviceList::iterator currentDevice;
  DeviceTypes deviceTypes;
  DeviceTrashCan trashCan;
  unsigned short status;


public:    // functions
  HomeController(void);
  HomeController(const HomeController & _controller);
  virtual ~HomeController(void);
  void populateEditView(void);
  HomeController & operator=(const HomeController &_controller);
  void processCommand(unsigned short device_mask, unsigned long command);

  void lockDoors(void);
  void unlockDoors(void);
  void lockWindows(void);
  void unlockWindows(void);
  void turnOnLights(void);
  void turnOffLights(void);
  void enableAlarms(void);
  void disableAlarms(void);
  void enableOutlets(void);
  void disableOutlets(void);

  void selectAll(void);
  void clearSelection(void);
  void enableSelectedItems(void);
  void disableSelectedItems(void);
  void deleteSelectedItems(void);

  ostream & operator<<(ostream & stream);
  istream & operator>>(istream & stream);

  
};
DECLARE_VISIBILITY_CREATOR(HomeController)     // Instrumentation statement

#endif   // __HOME_CONTROLLER_HPP


Copyright 2002-2007 Outerface Technologies, Inc.