Пример #1
0
static void disablewan_set_cb(struct ofono_error *error, void *data)
{
	struct cb_data *cbd = data;
	struct ofono_wan_data *od = cbd->user;
	wan_result_cb cb = cbd->cb;
	struct wan_error werror;

	if (error) {
		werror.code = WAN_ERROR_FAILED;
		cb(&werror, cbd->data);
		goto cleanup;
	}

	if (is_flag_set(od->pending_configuration->flags, WAN_CONFIGURATION_TYPE_ROAMGUARD)) {
		if (od->pending_configuration->roamguard == ofono_connection_manager_get_roaming_allowed(od->cm)) {
			ofono_connection_manager_set_roaming_allowed(od->cm, !od->pending_configuration->roamguard,
														 roamguard_set_cb, cbd);
			return;
		}
	}

	cb(NULL, cbd->data);

cleanup:
	g_free(cbd);
}
Пример #2
0
void ofono_wan_set_configuration(struct wan_service *service, struct wan_configuration *configuration,
									   wan_result_cb cb, void *data)
{
	struct ofono_wan_data *od = wan_service_get_data(service);
	struct cb_data *cbd = NULL;

	if (configuration->roamguard && !ofono_connection_manager_get_roaming_allowed(od->cm)) {
		cb(NULL, data);
		return;
	}

	cbd = cb_data_new(cb, data);
	ofono_connection_manager_set_roaming_allowed(od->cm, !configuration->roamguard,
												 set_roaming_allowed_cb, cbd);
}
Пример #3
0
void ofono_wan_set_configuration(struct wan_service *service, struct wan_configuration *configuration,
									   wan_result_cb cb, void *data)
{
	struct ofono_wan_data *od = wan_service_get_data(service);
	struct cb_data *cbd = NULL;
	struct wan_error error;

	if (!od->current_service_path) {
		error.code = WAN_ERROR_NOT_AVAILABLE;
		cb(&error, data);
		return;
	}

	od->pending_configuration = configuration;

	if (is_flag_set(configuration->flags, WAN_CONFIGURATION_TYPE_DISABLEWAN)) {
		if (configuration->disablewan != od->wan_disabled) {
			cbd = cb_data_new(cb, data);
			cbd->user = od;

			switch_current_service_state(od, !configuration->disablewan,
										 disablewan_set_cb, cbd);
		}
	}
	else if (is_flag_set(configuration->flags, WAN_CONFIGURATION_TYPE_ROAMGUARD)) {
		if (configuration->roamguard == ofono_connection_manager_get_roaming_allowed(od->cm)) {
			cbd = cb_data_new(cb, data);
			cbd->user = od;

			ofono_connection_manager_set_roaming_allowed(od->cm, !configuration->roamguard,
														 roamguard_set_cb, cbd);
		}
	}
	else {
		cb (NULL, data);
	}
}