#include <idlescript.h>
Inheritance diagram for IdleScript:
Public Member Functions | |
IdleScript (ostream &debug, unsigned short debug_level, ostream &error, Capi *capi, string idlescript, int idlescript_interval, PyThreadState *py_state, PycStringIO_CAPI *cStringIO) throw (ApplicationError) | |
Constructor. Create Object and start a detached thread. | |
virtual | ~IdleScript () |
Destructor. Destruct object. | |
void | requestTerminate (void) |
terminate thread | |
void | activate (void) |
reactivate the script execution in the case it was deactivated by too much errors | |
Private Member Functions | |
virtual void | run (void) throw () |
Thread body. Calls the python function idle(). | |
Private Attributes | |
PyThreadState * | py_state |
py_state of the main python interpreter used for run(). | |
string | idlescript |
name of the python script which is called at regular intervals | |
int | idlescript_interval |
interval between subsequent executions of idle script | |
Capi * | capi |
reference to Capi object | |
bool | active |
used to disable IdleScript in case of too much errors | |
pthread_t | thread_handle |
handle for the created pthread thread | |
Friends | |
void * | idlescript_exec_handler (void *) |
Thread exec handler for IdleScript class. | |
void | idlescript_cleanup_handler (void *) |
Thread clean handler for IdleScript class. |
Executes a given idle script at regular intervals thus giving the user the ability to do arbitrary things. The main use is surely initiating outgoing calls, e.g. to send faxes.
It creates one new thread which will execute the idle script over and over...
If the script fails too often, it's deactivated. After fixing the script, it can be reactivated with activate().
|
Constructor. Create Object and start a detached thread.
|
|
Destructor. Destruct object.
|
|
reactivate the script execution in the case it was deactivated by too much errors
|
|
terminate thread
|
|
Thread body. Calls the python function idle(). The read Python idle script must provide a function named idle with the following signature: def idle(capi): # function body The parameters given to the python function are:
The script is responsible for clearing each call it initiates, even in the exception handlers! If the call is disconnected by the other party, the Python exception CallGoneError is raised and should be caught by the script (don't forget to call disconnect() there). If the script produces too much errors in a row, it will be deactivated. Use activate() to re-enable. The python global lock will be acquired while the function runs. Reimplemented from PythonScript.
|
|
Thread clean handler for IdleScript class. This is a handler which is called by pthreads at cleanup. It will call this->final(). |
|
Thread exec handler for IdleScript class. This is a handler which will call this->run() for the use in pthread_create(). It will also register idlescript_cleanup_handler |
|
used to disable IdleScript in case of too much errors
|
|
reference to Capi object
|
|
name of the python script which is called at regular intervals
|
|
interval between subsequent executions of idle script
|
|
py_state of the main python interpreter used for run().
|
|
handle for the created pthread thread
|