Navigation Menu

Skip to content

Commit

Permalink
[datapipe] Add datapipe for requesting ngfd event playback
Browse files Browse the repository at this point in the history
To allow all parts of mce code base to request playing of ngfd events,
add a datapipe for this purpose and connect it to already existing
logic in the powerkey module.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Aug 15, 2018
1 parent 7f395b6 commit 0f3b845
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions datapipe.c
Expand Up @@ -205,6 +205,9 @@ datapipe_struct usbmoded_service_state_pipe;
/** ngfd availability; read only */
datapipe_struct ngfd_service_state_pipe;

/** Request ngfd event playing */
datapipe_struct ngfd_event_request_pipe;

/** dsme availability; read only */
datapipe_struct dsme_service_state_pipe;

Expand Down Expand Up @@ -855,6 +858,8 @@ void mce_datapipe_init(void)
0, GINT_TO_POINTER(SERVICE_STATE_UNDEF));
datapipe_init(&ngfd_service_state_pipe, READ_ONLY, DONT_FREE_CACHE,
0, GINT_TO_POINTER(SERVICE_STATE_UNDEF));
datapipe_init(&ngfd_event_request_pipe, READ_ONLY, DONT_FREE_CACHE,
0, NULL);

datapipe_init(&dsme_service_state_pipe, READ_ONLY, DONT_FREE_CACHE,
0, GINT_TO_POINTER(SERVICE_STATE_UNDEF));
Expand Down Expand Up @@ -951,6 +956,7 @@ void mce_datapipe_quit(void)
datapipe_free(&devicelock_service_state_pipe);
datapipe_free(&usbmoded_service_state_pipe);
datapipe_free(&ngfd_service_state_pipe);
datapipe_free(&ngfd_event_request_pipe);
datapipe_free(&dsme_service_state_pipe);
datapipe_free(&bluez_service_state_pipe);
datapipe_free(&packagekit_locked_pipe);
Expand Down
1 change: 1 addition & 0 deletions datapipe.h
Expand Up @@ -143,6 +143,7 @@ extern datapipe_struct lipstick_service_state_pipe;
extern datapipe_struct devicelock_service_state_pipe;
extern datapipe_struct usbmoded_service_state_pipe;
extern datapipe_struct ngfd_service_state_pipe;
extern datapipe_struct ngfd_event_request_pipe;
extern datapipe_struct dsme_service_state_pipe;
extern datapipe_struct bluez_service_state_pipe;
extern datapipe_struct packagekit_locked_pipe;
Expand Down
15 changes: 15 additions & 0 deletions powerkey.c
Expand Up @@ -3097,6 +3097,17 @@ static void pwrkey_datapipe_enroll_in_progress_cb(gconstpointer data)
return;
}

/** Handle NGFD play event requests
*
* @param data Requested event name (as void pointer)
*/
static void fba_datapipe_ngfd_event_request_cb(gconstpointer data)
{
const char *event = data;
mce_log(LL_DEBUG, "ngfd event request = %s", event);
xngf_play_event(event);
}

/** Array of datapipe handlers */
static datapipe_handler_t pwrkey_datapipe_handlers[] =
{
Expand Down Expand Up @@ -3146,6 +3157,10 @@ static datapipe_handler_t pwrkey_datapipe_handlers[] =
.datapipe = &enroll_in_progress_pipe,
.output_cb = pwrkey_datapipe_enroll_in_progress_cb,
},
{
.datapipe = &ngfd_event_request_pipe,
.output_cb = fba_datapipe_ngfd_event_request_cb,
},

// sentinel
{
Expand Down

0 comments on commit 0f3b845

Please sign in to comment.