Contributors: Stefan Ruppin
Contributors Stefan Ruppin
Contributors Stefan Ruppin
Bases: builtins.object
Processes alive response from processes/plugins and GUI, organising the counter, i.e. increment GUI counter if alive event’s origin is GUI, otherwise increment counter stored in dplugin object
Alive events that were sent by plugins are the response on alive request which were sent by the core alive timer. An alive event indicates that the plugin is still running and responding to requests.
Parameters: | event (PapiEventBase) – event to process |
---|
This functions processes a close_program event from GUI and sends events to all processes to close themselves
The GUI can request the close to quit PaPI.
The method will request all other processes to stop their execution and to close.
Parameters: | event (PapiEventBase) – event to process |
---|
Processes create_plugin event. So it will create a plugin, start a process if needed, send events to GUI to create a plugin and do the pre configuration
This method reacts to the create plugin event. Such an event, is mostly sent by the GUI.
The method extracts all the necessary plugin properties from the event. Then, the yapsy plugin loader tries to find the plugin via its identifier. Afterwards, the PaPI dplugin object is created and filled with all information. It is decided if the plugin runs in the GUI or in an own process. Based on this, a new process is created or the plugin is redirected to the GUI process. The startup configurations are merged and passed to the plugin.
Parameters: |
|
---|---|
Returns: | -1: Error |
First stage of event processing, deciding which data_event this is
Parameters: | event (PapiEventBase) – event to process |
---|
Processes delete_block event.
The event is sent by a plugin if the plugin wants to delete one of its own blocks (plugin updates itself).
The methods searches in the dplugin object for the block and deletes it. Before deletion, all block subscriptions are cut loose to ensure that no dead links are created.
Parameters: | event (PapiEventBase) – event to process |
---|
Processes delete parameter event.
The event is sent by a plugin if the plugin wants to delete one of its own parameter (plugin updates itself).
The methods searches in the dplugin object for the parameter and deletes it. Before deletion, all parameter subscriptions are cut loose to ensure that no dead links are created.
Parameters: | event (PapiEventBase) – event to process |
---|---|
Returns: |
This function processes edit plugin events and acts like a wrapper for the ‘__process_edit_dplugin’ function which requires plugin ids instead of unames.
Documentation of what the method does can be found in the method: __process_edit_dplugin
Parameters: | event – |
---|---|
Returns: |
Initial stage of event processing, dividing by event type Extracts event type and give it to a switch case equivalent
Parameters: | event (PapiEventBase) – event to process |
---|
First stage of event processing, deciding which instr_event this is. Therefore, the method extracts the event operation and processes it.
Parameters: | event (PapiEventBase) – event to process |
---|
Process join requests of processes
A join request is send from a plugin which will close itself. The requests wants the core to join the process of the plugin for clean-up reasons. Therefore, the join request is just send by plugins running in an own process (and not in the GUI).
The method is searching for the dplugin object in the core database to get the corresponding process object. Then, the method joins the process. Note, that a join request is the last action of a plugin to ensure that the core is not blocked by the process join procedure. Afterwards, the plugin will be removed from the core’s database. A event is send to the GUI process to inform the GUI about the closed and removed plugin.
Parameters: | event (PapiEventBase) – event to process |
---|
Processes new_block event. Will try to add a new data block to a DPlugin object
This event is a request from a plugin to create a new block.
The method receives all block information via the event. It searches the corresponding pluign and add the blocks
Parameters: | event (PapiEventBase) – event to process |
---|
Process new_data event from plugins. Will do the routing: Subscriber/Subscription
This method is doing all the magic in PaPI. It routes all data to its target and decides whether subscription are for data or parameters.
First, it is checked if the GUI is alive, since no data shall be processed if the GUI is already closed. Then, the dplugin object of the origin of the data event is searched. Then, the block of the new data is searched. With the block object of the origin plugin, the subscriber list can be extracted. Then, for every subscriber of the block (which has new data available), the plugin object is searched. If a subscriber plugin is running (not dead/stopped), the data event is routed to it. For subscriber running in the GUI, just one event is sent with multiple receipts. Data events which represent parameter subscriptions are handles separately.
Parameters: | event (PapiEventBase) – event to process |
---|
Processes new parameter event. Adding a new parameter to DPluign in DCore and updating GUI information
Parameters: | event (PapiEventBase) – event to process |
---|
Processes pause_plugin event. Will add information that a plugin is paused and send event to plugin to pause it.
Pause events are request from the GUI to pause a plugin. Paused plugins will not execute its execution function and thus, lower the computational load.
Parameters: | event (PapiEventBase) – event to process |
---|
Process plugin_stopped event. Will change plugins state and delete its parameters and blocks. Will update meta to gui
The event is the result of a stop request of a plugin. A plugin which is request to stop its operation (no deletion) sends the plugin stopped event to confirm that it has stopped its operation.
The method searches the plugin in the database and updates its state. Additionally, all subscribers, blocks and parameter are removed/delete.
Parameters: | event (PapiEventBase) – Incomming event |
---|---|
Returns: |
Processes resume_plugin event. Will add information that a plugin is resumed and send event to plugin to resume it.
Resumes a paused plugin to make it work again. So, the plugin will execute its main functions again.
Parameters: | event (PapiEventBase) – event to process |
---|
Process set_parameter event. Core will just route this event from GUI to destination plugin and update DCore
The set parameter event is sent from plugins to some plugins to trigger parameter changes.
First, the method checks whether the event is an event by uname or by id. When the event is by uname, it is modified to be by id. If the plugin which the event refers to is not started yet, the event is put in the delayed operation queue. Then, the correct dplugin object and an event by id is available. The dplugin object is searched for the parameter which is changed. If the parameter exists, its value in the database is changed and then, the change event is redirected to the plugin itself.
Parameters: | event (PapiEventBase) – event to process |
---|
Process start failed event and do error handling
This event occurs when a plugin returns false in its initialize routine. Therefore, it means that the start of failed but the plugin noticed it itself and was able to return false.
This method will update the core database with the new state of the plugin. At the moment, no other actions are done.
Parameters: | event (PapiEventBase) – event to process |
---|
Processes start event for a plugin.
The start plugin event is a request for the core to send a start event to a plugin. The plugin will be started by receiving the event, i.e. it will call its initialize function and start its execution afterwards.
The methods searches the plugin in the database and checks wheter it has its own process or not. Then, it will send an event to the corresponding queue to tell the plugin it should start.
Parameters: | event (PapiEventBase) – Incomming event |
---|---|
Returns: |
Process start_successful event.
A start_successful event is sent by plugins after their initialize function returned ‘true’ indicating a successful start of the plugin before continuing with its main execution routine.
Parameters: | event (PapiEventBase) – event to process |
---|
First stage of event processing, deciding which status_event this is. Therefore, the method extracts the event operation and processes it.
Parameters: | event (PapiEventBase) – event to process |
---|
Process stop_plugin event. Will send an event to destination plugin to close itself. Will lead to a join request of this plugin.
A stop plugin event is sent by the GUI to the core to request the core to stop a plugin. ‘Stop’ means that: either the plugin is just stopped and not deleted or the plugin execution is stopped and the is deleted from the database (i.e. it is cleaned). It is determines by a flag which of them is used.
The methods searches for the dplugin object in the core database. If the plugin runs in an own process, the stop event is redirected to the corresponding plugin (to notify it to close itself). The core will cut all subscriptions&subscribers loose and update the gui data with the new plugin state. If the plugin is not running in an own process (runs in GUI), the event is checked for the delete flag. If the delete flag is set, the method will send a close request to the plugin. If not, the plugin will receive a customized stop event. The state will be modified and updated to the GUI.
Parameters: | event (PapiEventBase) – event to process |
---|
Just a wrapper function for ‘__process_stop_plugin__’ to use the uname instead of a plugin id.
Parameters: | event – |
---|---|
Returns: |
Process subscribe_event.
The event is sent to create new data connections between plugins.
The method will call the functional method ‘new_subscription’ will the necessary arguments, like SourceID, Block, Signals, Alias
Parameters: | event (PapiEventBase) – event to process |
---|
Process subscribe_event. Uses uname instead of IDs
The event is sent to create new data connections between plugins.
The method will call the functional method ‘new_subscription’ will the necessary arguments, like SourceID, Block, Signals, Alias
Parameters: | event (PapiEventBase) – event to process |
---|
Process unsubscribe_event. Will try to remove a subscription from DCore
Parameters: | event (PapiEventBase) – event to process |
---|
Callback function for check_alive status timer, get called every time the timer triggers, does sth and starts a new timer. Handles sending events to processes and checking their answer.
Returns: |
---|
Process all events which are in the delayed operation queue by poping them out and inserting them to the main core event queue ‘core_event_queue’ :return:
Error handler for the case that the gui is dead. The handler gets called by the method ‘handle_alive_situation’ in case the gui counter does not match
Returns: |
---|
Function which handles the check for the alive situation of all plugins in data base Will distribute to error_handling methods to handle dead processes This is no callback functions, more a rather periodically called method to check the alive situation. Is called by the handler which handles the alive timer callbacks
It checks the counter of the plugins and compares them against the core counter. A not equal (normally smaller) number in the plugin object indicates a dead process. A error handler is called.
Returns: |
---|
This function should be called whenever there is a new_data event for changing a parameter value This function changes the value in DCore and updates this information to the GUI via a meta update
Parameters: |
|
---|---|
Returns: | -1 for error(parameter with parameter_name does not exist in plugin), 1 for o.k., done |
Gets information of a new and desired subscription. This method will try to create the wanted subscription.
Parameters: |
|
---|---|
Returns: |
Error handler for the case that the a plugin is dead. The handler gets called by the method ‘handle_alive_situation’ in case the plugin counter does not match
Parameters: | dplug (DPlugin) – Plugin which is dead |
---|---|
Returns: |
Function for check_alive_status timer to send check_alive events to all running processes This will trigger all correctly running processes to send an answer to core. Alive response is handled in method ‘__process_alive__’ :return:
Callback-handler for signal from cmd line like e.g. SIGINT :return:
On call, this function sends the meta information of the plugin with pl_id to the GUI With meta information is meant: all data in the dplugin object which is not process related (e.g. ids, names, states, subscriptions) The methods should be called everywhere, where some of those information are changed and a update in other processes is required/wanted. Additionally, subscriber of the plugin ‘pl_id’ are informed/
The methods takes the dplugin specified by its id and extracts all the meta data. Then, sends the updated meta data to the gui. Afterwards, if required, the subscriber will be informed by calling this methods (some kind of recursive) again with another id.
Parameters: |
|
---|---|
Returns: |
Contributors Stefan Ruppin
Contributors: Stefan Ruppin Sven Knuth
Contributors: <Stefan Ruppin