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

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: SensorSPRU.h
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of SensorSPRU.h
  13. //----------------------------------------------------------------------------
  14. // SensorSPRU.h: interface for the CSensorSPRU class.
  15. //
  16. //////////////////////////////////////////////////////////////////////
  17. #if !defined(AFX_SensorSPRU_H__7D119E9D_741C_11D4_A1F0_0010B55CB330__INCLUDED_)
  18. #define AFX_SensorSPRU_H__7D119E9D_741C_11D4_A1F0_0010B55CB330__INCLUDED_
  19. #if _MSC_VER > 1000
  20. #pragma once
  21. #endif
  22. #include "Sensor.h"
  23. #define DTR_BIT_COUNT 7
  24. #define DTR_BITMASK 0x7F
  25. class CSensorSPRU : public CSensor
  26. {
  27. public:
  28. CSensorSPRU();
  29. ~CSensorSPRU();
  30. public:
  31. virtual void Enable( BOOL bEnable );
  32. virtual void Reset();
  33. virtual CString GetEventString( int nEvent, BYTE bitState );
  34. virtual COLORREF GetEventColor( int nEvent );
  35. virtual CBitmap* GetBitmap() { return m_pBitmap; }
  36. virtual void SetBitmap( CBitmap* pBitmap ) { m_pBitmap = pBitmap; }
  37. void PaintBits( CDC *pDC, CRect &viewRect, BOOL bInverse );
  38. int GetBitCount()
  39. {
  40. static const BYTE bits[DTR_BIT_COUNT] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40 };
  41. int nCount = 0;
  42. for( int i = 0; i < DTR_BIT_COUNT; i++ )
  43. if( bits[i] & GetBitMask() )
  44. nCount++;
  45. return nCount;
  46. }
  47. BYTE GetBitMask() { return m_bBitMask; }
  48. void SetBitMask( BYTE bBitMask ) { m_bBitMask = bBitMask; }
  49. BYTE GetBitState() { return m_bBitState; }
  50. void SetBitState( BYTE bBitState )
  51. {
  52. m_bBitState = bBitState;
  53. m_bBitAlarm |= bBitState; // save bits which have alarm state whenever
  54. }
  55. BYTE GetBitAlarm() { return m_bBitAlarm; }
  56. void SetBitAlarm( BYTE bBitAlarm ) { m_bBitAlarm = bBitAlarm; }
  57. BYTE GetBitEnable() { return m_bBitEnable; }
  58. void SetBitEnable( BYTE bBitEnable );
  59. void Enable( BOOL bEnable, int nBit );
  60. SDPOINT& GetBitPosition( int nBit ) { return m_pBitPosition[nBit]; }
  61. void SetBitPosition( int nBit, SDPOINT& pos ) { m_pBitPosition[nBit] = pos; }
  62. int GetBitIndex( LPSDPOINT pPoint );
  63. void SetInactiveTime( int iBitMask, DWORD minTime, DWORD maxTime );
  64. void CheckInactiveTime( LPBYTE pByte, DWORD dwCT );
  65. private:
  66. BYTE m_bBitMask;
  67. BYTE m_bBitState;
  68. BYTE m_bBitAlarm;
  69. BYTE m_bBitEnable;
  70. BYTE m_bBitInactive;
  71. DWORD m_pBitMinTime[DTR_BIT_COUNT];
  72. DWORD m_pBitMaxTime[DTR_BIT_COUNT];
  73. // BYTE m_nBitState[DTR_BIT_COUNT];
  74. SDPOINT m_pBitPosition[DTR_BIT_COUNT];
  75. };
  76. typedef struct
  77. {
  78. CSensorSPRU *pSensors[DTR_BIT_COUNT];
  79. INT nCount;
  80. }SDTRGROUP, *LPSDTRGROUP;
  81. #endif // !defined(AFX_SensorSPRU_H__7D119E9D_741C_11D4_A1F0_0010B55CB330__INCLUDED_)