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.

97 lines
2.7 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: DeviceRabbit.h
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of DeviceRabbit.h
  13. //----------------------------------------------------------------------------
  14. // DeviceRabbit.h: interface for the CDeviceRabbit class.
  15. //
  16. //////////////////////////////////////////////////////////////////////
  17. #if !defined(AFX_DEVICERABBIT_H__6860E463_7FF2_4A81_B01E_400815D37D99__INCLUDED_)
  18. #define AFX_DEVICERABBIT_H__6860E463_7FF2_4A81_B01E_400815D37D99__INCLUDED_
  19. #if _MSC_VER > 1000
  20. #pragma once
  21. #endif // _MSC_VER > 1000
  22. #include "DeviceDI.h"
  23. #include "DevicePTZ.h"
  24. #include "DeviceDO.h"
  25. #include "DeviceMD.h"
  26. #include "DeviceVM.h"
  27. class CDeviceRabbit:
  28. public CDeviceMD,
  29. public CDeviceDI,
  30. public CDeviceDO,
  31. public CDevicePTZ
  32. {
  33. public:
  34. CDeviceRabbit();
  35. virtual ~CDeviceRabbit();
  36. public:
  37. enum { DI_INPUT_COUNT = 16, DO_OUTPUT_COUNT = 12, VM_OUTPUT_COUNT = 1, VM_INPUT_COUNT = 2 };
  38. protected:
  39. virtual BOOL GetCommand( LPBYTE pBuffer, DWORD &dwCount, BOOL &bNext );
  40. virtual BOOL SetAnswer( LPBYTE pBuffer, DWORD dwCount );
  41. private:
  42. struct DATA_MOVE
  43. {
  44. int nDir;
  45. double speed;
  46. }m_DataPan, m_DataTilt, m_DataZoom;
  47. struct DATA_PTZ
  48. {
  49. double pan;
  50. double tilt;
  51. double zoom;
  52. }m_DataPtz;
  53. struct DATA_VM
  54. {
  55. int nOutput[2][ VM_OUTPUT_COUNT ];
  56. }m_DataVM;
  57. WORD m_wInputBits;
  58. WORD m_wOutputBits;
  59. BOOL m_bWaitForPTZReady;
  60. private:
  61. BOOL m_bCmdPtz[ PTZC_COUNT ];
  62. BOOL m_bCmdDI[ DDIC_COUNT ];
  63. BOOL m_bCmdDO[ DDOC_COUNT ];
  64. BOOL m_bCmdVM[ CDeviceVM::DVMC_COUNT ];
  65. private:
  66. CDeviceVM m_DeviceVM[2];
  67. public:
  68. CDeviceVM *GetDeviceVM( int nIndex ){ return ( nIndex < 2 ) ? &m_DeviceVM[nIndex] : NULL; }
  69. private:
  70. double ConvertPanToDegree( WORD Pan ) { return 360.0 - ((double)Pan) * 360.0 / 512.0; }
  71. WORD ConvertDegreeToPan( double Angle ) { return (WORD)( ( ( 360.0 - Angle ) * 512.0 ) / 360.0 ); }
  72. double ConvertTiltToDegree( WORD Tilt ) { return 90.0 - ((double)Tilt) * 360.0 / 512.0; }
  73. WORD ConvertDegreeToTilt( double Angle ) { return (WORD)( ( ( 90.0 - Angle ) * 512.0 ) / 360.0 ); }
  74. double ConvertZoomToPercent( WORD Zoom ) { return ((double)Zoom) * 100.0 / 511.0; }
  75. WORD ConvertPercentToZoom( double Percent ) { return (WORD)( ( Percent * 511) / 100.0); }
  76. double ConvertSpeedToPercent( BYTE Speed ) { return ((double)Speed) * 100.0 / 63.0; }
  77. BYTE ConvertPercentToSpeed( double Percent ) { return (BYTE)( ( Percent * 63.0 ) / 100.0 ); }
  78. };
  79. #endif