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)
 
void RefreshDataSources ()
 
bool HasDataSources () const
 
void BindWebViewLoaded ()
 

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

Member Function Documentation

◆ beginSessionHandshake()

void PANEL_REMOTE_SYMBOL::beginSessionHandshake ( )
private

◆ BindWebViewLoaded()

void PANEL_REMOTE_SYMBOL::BindWebViewLoaded ( )

Definition at line 536 of file panel_remote_symbol.cpp.

References m_webView, m_webViewLoadedBound, and onWebViewLoaded().

◆ currentDataSourceKey()

wxString PANEL_REMOTE_SYMBOL::currentDataSourceKey ( ) const
private

Definition at line 297 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 212 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 235 of file panel_remote_symbol.cpp.

References _.

Referenced by handleRpcMessage(), and receiveComponent().

◆ ensureDestinationRoot()

◆ ensureFootprintLibraryEntry()

bool PANEL_REMOTE_SYMBOL::ensureFootprintLibraryEntry ( const wxFileName & aLibraryDir,
const wxString & aNickname,
bool aGlobalTable,
wxString & aError ) const
private

◆ ensureSymbolLibraryEntry()

bool PANEL_REMOTE_SYMBOL::ensureSymbolLibraryEntry ( const wxFileName & aLibraryFile,
const wxString & aNickname,
bool aGlobalTable,
wxString & aError ) const
private

◆ extractUrlFromJson()

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

Definition at line 743 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 682 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 624 of file panel_remote_symbol.cpp.

References m_dataSources.

◆ jsonString()

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

◆ 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 302 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 396 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 286 of file panel_remote_symbol.cpp.

Referenced by loadDataSource().

◆ onConfigure()

void PANEL_REMOTE_SYMBOL::onConfigure ( wxCommandEvent & aEvent)
private

Definition at line 598 of file panel_remote_symbol.cpp.

References RefreshDataSources(), and DIALOG_SHIM::ShowModal().

◆ onDataSourceChanged()

void PANEL_REMOTE_SYMBOL::onDataSourceChanged ( wxCommandEvent & aEvent)
private

Definition at line 587 of file panel_remote_symbol.cpp.

References loadDataSource().

◆ onKicadMessage()

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

Definition at line 858 of file panel_remote_symbol.cpp.

References handleRpcMessage().

◆ onRefresh()

void PANEL_REMOTE_SYMBOL::onRefresh ( wxCommandEvent & aEvent)
private

Definition at line 608 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 882 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 1043 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 278 of file panel_remote_symbol.cpp.

Referenced by sendRpcMessage().

◆ 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 728 of file panel_remote_symbol.cpp.

References m_webView.

Referenced by loadDataSource(), and RefreshDataSources().

◆ stopLoginServer()

void PANEL_REMOTE_SYMBOL::stopLoginServer ( )
private

Definition at line 919 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 355 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 137 of file panel_remote_symbol.h.

Referenced by PANEL_REMOTE_SYMBOL().

◆ m_dataSourceChoice

wxChoice* PANEL_REMOTE_SYMBOL::m_dataSourceChoice
private

Definition at line 136 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 141 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 145 of file panel_remote_symbol.h.

Referenced by handleRemoteLogin(), and stopLoginServer().

◆ m_messageIdCounter

int PANEL_REMOTE_SYMBOL::m_messageIdCounter
private

Definition at line 143 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 144 of file panel_remote_symbol.h.

Referenced by loadDataSource(), and onWebViewLoaded().

◆ m_refreshButton

BITMAP_BUTTON* PANEL_REMOTE_SYMBOL::m_refreshButton
private

Definition at line 138 of file panel_remote_symbol.h.

Referenced by PANEL_REMOTE_SYMBOL().

◆ m_sessionId

KIID PANEL_REMOTE_SYMBOL::m_sessionId
private

Definition at line 142 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 148 of file panel_remote_symbol.h.

Referenced by BindWebViewLoaded().


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