Пример #1
0
const gchar *g_module_check_init(GModule *module)
{
	(void)module;

	/* If we fail to restore the radio states, default to offline */
	if( !restore_radio_states(&active_radio_states, &radio_states) &&
	    !restore_default_radio_states(&active_radio_states, &radio_states) ) {
		active_radio_states = radio_states = 0;
	}

	mce_log(LL_DEBUG, "active_radio_states: %lx, radio_states: %lx",
		active_radio_states, radio_states);

	/* Append triggers/filters to datapipes */
	append_output_trigger_to_datapipe(&master_radio_pipe,
					  master_radio_trigger);

	/* get_radio_states */
	if (mce_dbus_handler_add(MCE_REQUEST_IF,
				 MCE_RADIO_STATES_GET,
				 NULL,
				 DBUS_MESSAGE_TYPE_METHOD_CALL,
				 get_radio_states_dbus_cb) == NULL)
		goto EXIT;

	/* req_radio_states_change */
	if (mce_dbus_handler_add(MCE_REQUEST_IF,
				 MCE_RADIO_STATES_CHANGE_REQ,
				 NULL,
				 DBUS_MESSAGE_TYPE_METHOD_CALL,
				 req_radio_states_change_dbus_cb) == NULL)
		goto EXIT;

	if( !xconnman_init() )
		mce_log(LL_WARN, "failed to set up connman mirroring");

EXIT:
	return NULL;
}
Пример #2
0
/** Init function for the radio states module
 *
 * @param module (Unused)
 *
 * @return NULL on success, a string with an error message on failure
 */
G_MODULE_EXPORT const gchar *
g_module_check_init(GModule *module)
{
	(void)module;

	/* Read persistent values */
	mrs_restore_radio_states();

	/* Append triggers/filters to datapipes */
	mrs_datapipe_init();

	/* Add dbus handlers */
	mrs_dbus_init();

	if( !xconnman_init() )
		mce_log(LL_WARN, "failed to set up connman mirroring");

	/* Process and broadcast initial state */
	mrs_datapipe_update_master_radio_enabled();
	mrs_dbus_send_radio_states(NULL);

	return NULL;
}