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.

101 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: chebron.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW `
  11. // ~~~~~~~~
  12. // Source file of ctks576.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "chebron.h"
  16. #ifdef EMBEDDED_CAMERA_HEBRON
  17. #ifdef INCLUDE_WINDOWS_DEFINITIONS
  18. #include "..\lglib\device\dhebron.cpp"
  19. #endif
  20. CCameraHebronPTZ::CCameraHebronPTZ()
  21. {
  22. m_pComm = NULL;
  23. m_pCamera = NULL;
  24. }
  25. CCameraHebronPTZ::~CCameraHebronPTZ()
  26. {
  27. Destroy();
  28. }
  29. BOOL CCameraHebronPTZ::Create( CCamera *pCamera, CComm485* pComm, CComm485::PORTS nPort, LGS::PCAMERA_PARAMETERS pParameters, BOOL bSwitcher, SWITCHER_SETTINGS *pSwitcher )
  30. {
  31. // destroy old incarnation :)
  32. Destroy();
  33. m_pComm = pComm;
  34. m_pCamera = pCamera;
  35. m_bSwitcher = bSwitcher;
  36. if( !m_pComm->Create( nPort, 19200L, 8, CComm485::_NOPARITY ) )
  37. return FALSE;
  38. if( !m_Protocol.Create( m_pComm ) )
  39. return FALSE;
  40. SetProtocol( &m_Protocol );
  41. SetAddress( 0 );
  42. if( m_bSwitcher )
  43. {
  44. //#ifdef LGS_MIRROR
  45. // m_pTable[0] = 360 - LGS_MIRROR_ANGLE_OF_VIEW * 1 / 4;
  46. // m_pTable[1] = 360 - LGS_MIRROR_ANGLE_OF_VIEW * 2 / 4;
  47. // m_pTable[2] = 360 - LGS_MIRROR_ANGLE_OF_VIEW * 3 / 4;
  48. //#else
  49. m_pTable[0] = pSwitcher->pTable[0];
  50. m_pTable[1] = pSwitcher->pTable[1];
  51. m_pTable[2] = pSwitcher->pTable[2];
  52. //#endif
  53. }
  54. return CmdInit();
  55. }
  56. void CCameraHebronPTZ::Destroy()
  57. {
  58. m_Protocol.Destroy();
  59. if( m_pComm )
  60. {
  61. m_pComm->Destroy();
  62. m_pComm = NULL;
  63. }
  64. }
  65. BOOL CCameraHebronPTZ::CmdSetPTZ( PTZ_DEGREE dPan, PTZ_DEGREE dTilt, PTZ_PERCENT dZoom )
  66. {
  67. if( m_bSwitcher )
  68. {
  69. //#ifdef LGS_MIRROR
  70. // if ( dPan > m_pTable[0] ) dPan = 360 - (LGS_MIRROR_ANGLE_OF_VIEW * 1 / 4 - LGS_MIRROR_ANGLE_OF_VIEW / 8);
  71. // else if ( dPan > m_pTable[1] ) dPan = 360 - (LGS_MIRROR_ANGLE_OF_VIEW * 2 / 4 - LGS_MIRROR_ANGLE_OF_VIEW / 8);
  72. // else if ( dPan > m_pTable[2] ) dPan = 360 - (LGS_MIRROR_ANGLE_OF_VIEW * 3 / 4 - LGS_MIRROR_ANGLE_OF_VIEW / 8);
  73. // else dPan = 360 - (LGS_MIRROR_ANGLE_OF_VIEW * 4 / 4 - LGS_MIRROR_ANGLE_OF_VIEW / 8);
  74. //#else
  75. if ( dPan > m_pTable[2] ) dPan = 360 - (LGS_MIRROR_ANGLE_OF_VIEW * 4 / 4 - LGS_MIRROR_ANGLE_OF_VIEW / 8);
  76. else if ( dPan > m_pTable[1] ) dPan = 360 - (LGS_MIRROR_ANGLE_OF_VIEW * 3 / 4 - LGS_MIRROR_ANGLE_OF_VIEW / 8);
  77. else if ( dPan > m_pTable[0] ) dPan = 360 - (LGS_MIRROR_ANGLE_OF_VIEW * 2 / 4 - LGS_MIRROR_ANGLE_OF_VIEW / 8);
  78. else dPan = 360 - (LGS_MIRROR_ANGLE_OF_VIEW * 1 / 4 - LGS_MIRROR_ANGLE_OF_VIEW / 8);
  79. //#endif
  80. }
  81. return CLgDevicePTZHebron::CmdSetPTZ( dPan, dTilt, dZoom );
  82. }
  83. #endif // EMBEDDED_CAMERA_HEBRON