本文整理汇总了C++中CAMBEData类的典型用法代码示例。如果您正苦于以下问题:C++ CAMBEData类的具体用法?C++ CAMBEData怎么用?C++ CAMBEData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CAMBEData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeAMBEInt
void CDPlusHandler::writeAMBEInt(IReflectorCallback* handler, CAMBEData& data, DIRECTION direction)
{
if (m_linkState != DPLUS_LINKED)
return;
if (direction != m_direction)
return;
// Already in use?
if (m_dPlusId != 0x00U)
return;
switch (m_direction) {
case DIR_OUTGOING:
if (m_destination == handler) {
data.setDestination(m_yourAddress, m_yourPort);
m_handler->writeAMBE(data);
}
break;
case DIR_INCOMING:
data.setDestination(m_yourAddress, m_yourPort);
m_handler->writeAMBE(data);
break;
}
}
示例2: writeAMBEInt
void CDPlusHandler::writeAMBEInt(CAMBEData& data, DIRECTION direction)
{
if (m_linkState != DPLUS_LINKED)
return;
if (direction != m_direction)
return;
// Already in use?
if (m_dPlusId != 0x00U)
return;
switch (m_direction) {
case DIR_OUTGOING:
if (data.getId() == m_rptrId) {
data.setDestination(m_yourAddress, m_yourPort);
m_handler->writeAMBE(data);
if (data.isEnd())
m_rptrId = 0x00U;
}
break;
case DIR_INCOMING:
data.setDestination(m_yourAddress, m_yourPort);
m_handler->writeAMBE(data);
break;
}
}
示例3: sendData
bool CAPRSTransmit::sendData(const CAMBEData& data)
{
unsigned char buffer[60U];
unsigned int length = data.getG2Data(buffer, 60U);
return m_socket.write(buffer, length, data.getYourAddress(), data.getYourPort());
}
示例4: processInt
void CDPlusHandler::processInt(CAMBEData& data)
{
unsigned int id = data.getId();
if (m_dPlusId != id)
return;
m_dPlusSeq = data.getSeq();
// Send the header every 21 frames
if (m_dPlusSeq == 0U)
m_destination->process(*m_header, AS_DUP);
m_inactivityTimer.reset();
m_pollInactivityTimer.reset();
m_destination->process(data, AS_DPLUS);
if (data.isEnd()) {
m_dPlusId = 0x00U;
m_dPlusSeq = 0x00U;
delete m_header;
m_header = NULL;
m_inactivityTimer.stop();
}
}
示例5: temp
void CDExtraHandler::processInt(CAMBEData& data)
{
if (m_linkState != DEXTRA_LINKED)
return;
if (m_dExtraId != data.getId())
return;
m_inactivityTimer.reset();
m_dExtraSeq = data.getSeq();
// Send the header every 21 frames
if (m_dExtraSeq == 0U)
m_destination->process(*m_header, AS_DUP);
// Copy the data to ensure it remains unchanged
CAMBEData temp(data);
m_destination->process(temp, AS_DEXTRA);
if (temp.isEnd()) {
delete m_header;
m_header = NULL;
m_dExtraId = 0x00U;
m_dExtraSeq = 0x00U;
m_inactivityTimer.stop();
}
}
示例6:
void CG2Handler::process(CAMBEData& data)
{
// Check to see if this is for StarNet
CStarNetHandler* handler = CStarNetHandler::findStarNet(data);
if (handler != NULL) {
handler->process(data);
return;
}
// No need to go any further
if (m_maxRoutes == 0U)
return;
unsigned int id = data.getId();
for (unsigned int i = 0U; i < m_maxRoutes; i++) {
CG2Handler* route = m_routes[i];
if (route != NULL) {
if (route->m_id == id) {
route->m_inactivityTimer.reset();
route->m_repeater->process(data, DIR_INCOMING, AS_G2);
if (data.isEnd()) {
delete route;
m_routes[i] = NULL;
}
return;
}
}
}
}
示例7: lookup
bool CTimeServerThread::lookup(const wxString &id)
{
CIndexRecord* info = m_index[id];
if (info == NULL) {
// wxLogError(wxT("Cannot find the AMBE index for *%s*"), id.c_str());
return false;
}
unsigned int start = info->getStart();
unsigned int length = info->getLength();
SLOW_DATA slowData = SD_TEXT;
for (unsigned int i = 0U; i < length; i++) {
unsigned char* dataIn = m_ambe + (start + i) * VOICE_FRAME_LENGTH_BYTES;
CAMBEData* dataOut = new CAMBEData;
dataOut->setDestination(m_address, G2_DV_PORT);
dataOut->setSeq(m_seqNo);
unsigned char buffer[DV_FRAME_LENGTH_BYTES];
::memcpy(buffer + 0U, dataIn, VOICE_FRAME_LENGTH_BYTES);
// Insert sync bytes when the sequence number is zero, slow data otherwise
if (m_seqNo == 0U) {
::memcpy(buffer + VOICE_FRAME_LENGTH_BYTES, DATA_SYNC_BYTES, DATA_FRAME_LENGTH_BYTES);
m_encoder.sync();
switch (slowData) {
case SD_HEADER:
slowData = SD_TEXT;
break;
case SD_TEXT:
slowData = SD_HEADER;
break;
}
} else {
switch (slowData) {
case SD_HEADER:
m_encoder.getHeaderData(buffer + VOICE_FRAME_LENGTH_BYTES);
break;
case SD_TEXT:
m_encoder.getTextData(buffer + VOICE_FRAME_LENGTH_BYTES);
break;
}
}
dataOut->setData(buffer, DV_FRAME_LENGTH_BYTES);
m_seqNo++;
if (m_seqNo == 21U)
m_seqNo = 0U;
m_data[m_in] = dataOut;
m_in++;
}
return true;
}
示例8: writeData
bool CCCSProtocolHandler::writeData(const CAMBEData& data)
{
unsigned char buffer[100U];
unsigned int length = data.getCCSData(buffer, 100U);
#if defined(DUMP_TX)
CUtils::dump(wxT("Sending Data"), buffer, length);
#endif
return m_socket.write(buffer, length, data.getYourAddress(), data.getYourPort());
}
示例9: process
void CDExtraHandler::process(CAMBEData& data)
{
for (unsigned int i = 0U; i < m_maxReflectors; i++) {
CDExtraHandler* reflector = m_reflectors[i];
if (reflector != NULL) {
if (reflector->m_address.s_addr == data.getAddress().s_addr &&
reflector->m_port == data.getPort())
reflector->processInt(data);
}
}
}
示例10: end
void CTimeServerThread::end()
{
CAMBEData* dataOut = new CAMBEData;
dataOut->setData(END_PATTERN_BYTES, DV_FRAME_LENGTH_BYTES);
dataOut->setDestination(m_address, G2_DV_PORT);
dataOut->setSeq(m_seqNo);
dataOut->setEnd(true);
m_data[m_in] = dataOut;
m_in++;
}
示例11: sendData
bool CTimeServerThread::sendData(const CAMBEData& data)
{
unsigned char buffer[40U];
unsigned int length = data.getG2Data(buffer, 40U);
#if defined(DUMP_TX)
CUtils::dump(wxT("Sending Data"), buffer, length);
return true;
#else
return m_socket.write(buffer, length, data.getAddress(), data.getPort());
#endif
}
示例12: writeAMBE
bool CHBRepeaterProtocolHandler::writeAMBE(CAMBEData& data)
{
unsigned char buffer[30U];
unsigned int length = data.getHBRepeaterData(buffer, 30U);
#if defined(DUMP_TX)
CUtils::dump(wxT("Sending Data"), buffer, length);
return true;
#else
return m_socket.write(buffer, length, data.getYourAddress(), data.getYourPort());
#endif
}
示例13: while
void CEchoUnit::clock(unsigned int ms)
{
m_timer.clock(ms);
if (m_status == ES_WAIT && m_timer.hasExpired()) {
m_timer.stop();
// RPT1 and RPT2 will be filled in later
m_header->setMyCall1(m_callsign);
m_header->setMyCall2(wxT("ECHO"));
m_header->setYourCall(wxT("CQCQCQ "));
m_handler->process(*m_header, AS_ECHO);
delete m_header;
m_out = 0U;
m_status = ES_TRANSMIT;
m_time.Start();
return;
}
if (m_status == ES_TRANSMIT) {
unsigned int needed = m_time.Time() / DSTAR_FRAME_TIME_MS;
while (m_out < needed) {
CAMBEData* data = m_data[m_out];
m_data[m_out] = NULL;
m_out++;
if (m_in == m_out)
data->setEnd(true);
m_handler->process(*data, AS_ECHO);
delete data;
if (m_in == m_out) {
m_in = 0U;
m_out = 0U;
m_status = ES_IDLE;
return;
}
}
return;
}
}
示例14: readAMBE
CAMBEData* CDPlusProtocolHandler::readAMBE()
{
if (m_type != DP_AMBE)
return NULL;
CAMBEData* data = new CAMBEData;
bool res = data->setDPlusData(m_buffer, m_length, m_yourAddress, m_yourPort, m_myPort);
if (!res) {
delete data;
return NULL;
}
return data;
}
示例15: readData
CAMBEData* CCCSProtocolHandler::readData()
{
if (m_type != CT_DATA)
return NULL;
CAMBEData* data = new CAMBEData;
bool res = data->setCCSData(m_buffer, m_length, m_yourAddress, m_yourPort, m_myPort);
if (!res) {
delete data;
return NULL;
}
return data;
}