Re: [PATCH BlueZ v5 07/16] gatt: Assign read callback for external services

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Claudio,

On Tue, Mar 18, 2014, Claudio Takahasi wrote:
> This patch adds the callback for reading the external characteristic
> Value. Internally, GDBusProxy implementation tracks all properties Value
> changes consequently Value can be ready directly from the proxy without
> additional method calls.
> ---
>  src/gatt-dbus.c | 42 +++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 41 insertions(+), 1 deletion(-)

The first 6 patches have been applied. However:

> +static void proxy_read_cb(struct btd_attribute *attr,
> +				btd_attr_read_result_t result, void *user_data)
> +{
> +	DBusMessageIter iter, array;
> +	GDBusProxy *proxy;
> +	uint8_t *value;
> +	int len;
> +
> +	/*
> +	 * Remote device is trying to read the informed attribute,
> +	 * "Value" should be read from the proxy. GDBusProxy tracks
> +	 * properties changes automatically, it is not necessary to
> +	 * get the value directly from the GATT server.
> +	 */
> +	proxy = g_hash_table_lookup(proxy_hash, attr);
> +	if (proxy == NULL) {
> +		result(ENOENT, NULL, 0, user_data);
> +		return;
> +	}
> +
> +	if (!g_dbus_proxy_get_property(proxy, "Value", &iter)) {
> +		/* Unusual situation, read property will checked earlier */
> +		result(EPERM, NULL, 0, user_data);
> +		return;
> +	}
> +
> +	if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY) {
> +		DBG("External service inconsistent!");
> +		result(EPERM, NULL, 0, user_data);
> +		return;
> +	}

Whenever we have "int err" variables a negative value denotes an error.
Let's keep this convention consistent throughout the code base.

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux