void weather_routing_pi::OnToolbarToolCallback(int id) { if(!m_pWeather_Routing) { m_pWeather_Routing = new WeatherRouting(m_parent_window, *this); wxPoint p = m_pWeather_Routing->GetPosition(); m_pWeather_Routing->Move(0,0); // workaround for gtk autocentre dialog behavior m_pWeather_Routing->Move(p); SendPluginMessage(wxString(_T("GRIB_TIMELINE_REQUEST")), _T("")); SendPluginMessage(wxString(_T("CLIMATOLOGY_REQUEST")), _T("")); if(ODVersionNewerThan( 1, 1, 15)) { wxJSONValue jMsg; wxJSONWriter writer; wxString MsgString; jMsg[wxT("Source")] = wxT("WEATHER_ROUTING_PI"); jMsg[wxT("Type")] = wxT("Request"); jMsg[wxT("Msg")] = wxS("GetAPIAddresses"); jMsg[wxT("MsgId")] = wxS("GetAPIAddresses"); writer.Write( jMsg, MsgString ); SendPluginMessage( wxS("OCPN_DRAW_PI"), MsgString ); } m_pWeather_Routing->Reset(); } m_pWeather_Routing->Show(!m_pWeather_Routing->IsShown()); }
void findit_pi::OnToolbarToolCallback(int id) { SendPluginMessage(_T("LOGBOOK_IS_READY_FOR_REQUEST"), wxEmptyString); if(NULL == m_pFindItWindow) m_pFindItWindow = new MainDialog(this->m_parent_window,this); else { if(m_pFindItWindow->IsIconized()) m_pFindItWindow->Iconize(false); } m_pFindItWindow->Show(); m_pFindItWindow->SetFocus(); }
bool PathMan::ActivatePath(ODPath *pPathToActivate ) { wxString msg_id( wxS("OCPN_PATH_ACTIVATED") ); wxString msg; msg.append( wxS("Name: ") ); msg.append( pPathToActivate->m_PathNameString.c_str() ); msg.append( wxS(", GUID: ") ); msg.append( pPathToActivate->m_GUID ); SendPluginMessage( msg_id, msg ); pPathToActivate->m_bPathIsActive = true; pPathToActivate->SetActiveColours(); return true; }
CKAHUM::OpResult CKAHSTM::SetNetDefaultReaction( bool NetUsesStm ) { STEALTH_NET_REACTION snr = { NetUsesStm }; CKAHUM::OpResult Result = SendPluginMessage( CCKAHPlugin::ptStealthMode, PLUG_IOCTL, STEALTH_MODE_PLUGIN_NAME, STEALTH_SET_NET_DEFAULT_REACTION, &snr, sizeof ( snr ), NULL, 0); return Result; }
bool PathMan::DeactivatePath( ODPath *pPathToDeactivate ) { wxString msg_id( _T("OCPN_PATH_DEACTIVATED") ); wxString msg; msg.append( wxS("Name: ") ); msg.append( pPathToDeactivate->m_PathNameString.c_str() ); msg.append( wxS(", GUID: ") ); msg.append( pPathToDeactivate->m_GUID ); SendPluginMessage( msg_id, msg ); pPathToDeactivate->m_bPathIsActive = false; pPathToDeactivate->SetActiveColours(); // console->pCDI->ClearBackground(); // m_bDataValid = false; return true; }
CKAHUM::OpResult CKAHSTM::SetStealth(char MacAddr[6], bool Mode) { SET_STEALTH_STRUCT sss; memcpy ( sss.MacAddress, MacAddr, sizeof ( MacAddr ) ); sss.isSet = Mode; CKAHUM::OpResult Result = SendPluginMessage( CCKAHPlugin::ptStealthMode, PLUG_IOCTL, STEALTH_MODE_PLUGIN_NAME, STEALTH_SET_STEALTH, &sss, sizeof ( sss ), NULL, 0); return Result; }
void climatology_pi::SendClimatology(bool valid) { Json::Value v; v["ClimatologyVersionMajor"] = GetPlugInVersionMajor(); v["ClimatologyVersionMinor"] = GetPlugInVersionMinor(); char ptr[64]; snprintf(ptr, sizeof ptr, "%p", valid ? ClimatologyData : NULL); v["ClimatologyDataPtr"] = ptr; snprintf(ptr, sizeof ptr, "%p", valid ? ClimatologyWindAtlasData : NULL); v["ClimatologyWindAtlasDataPtr"] = ptr; snprintf(ptr, sizeof ptr, "%p", valid ? ClimatologyCycloneTrackCrossings : NULL); v["ClimatologyCycloneTrackCrossingsPtr"] = ptr; Json::FastWriter writer; SendPluginMessage(wxT("CLIMATOLOGY"), writer.write( v )); }
// ------------------------------------------------------- // GRIBMELINE is a misnomer void climatology_pi::SendTimelineMessage(wxDateTime time) { Json::Value v; if (time.IsValid()) { v["Day"] = time.GetDay(); v["Month"] = time.GetMonth(); v["Year"] = time.GetYear(); v["Hour"] = time.GetHour(); v["Minute"] = time.GetMinute(); v["Second"] = time.GetSecond(); } else { v["Day"] = -1; v["Month"] = -1; v["Year"] = -1; v["Hour"] = -1; v["Minute"] = -1; v["Second"] = -1; } Json::FastWriter writer; SendPluginMessage("GRIB_TIMELINE", writer.write( v )); }
CKAHUM::OpResult CKAHSTM::RemoveNet( StmNet* pNet ) { if (!pNet) return CKAHUM::srInvalidArg; if (pNet->Net.Version != pNet->Mask.Version) return CKAHUM::srInvalidArg; STEALTH_NET2 sn; if (pNet->Net.Isv4()) { sn.Net.IpVer = 4; sn.Net.Ipv4 = pNet->Net.v4; sn.Mask.IpVer = 4; sn.Mask.Ipv4 = pNet->Mask.v4; } else if (pNet->Net.Isv6()) { sn.Net.IpVer = 6; memcpy (sn.Net.Ipv6_uchar, &pNet->Net.v6.O, sizeof(sn.Net.Ipv6_uchar)); sn.Net.Zone = pNet->Net.v6.Zone; sn.Mask.IpVer = 6; memcpy (sn.Mask.Ipv6_uchar, &pNet->Mask.v6, sizeof(sn.Mask.Ipv6_uchar)); sn.Mask.Zone = pNet->Mask.v6.Zone; } CKAHUM::OpResult Result = SendPluginMessage( CCKAHPlugin::ptStealthMode, PLUG_IOCTL, STEALTH_MODE_PLUGIN_NAME, STEALTH_REMOVE_NET2, &sn, sizeof ( sn ), NULL, 0); return Result; }
static bool ODVersionNewerThan(int major, int minor, int patch) { wxJSONValue jMsg; wxJSONWriter writer; wxString MsgString; jMsg[wxS("Source")] = wxS("WEATHER_ROUTING_PI"); jMsg[wxT("Type")] = wxT("Request"); jMsg[wxT("Msg")] = wxS("Version"); jMsg[wxT("MsgId")] = wxS("version"); writer.Write( jMsg, MsgString ); SendPluginMessage( wxS("OCPN_DRAW_PI"), MsgString ); if(!g_ReceivedODVersionJSONMsg.Size()) return false; if(g_ReceivedODVersionJSONMsg[wxS("Major")].AsInt() > major) return true; if(g_ReceivedODVersionJSONMsg[wxS("Major")].AsInt() == major && g_ReceivedODVersionJSONMsg[wxS("Minor")].AsInt() > minor) return true; if(g_ReceivedODVersionJSONMsg[wxS("Major")].AsInt() == major && g_ReceivedODVersionJSONMsg[wxS("Minor")].AsInt() == minor && g_ReceivedODVersionJSONMsg[wxS("Patch")].AsInt() >= patch) return true; return false; }
bool PathProp::SaveChanges( void ) { if( m_pPath && !m_pPath->m_bIsInLayer ) { // Get User input Text Fields m_pPath->m_PathNameString = m_PathNameCtl->GetValue(); m_pPath->m_PathDescription = m_textDescription->GetValue(); m_pPath->m_bPathIsActive = m_pPathActive->GetValue(); if( m_chColor->GetSelection() == 0 ) m_pPath->m_ActiveLineColour = wxEmptyString; else m_pPath->m_ActiveLineColour = ::GpxxColorNames[m_chColor->GetSelection() - 1]; if( m_chLineColor->GetSelection() == 0 ) m_pPath->m_ActiveFillColour = wxEmptyString; else m_pPath->m_ActiveFillColour = ::GpxxColorNames[m_chLineColor->GetSelection() - 1]; m_pPath->m_style = ::StyleValues[m_chStyle->GetSelection()]; m_pPath->m_width = ::WidthValues[m_chWidth->GetSelection()]; g_pODConfig->UpdatePath( m_pPath ); //g_ocpn_draw_pi->SaveConfig(); } if( m_pPath->IsActive() ) { wxString msg_id( wxS("OCPN_PATH_ACTIVATED") ); wxString msg; msg.append( wxS("Name: ") ); msg.append( m_pPath->m_PathNameString.c_str() ); msg.append( wxS(", GUID: ") ); msg.append( m_pPath->m_GUID ); SendPluginMessage( msg_id, msg ); } return true; }
CKAHUM::OpResult CKAHSTM::GetNetList(HSTMNETLIST* phList) { if ( ! phList ) { return CKAHUM::srInvalidArg; } unsigned char * buf; ULONG bufsize = 65536; ULONG retsize = 0; if ( ! ( buf = new unsigned char [ bufsize ] ) ) { return CKAHUM::srOpFailed; } CKAHUM::OpResult res; while ( ( res = SendPluginMessage( CCKAHPlugin::ptStealthMode, PLUG_IOCTL, STEALTH_MODE_PLUGIN_NAME, STEALTH_GET_NET_LIST2, NULL, 0, buf, bufsize, &retsize ) ) == CKAHUM::srInsufficientBuffer ) { delete [] buf; bufsize *= 2; if ( ! ( buf = new unsigned char [ bufsize ] ) ) { return CKAHUM::srOpFailed; } } if ( res != CKAHUM::srOK ) { delete [] buf; return res; } int entries = PSTEALTH_NET_LIST2(buf)->Count; StmNetList* list = (StmNetList*) new unsigned char [ sizeof ( int ) + entries * sizeof ( CKAHSTM::StmNet ) ]; list->size = entries; for ( int i = 0; i < entries; ++i ) { if (((PSTEALTH_NET_LIST2)buf)->Net[i].Net.IpVer == 4) list->list[i].Net.Setv4 (((PSTEALTH_NET_LIST2)buf)->Net[i].Net.Ipv4); else if (((PSTEALTH_NET_LIST2)buf)->Net[i].Net.IpVer == 6) list->list[i].Net.Setv6 ( *(CKAHUM::OWord*)((PSTEALTH_NET_LIST2)buf)->Net[i].Net.Ipv6_uchar, ((PSTEALTH_NET_LIST2)buf)->Net[i].Net.Zone ); if (((PSTEALTH_NET_LIST2)buf)->Net[i].Mask.IpVer == 4) list->list[i].Mask.Setv4 (((PSTEALTH_NET_LIST2)buf)->Net[i].Mask.Ipv4); else if (((PSTEALTH_NET_LIST2)buf)->Net[i].Mask.IpVer == 6) list->list[i].Mask.Setv6 ( *(CKAHUM::OWord*)((PSTEALTH_NET_LIST2)buf)->Net[i].Mask.Ipv6_uchar, ((PSTEALTH_NET_LIST2)buf)->Net[i].Mask.Zone ); } *phList = list; delete [] buf; return CKAHUM::srOK; }