当前位置: 首页>>代码示例>>C++>>正文


C++ CHeaderData::getFlag1方法代码示例

本文整理汇总了C++中CHeaderData::getFlag1方法的典型用法代码示例。如果您正苦于以下问题:C++ CHeaderData::getFlag1方法的具体用法?C++ CHeaderData::getFlag1怎么用?C++ CHeaderData::getFlag1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CHeaderData的用法示例。


在下文中一共展示了CHeaderData::getFlag1方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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);
}
开发者ID:chulochumo,项目名称:OpenDV,代码行数:34,代码来源:GMSKModemWinUSB.cpp

示例2: 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;
}
开发者ID:BackupTheBerlios,项目名称:opendv-svn,代码行数:60,代码来源:DVAPController.cpp

示例3: 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;
}
开发者ID:EA3HKB,项目名称:OpenDV,代码行数:59,代码来源:DVRPTRV3Controller.cpp

示例4: 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
}
开发者ID:BackupTheBerlios,项目名称:opendv-svn,代码行数:58,代码来源:RepeaterProtocolHandler.cpp

示例5: writeHeader

bool CMMDVMController::writeHeader(const CHeaderData& header)
{
	bool ret = m_txData.hasSpace(46U);
	if (!ret) {
		wxLogWarning(wxT("No space to write the header"));
		return false;
	}

	unsigned char buffer[50U];

	buffer[0U] = MMDVM_FRAME_START;
	buffer[1U] = RADIO_HEADER_LENGTH_BYTES + 3U;
	buffer[2U] = MMDVM_DSTAR_HEADER;

	::memset(buffer + 3U, ' ', RADIO_HEADER_LENGTH_BYTES);

	buffer[3U] = header.getFlag1();
	buffer[4U] = header.getFlag2();
	buffer[5U] = header.getFlag3();

	wxString rpt2 = header.getRptCall2();
	for (unsigned int i = 0U; i < rpt2.Len() && i < LONG_CALLSIGN_LENGTH; i++)
		buffer[i + 6U]  = rpt2.GetChar(i);

	wxString rpt1 = header.getRptCall1();
	for (unsigned int i = 0U; i < rpt1.Len() && i < LONG_CALLSIGN_LENGTH; i++)
		buffer[i + 14U] = rpt1.GetChar(i);

	wxString your = header.getYourCall();
	for (unsigned int i = 0U; i < your.Len() && i < LONG_CALLSIGN_LENGTH; i++)
		buffer[i + 22U] = your.GetChar(i);

	wxString my1 = header.getMyCall1();
	for (unsigned int i = 0U; i < my1.Len() && i < LONG_CALLSIGN_LENGTH; i++)
		buffer[i + 30U] = my1.GetChar(i);

	wxString my2 = header.getMyCall2();
	for (unsigned int i = 0U; i < my2.Len() && i < SHORT_CALLSIGN_LENGTH; i++)
		buffer[i + 38U] = my2.GetChar(i);

	CCCITTChecksumReverse cksum1;
	cksum1.update(buffer + 3U, RADIO_HEADER_LENGTH_BYTES - 2U);
	cksum1.result(buffer + 42U);

	wxMutexLocker locker(m_mutex);

	unsigned char type = DSMTT_HEADER;
	m_txData.addData(&type, 1U);

	unsigned char len = RADIO_HEADER_LENGTH_BYTES + 3U;
	m_txData.addData(&len, 1U);

	m_txData.addData(buffer, RADIO_HEADER_LENGTH_BYTES + 3U);

	return true;
}
开发者ID:remcovz,项目名称:OpenDV,代码行数:56,代码来源:MMDVMController.cpp

示例6: 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);
	}
}
开发者ID:BackupTheBerlios,项目名称:opendv-svn,代码行数:50,代码来源:DummyRepeaterFrame.cpp

示例7: onHeader

void CDVToolReaderFrame::onHeader(wxEvent& event)
{
	CHeaderEvent& hdrEvent = dynamic_cast<CHeaderEvent&>(event);

	CHeaderData* header = hdrEvent.getHeaderData();

	if (header != NULL) {
		wxDateTime dateTime = header->getTime();
		wxString hrdDateTime = dateTime.FormatISODate() + wxT(" ") + dateTime.FormatISOTime();

		wxString urCall = header->getYourCall();
		m_your->SetLabel(urCall);

		wxString myCall = header->getMyCall1();

		wxString myCall2 = header->getMyCall2();
		if (!myCall2.IsSameAs(wxT("    "))) {
			myCall.Append(wxT("/"));
			myCall.Append(myCall2);
		}

		m_my->SetLabel(myCall);

		wxString rpt1Call = header->getRptCall1();
		m_rpt1->SetLabel(rpt1Call);

		wxString rpt2Call = header->getRptCall2();
		m_rpt2->SetLabel(rpt2Call);

		wxString flags;
		flags.Printf(wxT("%02X %02X %02X"), header->getFlag1(), header->getFlag2(), header->getFlag3());
		m_flags->SetLabel(flags);

		m_message->SetLabel(wxEmptyString);

		delete header;
	} else {
		m_fileName->SetLabel(wxEmptyString);

		m_your->SetLabel(wxEmptyString);
		m_my->SetLabel(wxEmptyString);
		m_rpt1->SetLabel(wxEmptyString);
		m_rpt2->SetLabel(wxEmptyString);
		m_flags->SetLabel(wxEmptyString);
		m_message->SetLabel(wxEmptyString);
	}
}
开发者ID:OZ1BV,项目名称:DMRRepeater,代码行数:47,代码来源:DVToolReaderFrame.cpp

示例8: writeHeader

bool CGMSKController::writeHeader(const CHeaderData& header)
{
	unsigned char buffer[50U];

	::memset(buffer, ' ', RADIO_HEADER_LENGTH_BYTES - 2U);

	buffer[0U] = header.getFlag1();
	buffer[1U] = header.getFlag2();
	buffer[2U] = header.getFlag3();

	wxString rpt2 = header.getRptCall2();
	for (unsigned int i = 0U; i < rpt2.Len() && i < LONG_CALLSIGN_LENGTH; i++)
		buffer[i + 3U]  = rpt2.GetChar(i);

	wxString rpt1 = header.getRptCall1();
	for (unsigned int i = 0U; i < rpt1.Len() && i < LONG_CALLSIGN_LENGTH; i++)
		buffer[i + 11U] = rpt1.GetChar(i);

	wxString your = header.getYourCall();
	for (unsigned int i = 0U; i < your.Len() && i < LONG_CALLSIGN_LENGTH; i++)
		buffer[i + 19U] = your.GetChar(i);

	wxString my1 = header.getMyCall1();
	for (unsigned int i = 0U; i < my1.Len() && i < LONG_CALLSIGN_LENGTH; i++)
		buffer[i + 27U] = my1.GetChar(i);

	wxString my2 = header.getMyCall2();
	for (unsigned int i = 0U; i < my2.Len() && i < SHORT_CALLSIGN_LENGTH; i++)
		buffer[i + 35U] = my2.GetChar(i);

	wxMutexLocker locker(m_mutex);

	bool ret = m_txData.hasSpace(RADIO_HEADER_LENGTH_BYTES);
	if (!ret)
		return false;

	unsigned char data[2U];
	data[0U] = DSMTT_HEADER;
	data[1U] = RADIO_HEADER_LENGTH_BYTES - 2U;
	m_txData.addData(data, 2U);

	m_txData.addData(buffer, RADIO_HEADER_LENGTH_BYTES - 2U);

	return true;
}
开发者ID:BackupTheBerlios,项目名称:opendv-svn,代码行数:45,代码来源:GMSKController.cpp

示例9: write

void CHeaderLogger::write(const wxChar* type, const CHeaderData& header)
{
	wxASSERT(type != NULL);

	time_t timeNow = ::time(NULL);
	struct tm* tm = ::gmtime(&timeNow);

	char* t = ::inet_ntoa(header.getYourAddress());
	wxString address(t, wxConvLocal);

	wxString text;
	text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: %s header - My: %s/%s  Your: %s  Rpt1: %s  Rpt2: %s  Flags: %02X %02X %02X (%s:%u)\n"),
		tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, type,
		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(), address.c_str(), header.getYourPort());

	m_file.Write(text);
	m_file.Flush();
}
开发者ID:NJ08512,项目名称:OpenDV,代码行数:20,代码来源:HeaderLogger.cpp

示例10: writeHeader

bool CGMSKModemLibUsb::writeHeader(const CHeaderData& header)
{
	char myCall1[LONG_CALLSIGN_LENGTH];
	char myCall2[SHORT_CALLSIGN_LENGTH];
	char yourCall[LONG_CALLSIGN_LENGTH];
	char rptCall1[LONG_CALLSIGN_LENGTH];
	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);

	int ret = io(0x40, SET_MyCALL2, 0, 0, myCall2, SHORT_CALLSIGN_LENGTH, USB_TIMEOUT);
	if (ret < 0) {
		wxString errorText(m_usbStrerror(), wxConvLocal);
		wxLogMessage(wxT("SET_MyCALL2, ret: %d, err=%s"), ret, errorText.c_str());
		return false;
	}

	ret = io(0x40, SET_MyCALL, 0, 0, myCall1, LONG_CALLSIGN_LENGTH, USB_TIMEOUT);
	if (ret < 0) {
		wxString errorText(m_usbStrerror(), wxConvLocal);
		wxLogMessage(wxT("SET_MyCALL, ret: %d, err=%s"), ret, errorText.c_str());
		return false;
	}

	ret = io(0x40, SET_YourCALL, 0, 0, yourCall, LONG_CALLSIGN_LENGTH, USB_TIMEOUT);
	if (ret < 0) {
		wxString errorText(m_usbStrerror(), wxConvLocal);
		wxLogMessage(wxT("SET_YourCALL, ret: %d, err=%s"), ret, errorText.c_str());
		return false;
	}

	ret = io(0x40, SET_RPT1CALL, 0, 0, rptCall1, LONG_CALLSIGN_LENGTH, USB_TIMEOUT);
	if (ret < 0) {
		wxString errorText(m_usbStrerror(), wxConvLocal);
		wxLogMessage(wxT("SET_RPT1CALL, ret: %d, err=%s"), ret, errorText.c_str());
		return false;
	}

	ret = io(0x40, SET_RPT2CALL, 0, 0, rptCall2, LONG_CALLSIGN_LENGTH, USB_TIMEOUT);
	if (ret < 0) {
		wxString errorText(m_usbStrerror(), wxConvLocal);
		wxLogMessage(wxT("SET_RPT2CALL, ret: %d, err=%s"), ret, errorText.c_str());
		return false;
	}

	char flags[3U];
	flags[0U] = header.getFlag1();
	flags[1U] = header.getFlag2();
	flags[2U] = header.getFlag3();

	ret = io(0x40, SET_FLAGS, 0, 0, flags, 3, USB_TIMEOUT);
	if (ret < 0) {
		wxString errorText(m_usbStrerror(), wxConvLocal);
		wxLogMessage(wxT("SET_FLAGS, ret: %d, err=%s"), ret, errorText.c_str());
		return false;
	}

	return true;
}
开发者ID:BackupTheBerlios,项目名称:opendv-svn,代码行数:68,代码来源:GMSKModemLibUsb.cpp

示例11: writeHeader

bool 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);

	int ret = io(SET_MyCALL2, 0x40U, 0U, myCall2, SHORT_CALLSIGN_LENGTH);
	if (ret < 0) {
		wxLogError(wxT("SET_MyCALL2 returned %d"), -ret);
		return false;
	}

	ret = io(SET_MyCALL, 0x40U, 0U, myCall1, LONG_CALLSIGN_LENGTH);
	if (ret < 0) {
		wxLogError(wxT("SET_MyCALL returned %d"), -ret);
		return false;
	}

	ret = io(SET_YourCALL, 0x40U, 0U, yourCall, LONG_CALLSIGN_LENGTH);
	if (ret < 0) {
		wxLogError(wxT("SET_YourCALL returned %d"), -ret);
		return false;
	}

	ret = io(SET_RPT1CALL, 0x40U, 0U, rptCall1, LONG_CALLSIGN_LENGTH);
	if (ret < 0) {
		wxLogError(wxT("SET_RPT1CALL returned %d"), -ret);
		return false;
	}

	ret = io(SET_RPT2CALL, 0x40U, 0U, rptCall2, LONG_CALLSIGN_LENGTH);
	if (ret < 0) {
		wxLogError(wxT("SET_RPT2CALL returned %d"), -ret);
		return false;
	}

	unsigned char flags[3U];
	flags[0U] = header.getFlag1();
	flags[1U] = header.getFlag2();
	flags[2U] = header.getFlag3();

	ret = io(SET_FLAGS, 0x40U, 0U, flags, 3U);
	if (ret < 0) {
		wxLogError(wxT("SET_FLAGS returned %d"), -ret);
		return false;
	}

	return setPTT(true);
}
开发者ID:BackupTheBerlios,项目名称:opendv-svn,代码行数:62,代码来源:GMSKModemWinUSB.cpp

示例12:

void CG2Handler::process(CHeaderData& header)
{
	// Is this a busy reply?
	unsigned char flag1 = header.getFlag1();
	if (flag1 == 0x01) {
		// Don't check the incoming stream
		// wxLogMessage(wxT("G2 busy message received"));
		return;
	}

	// Check to see if this is for StarNet
	CStarNetHandler* handler = CStarNetHandler::findStarNet(header);
	if (handler != NULL) {
		// Write to Header.log if it's enabled
		if (m_headerLogger != NULL)
			m_headerLogger->write(wxT("StarNet"), header);

		handler->process(header);
		return;
	}

	// No need to go any further
	if (m_maxRoutes == 0U)
		return;

	in_addr address = header.getYourAddress();
	unsigned int id = header.getId();

	for (unsigned int i = 0U; i < m_maxRoutes; i++) {
		CG2Handler* route = m_routes[i];
		if (route != NULL) {
			// Is this a duplicate header, ignore it
			if (route->m_id == id)
				return;
		}
	}	

	// Find the destination repeater
	CRepeaterHandler* repeater = CRepeaterHandler::findDVRepeater(header.getRptCall2());
	if (repeater == NULL) {
		wxLogMessage(wxT("Incoming G2 header from %s to unknown repeater - %s"), header.getMyCall1().c_str(), header.getRptCall2().c_str());
		return;		// Not found, ignore
	}

	CG2Handler* route = new CG2Handler(repeater, address, id);

	for (unsigned int i = 0U; i < m_maxRoutes; i++) {
		if (m_routes[i] == NULL) {
			m_routes[i] = route;

			// Write to Header.log if it's enabled
			if (m_headerLogger != NULL)
				m_headerLogger->write(wxT("G2"), header);

			repeater->process(header, DIR_INCOMING, AS_G2);
			return;
		}
	}

	wxLogMessage(wxT("No space to add new G2 route, ignoring"));

	delete route;
}
开发者ID:KH6VM,项目名称:OpenSystemFusion,代码行数:63,代码来源:G2Handler.cpp

示例13: 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;
}
开发者ID:BackupTheBerlios,项目名称:opendv-svn,代码行数:29,代码来源:SoundCardRepeaterTXRXThread.cpp

示例14: receiveSlowData

void CDStarRepeaterRXThread::receiveSlowData(unsigned char* data, unsigned int)
{
    unsigned int errs;
    errs  = countBits(data[VOICE_FRAME_LENGTH_BYTES + 0U] ^ DATA_SYNC_BYTES[0U]);
    errs += countBits(data[VOICE_FRAME_LENGTH_BYTES + 1U] ^ DATA_SYNC_BYTES[1U]);
    errs += countBits(data[VOICE_FRAME_LENGTH_BYTES + 2U] ^ DATA_SYNC_BYTES[2U]);

    // The data sync has been seen, a fuzzy match is used, two bit errors or less
    if (errs <= MAX_DATA_SYNC_BIT_ERRS) {
        // wxLogMessage(wxT("Found data sync at frame %u, errs: %u"), m_radioSeqNo, errs);
        m_radioSeqNo     = 0U;
        m_slowDataDecoder.sync();
    } else if (m_radioSeqNo == 20U) {
        // wxLogMessage(wxT("Assuming data sync"));
        m_radioSeqNo = 0U;
        m_slowDataDecoder.sync();
    } else {
        m_radioSeqNo++;
        m_slowDataDecoder.addData(data + VOICE_FRAME_LENGTH_BYTES);

        CHeaderData* header = m_slowDataDecoder.getHeaderData();
        if (header == NULL)
            return;

        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());

        if (header != NULL) {
            bool res = processRadioHeader(header);
            if (res) {
                // A valid header and is a DV packet, go to normal data relaying
                setRadioState(DSRXS_PROCESS_DATA);
            } else {
                // This is a DD packet or some other problem
                // wxLogMessage(wxT("Invalid header"));
            }
        }
    }
}
开发者ID:yngwiechou,项目名称:OpenDV,代码行数:38,代码来源:DStarRepeaterRXThread.cpp

示例15: transmitNetworkHeader

void CGMSKRepeaterTXRXThread::transmitNetworkHeader(const CHeaderData& header)
{
	wxLogMessage(wxT("Transmitting to - 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 empty = m_networkQueue[m_readNum]->isEmpty();
	if (!empty) {
		bool headerReady = m_networkQueue[m_readNum]->headerReady();
		if (headerReady) {
			// Transmission has never started, so just purge the queue
			m_networkQueue[m_readNum]->reset();

			m_readNum++;
			if (m_readNum >= NETWORK_QUEUE_COUNT)
				m_readNum = 0U;
		} else {
			// Purge the currently transmitting buffer and append an end of stream
			m_networkQueue[m_readNum]->reset();
			m_networkQueue[m_readNum]->addData(END_PATTERN_BYTES, DV_FRAME_LENGTH_BYTES, true);
		}
	}

	m_networkQueue[m_writeNum]->reset();
	m_networkQueue[m_writeNum]->setHeader(new CHeaderData(header));
}
开发者ID:BackupTheBerlios,项目名称:opendv-svn,代码行数:24,代码来源:GMSKRepeaterTXRXThread.cpp


注:本文中的CHeaderData::getFlag1方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。