daemon: cmd_start_app -> cmd_change_app_state
This commit is contained in:
parent
df1c44647b
commit
d2782283a7
|
@ -625,7 +625,7 @@ static void start_app(struct dbus_method_call * call_ptr)
|
||||||
return;
|
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);
|
method_return_new_void(call_ptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,6 @@ ladish_command_new_app(
|
||||||
const char * name,
|
const char * name,
|
||||||
uint8_t level);
|
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 */
|
#endif /* #ifndef CMD_H__28542C9B_7CB8_40F8_BBB6_DCE13CBB1E7F__INCLUDED */
|
||||||
|
|
|
@ -35,6 +35,7 @@ struct ladish_command_start_app
|
||||||
struct ladish_command command; /* must be the first member */
|
struct ladish_command command; /* must be the first member */
|
||||||
char * opath;
|
char * opath;
|
||||||
uint64_t id;
|
uint64_t id;
|
||||||
|
unsigned int target_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define cmd_ptr ((struct ladish_command_start_app *)context)
|
#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);
|
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())
|
if (!ladish_studio_is_started())
|
||||||
{
|
{
|
||||||
log_error("cannot start app because studio is not started", cmd_ptr->opath);
|
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
|
#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;
|
struct ladish_command_start_app * cmd_ptr;
|
||||||
char * opath_dup;
|
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->command.destructor = destructor;
|
||||||
cmd_ptr->opath = opath_dup;
|
cmd_ptr->opath = opath_dup;
|
||||||
cmd_ptr->id = id;
|
cmd_ptr->id = id;
|
||||||
|
cmd_ptr->target_state = target_state;
|
||||||
|
|
||||||
if (!ladish_cqueue_add_command(queue_ptr, &cmd_ptr->command))
|
if (!ladish_cqueue_add_command(queue_ptr, &cmd_ptr->command))
|
||||||
{
|
{
|
2
wscript
2
wscript
|
@ -232,7 +232,7 @@ def build(bld):
|
||||||
'cmd_stop_studio.c',
|
'cmd_stop_studio.c',
|
||||||
'cmd_unload_studio.c',
|
'cmd_unload_studio.c',
|
||||||
'cmd_new_app.c',
|
'cmd_new_app.c',
|
||||||
'cmd_start_app.c',
|
'cmd_change_app_state.c',
|
||||||
'cmd_exit.c',
|
'cmd_exit.c',
|
||||||
'cqueue.c',
|
'cqueue.c',
|
||||||
'app_supervisor.c',
|
'app_supervisor.c',
|
||||||
|
|
Loading…
Reference in New Issue