⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xdspacket.cpp

📁 完整的基于Conxant平台的USB电视棒的WIN驱动程序。
💻 CPP
字号:
/*+++ *******************************************************************\ 
* 
*  Copyright and Disclaimer: 
*  
*     --------------------------------------------------------------- 
*     This software is provided "AS IS" without warranty of any kind, 
*     either expressed or implied, including but not limited to the 
*     implied warranties of noninfringement, merchantability and/or 
*     fitness for a particular purpose.
*     --------------------------------------------------------------- 
*   
*     Copyright (c) 2004 Conexant Systems, Inc. 
*     All rights reserved. 
*
\******************************************************************* ---*/ 

// XDSPacket.cpp

#include "XDSPacket.h"


XDSPacket::XDSPacket( BYTE byte1, BYTE byte2 ): 
    _control( byte1 ), _type( byte2 )
{}


void  
XDSPacket::addBytePair( BYTE byte1, BYTE byte2 )
{
    _info += byte1;
    _info += byte2;
}


bool  
XDSPacket::checkSum( BYTE checkSumByte )
{
    // Init sum with the Control/Type pair, and End/Checksum pair
    int sum = (_control & NBITS(7)) + (_type & NBITS(7)) + 
              XDS_END_ALL + (checkSumByte & NBITS(7));
    
    // Add in all the Informational charactors
    for( unsigned int i = 0; i < _info.size(); ++i )
        sum += _info[i] & NBITS(7);

    return (sum & NBITS(7)) == 0;
}


void  
XDSPacket::clearInfo()
{
    _info.resize( 0 );
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -