Пример #1
0
static void ril_call_barring_query(struct ofono_call_barring *cb,
					const char *lock, int cls,
					ofono_call_barring_query_cb_t callback,
					void *data)
{
	struct barring_data *bd = ofono_call_barring_get_data(cb);
	struct cb_data *cbd = cb_data_new(callback, data, bd);
	struct parcel rilp;
	char svcs_str[4];

	DBG("lock: %s, services to query: %d", lock, cls);

	FIXUP_CLS();

	parcel_init(&rilp);
	parcel_w_int32(&rilp, 4);	/* # of strings */
	parcel_w_string(&rilp, lock);
	parcel_w_string(&rilp, "");	/* Password is empty when not needed */
	snprintf(svcs_str, sizeof(svcs_str), "%d", cls);
	parcel_w_string(&rilp, svcs_str);
	parcel_w_string(&rilp, NULL);	/* AID (for FDN, not yet supported) */

	g_ril_append_print_buf(bd->ril, "(%s,\"\",%s,(null))",
				lock, svcs_str);

	if (g_ril_send(bd->ril, RIL_REQUEST_QUERY_FACILITY_LOCK, &rilp,
				ril_call_barring_query_cb, cbd, g_free) > 0)
		return;

	g_free(cbd);
	CALLBACK_WITH_FAILURE(callback, -1, data);
}
Пример #2
0
static void ril_call_barring_set_passwd(struct ofono_call_barring *barr,
					const char *lock,
					const char *old_passwd,
					const char *new_passwd,
					ofono_call_barring_set_cb_t cb,
					void *data)
{
	struct barring_data *bd = ofono_call_barring_get_data(barr);
	struct cb_data *cbd = cb_data_new(cb, data, bd);
	struct parcel rilp;

	DBG("lock %s old %s new %s", lock, old_passwd, new_passwd);

	parcel_init(&rilp);

	parcel_w_int32(&rilp, 3);	/* # of strings */
	parcel_w_string(&rilp, lock);
	parcel_w_string(&rilp, old_passwd);
	parcel_w_string(&rilp, new_passwd);

	g_ril_append_print_buf(bd->ril, "(%s,%s,%s)",
				lock, old_passwd, new_passwd);

	if (g_ril_send(bd->ril, RIL_REQUEST_CHANGE_BARRING_PASSWORD, &rilp,
			ril_call_barring_set_passwd_cb, cbd, g_free) > 0)
		return;

	g_free(cbd);
	CALLBACK_WITH_FAILURE(cb, data);
}
Пример #3
0
static void ril_call_barring_set(struct ofono_call_barring *cb,
				const char *lock, int enable,
				const char *passwd, int cls,
				ofono_call_barring_set_cb_t callback,
				void *data)
{
	struct barring_data *bd = ofono_call_barring_get_data(cb);
	struct cb_data *cbd = cb_data_new(callback, data, bd);
	struct parcel rilp;
	char svcs_str[4];

	DBG("lock: %s, enable: %d, bearer class: %d", lock, enable, cls);

	FIXUP_CLS();

	parcel_init(&rilp);
	parcel_w_int32(&rilp, 5);	/* # of strings */
	parcel_w_string(&rilp, lock);
	parcel_w_string(&rilp, enable ? "1" : "0");
	parcel_w_string(&rilp, passwd);
	snprintf(svcs_str, sizeof(svcs_str), "%d", cls);
	parcel_w_string(&rilp, svcs_str);
	parcel_w_string(&rilp, NULL);	/* AID (for FDN, not yet supported) */

	g_ril_append_print_buf(bd->ril, "(%s,%s,%s,%s,(null))",
				lock, enable ? "1" : "0", passwd, svcs_str);

	if (g_ril_send(bd->ril, RIL_REQUEST_SET_FACILITY_LOCK, &rilp,
			ril_call_barring_set_cb, cbd, g_free) > 0)
		return;

	g_free(cbd);
	CALLBACK_WITH_FAILURE(callback, data);
}
Пример #4
0
static void ril_call_barring_set_passwd(struct ofono_call_barring *barr,
					const char *lock,
					const char *old_passwd,
					const char *new_passwd,
					ofono_call_barring_set_cb_t cb,
					void *data)
{
	struct barring_data *bd = ofono_call_barring_get_data(barr);
	struct cb_data *cbd = cb_data_new(cb, data);
	struct parcel rilp;
	int ret = 0;

	DBG("");

	parcel_init(&rilp);
	parcel_w_int32(&rilp, RIL_SET_PW_STRING_COUNT);	/* Nbr of strings */
	parcel_w_string(&rilp, (char *) lock);		/* Facility code */
	parcel_w_string(&rilp, (char *) old_passwd);
	parcel_w_string(&rilp, (char *) new_passwd);

	ret = g_ril_send(bd->ril, RIL_REQUEST_CHANGE_BARRING_PASSWORD,
			rilp.data, rilp.size, ril_call_barring_set_passwd_cb,
			cbd, g_free);

	parcel_free(&rilp);

	if (ret <= 0) {
		ofono_error("Sending Call Barring Set PW req failed, err: %i",
				ret);
		g_free(cbd);
		CALLBACK_WITH_FAILURE(cb, data);
	}
}
Пример #5
0
static void ril_call_barring_remove(struct ofono_call_barring *cb)
{
	struct barring_data *data = ofono_call_barring_get_data(cb);
	ofono_call_barring_set_data(cb, NULL);

	g_ril_unref(data->ril);
	g_free(data);
}
Пример #6
0
static gboolean ril_delayed_register(gpointer user_data)
{
	struct ofono_call_barring *cb = user_data;
	struct barring_data *bd = ofono_call_barring_get_data(cb);

	bd->timer_id = 0;

	ofono_call_barring_register(cb);
	return FALSE;
}
Пример #7
0
static void ril_call_barring_set(struct ofono_call_barring *cb,
				const char *lock, int enable,
				const char *passwd, int cls,
				ofono_call_barring_set_cb_t callback,
				void *data)
{
	struct barring_data *bd = ofono_call_barring_get_data(cb);
	struct cb_data *cbd = cb_data_new(callback, data);
	struct parcel rilp;
	int ret = 0;
	char cls_textual[RIL_MAX_SERVICE_LENGTH];

	DBG("lock: %s, enable: %i, bearer class: %i", lock, enable, cls);

	/*
	 * RIL modem does not support 7 as default bearer class. According to
	 * the 22.030 Annex C: When service code is not given it corresponds to
	 * "All tele and bearer services"
	 */
	if (cls == BEARER_CLASS_DEFAULT)
		cls = SERVICE_CLASS_NONE;

	sprintf(cls_textual, "%d", cls);

	/* See 3GPP 27.007 7.4 for parameter descriptions */
	parcel_init(&rilp);
	parcel_w_int32(&rilp, RIL_SET_STRING_COUNT);	/* Nbr of strings */
	parcel_w_string(&rilp, (char *) lock);		/* Facility code */

	if (enable)
		parcel_w_string(&rilp, RIL_FACILITY_LOCK);
	else
		parcel_w_string(&rilp, RIL_FACILITY_UNLOCK);

	parcel_w_string(&rilp, (char *) passwd);
	parcel_w_string(&rilp, (char *) cls_textual);
	parcel_w_string(&rilp, NULL);	/* AID (for FDN, not yet supported) */

	ret = g_ril_send(bd->ril, RIL_REQUEST_SET_FACILITY_LOCK,
			rilp.data, rilp.size, ril_call_barring_set_cb,
			cbd, g_free);

	parcel_free(&rilp);

	if (ret <= 0) {
		ofono_error("Sending Call Barring Set request failed, err: %i",
				ret);
		g_free(cbd);
		CALLBACK_WITH_FAILURE(callback, data);
	}
}
Пример #8
0
static void ril_call_barring_query(struct ofono_call_barring *cb,
					const char *lock, int cls,
					ofono_call_barring_query_cb_t callback,
					void *data)
{
	struct barring_data *bd = ofono_call_barring_get_data(cb);
	struct cb_data *cbd = cb_data_new(callback, data);
	struct parcel rilp;
	int ret = 0;
	char cls_textual[RIL_MAX_SERVICE_LENGTH];

	DBG("lock: %s, services to query: %i", lock, cls);

	/*
	 * RIL modems do not support 7 as default bearer class. According to
	 * the 22.030 Annex C: When service code is not given it corresponds to
	 * "All tele and bearer services"
	 */
	if (cls == BEARER_CLASS_DEFAULT)
		cls = SERVICE_CLASS_NONE;

	sprintf(cls_textual, "%d", cls);

	/*
	 * See 3GPP 27.007 7.4 for parameter descriptions.
	 * According to ril.h password should be empty string "" when not
	 * needed, but in reality we only need to give string length as 0
	 */
	parcel_init(&rilp);
	parcel_w_int32(&rilp, RIL_QUERY_STRING_COUNT);	/* Nbr of strings */
	parcel_w_string(&rilp, (char *) lock);		/* Facility code */
	parcel_w_int32(&rilp, RIL_LENGTH_ZERO);		/* Password length */
	parcel_w_string(&rilp, (char *) cls_textual);
	parcel_w_string(&rilp, NULL); /* AID (for FDN, not yet supported) */

	ret = g_ril_send(bd->ril, RIL_REQUEST_QUERY_FACILITY_LOCK,
			rilp.data, rilp.size, ril_call_barring_query_cb,
			cbd, g_free);

	parcel_free(&rilp);

	if (ret <= 0) {
		ofono_error("Sending Call Barring query failed, err: %i", ret);
		g_free(cbd);
		CALLBACK_WITH_FAILURE(callback, -1, data);
	}
}