KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PANEL_REMOTE_SYMBOL Class Reference

#include <panel_remote_symbol.h>

Inheritance diagram for PANEL_REMOTE_SYMBOL:

Public Member Functions

 PANEL_REMOTE_SYMBOL (SCH_EDIT_FRAME *aParent)
 
 ~PANEL_REMOTE_SYMBOL ()
 
void RefreshDataSources ()
 
bool HasDataSources () const
 
void BindWebViewLoaded ()
 
void SaveCookies ()
 Store WebView cookies to settings for persistence across sessions.
 
void LoadCookies ()
 Restore WebView cookies from settings.
 

Private Member Functions

void onDataSourceChanged (wxCommandEvent &aEvent)
 
void onConfigure (wxCommandEvent &aEvent)
 
void onRefresh (wxCommandEvent &aEvent)
 
void onWebViewLoaded (wxWebViewEvent &aEvent)
 
void onRemoteLoginResult (wxCommandEvent &aEvent)
 
bool loadDataSource (size_t aIndex)
 
bool loadDataSource (const PCM_INSTALLATION_ENTRY &aEntry)
 
std::optional< wxFileName > findDataSourceJson (const PCM_INSTALLATION_ENTRY &aEntry) const
 
void showMessage (const wxString &aMessage)
 
std::optional< wxString > extractUrlFromJson (const wxString &aJsonContent) const
 
void onKicadMessage (const wxString &aMessage)
 
void handleRpcMessage (const nlohmann::json &aMessage)
 
void beginSessionHandshake ()
 
void handleRemoteLogin (const nlohmann::json &aParams, int aMessageId)
 
void stopLoginServer ()
 
void storeUserIdForActiveSource (const wxString &aUserId)
 
void loadStoredUserIdForActiveSource ()
 
wxString currentDataSourceKey () const
 
void sendRpcMessage (const wxString &aCommand, nlohmann::json aParameters=nlohmann::json::object(), std::optional< int > aResponseTo=std::nullopt, const wxString &aStatus=wxS("OK"), const std::string &aData=std::string(), const wxString &aErrorCode=wxEmptyString, const wxString &aErrorMessage=wxEmptyString)
 
void respondWithError (const wxString &aCommand, int aResponseTo, const wxString &aErrorCode, const wxString &aErrorMessage)
 
bool ensureDestinationRoot (wxFileName &aOutDir, wxString &aError) const
 
bool ensureSymbolLibraryEntry (const wxFileName &aLibraryFile, const wxString &aNickname, bool aGlobalTable, wxString &aError) const
 
bool ensureFootprintLibraryEntry (const wxFileName &aLibraryDir, const wxString &aNickname, bool aGlobalTable, wxString &aError) const
 
wxString sanitizedPrefix () const
 
bool receiveFootprint (const nlohmann::json &aParams, const std::vector< uint8_t > &aPayload, wxString &aError)
 
bool receiveSymbol (const nlohmann::json &aParams, const std::vector< uint8_t > &aPayload, wxString &aError)
 
bool receive3DModel (const nlohmann::json &aParams, const std::vector< uint8_t > &aPayload, wxString &aError)
 
bool receiveSPICEModel (const nlohmann::json &aParams, const std::vector< uint8_t > &aPayload, wxString &aError)
 
bool receiveComponent (const nlohmann::json &aParams, const std::vector< uint8_t > &aPayload, wxString &aError, nlohmann::json *aResponseParams=nullptr)
 
bool placeDownloadedSymbol (const wxString &aNickname, const wxString &aLibItemName, wxString &aError)
 
wxString sanitizeFileComponent (const wxString &aComponent, const wxString &aDefault) const
 
wxString sanitizeForScript (const std::string &aJson) const
 
wxString jsonString (const nlohmann::json &aObject, const char *aKey) const
 
wxString normalizeDataSourceUrl (const wxString &aUrl) const
 
bool decodeBase64Payload (const std::string &aMessage, std::vector< uint8_t > &aOutPayload, wxString &aError) const
 
bool decompressIfNeeded (const std::string &aCompression, const std::vector< uint8_t > &aInput, std::vector< uint8_t > &aOutput, wxString &aError) const
 
bool writeBinaryFile (const wxFileName &aFile, const std::vector< uint8_t > &aData, wxString &aError) const
 
std::unique_ptr< LIB_SYMBOLloadSymbolFromPayload (const std::vector< uint8_t > &aPayload, const wxString &aLibItemName, wxString &aError) const
 

Private Attributes

SCH_EDIT_FRAMEm_frame
 
wxChoice * m_dataSourceChoice
 
BITMAP_BUTTONm_configButton
 
BITMAP_BUTTONm_refreshButton
 
WEBVIEW_PANELm_webView
 
std::shared_ptr< PLUGIN_CONTENT_MANAGERm_pcm
 
std::vector< PCM_INSTALLATION_ENTRYm_dataSources
 
KIID m_sessionId
 
int m_messageIdCounter
 
bool m_pendingHandshake
 
std::unique_ptr< REMOTE_LOGIN_SERVERm_loginServer
 
wxString m_activeDataSourceUrl
 
wxString m_activeUserId
 
bool m_webViewLoadedBound
 

Detailed Description

Definition at line 50 of file panel_remote_symbol.h.

Constructor & Destructor Documentation

◆ PANEL_REMOTE_SYMBOL()

PANEL_REMOTE_SYMBOL::PANEL_REMOTE_SYMBOL ( SCH_EDIT_FRAME * aParent)
explicit

◆ ~PANEL_REMOTE_SYMBOL()

PANEL_REMOTE_SYMBOL::~PANEL_REMOTE_SYMBOL ( )

Definition at line 543 of file panel_remote_symbol.cpp.

References SaveCookies().

Member Function Documentation

◆ beginSessionHandshake()

void PANEL_REMOTE_SYMBOL::beginSessionHandshake ( )
private

◆ BindWebViewLoaded()

void PANEL_REMOTE_SYMBOL::BindWebViewLoaded ( )

Definition at line 570 of file panel_remote_symbol.cpp.

References m_webView, m_webViewLoadedBound, and onWebViewLoaded().

◆ currentDataSourceKey()

wxString PANEL_REMOTE_SYMBOL::currentDataSourceKey ( ) const
private

Definition at line 301 of file panel_remote_symbol.cpp.

References m_activeDataSourceUrl.

◆ decodeBase64Payload()

bool PANEL_REMOTE_SYMBOL::decodeBase64Payload ( const std::string & aMessage,
std::vector< uint8_t > & aOutPayload,
wxString & aError ) const
private

Definition at line 216 of file panel_remote_symbol.cpp.

References _.

Referenced by handleRpcMessage(), and receiveComponent().

◆ decompressIfNeeded()

bool PANEL_REMOTE_SYMBOL::decompressIfNeeded ( const std::string & aCompression,
const std::vector< uint8_t > & aInput,
std::vector< uint8_t > & aOutput,
wxString & aError ) const
private

Definition at line 239 of file panel_remote_symbol.cpp.

References _.

Referenced by handleRpcMessage(), and receiveComponent().

◆ ensureDestinationRoot()

◆ ensureFootprintLibraryEntry()

◆ ensureSymbolLibraryEntry()

◆ extractUrlFromJson()

std::optional< wxString > PANEL_REMOTE_SYMBOL::extractUrlFromJson ( const wxString & aJsonContent) const
private

Definition at line 804 of file panel_remote_symbol.cpp.

References name, and path.

Referenced by loadDataSource().

◆ findDataSourceJson()

std::optional< wxFileName > PANEL_REMOTE_SYMBOL::findDataSourceJson ( const PCM_INSTALLATION_ENTRY & aEntry) const
private

Definition at line 743 of file panel_remote_symbol.cpp.

References PCM_PACKAGE::identifier, m_pcm, and PCM_INSTALLATION_ENTRY::package.

Referenced by loadDataSource().

◆ handleRemoteLogin()

void PANEL_REMOTE_SYMBOL::handleRemoteLogin ( const nlohmann::json & aParams,
int aMessageId )
private

◆ handleRpcMessage()

◆ HasDataSources()

bool PANEL_REMOTE_SYMBOL::HasDataSources ( ) const

Definition at line 685 of file panel_remote_symbol.cpp.

References m_dataSources.

◆ jsonString()

wxString PANEL_REMOTE_SYMBOL::jsonString ( const nlohmann::json & aObject,
const char * aKey ) const
private

◆ LoadCookies()

void PANEL_REMOTE_SYMBOL::LoadCookies ( )

Restore WebView cookies from settings.

Definition at line 560 of file panel_remote_symbol.cpp.

References PATHS::GetUserSettingsPath(), KIPLATFORM::WEBVIEW::LoadCookies(), and m_webView.

◆ loadDataSource() [1/2]

◆ loadDataSource() [2/2]

bool PANEL_REMOTE_SYMBOL::loadDataSource ( size_t aIndex)
private

◆ loadStoredUserIdForActiveSource()

void PANEL_REMOTE_SYMBOL::loadStoredUserIdForActiveSource ( )
private

Definition at line 306 of file panel_remote_symbol.cpp.

References GetAppSettings(), m_activeDataSourceUrl, and m_activeUserId.

Referenced by loadDataSource().

◆ loadSymbolFromPayload()

std::unique_ptr< LIB_SYMBOL > PANEL_REMOTE_SYMBOL::loadSymbolFromPayload ( const std::vector< uint8_t > & aPayload,
const wxString & aLibItemName,
wxString & aError ) const
private

Definition at line 400 of file panel_remote_symbol.cpp.

References _, and IO_ERROR::What().

Referenced by receiveComponent(), and receiveSymbol().

◆ normalizeDataSourceUrl()

wxString PANEL_REMOTE_SYMBOL::normalizeDataSourceUrl ( const wxString & aUrl) const
private

Definition at line 290 of file panel_remote_symbol.cpp.

Referenced by loadDataSource().

◆ onConfigure()

void PANEL_REMOTE_SYMBOL::onConfigure ( wxCommandEvent & aEvent)
private

◆ onDataSourceChanged()

void PANEL_REMOTE_SYMBOL::onDataSourceChanged ( wxCommandEvent & aEvent)
private

Definition at line 621 of file panel_remote_symbol.cpp.

References loadDataSource().

◆ onKicadMessage()

void PANEL_REMOTE_SYMBOL::onKicadMessage ( const wxString & aMessage)
private

Definition at line 919 of file panel_remote_symbol.cpp.

References handleRpcMessage().

◆ onRefresh()

void PANEL_REMOTE_SYMBOL::onRefresh ( wxCommandEvent & aEvent)
private

Definition at line 669 of file panel_remote_symbol.cpp.

References m_webView.

◆ onRemoteLoginResult()

void PANEL_REMOTE_SYMBOL::onRemoteLoginResult ( wxCommandEvent & aEvent)
private

◆ onWebViewLoaded()

void PANEL_REMOTE_SYMBOL::onWebViewLoaded ( wxWebViewEvent & aEvent)
private

Definition at line 943 of file panel_remote_symbol.cpp.

References beginSessionHandshake(), and m_pendingHandshake.

Referenced by BindWebViewLoaded().

◆ placeDownloadedSymbol()

bool PANEL_REMOTE_SYMBOL::placeDownloadedSymbol ( const wxString & aNickname,
const wxString & aLibItemName,
wxString & aError )
private

◆ receive3DModel()

bool PANEL_REMOTE_SYMBOL::receive3DModel ( const nlohmann::json & aParams,
const std::vector< uint8_t > & aPayload,
wxString & aError )
private

◆ receiveComponent()

bool PANEL_REMOTE_SYMBOL::receiveComponent ( const nlohmann::json & aParams,
const std::vector< uint8_t > & aPayload,
wxString & aError,
nlohmann::json * aResponseParams = nullptr )
private

◆ receiveFootprint()

◆ receiveSPICEModel()

bool PANEL_REMOTE_SYMBOL::receiveSPICEModel ( const nlohmann::json & aParams,
const std::vector< uint8_t > & aPayload,
wxString & aError )
private

◆ receiveSymbol()

◆ RefreshDataSources()

void PANEL_REMOTE_SYMBOL::RefreshDataSources ( )

◆ respondWithError()

void PANEL_REMOTE_SYMBOL::respondWithError ( const wxString & aCommand,
int aResponseTo,
const wxString & aErrorCode,
const wxString & aErrorMessage )
private

Definition at line 1104 of file panel_remote_symbol.cpp.

References sendRpcMessage().

Referenced by handleRemoteLogin(), and handleRpcMessage().

◆ sanitizedPrefix()

wxString PANEL_REMOTE_SYMBOL::sanitizedPrefix ( ) const
private

◆ sanitizeFileComponent()

wxString PANEL_REMOTE_SYMBOL::sanitizeFileComponent ( const wxString & aComponent,
const wxString & aDefault ) const
private

◆ sanitizeForScript()

wxString PANEL_REMOTE_SYMBOL::sanitizeForScript ( const std::string & aJson) const
private

Definition at line 282 of file panel_remote_symbol.cpp.

Referenced by sendRpcMessage().

◆ SaveCookies()

void PANEL_REMOTE_SYMBOL::SaveCookies ( )

Store WebView cookies to settings for persistence across sessions.

Definition at line 550 of file panel_remote_symbol.cpp.

References PATHS::GetUserSettingsPath(), m_webView, and KIPLATFORM::WEBVIEW::SaveCookies().

Referenced by ~PANEL_REMOTE_SYMBOL().

◆ sendRpcMessage()

void PANEL_REMOTE_SYMBOL::sendRpcMessage ( const wxString & aCommand,
nlohmann::json aParameters = nlohmann::json::object(),
std::optional< int > aResponseTo = std::nullopt,
const wxString & aStatus = wxS( "OK" ),
const std::string & aData = std::string(),
const wxString & aErrorCode = wxEmptyString,
const wxString & aErrorMessage = wxEmptyString )
private

◆ showMessage()

void PANEL_REMOTE_SYMBOL::showMessage ( const wxString & aMessage)
private

Definition at line 789 of file panel_remote_symbol.cpp.

References m_webView.

Referenced by loadDataSource(), and RefreshDataSources().

◆ stopLoginServer()

void PANEL_REMOTE_SYMBOL::stopLoginServer ( )
private

Definition at line 980 of file panel_remote_symbol.cpp.

References m_loginServer.

Referenced by handleRemoteLogin(), loadDataSource(), and onRemoteLoginResult().

◆ storeUserIdForActiveSource()

void PANEL_REMOTE_SYMBOL::storeUserIdForActiveSource ( const wxString & aUserId)
private

◆ writeBinaryFile()

bool PANEL_REMOTE_SYMBOL::writeBinaryFile ( const wxFileName & aFile,
const std::vector< uint8_t > & aData,
wxString & aError ) const
private

Definition at line 359 of file panel_remote_symbol.cpp.

References _.

Referenced by receive3DModel(), receiveComponent(), receiveFootprint(), and receiveSPICEModel().

Member Data Documentation

◆ m_activeDataSourceUrl

wxString PANEL_REMOTE_SYMBOL::m_activeDataSourceUrl
private

◆ m_activeUserId

wxString PANEL_REMOTE_SYMBOL::m_activeUserId
private

◆ m_configButton

BITMAP_BUTTON* PANEL_REMOTE_SYMBOL::m_configButton
private

Definition at line 144 of file panel_remote_symbol.h.

Referenced by onConfigure(), and PANEL_REMOTE_SYMBOL().

◆ m_dataSourceChoice

wxChoice* PANEL_REMOTE_SYMBOL::m_dataSourceChoice
private

Definition at line 143 of file panel_remote_symbol.h.

Referenced by PANEL_REMOTE_SYMBOL(), and RefreshDataSources().

◆ m_dataSources

std::vector<PCM_INSTALLATION_ENTRY> PANEL_REMOTE_SYMBOL::m_dataSources
private

Definition at line 148 of file panel_remote_symbol.h.

Referenced by HasDataSources(), loadDataSource(), and RefreshDataSources().

◆ m_frame

SCH_EDIT_FRAME* PANEL_REMOTE_SYMBOL::m_frame
private

◆ m_loginServer

std::unique_ptr<REMOTE_LOGIN_SERVER> PANEL_REMOTE_SYMBOL::m_loginServer
private

Definition at line 152 of file panel_remote_symbol.h.

Referenced by handleRemoteLogin(), and stopLoginServer().

◆ m_messageIdCounter

int PANEL_REMOTE_SYMBOL::m_messageIdCounter
private

Definition at line 150 of file panel_remote_symbol.h.

Referenced by beginSessionHandshake(), and sendRpcMessage().

◆ m_pcm

std::shared_ptr<PLUGIN_CONTENT_MANAGER> PANEL_REMOTE_SYMBOL::m_pcm
private

◆ m_pendingHandshake

bool PANEL_REMOTE_SYMBOL::m_pendingHandshake
private

Definition at line 151 of file panel_remote_symbol.h.

Referenced by loadDataSource(), and onWebViewLoaded().

◆ m_refreshButton

BITMAP_BUTTON* PANEL_REMOTE_SYMBOL::m_refreshButton
private

Definition at line 145 of file panel_remote_symbol.h.

Referenced by PANEL_REMOTE_SYMBOL().

◆ m_sessionId

KIID PANEL_REMOTE_SYMBOL::m_sessionId
private

Definition at line 149 of file panel_remote_symbol.h.

Referenced by beginSessionHandshake(), handleRpcMessage(), and sendRpcMessage().

◆ m_webView

◆ m_webViewLoadedBound

bool PANEL_REMOTE_SYMBOL::m_webViewLoadedBound
private

Definition at line 155 of file panel_remote_symbol.h.

Referenced by BindWebViewLoaded().


The documentation for this class was generated from the following files: