Beispiel #1
0
/** Synchronize connman OfflineMode -> MCE master radio state
 */
static void xconnman_sync_offline_to_master(void)
{
	if( (connman_master ^ active_radio_states) & MCE_RADIO_STATE_MASTER ) {
		mce_log(LL_DEBUG, "sync connman OfflineMode -> mce master");
		radio_states_change(connman_master, MCE_RADIO_STATE_MASTER);
	}
}
Beispiel #2
0
/**
 * D-Bus callback for radio states change method call
 *
 * @todo Decide on error handling policy
 *
 * @param msg The D-Bus message
 * @return TRUE on success, FALSE on failure
 */
static gboolean req_radio_states_change_dbus_cb(DBusMessage *const msg)
{
	dbus_bool_t   no_reply = dbus_message_get_no_reply(msg);
	gboolean      status   = FALSE;
	dbus_uint32_t states   = 0;
	dbus_uint32_t mask     = 0;
	DBusError     error    = DBUS_ERROR_INIT;

	mce_log(LL_DEVEL, "Received radio states change request from %s",
		mce_dbus_get_message_sender_ident(msg));

	if (dbus_message_get_args(msg, &error,
				  DBUS_TYPE_UINT32, &states,
				  DBUS_TYPE_UINT32, &mask,
				  DBUS_TYPE_INVALID) == FALSE) {
		// XXX: should we return an error instead?
		mce_log(LL_CRIT,
			"Failed to get argument from %s.%s: %s",
			MCE_REQUEST_IF, MCE_RADIO_STATES_CHANGE_REQ,
			error.message);
		dbus_error_free(&error);
		goto EXIT;
	}

	radio_states_change(states, mask);

	if (no_reply == FALSE) {
		DBusMessage *reply = dbus_new_method_reply(msg);

		status = dbus_send_message(reply);
	} else {
		status = TRUE;
	}

EXIT:
	return status;
}