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.

98 lines
2.0 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: LgNetSocketMic1300PTZ.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of LgNetSocketMic1300PTZ.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "..\Version.h"
  16. #include "LgNetSocketMic1300PTZ.h"
  17. #include "LgNetDeviceMic1300PTZ.h"
  18. CLgNetSocketMic1300PTZ::CLgNetSocketMic1300PTZ()
  19. {
  20. }
  21. CLgNetSocketMic1300PTZ::~CLgNetSocketMic1300PTZ()
  22. {
  23. Destroy();
  24. // unlink all linked devices
  25. CLgLinkP<CLgNetSocket,CLgNetSocketDevice>::Unlink();
  26. }
  27. BOOL CLgNetSocketMic1300PTZ::Create( LPCTSTR pCommPort, BOOL bDemo )
  28. {
  29. Destroy();
  30. if( !bDemo )
  31. {
  32. if( !m_Connection.Create( pCommPort, 9600, 8, ODDPARITY, ONESTOPBIT, 1024, 1024 ) )
  33. return FALSE;
  34. if( !m_Protocol.Create( &m_Connection ) )
  35. return FALSE;
  36. }
  37. if( !CLgNetSocket::Create( &m_Protocol ) )
  38. return FALSE;
  39. return TRUE;
  40. }
  41. BOOL CLgNetSocketMic1300PTZ::SetBaudrate( DWORD nBaudrate )
  42. {
  43. DCB dcb;
  44. if( !m_Connection.GetCommState( &dcb ) )
  45. return FALSE;
  46. if( dcb.BaudRate == nBaudrate )
  47. return TRUE;
  48. dcb.BaudRate = nBaudrate;
  49. return m_Connection.SetCommState( &dcb );
  50. }
  51. /*
  52. BOOL CLgNetSocketMic1300PTZ::SetLowBaudrate( BOOL bLowSpeed )
  53. {
  54. DCB dcb;
  55. if( !m_Connection.GetCommState( &dcb ) )
  56. return FALSE;
  57. return SetBaudrate( bLowSpeed ? 1200 : 9600 );
  58. if( bLowSpeed )
  59. {
  60. if( dcb.BaudRate != 1200 )
  61. {
  62. dcb.BaudRate = 1200;
  63. return m_Connection.SetCommState( &dcb );
  64. }
  65. }
  66. else
  67. {
  68. if( dcb.BaudRate != 9600 )
  69. {
  70. dcb.BaudRate = 9600;
  71. return m_Connection.SetCommState( &dcb );
  72. }
  73. }
  74. return TRUE;
  75. }
  76. */
  77. void CLgNetSocketMic1300PTZ::Destroy()
  78. {
  79. CLgNetSocket::Destroy();
  80. m_Protocol.Destroy();
  81. m_Connection.Destroy();
  82. }