//	Zinc Application Framework - Z_DEVICE.CPP
//	COPYRIGHT (C) 1990-1999.  All Rights Reserved.
//	Zinc Software Incorporated.  Pleasant Grove, Utah  USA

#include <z_device.hpp>
#include <z_evtmgr.hpp>
#include <z_string.hpp> // For strcmp().
#define ZAF_DEVICE_INFO
#include "gbl_def.cpp"

// ----- ZafDevice ----------------------------------------------------------

ZafDevice::ZafDevice(ZafDeviceType tDeviceType,
	ZafDeviceState tDeviceState) :
	installed(false), deviceType(tDeviceType), deviceState(tDeviceState)
{
}

ZafDevice::~ZafDevice(void)
{
}

int ZafDevice::CompareDevices(void *device1, void *device2)
{
	return ((int)(((ZafDevice *)device1)->deviceType - ((ZafDevice *)device2)->deviceType));
}

bool ZafDevice::IsA(ZafClassID compareID) const
{
	return ((compareID == classID) ? true : ZafElement::IsA(compareID));
}

bool ZafDevice::IsA(ZafClassName compareName) const
{
	return (!strcmp(compareName, className) ? true : ZafElement::IsA(compareName));
}

ZafDeviceState ZafDevice::SetDeviceState(ZafDeviceState tDeviceState)
{
	// Let the Event() function set the deviceState and preform any necassary
	// initialization for D_ON and deinitialization for D_OFF.
	Event(tDeviceState);
	return (deviceState);
}

