本文整理汇总了C++中DataStream::ChecksumOK方法的典型用法代码示例。如果您正苦于以下问题:C++ DataStream::ChecksumOK方法的具体用法?C++ DataStream::ChecksumOK怎么用?C++ DataStream::ChecksumOK使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataStream
的用法示例。
在下文中一共展示了DataStream::ChecksumOK方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnEvtStream
void Multiplexer::OnEvtStream(OCPN_DataStreamEvent& event)
{
wxString message = wxString(event.GetNMEAString().c_str(), wxConvUTF8);
DataStream *stream = event.GetStream();
wxString port(_T("Virtual:"));
if( stream )
port = wxString(stream->GetPort());
if( !message.IsEmpty() )
{
//Send to core consumers
//if it passes the source's input filter
// If there is no datastream, as for PlugIns, then pass everything
bool bpass = true;
if( stream )
bpass = stream->SentencePassesFilter( message, FILTER_INPUT );
if( bpass ) {
if( message.Mid(3,3).IsSameAs(_T("VDM")) ||
message.Mid(1,5).IsSameAs(_T("FRPOS")) ||
message.Mid(1,2).IsSameAs(_T("CD")) ||
message.Mid(3,3).IsSameAs(_T("TLL")) ||
message.Mid(3,3).IsSameAs(_T("TTM")) ||
message.Mid(3,3).IsSameAs(_T("OSD")) ||
( g_bWplIsAprsPosition && message.Mid(3,3).IsSameAs(_T("WPL")) ) )
{
if( m_aisconsumer )
m_aisconsumer->AddPendingEvent(event);
}
else
{
if( m_gpsconsumer )
m_gpsconsumer->AddPendingEvent(event);
}
}
if ((g_b_legacy_input_filter_behaviour && !bpass) || bpass) {
//Send to plugins
if ( g_pi_manager ){
if(stream){ // Is this a real or a virtual stream?
if( stream->ChecksumOK(event.GetNMEAString()) )
g_pi_manager->SendNMEASentenceToAllPlugIns( message );
}
else{
if( CheckSumCheck(event.GetNMEAString()) )
g_pi_manager->SendNMEASentenceToAllPlugIns( message );
}
}
//Send to all the other outputs
for (size_t i = 0; i < m_pdatastreams->Count(); i++)
{
DataStream* s = m_pdatastreams->Item(i);
if ( s->IsOk() ) {
if((s->GetConnectionType() == SERIAL) || (s->GetPort() != port)) {
if ( s->GetIoSelect() == DS_TYPE_INPUT_OUTPUT || s->GetIoSelect() == DS_TYPE_OUTPUT ) {
bool bout_filter = true;
bool bxmit_ok = true;
if(s->SentencePassesFilter( message, FILTER_OUTPUT ) ) {
bxmit_ok = s->SendSentence(message);
bout_filter = false;
}
//Send to the Debug Window, if open
if( !bout_filter ) {
if( bxmit_ok )
LogOutputMessageColor( message, s->GetPort(), _T("<BLUE>") );
else
LogOutputMessageColor( message, s->GetPort(), _T("<RED>") );
}
else
LogOutputMessageColor( message, s->GetPort(), _T("<CORAL>") );
}
}
}
}
}
//Send to the Debug Window, if open
// Special formatting for non-printable characters helps debugging NMEA problems
if (NMEALogWindow::Get().Active()) {
std::string str= event.GetNMEAString();
wxString fmsg;
bool b_error = false;
for ( std::string::iterator it=str.begin(); it!=str.end(); ++it){
if(isprint(*it))
fmsg += *it;
else{
wxString bin_print;
bin_print.Printf(_T("<0x%02X>"), *it);
fmsg += bin_print;
if((*it != 0x0a) && (*it != 0x0d))
b_error = true;
}
//.........这里部分代码省略.........