static void hald_addon_bme_timeleft_info() { uint32 idle = 0; uint32 active = 0; log_print("%s\n",__func__); if (global_battery.power_supply_time_to_empty_avg && !global_charger_connected) { idle = active = global_battery.power_supply_time_to_empty_avg/60; if (global_battery.power_supply_time_to_empty_idle > idle) idle = global_battery.power_supply_time_to_empty_idle/60; } else if (global_battery.power_supply_time_to_full_now) idle = active = global_battery.power_supply_time_to_full_now/60; send_dbus_signal("battery_timeleft", DBUS_TYPE_UINT32, &idle, DBUS_TYPE_UINT32, &active, DBUS_TYPE_INVALID); }
static int send_thermal_mgr_event(bool activated) { DBusConnection* conn = NULL; int result; char *msg_value = activated ? STE_MAD_FEATURE_ON : STE_MAD_FEATURE_OFF; result = init_dbus(&conn); if (result < 0) { ERR("failed to init DBUS\n"); return result; } result = send_dbus_signal(conn, STE_MAD_TXBO_THERMAL_MANAGER, msg_value); if (result < 0) { ERR("DBUS message failed to send\n"); } if (conn) { dbus_connection_unref(conn); } return result; }
static gboolean send_battery_state_changed(uint32 now) { uint32 max = 8; log_print("send dbus signal: %s (bars=%d/%d)\n", "battery_state_changed",now,max); return send_dbus_signal("battery_state_changed",DBUS_TYPE_UINT32, &now, DBUS_TYPE_UINT32, &max, DBUS_TYPE_INVALID); }
static gboolean send_dbus_signal_(const char *name) { log_print("send dbus signal: %s\n", name); return send_dbus_signal(name, DBUS_TYPE_INVALID); }