Leonardo Platform Simulator ~ Python Interpreter API: $title

Leonardo Platform Simulator ~ Python Interpreter API
// purpose : usage of exec and eval for ICDPluginAction
#include <iostream>
#include <string>
#include <pypluginaction.h>
#include <pypluginhandler.h>
#define PLUGIN testcppPlugin
#define ACTION_HELLO 1
#define ACTION_CSQUARE 2
#define ACTION_PYSQUARE 3
class CSquareAction : public ICDPluginAction {
public:
CSquareAction( unsigned int id ) : ICDPluginAction( id,
"csquare",
ACTION_TYPE_NORMAL,
ACTION_KIND_PYTHON_ONLY,
NULL ) {}
bool execute(ICDDictionary in , ICDDictionary *out )
{
bool ret = false;
if (out == nullptr) return false;
if (in.get("number",&lval) )
{
long lval;
out->set("out", lval*lval);
ret = true;
} else {
out->set("error", "missing 'number' parameter");
}
return ret;
}
};
class PySquareAction : public PyPluginAction {
public:
PySquareAction( unsigned int id ) : PyPluginAction( id,
"pysquare",
ACTION_TYPE_NORMAL,
ACTION_KIND_PYTHON_ONLY,
NULL ) {}
PyObject* eval(PyObject *args, PyObject *kwargs)
{
PyObject *out = Py_None;
int number;
const char *keywords[] = {"number", NULL };
if( PyArg_ParseTupleAndKeywords(args,kwargs, (char *)"i:pysquare", (char **)(keywords), &number) )
{
out = Py_BuildValue("i",number*number);
}
return out;
}
bool execute(ICDDictionary in , ICDDictionary *out )
{
bool ret=false;
PyObject *kw = PyDict_New();
fromICDDictionaryToPyDict(in,kw);
PyObject *o=eval(PyTuple_New(0),kw);
if ( PyLong_Check(o) ) {
long l_value=PyLong_AsLong(o);
out->set("out", l_value );
ret=true;
} else {
out->set("error", "evaluating results");
}
return ret;
}
};
class PLUGIN : public ICDPluginObject
{
public:
PLUGIN(): ICDPluginObject(STR(PLUGIN))
{
this->addPluginAction( new CSquareAction( ACTION_CSQUARE ) );
this->addPluginAction( new PySquareAction( ACTION_PYSQUARE ) );
}
~PLUGIN() {}
void start() {}
void stop() {}
void onSetICDHandler(ICDHandler *h) {}
void onPluginAction(unsigned int a) {}
};
PLUGIN *p=nullptr;
extern "C" {
ICDPluginObject* onCreate() {
if ( ! p ) p = new PLUGIN();
return p;
}
void onDestroy() {
if ( p ) delete p;
p=nullptr;
}
}
Generated on Mon Feb 6 2023 08:56:39 for Leonardo Platform Simulator ~ Python Interpreter API by doxygen 1.8.14


Leonardo Platform Simulator ~ Python Interpreter API: $title

CC=g++
#SDK variable shall be passed both using make --eval="SDK=..." or using environment variable
_INTERFACES_INC_PATH= $(SDK)/include/interfaces
_PLUGIN_INC_PATH= $(SDK)/include/plugin
_ICDHANDLER_INC_PATH = $(SDK)/include/ICDHandler
_INTERPRETER_INC_PATH = $(SDK)/include/interpreter
INCLUDES=-I$(_INTERFACES_INC_PATH) -I$(_PLUGIN_INC_PATH) -I$(_ICDHANDLER_INC_PATH) -I$(_ICDHANDLER_INC_PATH)/ext -I$(_INTERPRETER_INC_PATH)
SRC=testPlugin.cpp
OBJ=testPlugin.o
TARGET=testplugin.dll
CFLAGS=-fno-keep-inline-dllexport -g -std=gnu++11 -Wall -W -Wextra -fexceptions -mthreads
LDFLAGS=-shared -Wl,-subsystem,windows -mthreads -Wl,--out-implib,$(TARGET).a
LIBS=-L$(SDK)/lib/x86_64-w64-mingw32 -lICDPlugin -lICDHandler -l_interpreter
PYTHONINCLUDE=-IC:\Python37\include
PYTHONLIBS=-LC:\Python37\libs -lpython3 -lpython37
$(TARGET) : $(OBJ)
$(CC) $(LDFLAGS) $< $(LIBS) $(PYTHONLIBS) -o $@
$(OBJ) : $(SRC)
$(CC) -c $(CFLAGS) $(INCLUDES) $(PYTHONINCLUDE) $< -o $@


Leonardo Platform Simulator ~ Python Interpreter API: Class List

Class List
Here are the classes, structs, unions and interfaces with brief descriptions:
C interpIO |
C PyInterfaceItem | Expose methods that interacts with the interface
C PyInterfaceManager |
C PyPluginAction | The PyPluginAction: enhanced ICDPluginAction that provides a virtual methods to executes full compliant python callback
C PyPluginHandler | The PyPluginHandler class
C PyPluginsManager | The PyPluginsManager class object to manage global plugins ( alias Tools )
C QPyConsole |
C QPyConsoleThread |


Leonardo Platform Simulator ~ Python Interpreter API: interpIO Struct Reference

List of all members
interpIO Struct Reference
The documentation for this struct was generated from the following file:
  • D:/sources/LeoPlatSim__trunk/qtinterpreter/include/qinterpreter_common.h


Leonardo Platform Simulator ~ Python Interpreter API: PyInterfaceItem Class Reference

Public Member Functions | List of all members
PyInterfaceItem Class Reference

The PyInterfaceItem class expose methods that interacts with the interface. More...

Public Member Functions

PyInterfaceItem (GenericInterfaceItem *p)
PyInterfaceItem::PyInterfaceItem. More...
PyObject * | pushOnICDEventCallback (PyObject *clbk)
PyInterfaceItem::pushEventCallback Link python function/methods to some ICD Events that are ( in terms of integer constant ): More...
PyObject * | popOnICDEventCallback ()
PyInterfaceItem::popOnICDEventCallback remove last inserted callback. More...
PyObject * | clearOnICDEventCallback ()
PyInterfaceItem::clearOnICDEventCallback remove all inserted callbacks. More...
PyPluginHandler * getPluginHandler ()
PyInterfaceItem::getPluginHandler. More...
PyObject * | getICDName ()
PyInterfaceItem::getICDName. More...
std::vector< std::string > | getMessageNames ()
PyInterfaceItem::getMessageNames. More...
bool | isMessageReadOnly (std::string msg_name)
PyInterfaceItem::isMessageReadOnly. More...
bool | touchMessage (std::string msg_name)
PyInterfaceItem::touchMessage. More...
PyObject * | getMessageId (std::string msg_name)
PyObject * | getMessageUsPeriodTime (std::string msg_name)
bool | isMessagePeriodic (std::string msg_name)
std::vector< std::string > | getMessageFieldNames (std::string msg_name)
PyInterfaceItem::getMessageFieldNames. More...
bool | assignMessageRawData (std::string msg_name, PyObject *raw)
PyInterfaceItem::assignMessageRawData. More...
PyObject * | getMessageRawData (std::string msg_name)
PyInterfaceItem::getMessageRawData. More...
PyObject * | setCallbackOnMsgReceived (std::string msg_name, PyObject *clbk)
PyInterfaceItem::setCallbackOnMsgReceived: it append a callback function to the message. More...
PyObject * | getMessageFieldUnit (std::string msg_name, std::string field_name)
PyInterfaceItem::getMessageFieldUnit. More...
PyObject * | getMessageFieldType (std::string msg_name, std::string field_name)
PyInterfaceItem::getMessageFieldType. More...
PyObject * | getMessageFieldValue (std::string msg_name, std::string field_name)
PyInterfaceItem::getMessageFieldValue. More...
PyObject * | getMessageFieldRange (std::string msg_name, std::string field_name)
PyInterfaceItem::getMessageFieldRange. More...
PyObject * | getMessageFieldBound (std::string msg_name, std::string field_name)
PyInterfaceItem::getMessageFieldBound. More...
PyObject * | getMessageFieldWeight (std::string msg_name, std::string field_name)
PyObject * | getMessageFieldWidth (std::string msg_name, std::string field_name)
std::vector< std::string > | getMessageFieldValues (std::string msg_name, std::string field_name)
PyInterfaceItem::getMessageFieldValues. More...
bool | assignMessageFieldValue (std::string msg_name, std::string field_name, PyObject *val, bool force=true)
PyInterfaceItem::assignMessageFieldValue. More...
bool | sendLastCommittedMessage (std::string msg_name)
PyInterfaceItem::sendLastCommittedMessage. More...
bool | updateRxMessage (std::string msg_name)
PyInterfaceItem::updateRxMessage. More...
bool | commitChanges ()
PyInterfaceItem::commitChanges. More...
void | revertChanges ()
PyInterfaceItem::revertChanges. More...
bool | start ()
PyInterfaceItem::start Start communication with the channel. More...
bool | stop ()
PyInterfaceItem::stop Shut down communication with the channel. More...
PyObject * | getSingleMessageSentSz (std::string msg_name) const
PyInterfaceItem::getSingleMessageSentSz. More...
PyObject * | getSingleMessageReceivedSz (std::string msg_name) const
PyInterfaceItem::getSingleMessageReceivedSz. More...
PyObject * | getMessageSentSz () const
PyInterfaceItem::getMessageSentSz. More...
PyObject * | getMessageReceivedSz () const
PyInterfaceItem::getMessageReceivedSz. More...
PyObject * | getMessageErrorSz () const
PyInterfaceItem::getMessageErrorSz. More...
PyObject * | getMessageLastError () const
PyInterfaceItem::getMessageLastError. More...
PyObject * | getLastChangedMessages () const
PyInterfaceItem::getLastChangedMessages. More...
PyObject * | getLastReceivedMessageId () const
PyInterfaceItem::getLastReceivedMessageId. More...
PyObject * | getLastReceivedMessageName () const
PyInterfaceItem::getLastReceivedMessageName. More...
PyObject * | getLastSentMessageNames () const
PyInterfaceItem::getLastSentMessageNames. More...
void | raiseError (std::string msg, int severity)
PyInterfaceItem::raiseError emulate bus error incoming. More...
int | logStart (int level, std::string dirName)
PyInterfaceItem::logStart. More...
void | logStop ()
PyInterfaceItem::logStop. Stop any log activities. More...
void | setVerbose (bool)
PyInterfaceItem::setVerbose Enable/Dsable auto log activities ( print information about operation ) More...
bool | getVerbose () const
PyInterfaceItem::getVerbose. More...
void | setCommitOnTheFly (bool b)
PyInterfaceItem::setCommitOnTheFly: every change event trigger commitment and send messages events. More...
bool | getCommitOnTheFly () const
PyInterfaceItem::getCommitOnTheFly. More...
bool | enableBusErrorInjection (int err)
PyInterfaceItem::enableBusErrorInjection Notify to the interface that error injection shall be used. More...
void | disableBusErrorInjection ()
PyInterfaceItem::disableBusErrorInjection Notify to the interface that no error injection shall be used. More...
int | getBusErrorInjection ()
PyInterfaceItem::getBusErrorInjection. More...
std::vector< std::string > | getBusErrorInjectionValues ()
PyInterfaceItem::getBusErrorInjectionValues. More...
unsigned long | getBusClockUsPeriodTime ()
PyInterfaceItem::getBusClockUsPeriodTime. More...
std::string | getBusConfiguration ()
PyInterfaceItem::getBusConfiguration. More...
bool | setBusConfiguration (std::string xml, bool persistent=false)
PyInterfaceItem::setBusConfiguration. More...

Detailed Description

The PyInterfaceItem class expose methods that interacts with the interface.

Constructor & Destructor Documentation

◆ PyInterfaceItem()

_EXPORT_ PyInterfaceItem::PyInterfaceItem ( GenericInterfaceItem * p )
explicit

PyInterfaceItem::PyInterfaceItem.

Parameters
p

Member Function Documentation

◆ assignMessageFieldValue()

_EXPORT_ bool PyInterfaceItem::assignMessageFieldValue | ( | std::string | msg_name,
 |  | std::string | field_name,
 |  | PyObject * | val,
 |  | bool | force = true
 | ) |  |

PyInterfaceItem::assignMessageFieldValue.

assigns the given value to the field contained in the message

Parameters
msg_name | the name of message in term of string
field_name | the name of field, that belongs to the given message, in term of string
val | the value
force | when true message is set as modified even if field val is not changed
Returns
boolean: True if assigment is successfull, False otherwise

◆ assignMessageRawData()

_EXPORT_ bool PyInterfaceItem::assignMessageRawData | ( | std::string | msg_name,
 |  | PyObject * | raw
 | ) |  |

PyInterfaceItem::assignMessageRawData.

assign the message data passing a byte array

Parameters
msg_name
raw tuple or list of numeric bytes or bytearray
Returns

◆ clearOnICDEventCallback()

_EXPORT_ PyObject * PyInterfaceItem::clearOnICDEventCallback ( )

PyInterfaceItem::clearOnICDEventCallback remove all inserted callbacks.

Returns
python Boolean

◆ commitChanges()

_EXPORT_ bool PyInterfaceItem::commitChanges ( )

PyInterfaceItem::commitChanges.

trigger the commit operation that flush changes applied to the ICD database

Returns
boolean: True if successfull, False otherwise

◆ disableBusErrorInjection()

_EXPORT_ void PyInterfaceItem::disableBusErrorInjection ( )

PyInterfaceItem::disableBusErrorInjection Notify to the interface that no error injection shall be used.

disable bus error injection

◆ enableBusErrorInjection()

_EXPORT_ bool PyInterfaceItem::enableBusErrorInjection ( int err )

PyInterfaceItem::enableBusErrorInjection Notify to the interface that error injection shall be used.

set bus error injection identifier

Parameters
err is the error id ( hint: use index of list passed getBusErrorInjectionValues() )
Returns
boolean: True if err is recognized, False otherwise

◆ getBusClockUsPeriodTime()

_EXPORT_ unsigned long PyInterfaceItem::getBusClockUsPeriodTime ( )

PyInterfaceItem::getBusClockUsPeriodTime.

get current bus clock time expressed in microseconds

Returns
clock period ( uSec )

◆ getBusConfiguration()

_EXPORT_ std::string PyInterfaceItem::getBusConfiguration ( )

PyInterfaceItem::getBusConfiguration.

get the xml lowlevel node as string

Returns
the xml lowlevel node as string

◆ getBusErrorInjection()

_EXPORT_ int PyInterfaceItem::getBusErrorInjection ( )

PyInterfaceItem::getBusErrorInjection.

get current bus error injection identifier

Returns
int: current bus error injection (-1 mean no ERROR_INJECTION_NONE)

◆ getBusErrorInjectionValues()

_EXPORT_ std::vector< std::string > PyInterfaceItem::getBusErrorInjectionValues ( )

PyInterfaceItem::getBusErrorInjectionValues.

returns bus error injection list

Returns
list: all error injection in terms of list of strings

◆ getCommitOnTheFly()

_EXPORT_ bool PyInterfaceItem::getCommitOnTheFly ( ) const

PyInterfaceItem::getCommitOnTheFly.

get the commot on the fly option

Returns
boolean value that indicates the option CommitOnTheFly

◆ getICDName()

_EXPORT_ PyObject * PyInterfaceItem::getICDName ( )

PyInterfaceItem::getICDName.

returns the name of the associated ICD database

Returns
string: name of the interface

◆ getLastChangedMessages()

_EXPORT_ PyObject * PyInterfaceItem::getLastChangedMessages ( ) const

PyInterfaceItem::getLastChangedMessages.

returns the last changed messages in terms of string

Returns
long: number of failed transmission/reception messages

◆ getLastReceivedMessageId()

_EXPORT_ PyObject * PyInterfaceItem::getLastReceivedMessageId ( ) const

PyInterfaceItem::getLastReceivedMessageId.

return the id of the last received message

Returns
the id of last received message ( None if not yet received any anyone)

◆ getLastReceivedMessageName()

_EXPORT_ PyObject * PyInterfaceItem::getLastReceivedMessageName ( ) const

PyInterfaceItem::getLastReceivedMessageName.

return the name of the last received message

Returns
the name of last received message ( None if not yet received anyone)

◆ getLastSentMessageNames()

_EXPORT_ PyObject * PyInterfaceItem::getLastSentMessageNames ( ) const

PyInterfaceItem::getLastSentMessageNames.

return a tuple containing the name of the last sent messages

Returns
tuple: last sent message names

◆ getMessageErrorSz()

_EXPORT_ PyObject * PyInterfaceItem::getMessageErrorSz ( ) const

PyInterfaceItem::getMessageErrorSz.

returns the number of all wrong messages ( both Tx and Rx )

Returns
long: number of failed transmission/reception messages

◆ getMessageFieldBound()

_EXPORT_ PyObject * PyInterfaceItem::getMessageFieldBound | ( | std::string | msg_name,
 |  | std::string | field_name
 | ) |  |

PyInterfaceItem::getMessageFieldBound.

return the bound limits in terms of tuple (min,max) for numerical fields

Parameters
msg_name
field_name
Returns
Bound limits tuple ( min , max )

◆ getMessageFieldNames()

_EXPORT_ std::vector< std::string > PyInterfaceItem::getMessageFieldNames ( std::string msg_name )

PyInterfaceItem::getMessageFieldNames.

returns, in terms of list, all the fields contained in the message

Parameters
msg_name
Returns
list: fields contained in the given message

◆ getMessageFieldRange()

_EXPORT_ PyObject * PyInterfaceItem::getMessageFieldRange | ( | std::string | msg_name,
 |  | std::string | field_name
 | ) |  |

PyInterfaceItem::getMessageFieldRange.

return the operative range in terms of tuple (min,max) for numerical fields

Parameters
msg_name
field_name
Returns
Range limits tuple ( min , max )

◆ getMessageFieldType()

_EXPORT_ PyObject * PyInterfaceItem::getMessageFieldType | ( | std::string | msg_name,
 |  | std::string | field_name
 | ) |  |

PyInterfaceItem::getMessageFieldType.

returns the type of field contained in message

Parameters
msg_name
field_name
Returns
string: the field type ( "spare","enum","boolean","string","int","uint","short","ushort","long","ulong","double","float" )

◆ getMessageFieldUnit()

_EXPORT_ PyObject * PyInterfaceItem::getMessageFieldUnit | ( | std::string | msg_name,
 |  | std::string | field_name
 | ) |  |

PyInterfaceItem::getMessageFieldUnit.

returns the unit of field contained in message

Parameters
msg_name
field_name
Returns
string: the field unit ( 'Volts','Sec','dBm', ... )

◆ getMessageFieldValue()

_EXPORT_ PyObject * PyInterfaceItem::getMessageFieldValue | ( | std::string | msg_name,
 |  | std::string | field_name
 | ) |  |

PyInterfaceItem::getMessageFieldValue.

returns the value of field contained in message

Parameters
msg_name
field_name
Returns
the current field value depending of field type ( as string, boolean, integer, float, ... )

◆ getMessageFieldValues()

_EXPORT_ std::vector< std::string > PyInterfaceItem::getMessageFieldValues | ( | std::string | msg_name,
 |  | std::string | field_name
 | ) |  |

PyInterfaceItem::getMessageFieldValues.

returns all the values that the field contains

Parameters
msg_name
field_name
Returns
list: mapped values when field is of type enum, empty one otherwise

◆ getMessageFieldWeight()

PyObject * PyInterfaceItem::getMessageFieldWeight | ( | std::string | msg_name,
 |  | std::string | field_name
 | ) |  |

return the bit weight for numerical fields

◆ getMessageFieldWidth()

PyObject * PyInterfaceItem::getMessageFieldWidth | ( | std::string | msg_name,
 |  | std::string | field_name
 | ) |  |

return the bit length for fields

◆ getMessageId()

_EXPORT_ PyObject * PyInterfaceItem::getMessageId ( std::string msg_name )

returns the id of Message named as argument

◆ getMessageLastError()

_EXPORT_ PyObject * PyInterfaceItem::getMessageLastError ( ) const

PyInterfaceItem::getMessageLastError.

returns the last error in terms of string

Returns
the string of last error coming from bus handler

◆ getMessageNames()

_EXPORT_ std::vector< std::string > PyInterfaceItem::getMessageNames ( )

PyInterfaceItem::getMessageNames.

returns, in terms of list, all the message names contained in the ICD database

Returns
list: messages contained in interface

◆ getMessageRawData()

_EXPORT_ PyObject * PyInterfaceItem::getMessageRawData ( std::string msg_name )

PyInterfaceItem::getMessageRawData.

returns, in terms of tuple, all the data as raw format

Parameters
msg_name
Returns
a tuple of bytes

◆ getMessageReceivedSz()

_EXPORT_ PyObject * PyInterfaceItem::getMessageReceivedSz ( ) const

PyInterfaceItem::getMessageReceivedSz.

returns the number of all received messages from the bus interface

Returns
long: number of received messages

◆ getMessageSentSz()

_EXPORT_ PyObject * PyInterfaceItem::getMessageSentSz ( ) const

PyInterfaceItem::getMessageSentSz.

returns the number of all messages sent to the bus interface

Returns
long: number of transmitted messages

◆ getMessageUsPeriodTime()

_EXPORT_ PyObject * PyInterfaceItem::getMessageUsPeriodTime ( std::string msg_name )

return the period time expressed in micorseconds for given message name. if message is not periodic it returns None

◆ getPluginHandler()

_EXPORT_ PyPluginHandler * PyInterfaceItem::getPluginHandler ( )

PyInterfaceItem::getPluginHandler.

returns the object that handle the plugin linked to that interface

Returns
the PyPluginHandler object to handle plugin operations

◆ getSingleMessageReceivedSz()

_EXPORT_ PyObject * PyInterfaceItem::getSingleMessageReceivedSz ( std::string msg_name ) const

PyInterfaceItem::getSingleMessageReceivedSz.

returns the number of received message (named as the given argument) from the bus interface

Parameters
msg_name
Returns
long: number of received message with corresponding name ( -1 ) in message not found

◆ getSingleMessageSentSz()

_EXPORT_ PyObject * PyInterfaceItem::getSingleMessageSentSz ( std::string msg_name ) const

PyInterfaceItem::getSingleMessageSentSz.

returns the number message (named as the given argument) sent to the bus interface

Parameters
msg_name
Returns
long: number of transmitted message with corresponding name ( -1 ) in message not found

◆ getVerbose()

_EXPORT_ bool PyInterfaceItem::getVerbose ( ) const

PyInterfaceItem::getVerbose.

get the verbosity flag

Returns
boolean: True if vebose is on, false otherwise

◆ isMessagePeriodic()

_EXPORT_ bool PyInterfaceItem::isMessagePeriodic ( std::string msg_name )

returns true if Message is periodic false othrewise ( Tx )

◆ isMessageReadOnly()

_EXPORT_ bool PyInterfaceItem::isMessageReadOnly ( std::string msg_name )

PyInterfaceItem::isMessageReadOnly.

returns true if Message is read only ( Rx ) false othrewise ( Tx )

Parameters
msg_name
Returns
boolean

◆ logStart()

_EXPORT_ int PyInterfaceItem::logStart | ( | int | level,
 |  | std::string | dirName
 | ) |  |

PyInterfaceItem::logStart.

start the bus logging at given dirpath and level

Parameters
level | ( 0~3 ) verbosity
dirName | the dir path where to save log file
Returns
int: 0 when successfull

◆ logStop()

_EXPORT_ void PyInterfaceItem::logStop ( )

PyInterfaceItem::logStop. Stop any log activities.

stop the bus log

◆ popOnICDEventCallback()

_EXPORT_ PyObject * PyInterfaceItem::popOnICDEventCallback ( )

PyInterfaceItem::popOnICDEventCallback remove last inserted callback.

link python function/methods to ICD Events

Returns
python Boolean

◆ pushOnICDEventCallback()

_EXPORT_ PyObject * PyInterfaceItem::pushOnICDEventCallback ( PyObject * clbk )

PyInterfaceItem::pushEventCallback Link python function/methods to some ICD Events that are ( in terms of integer constant ):

link python function/methods to ICD Events

  • 1001 (BUS CLOCK)
  • 1002 (BUS START)
  • 1003 (BUS STOP)
  • 2300 (RECEIVED ANY MESSAGE)
  • 2101 (SENT ANY MESSAGES)
    Parameters
    clbk : python function/method reference that shall manage the event constant as input argument
    #Example of callback function for ICD Event
    def dummy(event):
    print event
    mgr = interpreter.PyInterfaceManager()
    first_interface = mgr.getInterface(0)
    first_interface.pushEventCallback( dummy )
    Returns
    python object when handled, None otherwise

◆ raiseError()

_EXPORT_ void PyInterfaceItem::raiseError | ( | std::string | msg,
 |  | int | severity
 | ) |  |

PyInterfaceItem::raiseError emulate bus error incoming.

raise a generic error based on severity

◆ revertChanges()

_EXPORT_ void PyInterfaceItem::revertChanges ( )

PyInterfaceItem::revertChanges.

trigger the revert operation that restore the last committed values in the ICD database

◆ sendLastCommittedMessage()

_EXPORT_ bool PyInterfaceItem::sendLastCommittedMessage ( std::string msg_name )

PyInterfaceItem::sendLastCommittedMessage.

resend the given message without any changes

Parameters
msg_name the name of message in term of string
Returns
boolean:
  • True if:
    • message been successfully sent
  • False if:
    • interface is not running
    • interface has pending changes

◆ setBusConfiguration()

_EXPORT_ bool PyInterfaceItem::setBusConfiguration | ( | std::string | xml,
 |  | bool | persistent = false
 | ) |  |

PyInterfaceItem::setBusConfiguration.

set the xml lowlevel node as string, optionally in a persistent way

Parameters
xml | [string] containing the portion of xml code under lowLevel tree-node that should replace the current one.
persistent | [boolean] ( default false ) if true it overwrites the current xml file, otherwise a temporary file is generated and used
Returns

◆ setCallbackOnMsgReceived()

_EXPORT_ PyObject * PyInterfaceItem::setCallbackOnMsgReceived | ( | std::string | msg_name,
 |  | PyObject * | clbk
 | ) |  |

PyInterfaceItem::setCallbackOnMsgReceived: it append a callback function to the message.

set a specific callback on message names as given parameter

Parameters
msg_name | : name of message to link the callback
clbk | : the callback ( raw data is passed as the argument )
Returns

◆ setCommitOnTheFly()

_EXPORT_ void PyInterfaceItem::setCommitOnTheFly ( bool b )

PyInterfaceItem::setCommitOnTheFly: every change event trigger commitment and send messages events.

set the commot on the fly option

Parameters
b boolean

◆ setVerbose()

_EXPORT_ void PyInterfaceItem::setVerbose ( bool b )

PyInterfaceItem::setVerbose Enable/Dsable auto log activities ( print information about operation )

set the verbosity flag

Parameters
b boolean

◆ start()

_EXPORT_ bool PyInterfaceItem::start ( )

PyInterfaceItem::start Start communication with the channel.

start the interface

Returns
boolean: True if successfull, False otherwise

◆ stop()

_EXPORT_ bool PyInterfaceItem::stop ( )

PyInterfaceItem::stop Shut down communication with the channel.

stop the interface

Returns
boolean: True if successfull, False otherwise

◆ touchMessage()

_EXPORT_ bool PyInterfaceItem::touchMessage ( std::string msg_name )

PyInterfaceItem::touchMessage.

set message (when found) as modified with no event notifications. Returns true if message exists, false otherwise

Parameters
msg_name
Returns
boolean ( True if touched, False if message not found )

◆ updateRxMessage()

_EXPORT_ bool PyInterfaceItem::updateRxMessage ( std::string msg_name )

PyInterfaceItem::updateRxMessage.

synchronize rx message ( eventually sending request )

Parameters
msg_name
Returns
true if message exists and is a rx, false otherwise
The documentation for this class was generated from the following files:
  • include/pyinterfaceitem.h
  • src/pyinterfaceitem.cpp


Leonardo Platform Simulator ~ Python Interpreter API: PyInterfaceManager Class Reference

Public Member Functions | List of all members
PyInterfaceManager Class Reference

Public Member Functions

PyInterfaceManager ()
PyInterfaceManager::PyInterfaceManager The root node of python interfaces communication. More...
~PyInterfaceManager ()
PyInterfaceItem * | getInterface (unsigned int pos)
PyInterfaceManager::getInterface. More...
int | indexOf (std::string n)
PyInterfaceManager::indexOf. More...
size_t | size ()
PyInterfaceManager::size. More...
std::vector< std::string > | names ()
PyInterfaceManager::names. More...

Constructor & Destructor Documentation

◆ PyInterfaceManager()

PyInterfaceManager::PyInterfaceManager ( )

PyInterfaceManager::PyInterfaceManager The root node of python interfaces communication.

The constructor

◆ ~PyInterfaceManager()

PyInterfaceManager::~PyInterfaceManager ( )

The destructor

Member Function Documentation

◆ getInterface()

PyInterfaceItem * PyInterfaceManager::getInterface ( unsigned int pos )

PyInterfaceManager::getInterface.

obtain the interface object indexed as given argument

Parameters
pos int: the index of the interface
Returns
PyInterfaceItem object when successfull , None otherwise

◆ indexOf()

int PyInterfaceManager::indexOf ( std::string n )

PyInterfaceManager::indexOf.

corresponding position of interface named as given argument

Parameters
n string : name of the interface
Returns
int: the index of the interface names as given argument

◆ names()

std::vector< std::string > PyInterfaceManager::names ( )

PyInterfaceManager::names.

list of interfaces

Returns
list: names of the interfaces

◆ size()

size_t PyInterfaceManager::size ( )

PyInterfaceManager::size.

number of implemented interfaces

Returns
number of interfaces
The documentation for this class was generated from the following files:
  • include/interpreter.h
  • src/interpreter.cpp


Leonardo Platform Simulator ~ Python Interpreter API: PyPluginAction Class Reference

Public Member Functions | List of all members
PyPluginAction Class Reference

The PyPluginAction: enhanced ICDPluginAction that provides a virtual methods to executes full compliant python callback. More...

Inheritance diagram for PyPluginAction:

Public Member Functions

virtual PyObject * eval (PyObject *args, PyObject *kwargs=NULL)

Detailed Description

The PyPluginAction: enhanced ICDPluginAction that provides a virtual methods to executes full compliant python callback.

Member Function Documentation

◆ eval()

virtual PyObject* PyPluginAction::eval | ( | PyObject * | args,
 |  | PyObject * | kwargs = NULL
 | ) |  |
virtual

evaluate a full compliant python code

The documentation for this class was generated from the following file:
  • include/pypluginaction.h


Leonardo Platform Simulator ~ Python Interpreter API: PyPluginHandler Class Reference

Public Member Functions | List of all members
PyPluginHandler Class Reference

The PyPluginHandler class. More...

Public Member Functions

PyPluginHandler (GenericInterfaceItem *item)
std::vector< std::string > | names ()
PyPluginHandler::names. More...
bool | onAction (std::string)
PyPluginHandler::onAction : perform action with no arguments. More...
bool | execAction (std::string, PyObject *dict_args=NULL, PyObject *dict_retval=NULL)
PyPluginHandler::execAction : it executes function linked to the action by using dictionaries as input/ouput.
More...
PyObject * | evalAction (std::string, PyObject *args=NULL, PyObject *kwargs=NULL)
PyPluginHandler::evalAction it evaluates python callback linked to action [ passed to a python callback ]. More...
bool | getChecked (std::string n)
PyPluginHandler::getChecked. More...
bool | setChecked (std::string n, bool)
PyPluginHandler::setChecked. More...
bool | isCheckable (std::string n)
PyPluginHandler::isCheckable. More...
PyObject * | getActionHelp (std::string n)
PyPluginHandler::getActionHelp. More...

Detailed Description

The PyPluginHandler class.

Constructor & Destructor Documentation

◆ PyPluginHandler()

PyPluginHandler::PyPluginHandler ( GenericInterfaceItem * item )

Member Function Documentation

◆ evalAction()

PyObject * PyPluginHandler::evalAction | ( | std::string | n,
 |  | PyObject * | args = NULL,
 |  | PyObject * | kwargs = NULL
 | ) |  |

PyPluginHandler::evalAction it evaluates python callback linked to action [ passed to a python callback ].

evaluate python code only callback action

Parameters
n | : the action name
args | : ( optional ) A tuple of positional arguments values. Dynamically computed from the arguments attribute.
kwargs | : ( optional ) A dict of keyword arguments values. Dynamically computed from the arguments attribute
Returns
Python object
Note
if kwargs is null and args is of type dict, it will be trated as kwargs
Attention
this method is for python functions only ( c++, python )
Note
Above an example of callback that should be linked to:
  • C/C++ language:
    // function that returns a square value of an integer as input could be written as the followings:
    static PyObject *square(PyObject *self,PyObject *args,PyObject *kw)
    {
    PyObject *out=Py_None;
    int number;
    const char *keywords[] = {"number", NULL };
    if( PyArg_ParseTupleAndKeywords(args,kw, (char *)"d:square", (char **)(keywords), &number) )
    {
    out = Py_BuildValue("d",number*number);
    }
    return out;
    }
  • python language:
    def square(number):
    if number is None:
    return None #that implies return false without error
    else:
    return number*number
the python callback shall be something like this
a = interpreter.PyInterfaceManager().getInterface(0)
p = a.getPluginHandler()
out={}
ret=p.evalAction('square',(),{'number':7})
ret=p.evalAction('square',{'number':7})
ret=p.evalAction('square',(7,)})

◆ execAction()

bool PyPluginHandler::execAction | ( | std::string | n,
 |  | PyObject * | dict_args = NULL,
 |  | PyObject * | dict_retval = NULL
 | ) |  |

PyPluginHandler::execAction : it executes function linked to the action by using dictionaries as input/ouput.

execute callback action

Remarks
  • Action type shall be of type ACTION_KIND_PYTHON_ONLY.
  • Action function may be written in c/cpp without Python/C API.
  • Input argument must be a python dictionary and it is converted to a ICDDictionary (see plugin reference).
  • Output argument must be a python dictionary and is filled by converting the related ICDDictionary.
  • The converted ICDDictionary are passed to/retireved by the execute method of the action object (ICDPluginAction).
Note
ICDDictionary is a collection of variant objects wich can transports the following types (boolean,long,double,string).
Parameters
n | :string name of the action
dict_args | : python dictionary object for input arguments
dict_retval | : python dictionary object for return arguments
Returns
boolean : True if successfull, False otherwise
Note
Above an example of callback that should be linked to:
  • C/C++ language:
    // function that returns a square value of an integer as input could be written as the followings:
    bool square( ICDDictionary in, ICDDictionary *out)
    {
    bool ret = false;
    long lval;
    if (in.get("number",&lval) )
    {
    out->set("out", lval*lval);
    ret = true;
    }
    return ret;
    }
    // function that does not requires input and does not provide outputs
    bool dummy( ICDDictionary in, ICDDictionary *out)
    {
    // ....
    return true;
    }
  • python language:
    #for python code execAction is forwarded to the evalAction passing the first argument as the kwargs and using
    #the return object ( that shall be a dictionary ) as the second argument of the execute function
    #the square function could be written in the followings:
    def square(**kwargs):
    ival = kwargs.get('number',None)
    if ival is None:
    return None #that implies return false without error
    else:
    return {'out' : ival*ival }
    #as alternative the square function could be written using the keyword arguments made explicit
    #def square(number):
    # ival = number
    # if ival is None:
    # return None #that implies return false without error
    # else:
    # return {'out' : ival*ival }
    #function that does not requires input and does not provide outputs
    def dummy(**kwargs)
    {
    # .... any code
    return {} #empty dictionary
    }
the python usage of this function
#obtain the interface
a = interpreter.PyInterfaceManager().getInterface(0)
#obtain the plugin handler object
p = a.getPluginHandler()
#prepare the dictionary to manage the output
out={}
#call the execution of action
ret=p.execAction('square',{'number':7},out)
ret=p.execAction('dummy')
Attention
this method is usefull both for python and c/cpp plugin implementations

◆ getActionHelp()

PyObject * PyPluginHandler::getActionHelp ( std::string n )

PyPluginHandler::getActionHelp.

return help (if any)

Parameters
n :string name of the action
Returns
string : description (or usage ) of the action

◆ getChecked()

bool PyPluginHandler::getChecked ( std::string n )

PyPluginHandler::getChecked.

get checked state for action of type checkable

Parameters
n : the action name
Returns
: boolean True if successfull, false otherwise
Note
: it action is not of type ACTION_TYPE_CHECKABLE exception is raised

◆ isCheckable()

bool PyPluginHandler::isCheckable ( std::string n )

PyPluginHandler::isCheckable.

query for detect if the action is of type checkable

Parameters
n : the action name
Returns
boolean True if action is of type ACTION_TYPE_CHECKABLE, false otherwise

◆ names()

std::vector< std::string > PyPluginHandler::names ( )

PyPluginHandler::names.

return all action names using decorator @ for sub menu items

Returns
list : actions in plugin

◆ onAction()

bool PyPluginHandler::onAction ( std::string n )

PyPluginHandler::onAction : perform action with no arguments.

trigger action

otherwise it calls the plugin action and any graphical trigger

Parameters
n string: name of the action
Returns
boolean : True if successfull, False otherwise

◆ setChecked()

bool PyPluginHandler::setChecked | ( | std::string | n,
 |  | bool | b
 | ) |  |

PyPluginHandler::setChecked.

set checked state for action of type checkable

Parameters
n | : the action name
b | : boolean
Returns
: boolean True if successfull, false otherwise
Note
: it action is not of type ACTION_TYPE_CHECKABLE exception is raised
The documentation for this class was generated from the following files:
  • include/pypluginhandler.h
  • src/pypluginhandler.cpp


Leonardo Platform Simulator ~ Python Interpreter API: PyPluginsManager Class Reference

Public Member Functions | List of all members
PyPluginsManager Class Reference

The PyPluginsManager class object to manage global plugins ( alias Tools ) More...

Public Member Functions

PyPluginsManager ()
PyPluginsManager::PyPluginsManager. More...
PyPluginHandler * | getPlugin (unsigned int pos)
int | indexOf (std::string n)
size_t | size ()
std::vector< std::string > | names ()

Detailed Description

The PyPluginsManager class object to manage global plugins ( alias Tools )

Constructor & Destructor Documentation

◆ PyPluginsManager()

PyPluginsManager::PyPluginsManager ( )

PyPluginsManager::PyPluginsManager.

The constructor

Member Function Documentation

◆ getPlugin()

PyPluginHandler * PyPluginsManager::getPlugin ( unsigned int pos )

obtain the plugin object indexed as given argument

◆ indexOf()

int PyPluginsManager::indexOf ( std::string n )

corresponding position of plugin named as given argument

◆ names()

std::vector< std::string > PyPluginsManager::names ( )

list of plugins

◆ size()

size_t PyPluginsManager::size ( )

number of implemented plugins

The documentation for this class was generated from the following files:
  • include/interpreter.h
  • src/interpreter.cpp


Leonardo Platform Simulator ~ Python Interpreter API: QPyConsole Class Reference

Friends | List of all members
QPyConsole Class Reference
Inheritance diagram for QPyConsole:

Friends

class QPyConsoleThread
The documentation for this class was generated from the following files:
  • D:/sources/LeoPlatSim__trunk/qtinterpreter/include/qpyconsole.h
  • D:/sources/LeoPlatSim__trunk/Qtinterpreter/src/qpyconsole.cpp


Leonardo Platform Simulator ~ Python Interpreter API: QPyConsoleThread Class Reference

List of all members
QPyConsoleThread Class Reference
Inheritance diagram for QPyConsoleThread:
The documentation for this class was generated from the following files:
  • D:/sources/LeoPlatSim__trunk/qtinterpreter/include/qpyconsolethread.h
  • D:/sources/LeoPlatSim__trunk/Qtinterpreter/src/qpyconsolethread.cpp


Leonardo Platform Simulator ~ Python Interpreter API: Class Index

Class Index
i | p | q
i
p
PyInterfaceManager PyPluginsManager QPyConsoleThread
PyPluginAction
q
interpIO PyInterfaceItem PyPluginHandler
QPyConsole
i | p | q


Leonardo Platform Simulator ~ Python Interpreter API: Class Hierarchy

Class Hierarchy
This inheritance list is sorted roughly, but not completely, alphabetically:
[detail level 12]
▼C ICDPluginAction |
C PyPluginAction | The PyPluginAction: enhanced ICDPluginAction that provides a virtual methods to executes full compliant python callback
C interpIO |
C PyInterfaceItem | Expose methods that interacts with the interface
C PyInterfaceManager |
C PyPluginHandler | The PyPluginHandler class
C PyPluginsManager | The PyPluginsManager class object to manage global plugins ( alias Tools )
▼C QPlainTextEdit |
C QPyConsole |
▼C QThread |
C QPyConsoleThread |


Leonardo Platform Simulator ~ Python Interpreter API: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

- a -

  • assignMessageFieldValue() : PyInterfaceItem
  • assignMessageRawData() : PyInterfaceItem

- c -

  • clearOnICDEventCallback() : PyInterfaceItem
  • commitChanges() : PyInterfaceItem

- d -

  • disableBusErrorInjection() : PyInterfaceItem

- e -

  • enableBusErrorInjection() : PyInterfaceItem
  • eval() : PyPluginAction
  • evalAction() : PyPluginHandler
  • execAction() : PyPluginHandler

- g -

  • getActionHelp() : PyPluginHandler
  • getBusClockUsPeriodTime() : PyInterfaceItem
  • getBusConfiguration() : PyInterfaceItem
  • getBusErrorInjection() : PyInterfaceItem
  • getBusErrorInjectionValues() : PyInterfaceItem
  • getChecked() : PyPluginHandler
  • getCommitOnTheFly() : PyInterfaceItem
  • getICDName() : PyInterfaceItem
  • getInterface() : PyInterfaceManager
  • getLastChangedMessages() : PyInterfaceItem
  • getLastReceivedMessageId() : PyInterfaceItem
  • getLastReceivedMessageName() : PyInterfaceItem
  • getLastSentMessageNames() : PyInterfaceItem
  • getMessageErrorSz() : PyInterfaceItem
  • getMessageFieldBound() : PyInterfaceItem
  • getMessageFieldNames() : PyInterfaceItem
  • getMessageFieldRange() : PyInterfaceItem
  • getMessageFieldType() : PyInterfaceItem
  • getMessageFieldUnit() : PyInterfaceItem
  • getMessageFieldValue() : PyInterfaceItem
  • getMessageFieldValues() : PyInterfaceItem
  • getMessageFieldWeight() : PyInterfaceItem
  • getMessageFieldWidth() : PyInterfaceItem
  • getMessageId() : PyInterfaceItem
  • getMessageLastError() : PyInterfaceItem
  • getMessageNames() : PyInterfaceItem
  • getMessageRawData() : PyInterfaceItem
  • getMessageReceivedSz() : PyInterfaceItem
  • getMessageSentSz() : PyInterfaceItem
  • getMessageUsPeriodTime() : PyInterfaceItem
  • getPlugin() : PyPluginsManager
  • getPluginHandler() : PyInterfaceItem
  • getSingleMessageReceivedSz() : PyInterfaceItem
  • getSingleMessageSentSz() : PyInterfaceItem
  • getVerbose() : PyInterfaceItem

- i -

  • indexOf() : PyInterfaceManager , PyPluginsManager
  • isCheckable() : PyPluginHandler
  • isMessagePeriodic() : PyInterfaceItem
  • isMessageReadOnly() : PyInterfaceItem

- l -

  • logStart() : PyInterfaceItem
  • logStop() : PyInterfaceItem

- n -

  • names() : PyInterfaceManager , PyPluginHandler , PyPluginsManager

- o -

  • onAction() : PyPluginHandler

- p -

  • popOnICDEventCallback() : PyInterfaceItem
  • pushOnICDEventCallback() : PyInterfaceItem
  • PyInterfaceItem() : PyInterfaceItem
  • PyInterfaceManager() : PyInterfaceManager
  • PyPluginHandler() : PyPluginHandler
  • PyPluginsManager() : PyPluginsManager

- r -

  • raiseError() : PyInterfaceItem
  • revertChanges() : PyInterfaceItem

- s -

  • sendLastCommittedMessage() : PyInterfaceItem
  • setBusConfiguration() : PyInterfaceItem
  • setCallbackOnMsgReceived() : PyInterfaceItem
  • setChecked() : PyPluginHandler
  • setCommitOnTheFly() : PyInterfaceItem
  • setVerbose() : PyInterfaceItem
  • size() : PyInterfaceManager , PyPluginsManager
  • start() : PyInterfaceItem
  • stop() : PyInterfaceItem

- t -

  • touchMessage() : PyInterfaceItem

- u -

  • updateRxMessage() : PyInterfaceItem

- ~ -

  • ~PyInterfaceManager() : PyInterfaceManager


Leonardo Platform Simulator ~ Python Interpreter API: Class Members - Functions

- a -

  • assignMessageFieldValue() : PyInterfaceItem
  • assignMessageRawData() : PyInterfaceItem

- c -

  • clearOnICDEventCallback() : PyInterfaceItem
  • commitChanges() : PyInterfaceItem

- d -

  • disableBusErrorInjection() : PyInterfaceItem

- e -

  • enableBusErrorInjection() : PyInterfaceItem
  • eval() : PyPluginAction
  • evalAction() : PyPluginHandler
  • execAction() : PyPluginHandler

- g -

  • getActionHelp() : PyPluginHandler
  • getBusClockUsPeriodTime() : PyInterfaceItem
  • getBusConfiguration() : PyInterfaceItem
  • getBusErrorInjection() : PyInterfaceItem
  • getBusErrorInjectionValues() : PyInterfaceItem
  • getChecked() : PyPluginHandler
  • getCommitOnTheFly() : PyInterfaceItem
  • getICDName() : PyInterfaceItem
  • getInterface() : PyInterfaceManager
  • getLastChangedMessages() : PyInterfaceItem
  • getLastReceivedMessageId() : PyInterfaceItem
  • getLastReceivedMessageName() : PyInterfaceItem
  • getLastSentMessageNames() : PyInterfaceItem
  • getMessageErrorSz() : PyInterfaceItem
  • getMessageFieldBound() : PyInterfaceItem
  • getMessageFieldNames() : PyInterfaceItem
  • getMessageFieldRange() : PyInterfaceItem
  • getMessageFieldType() : PyInterfaceItem
  • getMessageFieldUnit() : PyInterfaceItem
  • getMessageFieldValue() : PyInterfaceItem
  • getMessageFieldValues() : PyInterfaceItem
  • getMessageFieldWeight() : PyInterfaceItem
  • getMessageFieldWidth() : PyInterfaceItem
  • getMessageId() : PyInterfaceItem
  • getMessageLastError() : PyInterfaceItem
  • getMessageNames() : PyInterfaceItem
  • getMessageRawData() : PyInterfaceItem
  • getMessageReceivedSz() : PyInterfaceItem
  • getMessageSentSz() : PyInterfaceItem
  • getMessageUsPeriodTime() : PyInterfaceItem
  • getPlugin() : PyPluginsManager
  • getPluginHandler() : PyInterfaceItem
  • getSingleMessageReceivedSz() : PyInterfaceItem
  • getSingleMessageSentSz() : PyInterfaceItem
  • getVerbose() : PyInterfaceItem

- i -

  • indexOf() : PyInterfaceManager , PyPluginsManager
  • isCheckable() : PyPluginHandler
  • isMessagePeriodic() : PyInterfaceItem
  • isMessageReadOnly() : PyInterfaceItem

- l -

  • logStart() : PyInterfaceItem
  • logStop() : PyInterfaceItem

- n -

  • names() : PyInterfaceManager , PyPluginHandler , PyPluginsManager

- o -

  • onAction() : PyPluginHandler

- p -

  • popOnICDEventCallback() : PyInterfaceItem
  • pushOnICDEventCallback() : PyInterfaceItem
  • PyInterfaceItem() : PyInterfaceItem
  • PyInterfaceManager() : PyInterfaceManager
  • PyPluginHandler() : PyPluginHandler
  • PyPluginsManager() : PyPluginsManager

- r -

  • raiseError() : PyInterfaceItem
  • revertChanges() : PyInterfaceItem

- s -

  • sendLastCommittedMessage() : PyInterfaceItem
  • setBusConfiguration() : PyInterfaceItem
  • setCallbackOnMsgReceived() : PyInterfaceItem
  • setChecked() : PyPluginHandler
  • setCommitOnTheFly() : PyInterfaceItem
  • setVerbose() : PyInterfaceItem
  • size() : PyInterfaceManager , PyPluginsManager
  • start() : PyInterfaceItem
  • stop() : PyInterfaceItem

- t -

  • touchMessage() : PyInterfaceItem

- u -

  • updateRxMessage() : PyInterfaceItem

- ~ -

  • ~PyInterfaceManager() : PyInterfaceManager


Leonardo Platform Simulator ~ Python Interpreter API: File List

File List
Here is a list of all documented files with brief descriptions:
[detail level 123]
▼ include |
interpreter.h | Python Interpreter Implementations
pyinterfaceitem.h |
pypluginaction.h | Python specialization of ICDPluginAction
pypluginhandler.h | Python Interpreter Plugin Implementations
▼ qtinterpreter |
▼ include |
qinterpreter_common.h |
qpyconsole.h |
qpyconsolethread.h |
▼ src |
interpreter.cpp | Python Interpreter Implementations


Leonardo Platform Simulator ~ Python Interpreter API: include Directory Reference

  • include
include Directory Reference

Files

file | interpreter.h [code]
Python Interpreter Implementations.
file | pypluginaction.h [code]
Python specialization of ICDPluginAction.
file | pypluginhandler.h [code]
Python Interpreter Plugin Implementations.


Leonardo Platform Simulator ~ Python Interpreter API: include/interpreter.h File Reference

  • include
Classes | Functions
interpreter.h File Reference

Python Interpreter Implementations. More...

Go to the source code of this file.

Classes

class | PyInterfaceManager
class | PyPluginsManager
The PyPluginsManager class object to manage global plugins ( alias Tools ) More...

Functions

void | PyInterpreterInit__SetMainWindow (QMainWindow *ptr)
PyInterpreterInit__SetMainWindow. More...
QMainWindow * | getMainWindow ()
PyInterpreterInit__GetMainWindow. More...
void | PyInterpreterInit__InterfaceManager (GenericInterfaceManager *ptr)
PyInterpreterInit__InterfaceManager. More...
GenericInterfaceManager * | getInterfaceManager ()
getInterfaceManager More...
void | PyInterpreterInit__PluginsManager (GenericPluginsManager *ptr)
PyInterpreterInit__PluginsManager. More...
GenericPluginsManager * | getPluginsManager ()
getPluginsManager More...

Detailed Description

Python Interpreter Implementations.

Date
2017
Author
Federico Paoletti
Copyright
Leonardo Company s.p.a

Function Documentation

◆ getInterfaceManager()

GenericInterfaceManager* getInterfaceManager ( )

getInterfaceManager

Returns

◆ getMainWindow()

QMainWindow* getMainWindow ( )

PyInterpreterInit__GetMainWindow.

Returns

◆ getPluginsManager()

GenericPluginsManager* getPluginsManager ( )

getPluginsManager

Returns

◆ PyInterpreterInit__InterfaceManager()

void PyInterpreterInit__InterfaceManager ( GenericInterfaceManager * ptr )

PyInterpreterInit__InterfaceManager.

Parameters
ptr

◆ PyInterpreterInit__PluginsManager()

void PyInterpreterInit__PluginsManager ( GenericPluginsManager * ptr )

PyInterpreterInit__PluginsManager.

Parameters
ptr

◆ PyInterpreterInit__SetMainWindow()

void PyInterpreterInit__SetMainWindow ( QMainWindow * ptr )

PyInterpreterInit__SetMainWindow.

Parameters
ptr


Leonardo Platform Simulator ~ Python Interpreter API: include/pyinterfaceitem.h Source File

  • include
pyinterfaceitem.h
1 #ifndef PYINTERFACEITEM_H
2 #define PYINTERFACEITEM_H
3
4 #pragma push_macro("slots")
5 #undef slots
6 #include <Python.h>
7 #pragma pop_macro("slots")
8 #include "icdhandler.h"
9 #include "interpreter_common.h"
10 #include "genericbusobject.h"
11
12
13 class PyPluginHandler;
14 class GenericInterfaceItem;
15 class PyInterfaceUiObject;
16
20 class PyInterfaceItem {
21 public:
22 explicit PyInterfaceItem(GenericInterfaceItem *p);
23 ~PyInterfaceItem();
24
25 //ICDUiObject related API
26 //PyObject *setOnICDEventCallback(PyObject *clbk); /*!< link python function/methods to ICD Events */
27 PyObject *pushOnICDEventCallback(PyObject *clbk);
28 PyObject *popOnICDEventCallback();
29 PyObject *clearOnICDEventCallback();
30
31 //Plugin Interface API
32 PyPluginHandler *getPluginHandler();
34 //ICDHandler APIs
35 PyObject *getICDName();
36 std::vector<std::string> getMessageNames();
39 //Message APIs
40 bool isMessageReadOnly(std::string msg_name);
41 bool touchMessage(std::string msg_name);
42 PyObject *getMessageId(std::string msg_name);
43 PyObject *getMessageUsPeriodTime(std::string msg_name);
44 bool isMessagePeriodic(std::string msg_name);
45 std::vector<std::string> getMessageFieldNames(std::string msg_name);
46 bool assignMessageRawData(std::string msg_name,PyObject *raw);
47 PyObject *getMessageRawData(std::string msg_name);
49 PyObject *setCallbackOnMsgReceived(std::string msg_name,PyObject *clbk);
52 //MessageField APIs
53 PyObject *getMessageFieldUnit(std::string msg_name,std::string field_name);
54 PyObject *getMessageFieldType(std::string msg_name,std::string field_name);
55 PyObject *getMessageFieldValue(std::string msg_name,std::string field_name);
56 PyObject *getMessageFieldRange(std::string msg_name,std::string field_name);
57 PyObject *getMessageFieldBound(std::string msg_name,std::string field_name);
58 PyObject *getMessageFieldWeight(std::string msg_name,std::string field_name);
59 PyObject *getMessageFieldWidth(std::string msg_name,std::string field_name);
61 std::vector<std::string> getMessageFieldValues(std::string msg_name,std::string field_name);
62 bool assignMessageFieldValue(std::string msg_name,std::string field_name,PyObject *val,bool force=true);
64 //Interface APIs
65 bool sendLastCommittedMessage(std::string msg_name);
66 bool updateRxMessage(std::string msg_name);
68 bool commitChanges();
69 void revertChanges();
71 bool start();
72 bool stop();
74 PyObject *getSingleMessageSentSz(std::string msg_name) const;
75 PyObject *getSingleMessageReceivedSz(std::string msg_name) const;
77 PyObject *getMessageSentSz() const;
78 PyObject *getMessageReceivedSz() const;
79 PyObject *getMessageErrorSz() const;
80 PyObject *getMessageLastError() const;
82 PyObject *getLastChangedMessages() const;
83 PyObject *getLastReceivedMessageId() const;
84 PyObject *getLastReceivedMessageName() const;
85 PyObject *getLastSentMessageNames() const;
87 void raiseError(std::string msg, int severity);
89 int logStart(int level, std::string dirName);
90 void logStop();
92 void setVerbose(bool);
93 bool getVerbose() const;
95 void setCommitOnTheFly(bool b);
96 bool getCommitOnTheFly() const;
98 //Bus APIs
99 bool enableBusErrorInjection(int err);
100 void disableBusErrorInjection();
101 int getBusErrorInjection();
102 std::vector<std::string> getBusErrorInjectionValues();
103 unsigned long getBusClockUsPeriodTime();
104 std::string getBusConfiguration();
105 bool setBusConfiguration(std::string xml, bool persistent=false );
107 private:
108 ICDGenericMessageField *findFieldFromMessage(std::string msg_name,std::string field_name);
109
110 private:
111 GenericInterfaceItem *_interface_item;
112 ICDHandler *_icd_handler;
113 GenericBusObject *_bus_handler;
114 PyPluginHandler *_pypluginhandler;
115 PyInterfaceUiObject *_ui_object;
116 bool _verbose;
117 };
118
119
120
121
122 #endif // PYINTERFACEMANAGER_H
PyInterfaceItem
The PyInterfaceItem class expose methods that interacts with the interface.
Definition: pyinterfaceitem.h:20
PyInterfaceItem::raiseError
void raiseError(std::string msg, int severity)
PyInterfaceItem::raiseError emulate bus error incoming.
Definition: pyinterfaceitem.cpp:953
PyInterfaceItem::getMessageFieldRange
PyObject * getMessageFieldRange(std::string msg_name, std::string field_name)
PyInterfaceItem::getMessageFieldRange.
Definition: pyinterfaceitem.cpp:581
PyInterfaceItem::getLastChangedMessages
PyObject * getLastChangedMessages() const
PyInterfaceItem::getLastChangedMessages.
Definition: pyinterfaceitem.cpp:286
PyInterfaceItem::assignMessageFieldValue
bool assignMessageFieldValue(std::string msg_name, std::string field_name, PyObject *val, bool force=true)
PyInterfaceItem::assignMessageFieldValue.
Definition: pyinterfaceitem.cpp:700
PyInterfaceItem::stop
bool stop()
PyInterfaceItem::stop Shut down communication with the channel.
Definition: pyinterfaceitem.cpp:221
PyInterfaceItem::getMessageErrorSz
PyObject * getMessageErrorSz() const
PyInterfaceItem::getMessageErrorSz.
Definition: pyinterfaceitem.cpp:278
PyInterfaceItem::getBusErrorInjectionValues
std::vector< std::string > getBusErrorInjectionValues()
PyInterfaceItem::getBusErrorInjectionValues.
Definition: pyinterfaceitem.cpp:946
PyInterfaceItem::commitChanges
bool commitChanges()
PyInterfaceItem::commitChanges.
Definition: pyinterfaceitem.cpp:781
PyInterfaceItem::setCommitOnTheFly
void setCommitOnTheFly(bool b)
PyInterfaceItem::setCommitOnTheFly: every change event trigger commitment and send messages events...
Definition: pyinterfaceitem.cpp:171
PyInterfaceItem::getMessageFieldNames
std::vector< std::string > getMessageFieldNames(std::string msg_name)
PyInterfaceItem::getMessageFieldNames.
Definition: pyinterfaceitem.cpp:429
PyInterfaceItem::setVerbose
void setVerbose(bool)
PyInterfaceItem::setVerbose Enable/Dsable auto log activities ( print information about operation ) ...
Definition: pyinterfaceitem.cpp:155
PyInterfaceItem::getSingleMessageReceivedSz
PyObject * getSingleMessageReceivedSz(std::string msg_name) const
PyInterfaceItem::getSingleMessageReceivedSz.
Definition: pyinterfaceitem.cpp:354
PyPluginHandler
The PyPluginHandler class.
Definition: pypluginhandler.h:27
PyInterfaceItem::getBusErrorInjection
int getBusErrorInjection()
PyInterfaceItem::getBusErrorInjection.
Definition: pyinterfaceitem.cpp:857
PyInterfaceItem::popOnICDEventCallback
PyObject * popOnICDEventCallback()
PyInterfaceItem::popOnICDEventCallback remove last inserted callback.
Definition: pyinterfaceitem.cpp:96
PyInterfaceItem::assignMessageRawData
bool assignMessageRawData(std::string msg_name, PyObject *raw)
PyInterfaceItem::assignMessageRawData.
Definition: pyinterfaceitem.cpp:445
PyInterfaceItem::logStart
int logStart(int level, std::string dirName)
PyInterfaceItem::logStart.
Definition: pyinterfaceitem.cpp:247
PyInterfaceItem::getLastSentMessageNames
PyObject * getLastSentMessageNames() const
PyInterfaceItem::getLastSentMessageNames.
Definition: pyinterfaceitem.cpp:328
PyInterfaceItem::getMessageUsPeriodTime
PyObject * getMessageUsPeriodTime(std::string msg_name)
Definition: pyinterfaceitem.cpp:409
PyInterfaceItem::getMessageFieldWidth
PyObject * getMessageFieldWidth(std::string msg_name, std::string field_name)
Definition: pyinterfaceitem.cpp:609
PyInterfaceItem::setCallbackOnMsgReceived
PyObject * setCallbackOnMsgReceived(std::string msg_name, PyObject *clbk)
PyInterfaceItem::setCallbackOnMsgReceived: it append a callback function to the message.
Definition: pyinterfaceitem.cpp:119
PyInterfaceItem::getMessageFieldUnit
PyObject * getMessageFieldUnit(std::string msg_name, std::string field_name)
PyInterfaceItem::getMessageFieldUnit.
Definition: pyinterfaceitem.cpp:637
PyInterfaceItem::pushOnICDEventCallback
PyObject * pushOnICDEventCallback(PyObject *clbk)
PyInterfaceItem::pushEventCallback Link python function/methods to some ICD Events that are ( in term...
Definition: pyinterfaceitem.cpp:86
PyInterfaceItem::getMessageRawData
PyObject * getMessageRawData(std::string msg_name)
PyInterfaceItem::getMessageRawData.
Definition: pyinterfaceitem.cpp:532
PyInterfaceItem::enableBusErrorInjection
bool enableBusErrorInjection(int err)
PyInterfaceItem::enableBusErrorInjection Notify to the interface that error injection shall be used...
Definition: pyinterfaceitem.cpp:839
PyInterfaceItem::getLastReceivedMessageId
PyObject * getLastReceivedMessageId() const
PyInterfaceItem::getLastReceivedMessageId.
Definition: pyinterfaceitem.cpp:308
PyInterfaceItem::setBusConfiguration
bool setBusConfiguration(std::string xml, bool persistent=false)
PyInterfaceItem::setBusConfiguration.
Definition: pyinterfaceitem.cpp:904
PyInterfaceItem::getMessageFieldWeight
PyObject * getMessageFieldWeight(std::string msg_name, std::string field_name)
Definition: pyinterfaceitem.cpp:620
PyInterfaceItem::getSingleMessageSentSz
PyObject * getSingleMessageSentSz(std::string msg_name) const
PyInterfaceItem::getSingleMessageSentSz.
Definition: pyinterfaceitem.cpp:343
PyInterfaceItem::getMessageReceivedSz
PyObject * getMessageReceivedSz() const
PyInterfaceItem::getMessageReceivedSz.
Definition: pyinterfaceitem.cpp:270
PyInterfaceItem::getICDName
PyObject * getICDName()
PyInterfaceItem::getICDName.
Definition: pyinterfaceitem.cpp:364
PyInterfaceItem::getMessageFieldValues
std::vector< std::string > getMessageFieldValues(std::string msg_name, std::string field_name)
PyInterfaceItem::getMessageFieldValues.
Definition: pyinterfaceitem.cpp:685
PyInterfaceItem::getLastReceivedMessageName
PyObject * getLastReceivedMessageName() const
PyInterfaceItem::getLastReceivedMessageName.
Definition: pyinterfaceitem.cpp:318
PyInterfaceItem::isMessageReadOnly
bool isMessageReadOnly(std::string msg_name)
PyInterfaceItem::isMessageReadOnly.
Definition: pyinterfaceitem.cpp:387
PyInterfaceItem::getBusClockUsPeriodTime
unsigned long getBusClockUsPeriodTime()
PyInterfaceItem::getBusClockUsPeriodTime.
Definition: pyinterfaceitem.cpp:865
PyInterfaceItem::start
bool start()
PyInterfaceItem::start Start communication with the channel.
Definition: pyinterfaceitem.cpp:197
PyInterfaceItem::disableBusErrorInjection
void disableBusErrorInjection()
PyInterfaceItem::disableBusErrorInjection Notify to the interface that no error injection shall be us...
Definition: pyinterfaceitem.cpp:849
PyInterfaceItem::getMessageFieldValue
PyObject * getMessageFieldValue(std::string msg_name, std::string field_name)
PyInterfaceItem::getMessageFieldValue.
Definition: pyinterfaceitem.cpp:555
PyInterfaceItem::getMessageLastError
PyObject * getMessageLastError() const
PyInterfaceItem::getMessageLastError.
Definition: pyinterfaceitem.cpp:300
PyInterfaceItem::getBusConfiguration
std::string getBusConfiguration()
PyInterfaceItem::getBusConfiguration.
Definition: pyinterfaceitem.cpp:878
PyInterfaceItem::clearOnICDEventCallback
PyObject * clearOnICDEventCallback()
PyInterfaceItem::clearOnICDEventCallback remove all inserted callbacks.
Definition: pyinterfaceitem.cpp:106
PyInterfaceItem::PyInterfaceItem
PyInterfaceItem(GenericInterfaceItem *p)
PyInterfaceItem::PyInterfaceItem.
Definition: pyinterfaceitem.cpp:36
PyInterfaceItem::sendLastCommittedMessage
bool sendLastCommittedMessage(std::string msg_name)
PyInterfaceItem::sendLastCommittedMessage.
Definition: pyinterfaceitem.cpp:731
PyInterfaceItem::getMessageNames
std::vector< std::string > getMessageNames()
PyInterfaceItem::getMessageNames.
Definition: pyinterfaceitem.cpp:373
PyInterfaceItem::logStop
void logStop()
PyInterfaceItem::logStop. Stop any log activities.
Definition: pyinterfaceitem.cpp:254
PyInterfaceItem::getMessageSentSz
PyObject * getMessageSentSz() const
PyInterfaceItem::getMessageSentSz.
Definition: pyinterfaceitem.cpp:262
PyInterfaceItem::updateRxMessage
bool updateRxMessage(std::string msg_name)
PyInterfaceItem::updateRxMessage.
Definition: pyinterfaceitem.cpp:758
PyInterfaceItem::getMessageFieldBound
PyObject * getMessageFieldBound(std::string msg_name, std::string field_name)
PyInterfaceItem::getMessageFieldBound.
Definition: pyinterfaceitem.cpp:598
PyInterfaceItem::isMessagePeriodic
bool isMessagePeriodic(std::string msg_name)
Definition: pyinterfaceitem.cpp:417
PyInterfaceItem::getPluginHandler
PyPluginHandler * getPluginHandler()
PyInterfaceItem::getPluginHandler.
Definition: pyinterfaceitem.cpp:189
PyInterfaceItem::getMessageFieldType
PyObject * getMessageFieldType(std::string msg_name, std::string field_name)
PyInterfaceItem::getMessageFieldType.
Definition: pyinterfaceitem.cpp:661
PyInterfaceItem::revertChanges
void revertChanges()
PyInterfaceItem::revertChanges.
Definition: pyinterfaceitem.cpp:821
PyInterfaceItem::getVerbose
bool getVerbose() const
PyInterfaceItem::getVerbose.
Definition: pyinterfaceitem.cpp:163
PyInterfaceItem::getMessageId
PyObject * getMessageId(std::string msg_name)
Definition: pyinterfaceitem.cpp:960
PyInterfaceItem::touchMessage
bool touchMessage(std::string msg_name)
PyInterfaceItem::touchMessage.
Definition: pyinterfaceitem.cpp:397
PyInterfaceItem::getCommitOnTheFly
bool getCommitOnTheFly() const
PyInterfaceItem::getCommitOnTheFly.
Definition: pyinterfaceitem.cpp:180


Leonardo Platform Simulator ~ Python Interpreter API: include/pypluginaction.h File Reference

  • include
Classes
pypluginaction.h File Reference

Python specialization of ICDPluginAction. More...

Go to the source code of this file.

Classes

class PyPluginAction
The PyPluginAction: enhanced ICDPluginAction that provides a virtual methods to executes full compliant python callback. More...

Detailed Description

Python specialization of ICDPluginAction.

Implements a virtual method eval that handle python code ( cpp using Python/C API or python script )

Date
2021
Author
Federico Paoletti
Copyright
Leonardo Company s.p.a


Leonardo Platform Simulator ~ Python Interpreter API: include/pypluginhandler.h File Reference

  • include
Classes | Functions
pypluginhandler.h File Reference

Python Interpreter Plugin Implementations. More...

Go to the source code of this file.

Classes

class PyPluginHandler
The PyPluginHandler class. More...

Functions

ICDDictionary | fromPyDictToICDDictionary (PyObject *)
fromPyDictToICDDictionary : Convert a Python object ( that shall be a dictionary ) into a ICDDictionary one More...
void | fromICDDictionaryToPyDict (ICDDictionary dict, PyObject *pydict)
fromICDDictionaryToPyDict : Convert a ICDDictionary into a python dictionary object More...

Detailed Description

Python Interpreter Plugin Implementations.

Handle Plugin in a python way

Date
2021
Author
Federico Paoletti
Copyright
Leonardo Company s.p.a

Function Documentation

◆ fromICDDictionaryToPyDict()

void fromICDDictionaryToPyDict | ( | ICDDictionary | dict,
 |  | PyObject * | pydict
 | ) |  |

fromICDDictionaryToPyDict : Convert a ICDDictionary into a python dictionary object

Parameters
dict | ICDDictionary
pydict | Python dictionary object

◆ fromPyDictToICDDictionary()

ICDDictionary fromPyDictToICDDictionary ( PyObject * dict )

fromPyDictToICDDictionary : Convert a Python object ( that shall be a dictionary ) into a ICDDictionary one

Note
only boolean, int, long, float and string values are managed
Parameters
dict the python pbject
Returns
ICDDictionary


Leonardo Platform Simulator ~ Python Interpreter API: D:/sources/LeoPlatSim__trunk/qtinterpreter Directory Reference

  • qtinterpreter
qtinterpreter Directory Reference

Directories

Generated on Mon Feb 6 2023 08:56:39 for Leonardo Platform Simulator ~ Python Interpreter API by doxygen 1.8.14


Leonardo Platform Simulator ~ Python Interpreter API: D:/sources/LeoPlatSim__trunk/qtinterpreter/include Directory Reference

  • qtinterpreter
  • include
include Directory Reference

Files

file qinterpreter_common.h [code]


Leonardo Platform Simulator ~ Python Interpreter API: D:/sources/LeoPlatSim__trunk/qtinterpreter/include/qinterpreter_common.h File Reference

  • qtinterpreter
  • include
Classes | Functions
qinterpreter_common.h File Reference

Go to the source code of this file.

Classes

struct interpIO

Functions

void | WriteToChannel (unsigned int ch, char *str)
Write the string str (included the line-feed), to the output device pointed by the channel or standard output otherwise. More...
char * | ReadFromChannel (unsigned int ch)
Read the string from the channel ch, or standard input otherwise. More...
int | messageBox (const char *text, const char *caption=NULL, unsigned int btn_flag=0, unsigned int icon_flag=0)
messageBox More...
PyObject * | inputBox (const char *caption="InputBox", const char *text=NULL)
InputBox: it provides a simple convenience dialog to get a single value from the user. More...
PyObject * | openFileDialog (const char *caption="Open File", const char *dir=".", const char *filters="All Files (*)")
openFileDialog : it open a dialog that returns an existing file selected by the user. If the user presses Cancel, it returns a null string. More...
PyObject * | saveFileDialog (const char *caption="Save File", const char *dir=".", const char *filters="All Files (*)")
SaveFileDialog : it open a dialog that will return a file name selected by the user. The file does not have to exist. More...
PyObject * | openDirDialog (const char *caption="Open Dir", const char *dir=".")
openDirDialog : it open a dialog that returns an existing file selected by the user. If the user presses Cancel, it returns a null string. More...

Detailed Description

Date
2017
Author
Federico Paoletti
Copyright
Leonardo Company s.p.a

Function Documentation

◆ inputBox()

PyObject* inputBox | ( | const char * | caption,
 |  | const char * | text
 | ) |  |

InputBox: it provides a simple convenience dialog to get a single value from the user.

Parameters
text | The message to be displayed. If the string consists of more than one line, you can separate the lines using a carriage return and/or linefeed character between each line.
caption | : The dialog box title.
Returns
the user text promped as python string

◆ messageBox()

int messageBox | ( | const char * | text,
 |  | const char * | caption,
 |  | unsigned int | btn_flag,
 |  | unsigned int | icon_flag
 | ) |  |

messageBox

Parameters
text | The message to be displayed. If the string consists of more than one line, you can separate the lines using a carriage return and/or linefeed character between each line.
caption | : The dialog box title. If this parameter is NULL, the default title is Error.
btn_flag integer
  • AbortRetryCancel 0x00000002L The message box contains three push buttons: Abort, Retry, and Ignore.
  • CancelRetryCancel 0x00000006L The message box contains three push buttons: Cancel, Try Again, Continue.
  • Ok 0x00000000L The message box contains one push button: OK. This is the default.
  • OkCancel 0x00000001L The message box contains two push buttons: OK and Cancel.
  • RetryCancel 0x00000005L The message box contains two push buttons: Retry and Cancel.
  • YesNo 0x00000004L The message box contains two push buttons: Yes and No.
  • YesNoCancel 0x00000003L The message box contains three push buttons: Yes, No, and Cancel.
btn_flag integer
  • NoIcon 0x00000000L The message box does not have any icon.
  • Question 0x00000004L An icon indicating that the message is asking a question.
  • Information 0x00000001L An icon indicating that the message is nothing out of the ordinary.
  • Warning 0x00000002L An icon indicating that the message is a warning, but can be dealt with.
  • Critical 0x00000003L An icon indicating that the message represents a critical problem.
Returns
clicked button flag:
  • Ok 0x00000400L An "OK" button defined with the AcceptRole.
  • Open 0x00002000L An "Open" button defined with the AcceptRole.
  • Save 0x00000800L A "Save" button defined with the AcceptRole.
  • Cancel 0x00400000L A "Cancel" button defined with the RejectRole.
  • Close 0x00200000L A "Close" button defined with the RejectRole.
  • Discard 0x00800000L A "Discard" or "Don't Save" button, depending on the platform, defined with the DestructiveRole.
  • Apply 0x02000000L An "Apply" button defined with the ApplyRole.
  • Reset 0x04000000L A "Reset" button defined with the ResetRole.
  • RestoreDefaults 0x08000000L A "Restore Defaults" button defined with the ResetRole.
  • Help 0x01000000L A "Help" button defined with the HelpRole.
  • SaveAll 0x00001000L A "Save All" button defined with the AcceptRole.
  • Yes 0x00004000L A "Yes" button defined with the YesRole.
  • YesToAll 0x00008000L A "Yes to All" button defined with the YesRole.
  • No 0x00010000L A "No" button defined with the NoRole.
  • NoToAll 0x00020000L A "No to All" button defined with the NoRole.
  • Abort 0x00040000L An "Abort" button defined with the RejectRole.
  • Retry 0x00080000L A "Retry" button defined with the AcceptRole.
  • Ignore 0x00100000L An "Ignore" button defined with the AcceptRole.
  • NoButton 0x00000000L An invalid button.

◆ openDirDialog()

PyObject* openDirDialog | ( | const char * | caption,
 |  | const char * | dir
 | ) |  |

openDirDialog : it open a dialog that returns an existing file selected by the user. If the user presses Cancel, it returns a null string.

Parameters
caption | : The dialog box title.
dir | : The initial directory path
Returns
The selected directory string

◆ openFileDialog()

PyObject* openFileDialog | ( | const char * | caption,
 |  | const char * | dir,
 |  | const char * | filters
 | ) |  |

openFileDialog : it open a dialog that returns an existing file selected by the user. If the user presses Cancel, it returns a null string.

Parameters
caption | : The dialog box title
dir | : The initial directory path
filters | : Only files that match the given filter are shown. The filter selected is set to selectedFilter.
Returns
The selected file string

◆ ReadFromChannel()

char* ReadFromChannel ( unsigned int ch )

Read the string from the channel ch, or standard input otherwise.

Parameters
ch object

Read the string from the channel ch, or standard input otherwise.

Parameters
ch the channel id
Returns
char *

◆ saveFileDialog()

PyObject* saveFileDialog | ( | const char * | caption,
 |  | const char * | dir,
 |  | const char * | filters
 | ) |  |

SaveFileDialog : it open a dialog that will return a file name selected by the user. The file does not have to exist.

Parameters
caption | : The dialog box title
dir | : The initial directory path
filters | : Only files that match the given filter are shown. The filter selected is set to selectedFilter.
Returns
The selected file string

◆ WriteToChannel()

void WriteToChannel | ( | unsigned int | ch,
 |  | char * | str
 | ) |  |

Write the string str (included the line-feed), to the output device pointed by the channel or standard output otherwise.

Parameters
ch
str | Write the string str (included the line-feed), to the output device pointed by the channel or standard output otherwise.
ch | the channel id
char | *str the string
Returns
None


Leonardo Platform Simulator ~ Python Interpreter API: D:/sources/LeoPlatSim__trunk/qtinterpreter/include/qpyconsole.h Source File

  • qtinterpreter
  • include
qpyconsole.h
1 #ifndef PYTHONSIM_H
2 #define PYTHONSIM_H
3 #include <QPlainTextEdit>
4 #include "qpyconsolethread.h"
5 #include "qinterpreter_global.h"
6
7 class QINTERPRETERSHARED_EXPORT QPyConsole : public QPlainTextEdit
8 {
9 Q_OBJECT
10 public:
11 explicit QPyConsole(QWidget *parent = 0);
12 QPyConsole(QPlainTextEdit *plainText);
13 ~QPyConsole();
14 public:
15 unsigned int getChannel();
16
17 private:
18 void initialise();
19
20 signals:
21 void closed(QWidget *);
22 void eval(QString);
23
24 public:
25 QPyConsoleThread * getConsoleThread() const;
26
27 protected:
28 QPyConsoleThread *_console_thread;
29
30 private:
31 bool ctrlKeyPressed;
32 int cur_pos;
33 int history;
34 QStringList historyList;
35 QStringList mimelist;
36
37 public:
38 void terminate_thread();
39
40 public slots:
41 void insertPlainText(const QString & text);
42 void nextMime();
43
44 private slots:
45 void insertPrompt();
46
47 protected:
48 virtual void keyPressEvent ( QKeyEvent * e );
49 virtual void keyReleaseEvent ( QKeyEvent * e );
50 virtual void mousePressEvent ( QMouseEvent *e );
51 virtual void contextMenuEvent( QContextMenuEvent *event );
52 virtual void insertFromMimeData(const QMimeData *source);
53 friend class QPyConsoleThread;
54 };
55
56
57 #endif // PYTHONSIM_H
QPyConsole
Definition: qpyconsole.h:7
QPyConsoleThread
Definition: qpyconsolethread.h:19


Leonardo Platform Simulator ~ Python Interpreter API: D:/sources/LeoPlatSim__trunk/qtinterpreter/include/qpyconsolethread.h Source File

  • qtinterpreter
  • include
qpyconsolethread.h
1 #ifndef QPYCONSOLETHREAD_H
2 #define QPYCONSOLETHREAD_H
3
4 #include <QThread>
5 #include <QWaitCondition>
6 #include <QMutex>
7 #pragma push_macro("slots")
8 #undef slots
9 #include <Python.h>
10 #pragma pop_macro("slots")
11 #include <queue>
12
13 #include "qinterpreter_common.h"
14 #include "interpreter.h"
15 #include "qinterpreter_global.h"
16 #include "pythreadsupport.h"
17
18
19 class QINTERPRETERSHARED_EXPORT QPyConsoleThread : public QThread
20 {
21 Q_OBJECT
22 public:
23 QPyConsoleThread(QPlainTextEdit *parent);
24 ~QPyConsoleThread();
25 void quit();
26 void abort_interpreter();
27 public:
28 unsigned int channel;
29 const char *prompt;
30 size_t prompt_len;
31
32 public:
33 void notifyCursorPosition(int);
34 protected:
35 virtual void run();
36
37 private:
38 QWaitCondition wait_for_commands;
39 QMutex mutex;
40 public slots:
41 void onEval(QString);
42
43 signals:
44 void evaluated();
45
46 private:
47 void eval(char *);
48 void eval_queued_command(QString);
49 private:
50 QPlainTextEdit *_parent;
51 PyObject *glb, *loc, *main;
52 PyThreadState *_ts;
53
54 PySession *interp_sub;
55
56 int _cur_text_pos;
57 bool _is_interactive;
58 bool is_input;
59 QString input_command;
60 interpIO *term_io;
61 const char *ps1,*ps2;
62
63 bool do_loop;
64 std::queue<QString> c_queue;
65 char *code;
66 const char *channel_cmd;
67 public:
68 inline bool evaluating() { return (this->c_queue.empty() ) ? false : true; }
69 inline PySession * session() const { return interp_sub; }
70 };
71
72 #endif // QPYCONSOLETHREAD_H
interpreter.h
Python Interpreter Implementations.
QPyConsoleThread
Definition: qpyconsolethread.h:19
qinterpreter_common.h
interpIO
Definition: qinterpreter_common.h:47


Leonardo Platform Simulator ~ Python Interpreter API: src Directory Reference

  • src
src Directory Reference

Files

file interpreter.cpp
Python Interpreter Implementations.


Leonardo Platform Simulator ~ Python Interpreter API: src/interpreter.cpp File Reference

  • src
Functions
interpreter.cpp File Reference

Python Interpreter Implementations. More...

Functions

_EXPORT_ void | PyInterpreterInit__SetMainWindow (QMainWindow *ptr)
PyInterpreterInit__SetMainWindow. More...
_EXPORT_ QMainWindow * | getMainWindow ()
PyInterpreterInit__GetMainWindow. More...
_EXPORT_ void | PyInterpreterInit__InterfaceManager (GenericInterfaceManager *ptr)
PyInterpreterInit__InterfaceManager. More...
_EXPORT_ GenericInterfaceManager * | getInterfaceManager ()
getInterfaceManager More...
_EXPORT_ void | PyInterpreterInit__PluginsManager (GenericPluginsManager *ptr)
PyInterpreterInit__PluginsManager. More...
_EXPORT_ GenericPluginsManager * | getPluginsManager ()
getPluginsManager More...

Detailed Description

Python Interpreter Implementations.

Date
2017
Author
Federico Paoletti
Copyright
Leonardo Company s.p.a

Function Documentation

◆ getInterfaceManager()

_EXPORT_ GenericInterfaceManager* getInterfaceManager ( )

getInterfaceManager

Returns

◆ getMainWindow()

_EXPORT_ QMainWindow* getMainWindow ( )

PyInterpreterInit__GetMainWindow.

Returns

◆ getPluginsManager()

_EXPORT_ GenericPluginsManager* getPluginsManager ( )

getPluginsManager

Returns

◆ PyInterpreterInit__InterfaceManager()

_EXPORT_ void PyInterpreterInit__InterfaceManager ( GenericInterfaceManager * ptr )

PyInterpreterInit__InterfaceManager.

Parameters
ptr

◆ PyInterpreterInit__PluginsManager()

_EXPORT_ void PyInterpreterInit__PluginsManager ( GenericPluginsManager * ptr )

PyInterpreterInit__PluginsManager.

Parameters
ptr

◆ PyInterpreterInit__SetMainWindow()

_EXPORT_ void PyInterpreterInit__SetMainWindow ( QMainWindow * ptr )

PyInterpreterInit__SetMainWindow.

Parameters
ptr


Leonardo Platform Simulator ~ Python Interpreter API: File Members

Here is a list of all documented file members with links to the documentation:
  • fromICDDictionaryToPyDict() : pypluginhandler.h
  • fromPyDictToICDDictionary() : pypluginhandler.h
  • getInterfaceManager() : interpreter.cpp , interpreter.h
  • getMainWindow() : interpreter.h , interpreter.cpp
  • getPluginsManager() : interpreter.h , interpreter.cpp
  • inputBox() : qinterpreter_common.h
  • messageBox() : qinterpreter_common.h
  • openDirDialog() : qinterpreter_common.h
  • openFileDialog() : qinterpreter_common.h
  • PyInterpreterInit__InterfaceManager() : interpreter.cpp , interpreter.h
  • PyInterpreterInit__PluginsManager() : interpreter.h , interpreter.cpp
  • PyInterpreterInit__SetMainWindow() : interpreter.h , interpreter.cpp
  • ReadFromChannel() : qinterpreter_common.h
  • saveFileDialog() : qinterpreter_common.h
  • WriteToChannel() : qinterpreter_common.h


Leonardo Platform Simulator ~ Python Interpreter API: File Members

  • fromICDDictionaryToPyDict() : pypluginhandler.h
  • fromPyDictToICDDictionary() : pypluginhandler.h
  • getInterfaceManager() : interpreter.cpp , interpreter.h
  • getMainWindow() : interpreter.h , interpreter.cpp
  • getPluginsManager() : interpreter.h , interpreter.cpp
  • inputBox() : qinterpreter_common.h
  • messageBox() : qinterpreter_common.h
  • openDirDialog() : qinterpreter_common.h
  • openFileDialog() : qinterpreter_common.h
  • PyInterpreterInit__InterfaceManager() : interpreter.cpp , interpreter.h
  • PyInterpreterInit__PluginsManager() : interpreter.h , interpreter.cpp
  • PyInterpreterInit__SetMainWindow() : interpreter.h , interpreter.cpp
  • ReadFromChannel() : qinterpreter_common.h
  • saveFileDialog() : qinterpreter_common.h
  • WriteToChannel() : qinterpreter_common.h


Leonardo Platform Simulator ~ Python Interpreter API: Member List

PyInterfaceItem Member List

This is the complete list of members for PyInterfaceItem, including all inherited members.

assignMessageFieldValue(std::string msg_name, std::string field_name, PyObject *val, bool force=true) | PyInterfaceItem |
assignMessageRawData(std::string msg_name, PyObject *raw) | PyInterfaceItem |
clearOnICDEventCallback() | PyInterfaceItem |
commitChanges() | PyInterfaceItem |
disableBusErrorInjection() | PyInterfaceItem |
enableBusErrorInjection(int err) | PyInterfaceItem |
getBusClockUsPeriodTime() | PyInterfaceItem |
getBusConfiguration() | PyInterfaceItem |
getBusErrorInjection() | PyInterfaceItem |
getBusErrorInjectionValues() | PyInterfaceItem |
getCommitOnTheFly() const | PyInterfaceItem |
getICDName() | PyInterfaceItem |
getLastChangedMessages() const | PyInterfaceItem |
getLastReceivedMessageId() const | PyInterfaceItem |
getLastReceivedMessageName() const | PyInterfaceItem |
getLastSentMessageNames() const | PyInterfaceItem |
getMessageErrorSz() const | PyInterfaceItem |
getMessageFieldBound(std::string msg_name, std::string field_name) | PyInterfaceItem |
getMessageFieldNames(std::string msg_name) | PyInterfaceItem |
getMessageFieldRange(std::string msg_name, std::string field_name) | PyInterfaceItem |
getMessageFieldType(std::string msg_name, std::string field_name) | PyInterfaceItem |
getMessageFieldUnit(std::string msg_name, std::string field_name) | PyInterfaceItem |
getMessageFieldValue(std::string msg_name, std::string field_name) | PyInterfaceItem |
getMessageFieldValues(std::string msg_name, std::string field_name) | PyInterfaceItem |
getMessageFieldWeight(std::string msg_name, std::string field_name) | PyInterfaceItem |
getMessageFieldWidth(std::string msg_name, std::string field_name) | PyInterfaceItem |
getMessageId(std::string msg_name) | PyInterfaceItem |
getMessageLastError() const | PyInterfaceItem |
getMessageNames() | PyInterfaceItem |
getMessageRawData(std::string msg_name) | PyInterfaceItem |
getMessageReceivedSz() const | PyInterfaceItem |
getMessageSentSz() const | PyInterfaceItem |
getMessageUsPeriodTime(std::string msg_name) | PyInterfaceItem |
getPluginHandler() | PyInterfaceItem |
getSingleMessageReceivedSz(std::string msg_name) const | PyInterfaceItem |
getSingleMessageSentSz(std::string msg_name) const | PyInterfaceItem |
getVerbose() const | PyInterfaceItem |
isMessagePeriodic(std::string msg_name) | PyInterfaceItem |
isMessageReadOnly(std::string msg_name) | PyInterfaceItem |
logStart(int level, std::string dirName) | PyInterfaceItem |
logStop() | PyInterfaceItem |
popOnICDEventCallback() | PyInterfaceItem |
pushOnICDEventCallback(PyObject *clbk) | PyInterfaceItem |
PyInterfaceItem(GenericInterfaceItem *p) | PyInterfaceItem | explicit
raiseError(std::string msg, int severity) | PyInterfaceItem |
revertChanges() | PyInterfaceItem |
sendLastCommittedMessage(std::string msg_name) | PyInterfaceItem |
setBusConfiguration(std::string xml, bool persistent=false) | PyInterfaceItem |
setCallbackOnMsgReceived(std::string msg_name, PyObject *clbk) | PyInterfaceItem |
setCommitOnTheFly(bool b) | PyInterfaceItem |
setVerbose(bool) | PyInterfaceItem |
start() | PyInterfaceItem |
stop() | PyInterfaceItem |
touchMessage(std::string msg_name) | PyInterfaceItem |
updateRxMessage(std::string msg_name) | PyInterfaceItem |


Leonardo Platform Simulator ~ Python Interpreter API: Member List

PyInterfaceManager Member List

This is the complete list of members for PyInterfaceManager, including all inherited members.

getInterface(unsigned int pos) | PyInterfaceManager
indexOf(std::string n) | PyInterfaceManager
names() | PyInterfaceManager
PyInterfaceManager() | PyInterfaceManager
size() | PyInterfaceManager
~PyInterfaceManager() | PyInterfaceManager


Leonardo Platform Simulator ~ Python Interpreter API: Member List

PyPluginAction Member List

This is the complete list of members for PyPluginAction, including all inherited members.

eval(PyObject *args, PyObject *kwargs=NULL) PyPluginAction virtual


Leonardo Platform Simulator ~ Python Interpreter API: Member List

PyPluginHandler Member List

This is the complete list of members for PyPluginHandler, including all inherited members.

evalAction(std::string, PyObject *args=NULL, PyObject *kwargs=NULL) | PyPluginHandler
execAction(std::string, PyObject *dict_args=NULL, PyObject *dict_retval=NULL) | PyPluginHandler
getActionHelp(std::string n) | PyPluginHandler
getChecked(std::string n) | PyPluginHandler
isCheckable(std::string n) | PyPluginHandler
names() | PyPluginHandler
onAction(std::string) | PyPluginHandler
PyPluginHandler(GenericInterfaceItem *item) | PyPluginHandler
setChecked(std::string n, bool) | PyPluginHandler


Leonardo Platform Simulator ~ Python Interpreter API: Member List

PyPluginsManager Member List

This is the complete list of members for PyPluginsManager, including all inherited members.

getPlugin(unsigned int pos) | PyPluginsManager
indexOf(std::string n) | PyPluginsManager
names() | PyPluginsManager
PyPluginsManager() | PyPluginsManager
size() | PyPluginsManager


Leonardo Platform Simulator ~ Python Interpreter API: Member List

QPyConsole Member List

This is the complete list of members for QPyConsole, including all inherited members.


Leonardo Platform Simulator ~ Python Interpreter API: Member List

QPyConsoleThread Member List

This is the complete list of members for QPyConsoleThread, including all inherited members.


Leonardo Platform Simulator ~ Python Interpreter API: D:/sources/LeoPlatSim__trunk/Qtinterpreter Directory Reference

  • Qtinterpreter
Qtinterpreter Directory Reference

Directories

Generated on Mon Feb 6 2023 08:56:39 for Leonardo Platform Simulator ~ Python Interpreter API by doxygen 1.8.14


Leonardo Platform Simulator ~ Python Interpreter API: D:/sources/LeoPlatSim__trunk/Qtinterpreter/src Directory Reference

  • Qtinterpreter
  • src
src Directory Reference


Leonardo Platform Simulator ~ Python Interpreter API: Main Page

Leonardo Platform Simulator ~ Python Interpreter API Documentation


Leonardo Platform Simulator ~ Python Interpreter API: include/interpreter.h Source File

  • include
interpreter.h
Go to the documentation of this file.
1
10 #ifndef __INTERPRETER_H__
11 #define __INTERPRETER_H__
12
13 #define PYTHON_INTERPRETER_VER "1.6.0.0"
14
15
16 #include "pyinterfaceitem.h"
17 #include "pypluginhandler.h"
18
19 #include "genericinterfacemanager.h"
20 #include "genericpluginsmanager.h"
21
22 class QMainWindow;
27 void PyInterpreterInit__SetMainWindow (QMainWindow *ptr);
28
33 QMainWindow *getMainWindow();
34
39 void PyInterpreterInit__InterfaceManager (GenericInterfaceManager *ptr);
40
45 GenericInterfaceManager *getInterfaceManager();
46
51 void PyInterpreterInit__PluginsManager (GenericPluginsManager *ptr);
52
53
58 GenericPluginsManager *getPluginsManager();
59
60 class PyInterfaceManager {
61 public:
62 PyInterfaceManager();
63 ~PyInterfaceManager();
65 PyInterfaceItem *getInterface(unsigned int pos);
66 int indexOf(std::string n);
67 size_t size();
68 std::vector<std::string> names();
70 private:
71 //PyICDGenericContainer<GenericInterfaceManager,PyInterfaceItem> *_container;
72 GenericInterfaceManager *_interface_mgr;
73
74 };
75
80 class PyPluginsManager {
81 public:
82 PyPluginsManager();
84 PyPluginHandler *getPlugin(unsigned int pos);
85 int indexOf(std::string n);
86 size_t size();
87 std::vector<std::string> names();
88 private:
89 GenericPluginsManager* _plugins_mgr;
90 };
91
92 #endif // __INTERPRETER_H__
pypluginhandler.h
Python Interpreter Plugin Implementations.
PyInterfaceItem
The PyInterfaceItem class expose methods that interacts with the interface.
Definition: pyinterfaceitem.h:20
PyInterfaceManager::names
std::vector< std::string > names()
PyInterfaceManager::names.
Definition: interpreter.cpp:71
PyInterfaceManager::PyInterfaceManager
PyInterfaceManager()
PyInterfaceManager::PyInterfaceManager The root node of python interfaces communication.
Definition: interpreter.cpp:54
PyPluginsManager::names
std::vector< std::string > names()
Definition: interpreter.cpp:143
PyPluginsManager::indexOf
int indexOf(std::string n)
Definition: interpreter.cpp:133
PyInterfaceManager::size
size_t size()
PyInterfaceManager::size.
Definition: interpreter.cpp:106
PyInterfaceManager::getInterface
PyInterfaceItem * getInterface(unsigned int pos)
PyInterfaceManager::getInterface.
Definition: interpreter.cpp:85
PyInterpreterInit__PluginsManager
void PyInterpreterInit__PluginsManager(GenericPluginsManager *ptr)
PyInterpreterInit__PluginsManager.
Definition: interpreter.cpp:42
getMainWindow
QMainWindow * getMainWindow()
PyInterpreterInit__GetMainWindow.
Definition: interpreter.cpp:31
PyPluginHandler
The PyPluginHandler class.
Definition: pypluginhandler.h:27
PyPluginsManager::PyPluginsManager
PyPluginsManager()
PyPluginsManager::PyPluginsManager.
Definition: interpreter.cpp:115
PyInterpreterInit__SetMainWindow
void PyInterpreterInit__SetMainWindow(QMainWindow *ptr)
PyInterpreterInit__SetMainWindow.
Definition: interpreter.cpp:27
PyInterfaceManager::indexOf
int indexOf(std::string n)
PyInterfaceManager::indexOf.
Definition: interpreter.cpp:98
PyPluginsManager::size
size_t size()
Definition: interpreter.cpp:138
PyInterfaceManager::~PyInterfaceManager
~PyInterfaceManager()
Definition: interpreter.cpp:62
getPluginsManager
GenericPluginsManager * getPluginsManager()
getPluginsManager
Definition: interpreter.cpp:46
PyPluginsManager
The PyPluginsManager class object to manage global plugins ( alias Tools )
Definition: interpreter.h:80
getInterfaceManager
GenericInterfaceManager * getInterfaceManager()
getInterfaceManager
Definition: interpreter.cpp:39
PyPluginsManager::getPlugin
PyPluginHandler * getPlugin(unsigned int pos)
Definition: interpreter.cpp:123
PyInterfaceManager
Definition: interpreter.h:60
PyInterpreterInit__InterfaceManager
void PyInterpreterInit__InterfaceManager(GenericInterfaceManager *ptr)
PyInterpreterInit__InterfaceManager.
Definition: interpreter.cpp:35


Leonardo Platform Simulator ~ Python Interpreter API: Related Pages

Related Pages
Here is a list of all related documentation pages:
testPlugin.cpp
Makefile


Leonardo Platform Simulator ~ Python Interpreter API: include/pypluginaction.h Source File

  • include
pypluginaction.h
Go to the documentation of this file.
1
10 #ifndef PYPLUGINACTION_H
11 #define PYPLUGINACTION_H
12
13 #include <icdplugin.h>
14 #include <pyversioning.h>
18 class PyPluginAction: public ICDPluginAction {
19 public:
20 PyPluginAction(unsigned int id,
21 std::string name,
22 ICDPluginActionType type = ACTION_TYPE_NORMAL,
23 ICDPluginActionKind kind = ACTION_KIND_PYTHON_ONLY,
24 ICDPluginAction *parent = NULL);
25 virtual ~PyPluginAction();
26 //Python reserved methods
27 public:
28 virtual PyObject* eval(PyObject *args,PyObject *kwargs=NULL );
30 };
31
32 #endif // PYPLUGINACTION_H
PyPluginAction
The PyPluginAction: enhanced ICDPluginAction that provides a virtual methods to executes full complia...
Definition: pypluginaction.h:18
PyPluginAction::eval
virtual PyObject * eval(PyObject *args, PyObject *kwargs=NULL)


Leonardo Platform Simulator ~ Python Interpreter API: include/pypluginhandler.h Source File

  • include
pypluginhandler.h
Go to the documentation of this file.
1
10 #ifndef PYPLUGINHANDLER_H
11 #define PYPLUGINHANDLER_H
12 #include "pyversioning.h"
13 #include "icdplugin.h"
14 #include "genericinterfacemanager.h"
15 #include "interpreter_common.h"
16 class PyICDHandler;
17 class PyBusHandler;
18
19
20 ICDDictionary fromPyDictToICDDictionary(PyObject *);
21 void fromICDDictionaryToPyDict(ICDDictionary dict,PyObject *pydict);
22
23 typedef std::map<std::string,ICDPluginAction *> PyPluginMapper;
27 class PyPluginHandler {
28 public:
29 PyPluginHandler(GenericInterfaceItem *item);
30 std::vector<std::string> names();
31 bool onAction(std::string);
32 bool execAction(std::string,PyObject *dict_args=NULL,PyObject *dict_retval=NULL);
33 PyObject *evalAction(std::string, PyObject *args=NULL, PyObject *kwargs=NULL);
34 bool getChecked(std::string n);
35 bool setChecked(std::string n, bool);
36 bool isCheckable(std::string n);
37 PyObject *getActionHelp(std::string n);
38 private:
39 void parsePluginAction(ICDPluginAction *cur_action,std::string header=std::string());
40
41 private:
42 ICDPluginAction *findPluginByName(std::string);
43 private:
44 GenericInterfaceItem *_item_obj;
45 ICDPluginObject *_plugin_obj;
46 PyPluginMapper _mapper;
47 std::vector<std::string> _names;
48 };
49
50 #endif // PYPLUGINHANDLER_H
PyPluginHandler::PyPluginHandler
PyPluginHandler(GenericInterfaceItem *item)
Definition: pypluginhandler.cpp:83
fromPyDictToICDDictionary
ICDDictionary fromPyDictToICDDictionary(PyObject *)
fromPyDictToICDDictionary : Convert a Python object ( that shall be a dictionary ) into a ICDDictiona...
Definition: pypluginhandler.cpp:9
PyPluginHandler
The PyPluginHandler class.
Definition: pypluginhandler.h:27
PyPluginHandler::evalAction
PyObject * evalAction(std::string, PyObject *args=NULL, PyObject *kwargs=NULL)
PyPluginHandler::evalAction it evaluates python callback linked to action [ passed to a python callba...
Definition: pypluginhandler.cpp:264
PyPluginHandler::getChecked
bool getChecked(std::string n)
PyPluginHandler::getChecked.
Definition: pypluginhandler.cpp:312
PyPluginHandler::getActionHelp
PyObject * getActionHelp(std::string n)
PyPluginHandler::getActionHelp.
Definition: pypluginhandler.cpp:370
PyPluginHandler::execAction
bool execAction(std::string, PyObject *dict_args=NULL, PyObject *dict_retval=NULL)
PyPluginHandler::execAction : it executes function linked to the action by using dictionaries as inpu...
Definition: pypluginhandler.cpp:206
PyPluginHandler::onAction
bool onAction(std::string)
PyPluginHandler::onAction : perform action with no arguments.
Definition: pypluginhandler.cpp:103
PyPluginHandler::names
std::vector< std::string > names()
PyPluginHandler::names.
Definition: pypluginhandler.cpp:405
PyPluginHandler::setChecked
bool setChecked(std::string n, bool)
PyPluginHandler::setChecked.
Definition: pypluginhandler.cpp:332
PyPluginHandler::isCheckable
bool isCheckable(std::string n)
PyPluginHandler::isCheckable.
Definition: pypluginhandler.cpp:356
fromICDDictionaryToPyDict
void fromICDDictionaryToPyDict(ICDDictionary dict, PyObject *pydict)
fromICDDictionaryToPyDict : Convert a ICDDictionary into a python dictionary object ...
Definition: pypluginhandler.cpp:51


Leonardo Platform Simulator ~ Python Interpreter API: D:/sources/LeoPlatSim__trunk/qtinterpreter/include/qinterpreter_common.h Source File

  • qtinterpreter
  • include
qinterpreter_common.h
Go to the documentation of this file.
1
9 #ifndef QT_INTERPRETER_COMMON_H
10 #define QT_INTERPRETER_COMMON_H
11 #pragma push_macro("slots")
12 #undef slots
13 #include <Python.h>
14 #pragma pop_macro("slots")
15 #include <string>
16 #include "interpreter_common.h"
17
18 class QPlainTextEdit;
19 class PySession;
20
21
22
29 extern void WriteToChannel(unsigned int ch,char *str);
30
36 extern char *ReadFromChannel(unsigned int ch);
37
40 extern int messageBox(const char *text,const char *caption=NULL, unsigned int btn_flag=0, unsigned int icon_flag=0);
41 extern PyObject *inputBox(const char *caption="InputBox",const char *text=NULL);
42 extern PyObject *openFileDialog(const char *caption="Open File",const char *dir=".", const char *filters="All Files (*)");
43 extern PyObject *saveFileDialog(const char *caption="Save File",const char *dir=".", const char *filters="All Files (*)");
44 extern PyObject *openDirDialog(const char *caption="Open Dir",const char *dir=".");
45
46
47 struct interpIO
48 {
49 QPlainTextEdit *output;
50 std::string input;
51 size_t last_output_str_sz;
52 bool wait_for_input;
53 bool interactive;
54 PySession *session;
55 };
56
57 int PyQtInterpreter__LoadInterpreterModule(PySession *);
58 interpIO* PyQtInterpreter__NewInterpIO(bool is_interactive, QPlainTextEdit *cls);
59 unsigned int PyQtInterpreter__SetChannel(interpIO *);
60 int PyQtInterpreter__CreatePyStdioCatcher(PySession *, unsigned int channel);
61
62 #endif // QT_INTERPRETER_COMMON_H
messageBox
int messageBox(const char *text, const char *caption=NULL, unsigned int btn_flag=0, unsigned int icon_flag=0)
messageBox
Definition: qinterpreter_common.cpp:284
saveFileDialog
PyObject * saveFileDialog(const char *caption="Save File", const char *dir=".", const char *filters="All Files (*)")
SaveFileDialog : it open a dialog that will return a file name selected by the user. The file does not have to exist.
Definition: qinterpreter_common.cpp:323
ReadFromChannel
char * ReadFromChannel(unsigned int ch)
Read the string from the channel ch, or standard input otherwise.
Definition: qinterpreter_common.cpp:174
inputBox
PyObject * inputBox(const char *caption="InputBox", const char *text=NULL)
InputBox: it provides a simple convenience dialog to get a single value from the user.
Definition: qinterpreter_common.cpp:348
openFileDialog
PyObject * openFileDialog(const char *caption="Open File", const char *dir=".", const char *filters="All Files (*)")
openFileDialog : it open a dialog that returns an existing file selected by the user. If the user presses Cancel, it returns a null string.
Definition: qinterpreter_common.cpp:311
openDirDialog
PyObject * openDirDialog(const char *caption="Open Dir", const char *dir=".")
openDirDialog : it open a dialog that returns an existing file selected by the user. If the user presses Cancel, it returns a null string.
Definition: qinterpreter_common.cpp:335
WriteToChannel
void WriteToChannel(unsigned int ch, char *str)
Write the string str (included the line-feed), to the output device pointed by the channel or standar...
Definition: qinterpreter_common.cpp:153
interpIO
Definition: qinterpreter_common.h:47


Leonardo Platform Simulator ~ Python Interpreter API: Member List

interpIO Member List

This is the complete list of members for interpIO, including all inherited members.