Commit 5fadb870 authored by spiiroin's avatar spiiroin

[datapipe] Unify naming. Contributes to JB#22475

Use "datapipe_"  prefix for all functions:

 datapipe_add_filter            <- append_filter_to_datapipe
 datapipe_add_input_trigger     <- append_input_trigger_to_datapipe
 datapipe_add_output_trigger    <- append_output_trigger_to_datapipe
 datapipe_exec_filters          <- execute_datapipe_filters
 datapipe_exec_full             <- execute_datapipe
 datapipe_exec_input_triggers   <- execute_datapipe_input_triggers
 datapipe_exec_output_triggers  <- execute_datapipe_output_triggers
 datapipe_free                  <- free_datapipe
 datapipe_init                  <- setup_datapipe
 datapipe_remove_filter         <- remove_filter_from_datapipe
 datapipe_remove_input_trigger  <- remove_input_trigger_from_datapipe
 datapipe_remove_output_trigger <- remove_output_trigger_from_datapipe

Datapipes that are used for solely for requesting state changes (i.e. do not
themselves have a state) have a verb in the name:

 display_state_request_pipe          <- display_state_req_pipe
 led_pattern_activate_pipe           (no change)
 led_pattern_deactivate_pipe         (no change)
 tklock_request_pipe                 <- tk_lock_pipe

Datapipes that are used solely process input events without having a
persistent state have "event" in the name:

 heartbeat_event_pipe                <- heartbeat_pipe
 ignore_incoming_call_event_pipe     <- ignore_incoming_call_pipe
 inactivity_event_pipe               <- device_inactive_event_pipe
 keypress_event_pipe                 <- keypress_pipe
 resume_detected_event_pipe          <- device_resumed_pipe
 touchscreen_event_pipe              <- touchscreen_pipe
 user_activity_event_pipe            <- user_activity_pipe

Datapipes dealing with brightness have "brightness" included in the name:

 display_brightness_pipe             (no change)
 key_backlight_brightness_pipe       <- key_backlight_pipe
 led_brightness_pipe                 (no change)
 lpm_brightness_pipe                 (no change)

Datapipes dealing with sensors have "sensor" in name and the one holding
unfiltered data is called "actual":

 lid_sensor_actual_pipe              <- lid_cover_sensor_pipe
 lid_sensor_filtered_pipe            <- lid_cover_policy_pipe
 lid_sensor_is_working_pipe          (no change)
 light_sensor_actual_pipe            <- ambient_light_sensor_pipe
 light_sensor_filtered_pipe          <- ambient_light_level_pipe
 light_sensor_poll_request_pipe      <- ambient_light_poll_pipe
 orientation_sensor_actual_pipe      <- orientation_sensor_pipe
 proximity_sensor_actual_pipe        <- proximity_sensor_pipe

Datapipes that have enumerated state reflect the enumeration type in
datapipe name:

 alarm_ui_state_pipe                 (no change)
 audio_route_pipe                    (no change)
 battery_status_pipe                 (no change)
 bluez_service_state_pipe            <- bluez_available_pipe
 call_state_pipe                     (no change)
 call_type_pipe                      (no change)
 camera_button_state_pipe            <- camera_button_pipe
 charger_state_pipe                  (no change)
 compositor_service_state_pipe       <- compositor_available_pipe
 devicelock_service_state_pipe       <- devicelock_available_pipe
 devicelock_state_pipe               <- device_lock_state_pipe
 display_state_curr_pipe             <- display_state_pipe
 display_state_next_pipe             (no change)
 dsme_service_state_pipe             <- dsme_available_pipe
 jack_sense_state_pipe               <- jack_sense_pipe
 keyboard_available_state_pipe       <- keyboard_available_pipe
 keyboard_slide_state_pipe           <- keyboard_slide_pipe
 lens_cover_state_pipe               <- lens_cover_pipe
 lipstick_service_state_pipe         <- lipstick_available_pipe
 lockkey_state_pipe                  <- lockkey_pipe
 ngfd_service_state_pipe             <- ngfd_available_pipe
 submode_pipe                        (no change)
 system_state_pipe                   (no change)
 thermal_state_pipe                  (no change)
 uiexception_type_pipe               <- exception_state_pipe
 usb_cable_state_pipe                <- usb_cable_pipe
 usbmoded_service_state_pipe         <- usbmoded_available_pipe

Datapipes that have boolean state should answer an
"is" question:

 device_inactive_pipe                <- device_inactive_state_pipe
 interaction_expected_pipe           (no change)
 keypad_grab_active_pipe             (no change)
 keypad_grab_wanted_pipe             (no change)
 master_radio_enabled_pipe           <- master_radio_pipe
 music_playback_ongoing_pipe         <- music_playback_pipe
 osupdate_running_pipe               <- update_mode_pipe
 packagekit_locked_pipe              (no change)
 power_saving_mode_active_pipe       <- power_saving_mode_pipe
 proximity_blanked_pipe              <- proximity_blank_pipe
 shutting_down_pipe                  (no change)
 touch_detected_pipe                 (no change)
 touch_grab_active_pipe              (no change)
 touch_grab_wanted_pipe              (no change)

Datapipes that have integer state should answer
and "what is" question:

 battery_level_pipe                  (no change)
 inactivity_delay_pipe               <- inactivity_timeout_pipe

Rename datapipe related callback functions and variables similarly as what
was done to datapipes.

Define submode bitmasks as submode_t enumeration instead of using
gint type and preprocessor constants. Change the value naming from
MCE_xxx_SUBMODE to MCE_SUBMODE_xxx.

Change call_type_t enumeration value naming from xxx_CALL to
CALL_TYPE_xxx.

Change system_state_t enumeration value naming from MCE_STATE_xxx
to MCE_SYSTEM_STATE_xxx.

Fix setting up of power_saving_mode_active_pipe, master_radio_enabled_pipe
and lens_cover_state_pipe so that initial values of appropriate type are
used.

Switch lockkey_state_pipe value from gboolean to key_state_t type.
Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent 7af9f4ce
This diff is collapsed.
......@@ -24,20 +24,20 @@
#include <stdbool.h>
#include <glib.h>
/** Device lock states used in device_lock_state_pipe */
/** Device lock states used in devicelock_state_pipe */
typedef enum
{
/** Device lock is not active */
DEVICE_LOCK_UNLOCKED = 0,
DEVICELOCK_STATE_UNLOCKED = 0,
/** Device lock is active */
DEVICE_LOCK_LOCKED = 1,
DEVICELOCK_STATE_LOCKED = 1,
/** Initial startup value; from mce p.o.v. equals not active */
DEVICE_LOCK_UNDEFINED = 2,
} device_lock_state_t;
DEVICELOCK_STATE_UNDEFINED = 2,
} devicelock_state_t;
const char *device_lock_state_repr(device_lock_state_t state);
const char *devicelock_state_repr(devicelock_state_t state);
/**
* Datapipe structure
......@@ -90,70 +90,70 @@ typedef enum {
/* Available datapipes */
extern datapipe_struct led_brightness_pipe;
extern datapipe_struct lpm_brightness_pipe;
extern datapipe_struct device_inactive_state_pipe;
extern datapipe_struct device_inactive_event_pipe;
extern datapipe_struct device_inactive_pipe;
extern datapipe_struct inactivity_event_pipe;
extern datapipe_struct led_pattern_activate_pipe;
extern datapipe_struct led_pattern_deactivate_pipe;
extern datapipe_struct device_resumed_pipe;
extern datapipe_struct user_activity_pipe;
extern datapipe_struct display_state_pipe;
extern datapipe_struct display_state_req_pipe;
extern datapipe_struct resume_detected_event_pipe;
extern datapipe_struct user_activity_event_pipe;
extern datapipe_struct display_state_curr_pipe;
extern datapipe_struct display_state_request_pipe;
extern datapipe_struct display_state_next_pipe;
extern datapipe_struct exception_state_pipe;
extern datapipe_struct uiexception_type_pipe;
extern datapipe_struct display_brightness_pipe;
extern datapipe_struct key_backlight_pipe;
extern datapipe_struct keypress_pipe;
extern datapipe_struct touchscreen_pipe;
extern datapipe_struct lockkey_pipe;
extern datapipe_struct keyboard_slide_pipe;
extern datapipe_struct keyboard_available_pipe;
extern datapipe_struct key_backlight_brightness_pipe;
extern datapipe_struct keypress_event_pipe;
extern datapipe_struct touchscreen_event_pipe;
extern datapipe_struct lockkey_state_pipe;
extern datapipe_struct keyboard_slide_state_pipe;
extern datapipe_struct keyboard_available_state_pipe;
extern datapipe_struct lid_sensor_is_working_pipe;
extern datapipe_struct lid_cover_sensor_pipe;
extern datapipe_struct lid_cover_policy_pipe;
extern datapipe_struct lens_cover_pipe;
extern datapipe_struct proximity_sensor_pipe;
extern datapipe_struct ambient_light_sensor_pipe;
extern datapipe_struct ambient_light_level_pipe;
extern datapipe_struct ambient_light_poll_pipe;
extern datapipe_struct orientation_sensor_pipe;
extern datapipe_struct lid_sensor_actual_pipe;
extern datapipe_struct lid_sensor_filtered_pipe;
extern datapipe_struct lens_cover_state_pipe;
extern datapipe_struct proximity_sensor_actual_pipe;
extern datapipe_struct light_sensor_actual_pipe;
extern datapipe_struct light_sensor_filtered_pipe;
extern datapipe_struct light_sensor_poll_request_pipe;
extern datapipe_struct orientation_sensor_actual_pipe;
extern datapipe_struct alarm_ui_state_pipe;
extern datapipe_struct system_state_pipe;
extern datapipe_struct master_radio_pipe;
extern datapipe_struct master_radio_enabled_pipe;
extern datapipe_struct submode_pipe;
extern datapipe_struct call_state_pipe;
extern datapipe_struct ignore_incoming_call_pipe;
extern datapipe_struct ignore_incoming_call_event_pipe;
extern datapipe_struct call_type_pipe;
extern datapipe_struct tk_lock_pipe;
extern datapipe_struct tklock_request_pipe;
extern datapipe_struct interaction_expected_pipe;
extern datapipe_struct charger_state_pipe;
extern datapipe_struct battery_status_pipe;
extern datapipe_struct battery_level_pipe;
extern datapipe_struct camera_button_pipe;
extern datapipe_struct inactivity_timeout_pipe;
extern datapipe_struct camera_button_state_pipe;
extern datapipe_struct inactivity_delay_pipe;
extern datapipe_struct audio_route_pipe;
extern datapipe_struct usb_cable_pipe;
extern datapipe_struct jack_sense_pipe;
extern datapipe_struct power_saving_mode_pipe;
extern datapipe_struct usb_cable_state_pipe;
extern datapipe_struct jack_sense_state_pipe;
extern datapipe_struct power_saving_mode_active_pipe;
extern datapipe_struct thermal_state_pipe;
extern datapipe_struct heartbeat_pipe;
extern datapipe_struct compositor_available_pipe;
extern datapipe_struct lipstick_available_pipe;
extern datapipe_struct devicelock_available_pipe;
extern datapipe_struct usbmoded_available_pipe;
extern datapipe_struct ngfd_available_pipe;
extern datapipe_struct dsme_available_pipe;
extern datapipe_struct bluez_available_pipe;
extern datapipe_struct heartbeat_event_pipe;
extern datapipe_struct compositor_service_state_pipe;
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 dsme_service_state_pipe;
extern datapipe_struct bluez_service_state_pipe;
extern datapipe_struct packagekit_locked_pipe;
extern datapipe_struct update_mode_pipe;
extern datapipe_struct osupdate_running_pipe;
extern datapipe_struct shutting_down_pipe;
extern datapipe_struct device_lock_state_pipe;
extern datapipe_struct devicelock_state_pipe;
extern datapipe_struct touch_detected_pipe;
extern datapipe_struct touch_grab_wanted_pipe;
extern datapipe_struct touch_grab_active_pipe;
extern datapipe_struct keypad_grab_wanted_pipe;
extern datapipe_struct keypad_grab_active_pipe;
extern datapipe_struct music_playback_pipe;
extern datapipe_struct proximity_blank_pipe;
extern datapipe_struct music_playback_ongoing_pipe;
extern datapipe_struct proximity_blanked_pipe;
/* Data retrieval */
......@@ -173,43 +173,43 @@ extern datapipe_struct proximity_blank_pipe;
#define datapipe_get_gpointer(_datapipe) ((_datapipe).cached_data)
/* Datapipe execution */
void execute_datapipe_input_triggers(datapipe_struct *const datapipe,
gpointer const indata,
const data_source_t use_cache);
gconstpointer execute_datapipe_filters(datapipe_struct *const datapipe,
gpointer indata,
const data_source_t use_cache);
void execute_datapipe_output_triggers(const datapipe_struct *const datapipe,
gconstpointer indata,
const data_source_t use_cache);
gconstpointer execute_datapipe(datapipe_struct *const datapipe,
gpointer indata,
const data_source_t use_cache,
const caching_policy_t cache_indata);
void datapipe_exec_input_triggers(datapipe_struct *const datapipe,
gpointer const indata,
const data_source_t use_cache);
gconstpointer datapipe_exec_filters(datapipe_struct *const datapipe,
gpointer indata,
const data_source_t use_cache);
void datapipe_exec_output_triggers(const datapipe_struct *const datapipe,
gconstpointer indata,
const data_source_t use_cache);
gconstpointer datapipe_exec_full(datapipe_struct *const datapipe,
gpointer indata,
const data_source_t use_cache,
const caching_policy_t cache_indata);
/* Filters */
void append_filter_to_datapipe(datapipe_struct *const datapipe,
gpointer (*filter)(gpointer data));
void remove_filter_from_datapipe(datapipe_struct *const datapipe,
gpointer (*filter)(gpointer data));
void datapipe_add_filter(datapipe_struct *const datapipe,
gpointer (*filter)(gpointer data));
void datapipe_remove_filter(datapipe_struct *const datapipe,
gpointer (*filter)(gpointer data));
/* Input triggers */
void append_input_trigger_to_datapipe(datapipe_struct *const datapipe,
void (*trigger)(gconstpointer data));
void remove_input_trigger_from_datapipe(datapipe_struct *const datapipe,
void (*trigger)(gconstpointer data));
void datapipe_add_input_trigger(datapipe_struct *const datapipe,
void (*trigger)(gconstpointer data));
void datapipe_remove_input_trigger(datapipe_struct *const datapipe,
void (*trigger)(gconstpointer data));
/* Output triggers */
void append_output_trigger_to_datapipe(datapipe_struct *const datapipe,
void (*trigger)(gconstpointer data));
void remove_output_trigger_from_datapipe(datapipe_struct *const datapipe,
void (*trigger)(gconstpointer data));
void datapipe_add_output_trigger(datapipe_struct *const datapipe,
void (*trigger)(gconstpointer data));
void datapipe_remove_output_trigger(datapipe_struct *const datapipe,
void (*trigger)(gconstpointer data));
void setup_datapipe(datapipe_struct *const datapipe,
const read_only_policy_t read_only,
const cache_free_policy_t free_cache,
const gsize datasize, gpointer initial_data);
void free_datapipe(datapipe_struct *const datapipe);
void datapipe_init(datapipe_struct *const datapipe,
const read_only_policy_t read_only,
const cache_free_policy_t free_cache,
const gsize datasize, gpointer initial_data);
void datapipe_free(datapipe_struct *const datapipe);
/* Binding arrays */
......@@ -267,9 +267,9 @@ void mce_datapipe_quit(void);
* because during already ongoing transition something \
* else might be already queued up and we want't the \
* last request to reach the queue to "win". */ \
execute_datapipe(&display_state_req_pipe,\
GINT_TO_POINTER(req_target),\
USE_INDATA, CACHE_OUTDATA);\
datapipe_exec_full(&display_state_request_pipe,\
GINT_TO_POINTER(req_target),\
USE_INDATA, CACHE_OUTDATA);\
} while(0)
#endif /* _DATAPIPE_H_ */
This diff is collapsed.
This diff is collapsed.
......@@ -30,7 +30,7 @@ digraph home_key_state_machine {
WAIT_PRESS -> WAIT_UNBLANK [label=" pressed==true\l"];
WAIT_UNBLANK -> WAIT_RELEASE [label=" display_state_next!=on\l"];
WAIT_UNBLANK -> SEND_SIGNAL [label=" display_state==on\l"];
WAIT_UNBLANK -> SEND_SIGNAL [label=" display_state_curr==on\l"];
SEND_SIGNAL -> WAIT_RELEASE [label=" (always)\l"];
WAIT_RELEASE -> WAIT_PRESS [label=" pressed==false\l"];
}
......@@ -587,7 +587,7 @@ static datapipe_handler_t common_datapipe_handlers[] =
{
// output triggers
{
.datapipe = &usb_cable_pipe,
.datapipe = &usb_cable_state_pipe,
.output_cb = common_datapipe_usb_cable_state_cb,
},
{
......
......@@ -1020,9 +1020,9 @@ peerinfo_enter_state(peerinfo_t *self)
case PEERSTATE_RUNNING:
if( self->pi_datapipe ) {
execute_datapipe(self->pi_datapipe,
GINT_TO_POINTER(SERVICE_STATE_RUNNING),
USE_INDATA, CACHE_INDATA);
datapipe_exec_full(self->pi_datapipe,
GINT_TO_POINTER(SERVICE_STATE_RUNNING),
USE_INDATA, CACHE_INDATA);
}
peerinfo_handle_methods(self);
break;
......@@ -1076,9 +1076,9 @@ peerinfo_leave_state(peerinfo_t *self)
case PEERSTATE_RUNNING:
if( self->pi_datapipe ) {
execute_datapipe(self->pi_datapipe,
GINT_TO_POINTER(SERVICE_STATE_STOPPED),
USE_INDATA, CACHE_INDATA);
datapipe_exec_full(self->pi_datapipe,
GINT_TO_POINTER(SERVICE_STATE_STOPPED),
USE_INDATA, CACHE_INDATA);
}
break;
......@@ -1360,9 +1360,9 @@ peerinfo_set_datapipe(peerinfo_t *self, datapipe_struct *datapipe)
if( (self->pi_datapipe = datapipe) ) {
if( peerinfo_get_state(self) == PEERSTATE_RUNNING ) {
execute_datapipe(self->pi_datapipe,
GINT_TO_POINTER(SERVICE_STATE_RUNNING),
USE_INDATA, CACHE_INDATA);
datapipe_exec_full(self->pi_datapipe,
GINT_TO_POINTER(SERVICE_STATE_RUNNING),
USE_INDATA, CACHE_INDATA);
}
}
}
......@@ -1774,33 +1774,33 @@ static struct
{
{
.name = DSME_DBUS_SERVICE,
.datapipe = &dsme_available_pipe,
.datapipe = &dsme_service_state_pipe,
},
{
.name = "org.bluez",
.datapipe = &bluez_available_pipe,
.datapipe = &bluez_service_state_pipe,
},
{
.name = COMPOSITOR_SERVICE,
.datapipe = &compositor_available_pipe,
.datapipe = &compositor_service_state_pipe,
},
{
/* Note: due to lipstick==compositor assumption lipstick
* service name must be probed after compositor */
.name = LIPSTICK_SERVICE,
.datapipe = &lipstick_available_pipe,
.datapipe = &lipstick_service_state_pipe,
},
{
.name = DEVICELOCK_SERVICE,
.datapipe = &devicelock_available_pipe,
.datapipe = &devicelock_service_state_pipe,
},
{
.name = USB_MODED_DBUS_SERVICE,
.datapipe = &usbmoded_available_pipe,
.datapipe = &usbmoded_service_state_pipe,
},
{
.name = "com.nokia.NonGraphicFeedback1.Backend",
.datapipe = &ngfd_available_pipe,
.datapipe = &ngfd_service_state_pipe,
},
{
.name = 0,
......
......@@ -54,11 +54,11 @@ static guint mce_dsme_socket_recv_id = 0;
/** ID for delayed state transition reporting timer */
static guint mce_dsme_transition_id = 0;
/** Availability of dsme; from dsme_available_pipe */
static service_state_t dsme_available = SERVICE_STATE_UNDEF;
/** Availability of dsme; from dsme_service_state_pipe */
static service_state_t dsme_service_state = SERVICE_STATE_UNDEF;
/** System state from dsme; fed to system_state_pipe */
static system_state_t system_state = MCE_STATE_UNDEF;
static system_state_t system_state = MCE_SYSTEM_STATE_UNDEF;
/** Shutdown warning from dsme; fed to shutting_down_pipe */
static bool mce_dsme_shutting_down_flag = false;
......@@ -140,7 +140,7 @@ static void mce_dsme_dbus_quit(void);
* DATAPIPE_TRACKING
* ------------------------------------------------------------------------- */
static void mce_dsme_datapipe_dsme_available_cb (gconstpointer data);
static void mce_dsme_datapipe_dsme_service_state_cb (gconstpointer data);
static void mce_dsme_datapipe_system_state_cb (gconstpointer data);
static void mce_dsme_datapipe_init(void);
......@@ -213,27 +213,27 @@ static const char *mce_dsme_msg_type_repr(int type)
*/
static system_state_t mce_dsme_normalise_system_state(dsme_state_t dsmestate)
{
system_state_t state = MCE_STATE_UNDEF;
system_state_t state = MCE_SYSTEM_STATE_UNDEF;
switch (dsmestate) {
case DSME_STATE_SHUTDOWN:
state = MCE_STATE_SHUTDOWN;
state = MCE_SYSTEM_STATE_SHUTDOWN;
break;
case DSME_STATE_USER:
state = MCE_STATE_USER;
state = MCE_SYSTEM_STATE_USER;
break;
case DSME_STATE_ACTDEAD:
state = MCE_STATE_ACTDEAD;
state = MCE_SYSTEM_STATE_ACTDEAD;
break;
case DSME_STATE_REBOOT:
state = MCE_STATE_REBOOT;
state = MCE_SYSTEM_STATE_REBOOT;
break;
case DSME_STATE_BOOT:
state = MCE_STATE_BOOT;
state = MCE_SYSTEM_STATE_BOOT;
break;
case DSME_STATE_NOT_SET:
......@@ -375,8 +375,8 @@ static void mce_dsme_processwd_pong(void)
mce_dsme_worker_ping();
/* Execute hearbeat actions even if ping-pong ipc failed */
execute_datapipe(&heartbeat_pipe, GINT_TO_POINTER(0),
USE_INDATA, DONT_CACHE_INDATA);
datapipe_exec_full(&heartbeat_event_pipe, GINT_TO_POINTER(0),
USE_INDATA, DONT_CACHE_INDATA);
}
/**
......@@ -439,7 +439,7 @@ void mce_dsme_request_powerup(void)
*/
void mce_dsme_request_reboot(void)
{
if( datapipe_get_gint(update_mode_pipe) ) {
if( datapipe_get_gint(osupdate_running_pipe) ) {
mce_log(LL_WARN, "reboot blocked; os update in progress");
goto EXIT;
}
......@@ -457,7 +457,7 @@ EXIT:
*/
void mce_dsme_request_normal_shutdown(void)
{
if( datapipe_get_gint(update_mode_pipe) ) {
if( datapipe_get_gint(osupdate_running_pipe) ) {
mce_log(LL_WARN, "shutdown blocked; os update in progress");
goto EXIT;
}
......@@ -487,7 +487,7 @@ static gboolean mce_dsme_transition_cb(gpointer data)
mce_dsme_transition_id = 0;
mce_rem_submode_int32(MCE_TRANSITION_SUBMODE);
mce_rem_submode_int32(MCE_SUBMODE_TRANSITION);
return FALSE;
}
......@@ -510,7 +510,7 @@ static void mce_dsme_transition_schedule(void)
mce_dsme_transition_cancel();
/* Check if we have transition to end */
if( !(mce_get_submode_int32() & MCE_TRANSITION_SUBMODE) )
if( !(mce_get_submode_int32() & MCE_SUBMODE_TRANSITION) )
goto EXIT;
#if TRANSITION_DELAY > 0
......@@ -561,9 +561,9 @@ static void mce_dsme_set_shutting_down(bool shutting_down)
if( !mce_dsme_shutting_down_flag )
mce_dsme_socket_connect();
execute_datapipe(&shutting_down_pipe,
GINT_TO_POINTER(mce_dsme_shutting_down_flag),
USE_INDATA, CACHE_INDATA);
datapipe_exec_full(&shutting_down_pipe,
GINT_TO_POINTER(mce_dsme_shutting_down_flag),
USE_INDATA, CACHE_INDATA);
EXIT:
return;
......@@ -641,9 +641,9 @@ static gboolean mce_dsme_socket_recv_cb(GIOChannel *source,
}
else if( (msg2 = DSMEMSG_CAST(DSM_MSGTYPE_STATE_CHANGE_IND, msg)) ) {
system_state_t state = mce_dsme_normalise_system_state(msg2->state);
execute_datapipe(&system_state_pipe,
GINT_TO_POINTER(state),
USE_INDATA, CACHE_INDATA);
datapipe_exec_full(&system_state_pipe,
GINT_TO_POINTER(state),
USE_INDATA, CACHE_INDATA);
}
else {
mce_log(LL_DEBUG, "Unhandled message type %s (0x%x) received from DSME",
......@@ -692,7 +692,7 @@ static bool mce_dsme_socket_connect(void)
goto EXIT;
/* No new connections unless dsme dbus service is up */
if( dsme_available != SERVICE_STATE_RUNNING )
if( dsme_service_state != SERVICE_STATE_RUNNING )
goto EXIT;
/* Already connected ? */
......@@ -885,20 +885,20 @@ static void mce_dsme_dbus_quit(void)
*
* @param data DSME D-Bus service availability (as a void pointer)
*/
static void mce_dsme_datapipe_dsme_available_cb(gconstpointer const data)
static void mce_dsme_datapipe_dsme_service_state_cb(gconstpointer const data)
{
service_state_t prev = dsme_available;
dsme_available = GPOINTER_TO_INT(data);
service_state_t prev = dsme_service_state;
dsme_service_state = GPOINTER_TO_INT(data);
if( dsme_available == prev )
if( dsme_service_state == prev )
goto EXIT;
mce_log(LL_DEVEL, "DSME dbus service: %s -> %s",
service_state_repr(prev),
service_state_repr(dsme_available));
service_state_repr(dsme_service_state));
/* Re-evaluate dsmesock connection */
if( dsme_available == SERVICE_STATE_RUNNING )
if( dsme_service_state == SERVICE_STATE_RUNNING )
mce_dsme_socket_connect();
EXIT:
......@@ -924,23 +924,23 @@ static void mce_dsme_datapipe_system_state_cb(gconstpointer data)
system_state_repr(prev),
system_state_repr(system_state));
/* Set transition submode unless coming from MCE_STATE_UNDEF */
if( prev != MCE_STATE_UNDEF )
mce_add_submode_int32(MCE_TRANSITION_SUBMODE);
/* Set transition submode unless coming from MCE_SYSTEM_STATE_UNDEF */
if( prev != MCE_SYSTEM_STATE_UNDEF )
mce_add_submode_int32(MCE_SUBMODE_TRANSITION);
/* Handle LED patterns */
switch( system_state ) {
case MCE_STATE_USER:
execute_datapipe_output_triggers(&led_pattern_activate_pipe,
MCE_LED_PATTERN_DEVICE_ON,
USE_INDATA);
case MCE_SYSTEM_STATE_USER:
datapipe_exec_output_triggers(&led_pattern_activate_pipe,
MCE_LED_PATTERN_DEVICE_ON,
USE_INDATA);
break;
case MCE_STATE_SHUTDOWN:
case MCE_STATE_REBOOT:
execute_datapipe_output_triggers(&led_pattern_deactivate_pipe,
MCE_LED_PATTERN_DEVICE_ON,
USE_INDATA);
case MCE_SYSTEM_STATE_SHUTDOWN:
case MCE_SYSTEM_STATE_REBOOT:
datapipe_exec_output_triggers(&led_pattern_deactivate_pipe,
MCE_LED_PATTERN_DEVICE_ON,
USE_INDATA);
break;
default:
......@@ -949,15 +949,15 @@ static void mce_dsme_datapipe_system_state_cb(gconstpointer data)
/* Handle shutdown flag */
switch( system_state ) {
case MCE_STATE_ACTDEAD:
case MCE_STATE_USER:
case MCE_SYSTEM_STATE_ACTDEAD:
case MCE_SYSTEM_STATE_USER:
/* Re-entry to actdead/user also means shutdown
* has been cancelled */
mce_dsme_set_shutting_down(false);
break;
case MCE_STATE_SHUTDOWN:
case MCE_STATE_REBOOT:
case MCE_SYSTEM_STATE_SHUTDOWN:
case MCE_SYSTEM_STATE_REBOOT:
mce_dsme_set_shutting_down(true);
break;
......@@ -979,8 +979,8 @@ static datapipe_handler_t mce_dsme_datapipe_handlers[] =
},
// output triggers
{
.datapipe = &dsme_available_pipe,
.output_cb = mce_dsme_datapipe_dsme_available_cb,
.datapipe = &dsme_service_state_pipe,
.output_cb = mce_dsme_datapipe_dsme_service_state_cb,
},
// sentinel
{
......
......@@ -23,7 +23,7 @@
#include <glib.h>
/** How long to delay removal of MCE_TRANSITION_SUBMODE after
/** How long to delay removal of MCE_SUBMODE_TRANSITION after
* receiving system state change from dsme
*
* <0 -> immediately
......
......@@ -174,14 +174,14 @@ static void mht_connection_close (void);
* DATAPIPE_HANDLERS
* ------------------------------------------------------------------------- */
/** Availability of dsme; from dsme_available_pipe */
static service_state_t dsme_available = SERVICE_STATE_UNDEF;
/** Availability of dsme; from dsme_service_state_pipe */
static service_state_t dsme_service_state = SERVICE_STATE_UNDEF;
/** Device is shutting down; assume false */
static bool shutting_down = false;
static void mht_datapipe_dsme_available_cb (gconstpointer data);
static void mht_datapipe_device_resumed_cb (gconstpointer data);
static void mht_datapipe_dsme_service_state_cb (gconstpointer data);
static void mht_datapipe_resume_detected_event_cb (gconstpointer data);
static void mht_datapipe_shutting_down_cb (gconstpointer data);
static void mht_datapipe_init(void);
......@@ -955,7 +955,7 @@ mht_connection_close(void)
* ========================================================================= */
/** Resumed from suspend notification */
static void mht_datapipe_device_resumed_cb(gconstpointer data)
static void mht_datapipe_resume_detected_event_cb(gconstpointer data)
{
(void) data;
......@@ -966,19 +966,19 @@ static void mht_datapipe_device_resumed_cb(gconstpointer data)
/** Datapipe trigger for dsme availability
*/
static void mht_datapipe_dsme_available_cb(gconstpointer const data)
static void mht_datapipe_dsme_service_state_cb(gconstpointer const data)
{
service_state_t prev = dsme_available;
dsme_available = GPOINTER_TO_INT(data);
service_state_t prev = dsme_service_state;
dsme_service_state = GPOINTER_TO_INT(data);
if( dsme_available == prev )
if( dsme_service_state == prev )
goto EXIT;
mce_log(LL_DEBUG, "DSME dbus service: %s -> %s",
service_state_repr(prev),
service_state_repr(dsme_available));
service_state_repr(dsme_service_state));
if( dsme_available == SERVICE_STATE_RUNNING )
if( dsme_service_state == SERVICE_STATE_RUNNING )
mht_connection_open();
else
mht_connection_close();
......@@ -997,7 +997,8 @@ static void mht_datapipe_shutting_down_cb(gconstpointer data)
if( shutting_down == prev )
goto EXIT;
mce_log(LL_DEBUG, "shutting_down = %d -> %d", prev, shutting_down);
mce_log(LL_DEBUG, "shutting_down = %d -> %d",
prev, shutting_down);
/* Loss of iphb connection is expected during shutdown */
......@@ -1010,15 +1011,15 @@ static datapipe_handler_t mht_datapipe_handlers[] =
{
// output triggers
{
.datapipe = &device_resumed_pipe,
.output_cb = mht_datapipe_device_resumed_cb,
.datapipe = &resume_detected_event_pipe,
.output_cb = mht_datapipe_resume_detected_event_cb,
},
{
.datapipe = &dsme_available_pipe,
.output_cb = mht_datapipe_dsme_available_cb,
.datapipe = &dsme_service_state_pipe,
.output_cb = mht_datapipe_dsme_service_state_cb,
},
{
.datapipe = &shutting_down_pipe,
.datapipe = &shutting_down_pipe,
.output_cb = mht_datapipe_shutting_down_cb,
},
......
......@@ -175,9 +175,9 @@ static void io_detect_resume(void)
skip / 1000, skip % 1000);
// notify in case some timers need re-evaluating
execute_datapipe_output_triggers(&device_resumed_pipe,
&prev,
USE_INDATA);
datapipe_exec_output_triggers(&resume_detected_event_pipe,
&prev,
USE_INDATA);
EXIT:
return;
......
......@@ -168,52 +168,42 @@ typedef enum {
const char *alarm_state_repr(alarm_ui_state_t state);
/** System sub-modes; several of these can be active at once */
typedef gint submode_t;
typedef enum {
/** Submode invalid */
MCE_SUBMODE_INVALID = (1 << 31),
/** No submodes enabled */
MCE_SUBMODE_NORMAL = 0,
/** Touchscreen/Keypad lock enabled */
MCE_SUBMODE_TKLOCK = (1 << 0),
/** Event eater enabled */
MCE_SUBMODE_EVEATER = (1 << 1),
/** Bootup in progress */
MCE_SUBMODE_BOOTUP = (1 << 3),
/** State transition in progress */
MCE_SUBMODE_TRANSITION = (1 << 4),
/** Touchscreen/Keypad autorelock active */
MCE_SUBMODE_AUTORELOCK = (1 << 5),
/** Visual Touchscreen/Keypad active */
MCE_SUBMODE_VISUAL_TKLOCK = (1 << 6),
/** Proximity is used to protect from accidental events */
MCE_SUBMODE_POCKET = (1 << 7),
/** Touchscreen/Keypad lock is enabled based on proximity state */
MCE_SUBMODE_PROXIMITY_TKLOCK = (1 << 8),
/** Device is in MALF state */
MCE_SUBMODE_MALF = (1 << 9),
} submode_t;
const char *submode_change_repr(submode_t prev, submode_t curr);
const char *submode_repr(submode_t submode);
/** Submode invalid */
#define MCE_INVALID_SUBMODE (1 << 31)
/** No submodes enabled */
#define MCE_NORMAL_SUBMODE 0
/** Touchscreen/Keypad lock enabled */
#define MCE_TKLOCK_SUBMODE (1 << 0)
/** Event eater enabled */
#define MCE_EVEATER_SUBMODE (1 << 1)
/** Bootup in progress */
#define MCE_BOOTUP_SUBMODE (1 << 3)
/** State transition in progress */
#define MCE_TRANSITION_SUBMODE (1 << 4)
/** Touchscreen/Keypad autorelock active */
#define MCE_AUTORELOCK_SUBMODE (1 << 5)
/** Visual Touchscreen/Keypad active */
#define MCE_VISUAL_TKLOCK_SUBMODE (1 << 6)
/** Proximity is used to protect from accidental events */
#define MCE_POCKET_SUBMODE (1 << 7)
/** Touchscreen/Keypad lock is enabled based on proximity state */
#define MCE_PROXIMITY_TKLOCK_SUBMODE (1 << 8)
/** Device is in MALF state */
#define MCE_MALF_SUBMODE (1 << 9)
/** System state */
typedef enum {
MCE_STATE_UNDEF = -1, /**< System state not set */
MCE_STATE_SHUTDOWN = 0, /**< System is in shutdown state */
MCE_STATE_USER = 2, /**< System is in user state */
MCE_STATE_ACTDEAD = 5, /**< System is in acting dead state */
MCE_STATE_REBOOT = 6, /**< System is in reboot state */
MCE_STATE_BOOT = 9 /**< System is in bootup state */
MCE_SYSTEM_STATE_UNDEF = -1, /**< System state not set */