本文整理汇总了C++中CHeaderData::setRepeaterMode方法的典型用法代码示例。如果您正苦于以下问题:C++ CHeaderData::setRepeaterMode方法的具体用法?C++ CHeaderData::setRepeaterMode怎么用?C++ CHeaderData::setRepeaterMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHeaderData
的用法示例。
在下文中一共展示了CHeaderData::setRepeaterMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkHeader
TRISTATE CDVAPNodeTRXThread::checkHeader(CHeaderData& header)
{
// If not in RPT1 validation mode, then a simplex header is converted to a proper repeater header
if (!m_rpt1Validation) {
if (!header.isRepeaterMode()) {
// Convert to a properly addressed repeater packet
header.setRepeaterMode(true);
header.setRptCall1(m_rptCallsign);
header.setRptCall2(m_gwyCallsign);
}
}
// The repeater bit must be set
if (!header.isRepeaterMode()) {
wxLogMessage(wxT("Received a non-repeater packet, ignoring"));
return STATE_FALSE;
}
wxString my = header.getMyCall1();
// Make sure MyCall is not empty, a silly value, or the repeater or gateway callsigns
if (my.IsSameAs(m_rptCallsign) ||
my.IsSameAs(m_gwyCallsign) ||
my.Left(6U).IsSameAs(wxT("NOCALL")) ||
my.Left(6U).IsSameAs(wxT("N0CALL")) ||
my.Left(6U).IsSameAs(wxT("MYCALL"))) {
wxLogMessage(wxT("Invalid MYCALL value of %s, ignoring"), my.c_str());
return STATE_UNKNOWN;
}
// Check the MyCall value against the regular expression
bool ok = m_regEx.Matches(my);
if (!ok) {
wxLogMessage(wxT("Invalid MYCALL value of %s, ignoring"), my.c_str());
return STATE_UNKNOWN;
}
// Is it for us?
if (!header.getRptCall1().IsSameAs(m_rptCallsign)) {
wxLogMessage(wxT("Invalid RPT1 value %s, ignoring"), header.getRptCall1().c_str());
return STATE_FALSE;
}
// If using callsign restriction, validate the my callsign
if (m_restriction) {
if (!my.Left(LONG_CALLSIGN_LENGTH - 1U).IsSameAs(m_rptCallsign.Left(LONG_CALLSIGN_LENGTH - 1U))) {
wxLogMessage(wxT("Unauthorised user %s tried to access the repeater"), my.c_str());
return STATE_UNKNOWN;
}
}
return STATE_TRUE;
}