本文整理汇总了C++中DataStream::IsOk方法的典型用法代码示例。如果您正苦于以下问题:C++ DataStream::IsOk方法的具体用法?C++ DataStream::IsOk怎么用?C++ DataStream::IsOk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataStream
的用法示例。
在下文中一共展示了DataStream::IsOk方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendNMEAMessage
void Multiplexer::SendNMEAMessage( wxString &msg )
{
//Send to all the outputs
for (size_t i = 0; i < m_pdatastreams->Count(); i++)
{
DataStream* s = m_pdatastreams->Item(i);
if ( s->IsOk() && (s->GetIoSelect() == DS_TYPE_INPUT_OUTPUT || s->GetIoSelect() == DS_TYPE_OUTPUT) ) {
bool bout_filter = true;
bool bxmit_ok = true;
if(s->SentencePassesFilter( msg, FILTER_OUTPUT ) ) {
bxmit_ok = s->SendSentence(msg);
bout_filter = false;
}
//Send to the Debug Window, if open
if( !bout_filter ) {
if( bxmit_ok )
LogOutputMessageColor( msg, s->GetPort(), _T("<BLUE>") );
else
LogOutputMessageColor( msg, s->GetPort(), _T("<RED>") );
}
else
LogOutputMessageColor( msg, s->GetPort(), _T("<AMBER>") );
}
}
//Send to plugins
if ( g_pi_manager )
g_pi_manager->SendNMEASentenceToAllPlugIns( msg );
}
示例2: SendNMEAMessage
void Multiplexer::SendNMEAMessage( wxString &msg )
{
//Send to all the outputs
for (size_t i = 0; i < m_pdatastreams->Count(); i++)
{
DataStream* s = m_pdatastreams->Item(i);
if ( s->IsOk() && (s->GetIoSelect() == DS_TYPE_INPUT_OUTPUT || s->GetIoSelect() == DS_TYPE_OUTPUT) ) {
bool bout_filter = true;
if(s->SentencePassesFilter( msg, FILTER_OUTPUT ) ) {
s->SendSentence(msg);
bout_filter = false;
}
//Send to the Debug Window, if open
if( g_NMEALogWindow) {
wxDateTime now = wxDateTime::Now();
wxString ss = now.FormatISOTime();
ss.Prepend(_T("--> "));
ss.Append( _T(" (") );
ss.Append( s->GetPort() );
ss.Append( _T(") ") );
ss.Append( msg );
if(bout_filter)
ss.Prepend( _T("<AMBER>") );
else
ss.Prepend( _T("<BLUE>") );
g_NMEALogWindow->Add( ss );
g_NMEALogWindow->Refresh( false );
}
}
}
//Send to plugins
if ( g_pi_manager )
g_pi_manager->SendNMEASentenceToAllPlugIns( msg );
}
示例3: OnEvtStream
void Multiplexer::OnEvtStream(OCPN_DataStreamEvent& event)
{
wxString message = wxString(event.GetNMEAString().c_str(), wxConvUTF8);
wxString port = wxString(event.GetStreamName().c_str(), wxConvUTF8);
DataStream *stream = FindStream(port);
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")) )
{
if( m_aisconsumer )
m_aisconsumer->AddPendingEvent(event);
}
else
{
if( m_gpsconsumer )
m_gpsconsumer->AddPendingEvent(event);
}
// Handle AIVDO messages from transponder....
if( message.Mid(3,3).IsSameAs(_T("VDO")) ) {
if( m_gpsconsumer )
m_gpsconsumer->AddPendingEvent(event);
}
}
//Send to the Debug Window, if open
LogInputMessage( message, port, !bpass );
//Send to plugins
if ( g_pi_manager )
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;
if(s->SentencePassesFilter( message, FILTER_OUTPUT ) ) {
s->SendSentence(message);
bout_filter = false;
}
//Send to the Debug Window, if open
LogOutputMessage( message, port, bout_filter );
}
}
}
}
}
}
示例4: OnEvtStream
void Multiplexer::OnEvtStream(OCPN_DataStreamEvent& event)
{
wxString message = event.GetNMEAString();
wxString ds = event.GetDataSource();
DataStream *stream = event.GetDataStream();
if( !message.IsEmpty() )
{
//Send to all the other outputs
for (size_t i = 0; i < m_pdatastreams->Count(); i++)
{
DataStream* s = m_pdatastreams->Item(i);
if ( ds != s->GetPort() ) {
if ( s->IsOk() )
if ( s->GetIoSelect() == DS_TYPE_INPUT_OUTPUT || s->GetIoSelect() == DS_TYPE_OUTPUT ) {
bool bout_filter = true;
if(s->SentencePassesFilter( message, FILTER_OUTPUT ) ) {
s->SendSentence(message);
bout_filter = false;
}
//Send to the Debug Window, if open
if( g_NMEALogWindow) {
wxDateTime now = wxDateTime::Now();
wxString ss = now.FormatISOTime();
ss.Prepend(_T("--> "));
ss.Append( _T(" (") );
ss.Append( s->GetPort() );
ss.Append( _T(") ") );
ss.Append( message );
if(bout_filter)
ss.Prepend( _T("<AMBER>") );
else
ss.Prepend( _T("<BLUE>") );
g_NMEALogWindow->Add( ss );
g_NMEALogWindow->Refresh( false );
}
}
}
}
//Send to core consumers
//if it passes the source's input filter
bool bfilter = true;
if(stream->SentencePassesFilter( message, FILTER_INPUT ) ) {
bfilter = false;
if( message.Mid(3,3).IsSameAs(_T("VDM")) ||
message.Mid(3,3).IsSameAs(_T("VDO")) ||
message.Mid(1,5).IsSameAs(_T("FRPOS")) ||
message.Mid(1,2).IsSameAs(_T("CD")) )
{
if( m_aisconsumer )
m_aisconsumer->AddPendingEvent(event);
}
else
{
if( m_gpsconsumer )
m_gpsconsumer->AddPendingEvent(event);
}
//Send to plugins
if ( g_pi_manager )
g_pi_manager->SendNMEASentenceToAllPlugIns( message );
}
//Send to the Debug Window, if open
if( g_NMEALogWindow) {
wxDateTime now = wxDateTime::Now();
wxString ss = now.FormatISOTime();
ss.Append( _T(" (") );
ss.Append( event.GetDataSource() );
ss.Append( _T(") ") );
ss.Append( message );
if(bfilter)
ss.Prepend( _T("<AMBER>") );
else
ss.Prepend( _T("<GREEN>") );
g_NMEALogWindow->Add( ss );
g_NMEALogWindow->Refresh( false );
}
}
}
示例5: 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;
}
//.........这里部分代码省略.........