Old fashion design for PC-104
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

102 lines
2.9 KiB

//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright © 2000-2002. All Rights Reserved.
// Version 1.0 01/01/2000
// Last modification: 08/10/2003
// PROJECT:
// SUBSYSTEM:
// FILE: SensorSPRU.h
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Header file of SensorSPRU.h
//----------------------------------------------------------------------------
// SensorSPRU.h: interface for the CSensorSPRU class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SensorSPRU_H__7D119E9D_741C_11D4_A1F0_0010B55CB330__INCLUDED_)
#define AFX_SensorSPRU_H__7D119E9D_741C_11D4_A1F0_0010B55CB330__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif
#include "Sensor.h"
#define DTR_BIT_COUNT 7
#define DTR_BITMASK 0x7F
class CSensorSPRU : public CSensor
{
public:
CSensorSPRU();
~CSensorSPRU();
public:
virtual void Enable( BOOL bEnable );
virtual void Reset();
virtual CString GetEventString( int nEvent, BYTE bitState );
virtual COLORREF GetEventColor( int nEvent );
virtual CBitmap* GetBitmap() { return m_pBitmap; }
virtual void SetBitmap( CBitmap* pBitmap ) { m_pBitmap = pBitmap; }
void PaintBits( CDC *pDC, CRect &viewRect, BOOL bInverse );
int GetBitCount()
{
static const BYTE bits[DTR_BIT_COUNT] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40 };
int nCount = 0;
for( int i = 0; i < DTR_BIT_COUNT; i++ )
if( bits[i] & GetBitMask() )
nCount++;
return nCount;
}
BYTE GetBitMask() { return m_bBitMask; }
void SetBitMask( BYTE bBitMask ) { m_bBitMask = bBitMask; }
BYTE GetBitState() { return m_bBitState; }
void SetBitState( BYTE bBitState )
{
m_bBitState = bBitState;
m_bBitAlarm |= bBitState; // save bits which have alarm state whenever
}
BYTE GetBitAlarm() { return m_bBitAlarm; }
void SetBitAlarm( BYTE bBitAlarm ) { m_bBitAlarm = bBitAlarm; }
BYTE GetBitEnable() { return m_bBitEnable; }
void SetBitEnable( BYTE bBitEnable );
void Enable( BOOL bEnable, int nBit );
SDPOINT& GetBitPosition( int nBit ) { return m_pBitPosition[nBit]; }
void SetBitPosition( int nBit, SDPOINT& pos ) { m_pBitPosition[nBit] = pos; }
int GetBitIndex( LPSDPOINT pPoint );
void SetInactiveTime( int iBitMask, DWORD minTime, DWORD maxTime );
void CheckInactiveTime( LPBYTE pByte, DWORD dwCT );
private:
BYTE m_bBitMask;
BYTE m_bBitState;
BYTE m_bBitAlarm;
BYTE m_bBitEnable;
BYTE m_bBitInactive;
DWORD m_pBitMinTime[DTR_BIT_COUNT];
DWORD m_pBitMaxTime[DTR_BIT_COUNT];
// BYTE m_nBitState[DTR_BIT_COUNT];
SDPOINT m_pBitPosition[DTR_BIT_COUNT];
};
typedef struct
{
CSensorSPRU *pSensors[DTR_BIT_COUNT];
INT nCount;
}SDTRGROUP, *LPSDTRGROUP;
#endif // !defined(AFX_SensorSPRU_H__7D119E9D_741C_11D4_A1F0_0010B55CB330__INCLUDED_)