KiCad PCB EDA Suite
pcbnew/cross-probing.cpp File Reference

Cross probing functions to handle communication to and from Eeschema. More...

#include <class_board.h>
#include <class_module.h>
#include <class_track.h>
#include <collectors.h>
#include <eda_dde.h>
#include <fctsys.h>
#include <kiface_i.h>
#include <kiway_express.h>
#include <macros.h>
#include <netlist_reader/pcb_netlist.h>
#include <netlist_reader/board_netlist_updater.h>
#include <pcb_edit_frame.h>
#include <pcbnew_settings.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/selection_tool.h>
#include <netlist_reader/netlist_reader.h>

Go to the source code of this file.

Functions

std::string FormatProbeItem (BOARD_ITEM *aItem)
 

Detailed Description

Cross probing functions to handle communication to and from Eeschema.

Handle messages between Pcbnew and Eeschema via a socket, the port numbers are KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) (Eeschema to Pcbnew) KICAD_SCH_PORT_SERVICE_NUMBER (currently 4243) (Pcbnew to Eeschema) Note: these ports must be enabled for firewall protection

Definition in file pcbnew/cross-probing.cpp.

Function Documentation

◆ FormatProbeItem()

std::string FormatProbeItem ( BOARD_ITEM aItem)

Definition at line 292 of file pcbnew/cross-probing.cpp.

293 {
294  MODULE* module;
295 
296  if( !aItem )
297  return "$CLEAR: \"HIGHLIGHTED\""; // message to clear highlight state
298 
299  switch( aItem->Type() )
300  {
301  case PCB_MODULE_T:
302  module = (MODULE*) aItem;
303  return StrPrintf( "$PART: \"%s\"", TO_UTF8( module->GetReference() ) );
304 
305  case PCB_PAD_T:
306  {
307  module = (MODULE*) aItem->GetParent();
308  wxString pad = ((D_PAD*)aItem)->GetName();
309 
310  return StrPrintf( "$PART: \"%s\" $PAD: \"%s\"",
311  TO_UTF8( module->GetReference() ),
312  TO_UTF8( pad ) );
313  }
314 
315  case PCB_MODULE_TEXT_T:
316  {
317  module = static_cast<MODULE*>( aItem->GetParent() );
318 
319  TEXTE_MODULE* text_mod = static_cast<TEXTE_MODULE*>( aItem );
320 
321  const char* text_key;
322 
323  /* This can't be a switch since the break need to pull out
324  * from the outer switch! */
325  if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_REFERENCE )
326  text_key = "$REF:";
327  else if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_VALUE )
328  text_key = "$VAL:";
329  else
330  break;
331 
332  return StrPrintf( "$PART: \"%s\" %s \"%s\"",
333  TO_UTF8( module->GetReference() ),
334  text_key,
335  TO_UTF8( text_mod->GetText() ) );
336  }
337 
338  default:
339  break;
340  }
341 
342  return "";
343 }
int StrPrintf(std::string *aResult, const char *aFormat,...)
Function StrPrintf is like sprintf() but the output is appended to a std::string instead of to a char...
Definition: richio.cpp:74
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:444
class MODULE, a footprint
Definition: typeinfo.h:89
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
#define TO_UTF8(wxstring)
BOARD_ITEM_CONTAINER * GetParent() const
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References BOARD_ITEM::GetParent(), MODULE::GetReference(), PCB_MODULE_T, PCB_MODULE_TEXT_T, PCB_PAD_T, numEval::StrPrintf(), TEXTE_MODULE::TEXT_is_REFERENCE, TEXTE_MODULE::TEXT_is_VALUE, TO_UTF8, and EDA_ITEM::Type().

Referenced by PCB_EDIT_FRAME::SendMessageToEESCHEMA().