本文整理汇总了C++中CHeaderData类的典型用法代码示例。如果您正苦于以下问题:C++ CHeaderData类的具体用法?C++ CHeaderData怎么用?C++ CHeaderData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CHeaderData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeHeaderInt
void CDPlusHandler::writeHeaderInt(IReflectorCallback* handler, CHeaderData& header, DIRECTION direction)
{
wxASSERT(handler != NULL);
if (m_linkState != DPLUS_LINKED)
return;
if (direction != m_direction)
return;
// Already is use?
if (m_dPlusId != 0x00U)
return;
switch (m_direction) {
case DIR_OUTGOING:
if (m_destination == handler) {
header.setRepeaters(m_callsign, m_reflector);
header.setDestination(m_yourAddress, m_yourPort);
m_handler->writeHeader(header);
m_rptrId = header.getId();
}
break;
case DIR_INCOMING:
header.setDestination(m_yourAddress, m_yourPort);
m_handler->writeHeader(header);
break;
}
}
示例2: writeHeader
void CCCSHandler::writeHeader(CHeaderData& header)
{
m_myCall1 = header.getMyCall1();
m_myCall2 = header.getMyCall2();
m_seqNo = 0U;
}
示例3: process
void CDExtraHandler::process(CHeaderData& header)
{
for (unsigned int i = 0U; i < m_maxReflectors; i++) {
CDExtraHandler* reflector = m_reflectors[i];
if (reflector != NULL) {
if (reflector->m_address.s_addr == header.getAddress().s_addr &&
reflector->m_port == header.getPort())
reflector->processInt(header);
}
}
}
示例4: writeHeader
bool CHBRepeaterProtocolHandler::writeHeader(CHeaderData& header)
{
unsigned char buffer[50U];
unsigned int length = header.getHBRepeaterData(buffer, 50U, true);
#if defined(DUMP_TX)
CUtils::dump(wxT("Sending Header"), buffer, length);
return true;
#else
return m_socket.write(buffer, length, header.getYourAddress(), header.getYourPort());
#endif
}
示例5: sendHeader
bool CAPRSTransmit::sendHeader(const CHeaderData& header)
{
unsigned char buffer[60U];
unsigned int length = header.getG2Data(buffer, 60U, true);
for (unsigned int i = 0U; i < 2U; i++) {
bool res = m_socket.write(buffer, length, header.getYourAddress(), header.getYourPort());
if (!res)
return false;
}
return true;
}
示例6: writeHeader
bool CDVAPController::writeHeader(const CHeaderData& header)
{
m_streamId++;
unsigned char buffer[50U];
::memcpy(buffer, DVAP_HEADER, DVAP_HEADER_LEN);
wxUint16 sid = wxUINT16_SWAP_ON_BE(m_streamId);
::memcpy(buffer + 2U, &sid, sizeof(wxUint16));
buffer[4U] = 0x80U;
buffer[5U] = 0U;
::memset(buffer + 6U, ' ', RADIO_HEADER_LENGTH_BYTES);
buffer[6U] = header.getFlag1();
buffer[7U] = header.getFlag2();
buffer[8U] = header.getFlag3();
wxString rpt2 = header.getRptCall2();
for (unsigned int i = 0U; i < rpt2.Len() && i < LONG_CALLSIGN_LENGTH; i++)
buffer[i + 9U] = rpt2.GetChar(i);
wxString rpt1 = header.getRptCall1();
for (unsigned int i = 0U; i < rpt1.Len() && i < LONG_CALLSIGN_LENGTH; i++)
buffer[i + 17U] = rpt1.GetChar(i);
wxString your = header.getYourCall();
for (unsigned int i = 0U; i < your.Len() && i < LONG_CALLSIGN_LENGTH; i++)
buffer[i + 25U] = your.GetChar(i);
wxString my1 = header.getMyCall1();
for (unsigned int i = 0U; i < my1.Len() && i < LONG_CALLSIGN_LENGTH; i++)
buffer[i + 33U] = my1.GetChar(i);
wxString my2 = header.getMyCall2();
for (unsigned int i = 0U; i < my2.Len() && i < SHORT_CALLSIGN_LENGTH; i++)
buffer[i + 41U] = my2.GetChar(i);
CCCITTChecksumReverse cksum;
cksum.update(buffer + 6U, RADIO_HEADER_LENGTH_BYTES - 2U);
cksum.result(buffer + 45U);
m_framePos = 0U;
m_seq = 0U;
wxMutexLocker locker(m_mutex);
unsigned int space = m_txData.freeSpace();
if (space < 48U)
return false;
unsigned char len = DVAP_HEADER_LEN;
m_txData.addData(&len, 1U);
m_txData.addData(buffer, DVAP_HEADER_LEN);
return true;
}
示例7: onHeader
void CDummyRepeaterFrame::onHeader(wxEvent& event)
{
CDummyRepeaterHeaderEvent& hdrEvent = dynamic_cast<CDummyRepeaterHeaderEvent&>(event);
CHeaderData* header = hdrEvent.getHeaderData();
if (header != NULL) {
wxDateTime dateTime = header->getTime();
wxString hrdDateTime = dateTime.FormatISODate() + wxT(" ") + dateTime.FormatISOTime();
m_heard->InsertItem(0L, hrdDateTime);
wxString urCall = header->getYourCall();
m_hrdYour->SetLabel(urCall);
m_heard->SetItem(0L, 1, urCall);
wxString myCall = header->getMyCall1();
wxString myCall2 = header->getMyCall2();
if (!myCall2.IsSameAs(wxT(" "))) {
myCall.Append(wxT("/"));
myCall.Append(myCall2);
}
m_hrdMy->SetLabel(myCall);
m_heard->SetItem(0L, 2, myCall);
wxString rpt1Call = header->getRptCall1();
m_hrdRpt1->SetLabel(rpt1Call);
m_heard->SetItem(0L, 3, rpt1Call);
wxString rpt2Call = header->getRptCall2();
m_hrdRpt2->SetLabel(rpt2Call);
m_heard->SetItem(0L, 4, rpt2Call);
wxString flags;
flags.Printf(wxT("%02X %02X %02X"), header->getFlag1(), header->getFlag2(), header->getFlag3());
m_hrdFlags->SetLabel(flags);
m_hrdMessage->SetLabel(wxEmptyString);
delete header;
} else {
m_hrdYour->SetLabel(wxEmptyString);
m_hrdMy->SetLabel(wxEmptyString);
m_hrdRpt1->SetLabel(wxEmptyString);
m_hrdRpt2->SetLabel(wxEmptyString);
m_hrdFlags->SetLabel(wxEmptyString);
m_hrdMessage->SetLabel(wxEmptyString);
}
}
示例8: writeHeader
void CGMSKModemWinUSB::writeHeader(const CHeaderData& header)
{
unsigned char myCall1[LONG_CALLSIGN_LENGTH];
unsigned char myCall2[SHORT_CALLSIGN_LENGTH];
unsigned char yourCall[LONG_CALLSIGN_LENGTH];
unsigned char rptCall1[LONG_CALLSIGN_LENGTH];
unsigned char rptCall2[LONG_CALLSIGN_LENGTH];
for (unsigned int i = 0U; i < LONG_CALLSIGN_LENGTH; i++)
myCall1[i] = header.getMyCall1().GetChar(i);
for (unsigned int i = 0U; i < SHORT_CALLSIGN_LENGTH; i++)
myCall2[i] = header.getMyCall2().GetChar(i);
for (unsigned int i = 0U; i < LONG_CALLSIGN_LENGTH; i++)
yourCall[i] = header.getYourCall().GetChar(i);
for (unsigned int i = 0U; i < LONG_CALLSIGN_LENGTH; i++)
rptCall1[i] = header.getRptCall1().GetChar(i);
for (unsigned int i = 0U; i < LONG_CALLSIGN_LENGTH; i++)
rptCall2[i] = header.getRptCall2().GetChar(i);
io(SET_MyCALL2, 0x40U, 0U, myCall2, SHORT_CALLSIGN_LENGTH);
io(SET_MyCALL, 0x40U, 0U, myCall1, LONG_CALLSIGN_LENGTH);
io(SET_YourCALL, 0x40U, 0U, yourCall, LONG_CALLSIGN_LENGTH);
io(SET_RPT1CALL, 0x40U, 0U, rptCall1, LONG_CALLSIGN_LENGTH);
io(SET_RPT2CALL, 0x40U, 0U, rptCall2, LONG_CALLSIGN_LENGTH);
unsigned char flags[3U];
flags[0U] = header.getFlag1();
flags[1U] = header.getFlag2();
flags[2U] = header.getFlag3();
io(SET_FLAGS, 0x40U, 0U, flags, 3U);
setPTT(true);
}
示例9: locker
bool CDVRPTRV3Controller::writeHeader(const CHeaderData& header)
{
bool ret = m_txData.hasSpace(106U);
if (!ret) {
wxLogWarning(wxT("No space to write the header"));
return false;
}
unsigned char buffer[105U];
::memset(buffer, 0x00U, 105U);
buffer[0U] = 'H';
buffer[1U] = 'E';
buffer[2U] = 'A';
buffer[3U] = 'D';
buffer[4U] = 'X';
buffer[5U] = '0';
buffer[6U] = '0';
buffer[7U] = '0';
buffer[8U] = '2';
::memset(buffer + 9U, ' ', RADIO_HEADER_LENGTH_BYTES);
buffer[9U] = header.getFlag1();
buffer[10U] = header.getFlag2();
buffer[11U] = header.getFlag3();
wxString rpt2 = header.getRptCall2();
for (unsigned int i = 0U; i < rpt2.Len() && i < LONG_CALLSIGN_LENGTH; i++)
buffer[i + 12U] = rpt2.GetChar(i);
wxString rpt1 = header.getRptCall1();
for (unsigned int i = 0U; i < rpt1.Len() && i < LONG_CALLSIGN_LENGTH; i++)
buffer[i + 20U] = rpt1.GetChar(i);
wxString your = header.getYourCall();
for (unsigned int i = 0U; i < your.Len() && i < LONG_CALLSIGN_LENGTH; i++)
buffer[i + 28U] = your.GetChar(i);
wxString my1 = header.getMyCall1();
for (unsigned int i = 0U; i < my1.Len() && i < LONG_CALLSIGN_LENGTH; i++)
buffer[i + 36U] = my1.GetChar(i);
wxString my2 = header.getMyCall2();
for (unsigned int i = 0U; i < my2.Len() && i < SHORT_CALLSIGN_LENGTH; i++)
buffer[i + 44U] = my2.GetChar(i);
wxMutexLocker locker(m_mutex);
unsigned char len = 105U;
m_txData.addData(&len, 1U);
m_txData.addData(buffer, 105U);
m_tx = true;
return true;
}
示例10: sendToRepeaters
void CStarNetHandler::sendToRepeaters(CHeaderData& header) const
{
for (CStarNetRepeatersHashMap::const_iterator it = m_repeaters.begin(); it != m_repeaters.end(); ++it) {
CStarNetRepeater* repeater = it->second;
if (repeater != NULL) {
header.setYourCall(repeater->m_destination);
header.setDestination(repeater->m_address, G2_DV_PORT);
header.setRepeaters(repeater->m_gateway, repeater->m_repeater);
if (repeater->m_local != NULL)
repeater->m_local->process(header, AS_G2);
else
m_g2Handler->writeHeader(header);
}
}
}
示例11: writeHeader
bool CRepeaterProtocolHandler::writeHeader(const CHeaderData& header)
{
unsigned char buffer[50U];
buffer[0] = 'D';
buffer[1] = 'S';
buffer[2] = 'R';
buffer[3] = 'P';
buffer[4] = 0x20U;
// Create a random id for this transmission
m_outId = (::rand() % 65535U) + 1U;
buffer[5] = m_outId / 256U; // Unique session id
buffer[6] = m_outId % 256U;
buffer[7] = 0U;
buffer[8] = header.getFlag1();
buffer[9] = header.getFlag2();
buffer[10] = header.getFlag3();
for (unsigned int i = 0U; i < LONG_CALLSIGN_LENGTH; i++)
buffer[11 + i] = header.getRptCall1().GetChar(i);
for (unsigned int i = 0U; i < LONG_CALLSIGN_LENGTH; i++)
buffer[19 + i] = header.getRptCall2().GetChar(i);
for (unsigned int i = 0U; i < LONG_CALLSIGN_LENGTH; i++)
buffer[27 + i] = header.getYourCall().GetChar(i);
for (unsigned int i = 0U; i < LONG_CALLSIGN_LENGTH; i++)
buffer[35 + i] = header.getMyCall1().GetChar(i);
for (unsigned int i = 0U; i < SHORT_CALLSIGN_LENGTH; i++)
buffer[43 + i] = header.getMyCall2().GetChar(i);
// Get the checksum for the header
CCCITTChecksumReverse csum;
csum.update(buffer + 8U, 4U * LONG_CALLSIGN_LENGTH + SHORT_CALLSIGN_LENGTH + 3U);
csum.result(buffer + 47U);
m_outSeq = 0U;
#if defined(DUMP_TX)
CUtils::dump(wxT("Sending Header"), buffer, 49U);
return true;
#else
for (unsigned int i = 0U; i < 2U; i++) {
bool ret = m_socket.write(buffer, 49U);
if (!ret)
return false;
}
return true;
#endif
}
示例12: receiveRadioHeader
bool CGMSKRepeaterTXRXThread::receiveRadioHeader()
{
bool error;
CHeaderData* header = m_modem->readHeader(error);
if (header == NULL)
return error;
wxLogMessage(wxT("Header decoded - My: %s/%s Your: %s Rpt1: %s Rpt2: %s Flags: %02X %02X %02X"), header->getMyCall1().c_str(), header->getMyCall2().c_str(), header->getYourCall().c_str(), header->getRptCall1().c_str(), header->getRptCall2().c_str(), header->getFlag1(), header->getFlag2(), header->getFlag3());
bool res = processRadioHeader(header);
if (res) {
// A valid header and is a DV packet
m_radioSeqNo = 20U;
m_ambeFrames = 0U;
m_ambeSilence = 0U;
m_ambeBits = 1U;
m_ambeErrors = 0U;
m_ambeLength = 0U;
m_lastAMBEBits = 0U;
m_lastAMBEErrors = 0U;
} else {
// This is a DD packet or some other problem
// wxLogMessage(wxT("Invalid header"));
}
return false;
}
示例13: readHeader
CHeaderData* CDPlusProtocolHandler::readHeader()
{
if (m_type != DP_HEADER)
return NULL;
CHeaderData* header = new CHeaderData;
// DPlus checksums are unreliable
bool res = header->setDPlusData(m_buffer, m_length, false, m_yourAddress, m_yourPort, m_myPort);
if (!res) {
delete header;
return NULL;
}
return header;
}
示例14: readBusyHeader
CHeaderData* CHBRepeaterProtocolHandler::readBusyHeader()
{
if (m_type != RT_BUSY_HEADER)
return NULL;
CHeaderData* header = new CHeaderData;
bool res = header->setHBRepeaterData(m_buffer, m_length, true, m_address, m_port);
if (!res) {
wxLogError(wxT("Invalid checksum from the repeater"));
delete header;
return NULL;
}
return header;
}
示例15: processSlowData
CHeaderData* CSoundCardRepeaterTXRXThread::processSlowData(bool sync)
{
bool bits[DV_FRAME_LENGTH_BITS];
m_bitBuffer.getData(bits, DV_FRAME_LENGTH_BITS);
if (sync) {
m_slowDataDecoder.sync();
return NULL;
}
unsigned char bytes[DATA_FRAME_LENGTH_BYTES];
// Convert the bits to bytes
unsigned int n = 0U;
for (unsigned int i = 0U; i < DATA_FRAME_LENGTH_BYTES; i++, n += 8U)
bytes[i] = CUtils::bitsToByteRev(bits + VOICE_FRAME_LENGTH_BITS + n);
m_slowDataDecoder.addData(bytes);
CHeaderData* header = m_slowDataDecoder.getHeaderData();
if (header == NULL)
return NULL;
wxLogMessage(wxT("Radio header from slow data - My: %s/%s Your: %s Rpt1: %s Rpt2: %s Flags: %02X %02X %02X BER: 0%%"), header->getMyCall1().c_str(), header->getMyCall2().c_str(), header->getYourCall().c_str(), header->getRptCall1().c_str(), header->getRptCall2().c_str(), header->getFlag1(), header->getFlag2(), header->getFlag3());
m_headerBER = 0U;
return header;
}