#define STREAM_ROLE_RADIO "radio"
+enum deviced_poweroff_type {
+ DEVICED_POWER_OFF_NONE = 0,
+ DEVICED_POWER_OFF_POPUP,
+ DEVICED_POWER_OFF_DIRECT,
+ DEVICED_POWER_OFF_RESTART,
+};
+
struct userdata {
pa_module *module;
pa_dbus_connection *dbus_conn;
static DBusHandlerResult _dbus_filter_device_detect_handler(DBusConnection *c, DBusMessage *s, void *userdata) {
struct userdata *u = (struct userdata *)userdata;
+ int state = 0;
pa_assert(u);
pa_log_debug("signature : %s", dbus_message_get_signature(s));
if (dbus_message_is_signal(s, INTERFACE_NAME, SIGNAL_NAME)) {
- pa_log_warn("NOW POWEROFF!!!!");
- u->is_poweroff = true;
- mute_all_streams(u);
+ if (dbus_message_get_args(s, NULL, DBUS_TYPE_INT32, &state, DBUS_TYPE_INVALID)) {
+ if (state == DEVICED_POWER_OFF_DIRECT ||
+ state == DEVICED_POWER_OFF_RESTART) {
+ const char* mode_str[] = { "None", "Popup", "Direct", "Restart" };
+ pa_log_warn("---- PowerOff : %s ----", mode_str[state]);
+ u->is_poweroff = true;
+ mute_all_streams(u);
+ }
+ } else
+ pa_log_error("failed to parse state, do nothing!!!");
+
return DBUS_HANDLER_RESULT_HANDLED;
}