PSynCommand.cpp
上传用户:popouu88
上传日期:2013-02-11
资源大小:2894k
文件大小:1k
源码类别:

IP电话/视频会议

开发平台:

Visual C++

  1. // PSynCommand.cpp: implementation of the PSynCommand class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "PSynCommand.h"
  5. //////////////////////////////////////////////////////////////////////
  6. // Construction/Destruction
  7. //////////////////////////////////////////////////////////////////////
  8. PSynCommand::PSynCommand()
  9. {
  10. this->Tag = PSynCommandTAG;
  11. this->syncommand = 0;
  12. this->full_screen = false;
  13. }
  14. PSynCommand::~PSynCommand()
  15. {
  16. }
  17. bool PSynCommand::assembleData( int cmd , bool fullScreen )
  18. {
  19. this->buffer.Resize( 4 * INT_SIZE );
  20. char * now = this->buffer.GetBuffer( );
  21. *( int * )now = this->buffer.GetSize( ); now += INT_SIZE;
  22. *( int * )now = this->Tag; now += INT_SIZE;
  23. *( int * )now = cmd; now += INT_SIZE;
  24. *( int * )now = ( int )fullScreen;
  25. return true;
  26. }
  27. bool PSynCommand::parseData( CBuffer & buffer )
  28. {
  29. if( ! buffer.GetSize( ) ) return false;
  30. char * now = buffer.GetBuffer( ) + 2 * INT_SIZE;
  31. this->syncommand = *( int * )now; now += INT_SIZE;
  32. this->full_screen = ( bool ) * ( int * )now;
  33. return true;
  34. }