This module is an interface for launching other modules. More...
![]() |
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) |
module * | find_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_base * | module_base::next |
module * | module_list |
bool | wait = TRUE |
EXTERN processcontrol_information_message | processcontrol_info_message |
EXTERN module * | module_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 |
This module is an interface for launching other modules.
#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 |
Referenced by close_shell(), module_from_file(), read_status(), start_module(), and stop_module().
#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 struct module_base module |
typedef carmen_default_message processcontrol_reset_command_message |
typedef carmen_default_message processcontrol_reset_occurred_message |
enum TYPE_command |
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 | |||
) |
void button_runstart_callback | ( | GtkWidget * | widget, | |
gchar * | ||||
) |
void button_sillent_callback | ( | GtkWidget * | widget, | |
gchar * | ||||
) |
bool check_status | ( | int | pid | ) |
void close_all | ( | GtkWidget * | , | |
gchar * | ||||
) |
void close_modules | ( | GtkWidget * | , | |
gchar * | ||||
) |
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().
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 | |||
) |
GtkWidget * create_parameter_list | ( | ) |
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().
int get_uris | ( | gchar | list[MAX_NUMBER_FILES][1024] | ) |
void information_handler | ( | void | ) |
int interface | ( | int | child_pid | ) |
Referenced by logger::GetSensors(), and logger::WriteSensor().
gboolean ipc_sleep | ( | gpointer | ) |
bool istrue | ( | int | i | ) |
int main | ( | int | argc, | |
char ** | argv | |||
) |
References _LAR_TEXT_RED_, boxv_main, close_all(), close_modules(), create_parameter_list(), FALSE, frame, information_handler(), INIT, ipc_sleep(), make_vbox(), module_list, null, on_destroy(), on_extern_signal(), printc, processcontrol_info_message, processcontrol_subscribe_information(), select_ini_file(), send_command(), simple_kill(), start_processcontrol_base(), update_interface(), and wait.
int main | ( | int | argc, | |
char * | argv[] | |||
) |
References i, key(), NORMAL_START, r, shm, and SILLENT_START.
gint main_timeout | ( | gpointer | ) |
int module_from_file | ( | char * | file_name, | |
module ** | list | |||
) |
References add(), module_base::command, copy(), DISABLE, module_base::height, read_line(), module_base::reference_name, module_base::run_on_startup, module_base::sillent, module_base::widht, module_base::xpos, and module_base::ypos.
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 | ) |
void on_signal | ( | int | x | ) |
References _LAR_TEXT_RED_, close_shell(), module_base::command, module_list, module_base::next, printnc, read_pid(), module_base::reference_name, and stop_module().
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.
msg | Pointer to message. |
int processcontrol_publish_information | ( | processcontrol_information_message * | msg | ) |
Publishes processcontrol_information_message messages. Uses broadcast to all subscribers. Usually is only used by processcontrol.
msg | Pointer to message. |
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.
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.
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().
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().
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().
int send_command | ( | TYPE_command | command, | |
void * | data | |||
) |
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 | |||
) |
void simple_kill | ( | int | ) |
int start_module | ( | char * | reference_name | ) |
Don't know why but without this, there is a bug with module launch
References ACTIVE_WITH_PID, ACTIVE_WITHOUT_PID, close_shell(), module_base::command, DISABLE, find_module(), module_base::height, NORMAL_START, module_base::pid, module_base::reference_name, RUNNING, SHELL_OPEN, module_base::shell_status, module_base::sillent, sillent_start(), SLEEPING, module_base::status, wait, module_base::widht, module_base::xpos, and module_base::ypos.
Referenced by startup_start_modules().
void start_processcontrol_base | ( | char * | ini_file | ) |
void startup_start_modules | ( | void | ) |
References istrue(), module_list, module_base::next, module_base::reference_name, module_base::run_on_startup, and start_module().
int stop_module | ( | char * | reference_name | ) |
References DISABLE, find_module(), module_base::pid, and module_base::status.
Referenced by on_signal().
void update_interface | ( | ) |
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 | ) |
EXTERN char active_module[1024] |
GtkWidget* module_base::button [inherited] |
EXTERN GtkWidget* button_runstart |
EXTERN GtkWidget* button_sillent |
char module_base::command[1024] [inherited] |
Referenced by module_from_file(), module_to_file(), on_signal(), and start_module().
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 int handler_id_runstart |
EXTERN int handler_id_sillent |
int module_base::height [inherited] |
Referenced by module_from_file(), module_to_file(), and start_module().
char* processcontrol_command_message::host [inherited] |
Host computer name from where the message was sent. Always here and given by carmen_get_host()
char* processcontrol_information_message::host [inherited] |
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] |
EXTERN module* module_list |
Referenced by find_module(), main(), on_signal(), read_status(), and startup_start_modules().
Referenced by find_module(), main(), on_signal(), read_status(), and startup_start_modules().
char* processcontrol_information_message::modules [inherited] |
struct module_base* module_base::next [inherited] |
Referenced by find_module(), module_to_file(), on_signal(), read_status(), and startup_start_modules().
int processcontrol_command_message::number [inherited] |
int module_base::pid [inherited] |
Referenced by close_shell(), read_pid(), read_status(), start_module(), and stop_module().
Referenced by main().
char* processcontrol_command_message::reference_name [inherited] |
char module_base::reference_name[512] [inherited] |
Referenced by find_module(), module_from_file(), module_to_file(), on_signal(), read_pid(), start_module(), and startup_start_modules().
int module_base::shell_pid [inherited] |
Referenced by close_shell(), read_pid(), and read_status().
int module_base::shell_status [inherited] |
Referenced by close_shell(), read_pid(), read_status(), and start_module().
int module_base::sillent [inherited] |
Referenced by module_from_file(), module_to_file(), read_status(), and start_module().
int module_base::status [inherited] |
Referenced by close_shell(), read_status(), start_module(), and stop_module().
char* processcontrol_command_message::string [inherited] |
double processcontrol_command_message::timestamp [inherited] |
timestamp of message. Should always be here and indicates the message time given by carmen_get_time()
double processcontrol_information_message::timestamp [inherited] |
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] |
Referenced by module_from_file(), module_to_file(), and start_module().
int module_base::xpos [inherited] |
Referenced by module_from_file(), module_to_file(), and start_module().
int module_base::ypos [inherited] |
Referenced by module_from_file(), module_to_file(), and start_module().