Process Control
[Utils]

This module is an interface for launching other modules. More...

Collaboration diagram for Process Control:

Data Structures

struct  module_base
struct  processcontrol_information_message
 This is a test message, Here you insert the description of the entity, in this case the struct. More...
struct  processcontrol_command_message
 This is a test message, Here you insert the description of the entity, in this case the struct. More...

Files

file  processcontrol_interface.cpp
 

interface.c file for this module. Defines public funtions this module's interface library makes available to other modules.


file  processcontrol_interface.h
 

interface.h file for this module. Defines public funtions prototypes this module's interface library makes available to other modules.


file  processcontrol_messages.h
 

messages.h file for this module. Defines messages this module publishes or serves to others.


Defines

#define SLEEP   0.5
#define null   NULL
#define DISABLE   0
#define ACTIVE_WITHOUT_PID   1
#define ACTIVE_WITH_PID   2
#define SLEEPING   3
#define RUNNING   4
#define SHELL_OPEN   1
#define SHELL_CLOSED   -1
#define NO_SHELL   -2
#define INFO_MESSAGE_SIZE   4096
#define DELAY   100000
#define SILLENT_START   0
#define NORMAL_START   1
#define TIMEOUT   200
#define MAX_NUMBER_FILES   20
#define EXTERN   extern
#define PROCESS_START   1
#define PROCESS_CLOSE   2
#define PROCESS_CLOSE_SHELL   3
#define PROCESS_UPDATE_COMMAND   4
#define PROCESS_UPDATE_RUNSTARTPUP   5
#define PROCESS_UPDATE_SILLENT   6
#define PROCESS_UPDATE_XPOS   7
#define PROCESS_UPDATE_YPOS   8
#define PROCESS_UPDATE_HEIGHT   9
#define PROCESS_UPDATE_WIDTH   10
#define PROCESSCONTROL_RESET_OCCURRED_NAME   "processcontrol_reset_occurred"
 Control message to pass to the process control module. Always capitals finishes with _RESET_OCCURRED_NAME and the value is small letters the same without the suffix name.
#define PROCESSCONTROL_RESET_COMMAND_NAME   "processcontrol_reset_command"
 Control message to pass to the process control module. Always capitals finishes with _RESET_COMMAND_NAME and the value is small letters the same without the suffix name.
#define PROCESSCONTROL_INFORMATION_MESSAGE_NAME   "processcontrol_information"
 Name of the message passed to IPC. Always capitals finishes with _MESSAGE_NAME and the value is small letters the same without the suffix.
#define PROCESSCONTROL_INFORMATION_MESSAGE_FMT   "{int,string,double,string}"
 Format of the message passed to IPC. Always capitals finishes with _MESSAGE_FMT and the value is given similar to the one bellow. For more information view the IPC manual.
#define PROCESSCONTROL_COMMAND_MESSAGE_NAME   "processcontrol_command"
 Name of the message passed to IPC. Always capitals finishes with _MESSAGE_NAME and the value is small letters the same without the suffix.
#define PROCESSCONTROL_COMMAND_MESSAGE_FMT   "{int,string,string,int,double,string}"
 Format of the message passed to IPC. Always capitals finishes with _MESSAGE_FMT and the value is given similar to the one bellow. For more information view the IPC manual.

Typedefs

typedef struct module_base module
typedef carmen_default_message processcontrol_reset_occurred_message
typedef carmen_default_message processcontrol_reset_command_message

Enumerations

enum  TYPE_command {
  START_MODULE, STOP_MODULE, CLOSE_SHELL, INIT,
  UPDATE_COMMAND, UPDATE_RUNSTARTUP, UPDATE_SILENT, UPDATE_XPOS,
  UPDATE_YPOS, UPDATE_HEIGHT, UPDATE_WIDTH
}

Functions

int main (int argc, char *argv[])
int module_list_to_message (processcontrol_information_message *message)
void command_handler (void)
void void_handler (int)
int module_to_file (char *file_name, module *list, const char *mode)
int module_from_file (char *file_name, module **list)
void add (module **list, int pid, char *reference_name, char *command, int status, int xpos, int ypos, int widht, int height, int run_on_startup, int sillent)
char * read_line (FILE *buffer)
int sillent_start (module *list, char *reference_name)
int close_shell (char *reference_name)
int stop_module (char *reference_name)
int start_module (char *reference_name)
bool istrue (int i)
void startup_start_modules (void)
modulefind_module (char *ref)
void read_pid (void)
void on_signal (int x)
int processcontrol (int argc, char *argv[])
void close_modules (GtkWidget *, gchar *)
void close_all (GtkWidget *, gchar *)
void entry_ref_callback (GtkWidget *, gchar *)
void entry_command_callback (GtkWidget *widget, gchar *)
void button_runstart_callback (GtkWidget *widget, gchar *)
void button_sillent_callback (GtkWidget *widget, gchar *)
void entry_xpos_callback (GtkWidget *widget, gchar *)
void entry_ypos_callback (GtkWidget *widget, gchar *)
void entry_height_callback (GtkWidget *widget, gchar *)
void entry_width_callback (GtkWidget *widget, gchar *)
void set_active_module (char *ref)
gint main_timeout (gpointer)
void update_interface ()
void on_destroy (GtkWidget *, gpointer)
GtkWidget * create_parameter_list ()
void make_vbox (module *list)
void module_pressed (GtkWidget *, gpointer data)
void show_propreties (GtkWidget *, gpointer data)
void read_status ()
bool check_status (int pid)
void read_all_pids (void)
bool set_status (char *ref, int status)
void read_line (FILE *buffer, char *line)
void copy (int n, char *first, char *second)
int sillent_start (char *reference_name)
int get_uris (gchar list[MAX_NUMBER_FILES][1024])
char * select_ini_file (void)
int main (int argc, char **argv)
void start_processcontrol_base (char *ini_file)
void simple_kill (int)
void on_extern_signal (int)
gboolean ipc_sleep (gpointer)
int send_command (TYPE_command command, void *data)
void information_handler (void)
int module_in_list (char *ref_name)
void update_module (int pid, int shell_pid, char *reference_name, char *command, int status, int shell_status, int xpos, int ypos, int widht, int height, int run_on_startup, int sillent)
void complete_add (module **list, int pid, int shell_pid, char *reference_name, char *command, int status, int shell_status, int xpos, int ypos, int widht, int height, int run_on_startup, int sillent)
int interface (int child_pid)
int processcontrol_subscribe_information (processcontrol_information_message *msg, carmen_handler_t handler, carmen_subscribe_t subscribe_how)
 Subscribes processcontrol_information_message messages. Uses broadcast to all subscribers. Can be used by other modules.
int processcontrol_publish_information (processcontrol_information_message *msg)
 Publishes processcontrol_information_message messages. Uses broadcast to all subscribers. Usually is only used by processcontrol.
int processcontrol_subscribe_command (processcontrol_command_message *msg, carmen_handler_t handler, carmen_subscribe_t subscribe_how)
 Subscribes processcontrol_command_message messages. Uses broadcast to all subscribers. Can be used by other modules.
int processcontrol_publish_command (processcontrol_command_message *msg)
 Publishes processcontrol_command_message messages. Uses broadcast to all subscribers. Usually is only used by processcontrol.

Variables

char ini_file_name [100]
processcontrol_information_message processcontrol_info_message
processcontrol_command_message command_message
char module_base::reference_name [512]
int module_base::pid
int module_base::shell_pid
int module_base::xpos
int module_base::ypos
int module_base::height
int module_base::widht
char module_base::command [1024]
int module_base::status
int module_base::shell_status
int module_base::sillent
int module_base::id_count
GtkWidget * module_base::button
struct module_basemodule_base::next
modulemodule_list
bool wait = TRUE
EXTERN
processcontrol_information_message 
processcontrol_info_message
EXTERN modulemodule_list
EXTERN
processcontrol_command_message 
command_message
EXTERN char ini_file_name [100]
EXTERN char active_module [1024]
EXTERN GtkWidget * entry_ref
EXTERN GtkWidget * entry_command
EXTERN GtkWidget * button_runstart
EXTERN GtkWidget * button_sillent
EXTERN GtkWidget * entry_xpos
EXTERN GtkWidget * entry_ypos
EXTERN GtkWidget * entry_height
EXTERN GtkWidget * entry_width
EXTERN GtkWidget * boxv_main
EXTERN GtkWidget * frame
EXTERN int handler_id_runstart
EXTERN int handler_id_sillent
char * processcontrol_information_message::modules
double processcontrol_information_message::timestamp
char * processcontrol_information_message::host
char * processcontrol_command_message::reference_name
char * processcontrol_command_message::string
int processcontrol_command_message::number
double processcontrol_command_message::timestamp
char * processcontrol_command_message::host

Detailed Description

This module is an interface for launching other modules.


Define Documentation

#define ACTIVE_WITH_PID   2

Referenced by start_module().

#define ACTIVE_WITHOUT_PID   1

Referenced by start_module().

#define DELAY   100000

Referenced by read_pid().

#define DISABLE   0
#define EXTERN   extern
#define INFO_MESSAGE_SIZE   4096
#define MAX_NUMBER_FILES   20

Referenced by select_ini_file().

#define NO_SHELL   -2
#define NORMAL_START   1

Referenced by main(), and start_module().

#define null   NULL
#define PROCESS_CLOSE   2
#define PROCESS_CLOSE_SHELL   3
#define PROCESS_START   1
#define PROCESS_UPDATE_COMMAND   4
#define PROCESS_UPDATE_HEIGHT   9
#define PROCESS_UPDATE_RUNSTARTPUP   5
#define PROCESS_UPDATE_SILLENT   6
#define PROCESS_UPDATE_WIDTH   10
#define PROCESS_UPDATE_XPOS   7
#define PROCESS_UPDATE_YPOS   8
#define PROCESSCONTROL_COMMAND_MESSAGE_FMT   "{int,string,string,int,double,string}"

Format of the message passed to IPC. Always capitals finishes with _MESSAGE_FMT and the value is given similar to the one bellow. For more information view the IPC manual.

#define PROCESSCONTROL_COMMAND_MESSAGE_NAME   "processcontrol_command"

Name of the message passed to IPC. Always capitals finishes with _MESSAGE_NAME and the value is small letters the same without the suffix.

#define PROCESSCONTROL_INFORMATION_MESSAGE_FMT   "{int,string,double,string}"

Format of the message passed to IPC. Always capitals finishes with _MESSAGE_FMT and the value is given similar to the one bellow. For more information view the IPC manual.

#define PROCESSCONTROL_INFORMATION_MESSAGE_NAME   "processcontrol_information"

Name of the message passed to IPC. Always capitals finishes with _MESSAGE_NAME and the value is small letters the same without the suffix.

#define PROCESSCONTROL_RESET_COMMAND_NAME   "processcontrol_reset_command"

Control message to pass to the process control module. Always capitals finishes with _RESET_COMMAND_NAME and the value is small letters the same without the suffix name.

#define PROCESSCONTROL_RESET_OCCURRED_NAME   "processcontrol_reset_occurred"

Control message to pass to the process control module. Always capitals finishes with _RESET_OCCURRED_NAME and the value is small letters the same without the suffix name.

#define RUNNING   4

Referenced by read_status(), and start_module().

#define SHELL_CLOSED   -1

Referenced by close_shell(), and read_status().

#define SHELL_OPEN   1

Referenced by read_pid(), read_status(), and start_module().

#define SILLENT_START   0

Referenced by main().

#define SLEEP   0.5
#define SLEEPING   3

Referenced by read_status(), and start_module().

#define TIMEOUT   200

Typedef Documentation

typedef struct module_base module
typedef carmen_default_message processcontrol_reset_command_message
typedef carmen_default_message processcontrol_reset_occurred_message

Enumeration Type Documentation

Enumerator:
START_MODULE 
STOP_MODULE 
CLOSE_SHELL 
INIT 
UPDATE_COMMAND 
UPDATE_RUNSTARTUP 
UPDATE_SILENT 
UPDATE_XPOS 
UPDATE_YPOS 
UPDATE_HEIGHT 
UPDATE_WIDTH 

Function Documentation

void add ( module **  list,
int  pid,
char *  reference_name,
char *  command,
int  status,
int  xpos,
int  ypos,
int  widht,
int  height,
int  run_on_startup,
int  sillent 
)

Referenced by module_from_file().

Here is the caller graph for this function:

void button_runstart_callback ( GtkWidget *  widget,
gchar *   
)
void button_sillent_callback ( GtkWidget *  widget,
gchar *   
)
bool check_status ( int  pid  ) 

References FALSE, and TRUE.

Referenced by close_shell().

Here is the caller graph for this function:

void close_all ( GtkWidget *  ,
gchar *   
)

Referenced by main().

Here is the caller graph for this function:

void close_modules ( GtkWidget *  ,
gchar *   
)

Referenced by main().

Here is the caller graph for this function:

int close_shell ( char *  reference_name  ) 

References check_status(), DISABLE, find_module(), module_base::pid, SHELL_CLOSED, module_base::shell_pid, module_base::shell_status, and module_base::status.

Referenced by on_signal(), and start_module().

Here is the call graph for this function:

Here is the caller graph for this function:

void command_handler ( void   ) 
void complete_add ( module **  list,
int  pid,
int  shell_pid,
char *  reference_name,
char *  command,
int  status,
int  shell_status,
int  xpos,
int  ypos,
int  widht,
int  height,
int  run_on_startup,
int  sillent 
)
void copy ( int  n,
char *  first,
char *  second 
)

Referenced by module_from_file().

Here is the caller graph for this function:

GtkWidget * create_parameter_list (  ) 

Referenced by main().

Here is the caller graph for this function:

void entry_command_callback ( GtkWidget *  widget,
gchar *   
)
void entry_height_callback ( GtkWidget *  widget,
gchar *   
)
void entry_ref_callback ( GtkWidget *  ,
gchar *   
)

TODO currently not working

void entry_width_callback ( GtkWidget *  widget,
gchar *   
)
void entry_xpos_callback ( GtkWidget *  widget,
gchar *   
)
void entry_ypos_callback ( GtkWidget *  widget,
gchar *   
)
module * find_module ( char *  ref  ) 

References module_list, module_base::next, and module_base::reference_name.

Referenced by close_shell(), read_pid(), start_module(), and stop_module().

Here is the caller graph for this function:

int get_uris ( gchar  list[MAX_NUMBER_FILES][1024]  ) 

References dir, and i.

Referenced by select_ini_file().

Here is the caller graph for this function:

void information_handler ( void   ) 

Referenced by main().

Here is the caller graph for this function:

int interface ( int  child_pid  ) 

Referenced by logger::GetSensors(), and logger::WriteSensor().

Here is the caller graph for this function:

gboolean ipc_sleep ( gpointer   ) 

Referenced by main().

Here is the caller graph for this function:

bool istrue ( int  i  ) 

References FALSE, and TRUE.

Referenced by startup_start_modules().

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)
int main ( int  argc,
char *  argv[] 
)

References i, key(), NORMAL_START, r, shm, and SILLENT_START.

Here is the call graph for this function:

gint main_timeout ( gpointer   ) 
void make_vbox ( module list  ) 

Referenced by main().

Here is the caller graph for this function:

int module_from_file ( char *  file_name,
module **  list 
)
int module_in_list ( char *  ref_name  ) 
int module_list_to_message ( processcontrol_information_message message  ) 
void module_pressed ( GtkWidget *  ,
gpointer  data 
)
int module_to_file ( char *  file_name,
module list,
const char *  mode 
)
void on_destroy ( GtkWidget *  ,
gpointer   
)
void on_extern_signal ( int   ) 

Referenced by main().

Here is the caller graph for this function:

void on_signal ( int  x  ) 
int processcontrol ( int  argc,
char *  argv[] 
)
int processcontrol_publish_command ( processcontrol_command_message msg  ) 

Publishes processcontrol_command_message messages. Uses broadcast to all subscribers. Usually is only used by processcontrol.

Parameters:
msg Pointer to message.
Returns:
nothing
int processcontrol_publish_information ( processcontrol_information_message msg  ) 

Publishes processcontrol_information_message messages. Uses broadcast to all subscribers. Usually is only used by processcontrol.

Parameters:
msg Pointer to message.
Returns:
nothing
int processcontrol_subscribe_command ( processcontrol_command_message msg,
carmen_handler_t  handler,
carmen_subscribe_t  subscribe_how 
)

Subscribes processcontrol_command_message messages. Uses broadcast to all subscribers. Can be used by other modules.

Parameters:
msg Pointer to message. When a new message is received the variable msg is filled with the new command.
handler pointer to function that should be executed when a message is received. If NULL no function is called.
subscribe_how Value that says if all messages are to be received CARMEN_SUBSCRIBE_ALL or if only the more recent is important CARMEN_SUBSCRIBE_LATEST.
int processcontrol_subscribe_information ( processcontrol_information_message msg,
carmen_handler_t  handler,
carmen_subscribe_t  subscribe_how 
)

Subscribes processcontrol_information_message messages. Uses broadcast to all subscribers. Can be used by other modules.

Parameters:
msg Pointer to message. When a new message is received the variable msg is filled with the new information.
handler pointer to function that should be executed when a message is received. If NULL no function is called.
subscribe_how Value that says if all messages are to be received CARMEN_SUBSCRIBE_ALL or if only the more recent is important CARMEN_SUBSCRIBE_LATEST.

Referenced by main().

Here is the caller graph for this function:

void read_all_pids ( void   ) 
void read_line ( FILE *  buffer,
char *  line 
)
char* read_line ( FILE *  buffer  ) 
void read_pid ( void   ) 

References _LAR_TEXT_RED_, DELAY, find_module(), module_base::pid, printnc, module_base::reference_name, SHELL_OPEN, module_base::shell_pid, module_base::shell_status, and wait.

Referenced by on_signal().

Here is the call graph for this function:

Here is the caller graph for this function:

void read_status (  ) 
char* select_ini_file ( void   ) 

References _LAR_TEXT_GREEN_, _LAR_TEXT_RED_, error, filename, get_uris(), i, info, MAX_NUMBER_FILES, and printc.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

int send_command ( TYPE_command  command,
void *  data 
)

Referenced by main().

Here is the caller graph for this function:

void set_active_module ( char *  ref  ) 
bool set_status ( char *  ref,
int  status 
)
void show_propreties ( GtkWidget *  ,
gpointer  data 
)
int sillent_start ( char *  reference_name  ) 
int sillent_start ( module list,
char *  reference_name 
)

Referenced by start_module().

Here is the caller graph for this function:

void simple_kill ( int   ) 

Referenced by main().

Here is the caller graph for this function:

int start_module ( char *  reference_name  ) 
void start_processcontrol_base ( char *  ini_file  ) 

Referenced by main().

Here is the caller graph for this function:

void startup_start_modules ( void   ) 

References istrue(), module_list, module_base::next, module_base::reference_name, module_base::run_on_startup, and start_module().

Here is the call graph for this function:

int stop_module ( char *  reference_name  ) 

References DISABLE, find_module(), module_base::pid, and module_base::status.

Referenced by on_signal().

Here is the call graph for this function:

Here is the caller graph for this function:

void update_interface (  ) 

Referenced by main().

Here is the caller graph for this function:

void update_module ( int  pid,
int  shell_pid,
char *  reference_name,
char *  command,
int  status,
int  shell_status,
int  xpos,
int  ypos,
int  widht,
int  height,
int  run_on_startup,
int  sillent 
)
void void_handler ( int   ) 

Variable Documentation

EXTERN char active_module[1024]
EXTERN GtkWidget* boxv_main

Referenced by main().

GtkWidget* module_base::button [inherited]
EXTERN GtkWidget* button_runstart
EXTERN GtkWidget* button_sillent
char module_base::command[1024] [inherited]
EXTERN GtkWidget* entry_command
EXTERN GtkWidget* entry_height
EXTERN GtkWidget* entry_ref
EXTERN GtkWidget* entry_width
EXTERN GtkWidget* entry_xpos
EXTERN GtkWidget* entry_ypos
EXTERN GtkWidget* frame

Referenced by main().

EXTERN int handler_id_runstart
EXTERN int handler_id_sillent
int module_base::height [inherited]

Host computer name from where the message was sent. Always here and given by carmen_get_host()

Host computer name from where the message was sent. Always here and given by carmen_get_host()

int module_base::id_count [inherited]
EXTERN char ini_file_name[100]
char ini_file_name[100]
struct module_base* module_base::next [inherited]
int module_base::pid [inherited]

Referenced by main().

char module_base::reference_name[512] [inherited]
int module_base::shell_pid [inherited]

Referenced by close_shell(), read_pid(), and read_status().

int module_base::shell_status [inherited]
int module_base::sillent [inherited]
int module_base::status [inherited]

timestamp of message. Should always be here and indicates the message time given by carmen_get_time()

timestamp of message. Should always be here and indicates the message time given by carmen_get_time()

bool wait = TRUE

Referenced by main(), read_pid(), and start_module().

int module_base::widht [inherited]
int module_base::xpos [inherited]
int module_base::ypos [inherited]
Generated on Wed Jun 2 12:43:28 2010 for LAR Atlas by  doxygen 1.6.3