For DOS Protected Mode version of sensor core software
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.

93 lines
2.5 KiB

3 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: cnesher.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of ctks576.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "seraphim.h"
  16. #ifdef EMBEDDED_CAMERA_SERAPHIM
  17. #include "..\lglib\comm\PTZSrph.cpp"
  18. #include "..\lglib\device\DSeraphi.cpp"
  19. CCameraSeraphimPTZ::CCameraSeraphimPTZ()
  20. {
  21. m_pComm = NULL;
  22. m_pCamera = NULL;
  23. }
  24. CCameraSeraphimPTZ::~CCameraSeraphimPTZ()
  25. {
  26. Destroy();
  27. }
  28. BOOL CCameraSeraphimPTZ::Create( CCamera *pCamera, CComm485* pComm, CComm485::PORTS nPort, LGS::PCAMERA_PARAMETERS pParameters, SWITCHER_SETTINGS *pSwitcher )
  29. {
  30. // destroy old incarnation :)
  31. Destroy();
  32. m_pComm = pComm;
  33. m_pCamera = pCamera;
  34. if( !m_pComm->Create( nPort, 2400L, 8, CComm485::_NOPARITY ) )
  35. return FALSE;
  36. if( !m_Protocol.Create( m_pComm ) )
  37. return FALSE;
  38. SetProtocol( &m_Protocol );
  39. SetAddress( 2 );
  40. //printf("Seraphim Create\n");
  41. return CmdInit();
  42. //m_pTable[0] = pSwitcher->pTable[0];
  43. //m_pTable[1] = pSwitcher->pTable[1];
  44. //m_pTable[2] = pSwitcher->pTable[2];
  45. //m_nTimeoutCommand = pSwitcher->nReplyTimeout;
  46. //m_nTimeoutAfterCommand = pSwitcher->nCommandTimeout;
  47. //m_nTimeoutEnterSwitch = pSwitcher->nAutoEnterTimeout * 1000L; // convert to ms
  48. //m_nTimeoutInterSwitch = pSwitcher->nAutoSwitchTimeout * 1000L; // convert to ms
  49. //m_nSwitchMode = pSwitcher->nAutoMode;
  50. //return TRUE;
  51. }
  52. void CCameraSeraphimPTZ::OnEvtInit(){
  53. //#ifdef EMULATE_SERAPHIM_ON_REAL_PELCO
  54. m_pCamera->OnCameraInit();
  55. //#else
  56. //#endif
  57. }
  58. void CCameraSeraphimPTZ::Destroy()
  59. {
  60. m_Protocol.Destroy();
  61. if( m_pComm )
  62. {
  63. m_pComm->Destroy();
  64. m_pComm = NULL;
  65. }
  66. }
  67. BOOL CCameraSeraphimPTZ::CmdSetPTZ( PTZ_DEGREE dPan, PTZ_DEGREE dTilt, PTZ_PERCENT dZoom ){
  68. //if( dPan > m_pTable[2] ) dPan = (LGS_MIRROR_ANGLE_OF_VIEW * 4 / 4 - LGS_MIRROR_ANGLE_OF_VIEW / 8);
  69. //else if ( dPan > m_pTable[1] ) dPan = (LGS_MIRROR_ANGLE_OF_VIEW * 3 / 4 - LGS_MIRROR_ANGLE_OF_VIEW / 8);
  70. //else if ( dPan > m_pTable[0] ) dPan = (LGS_MIRROR_ANGLE_OF_VIEW * 2 / 4 - LGS_MIRROR_ANGLE_OF_VIEW / 8);
  71. //else dPan = (LGS_MIRROR_ANGLE_OF_VIEW * 1 / 4 - LGS_MIRROR_ANGLE_OF_VIEW / 8);
  72. return CLgDevicePTZSeraphim::CmdSetPTZ( dPan, dTilt, dZoom );
  73. }
  74. #endif // EMBEDDED_CAMERA_SERAPHIM