daemon: cmd_start_app -> cmd_change_app_state

This commit is contained in:
Nedko Arnaudov 2010-05-08 21:28:56 +03:00
parent df1c44647b
commit d2782283a7
4 changed files with 12 additions and 4 deletions

View File

@ -625,7 +625,7 @@ static void start_app(struct dbus_method_call * call_ptr)
return;
}
if (ladish_command_start_app(call_ptr, ladish_studio_get_cmd_queue(), supervisor_ptr->opath, id))
if (ladish_command_change_app_state(call_ptr, ladish_studio_get_cmd_queue(), supervisor_ptr->opath, id, LADISH_APP_STATE_STARTED))
{
method_return_new_void(call_ptr);
}

View File

@ -80,6 +80,6 @@ ladish_command_new_app(
const char * name,
uint8_t level);
bool ladish_command_start_app(void * call_ptr, struct ladish_cqueue * queue_ptr, const char * opath, uint64_t id);
bool ladish_command_change_app_state(void * call_ptr, struct ladish_cqueue * queue_ptr, const char * opath, uint64_t id, unsigned int target_state);
#endif /* #ifndef CMD_H__28542C9B_7CB8_40F8_BBB6_DCE13CBB1E7F__INCLUDED */

View File

@ -35,6 +35,7 @@ struct ladish_command_start_app
struct ladish_command command; /* must be the first member */
char * opath;
uint64_t id;
unsigned int target_state;
};
#define cmd_ptr ((struct ladish_command_start_app *)context)
@ -48,6 +49,12 @@ static bool run(void * context)
log_info("start_app command. opath='%s'", cmd_ptr->opath);
if (cmd_ptr->target_state != LADISH_APP_STATE_STARTED)
{
log_error("ATM only starting apps is implemented in the change app state command");
return false;
}
if (!ladish_studio_is_started())
{
log_error("cannot start app because studio is not started", cmd_ptr->opath);
@ -96,7 +103,7 @@ static void destructor(void * context)
#undef cmd_ptr
bool ladish_command_start_app(void * call_ptr, struct ladish_cqueue * queue_ptr, const char * opath, uint64_t id)
bool ladish_command_change_app_state(void * call_ptr, struct ladish_cqueue * queue_ptr, const char * opath, uint64_t id, unsigned int target_state)
{
struct ladish_command_start_app * cmd_ptr;
char * opath_dup;
@ -119,6 +126,7 @@ bool ladish_command_start_app(void * call_ptr, struct ladish_cqueue * queue_ptr,
cmd_ptr->command.destructor = destructor;
cmd_ptr->opath = opath_dup;
cmd_ptr->id = id;
cmd_ptr->target_state = target_state;
if (!ladish_cqueue_add_command(queue_ptr, &cmd_ptr->command))
{

View File

@ -232,7 +232,7 @@ def build(bld):
'cmd_stop_studio.c',
'cmd_unload_studio.c',
'cmd_new_app.c',
'cmd_start_app.c',
'cmd_change_app_state.c',
'cmd_exit.c',
'cqueue.c',
'app_supervisor.c',