Re: [PATCH v2] android: Add set/get for discovery timeout

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

 



Hi Lukasz,

On Thu, Nov 07, 2013, Lukasz Rymanowski wrote:
> @@ -1169,6 +1184,8 @@ void bt_adapter_init(uint16_t index, struct mgmt *mgmt, bt_adapter_ready cb)
>  	adapter->index = index;
>  	adapter->discovering = false;
>  	adapter->ready = cb;
> +	/* TODO: Read it from some storage */
> +	adapter->discoverable_timeout = DEFAULT_DISCOVERABLE_TIMEOUT;
>  
>  	if (mgmt_send(mgmt, MGMT_OP_READ_INFO, index, 0, NULL,
>  					read_info_complete, NULL, NULL) > 0)
> @@ -1286,11 +1303,25 @@ static bool get_devices(void)
>  
>  static bool get_discoverable_timeout(void)
>  {
> -	DBG("Not implemented");
> +	struct hal_ev_adapter_props_changed *ev;
> +	int len = sizeof(uint32_t);
> +	uint8_t buf[BASELEN_PROP_CHANGED + len];
>  
> -	/* TODO: Add implementation */
>  
> -	return false;
> +	memset(buf, 0, sizeof(buf));

Looks like you're leaving two empty lines above? Please remove one.

> +	ev = (void *) buf;
> +
> +	ev->num_props = 1;
> +	ev->status = HAL_STATUS_SUCCESS;
> +
> +	ev->props[0].type = HAL_PROP_ADAPTER_DISC_TIMEOUT;
> +	ev->props[0].len = len;

The len variable seems quite unnecessary to me since you could just use
sizeof(uint32_t) in the two places where you need it.

> +	memcpy(&ev->props[0].val, &adapter->discoverable_timeout, sizeof(uint32_t));
> +
> +	ipc_send(notification_sk, HAL_SERVICE_ID_BLUETOOTH,
> +				HAL_EV_ADAPTER_PROPS_CHANGED, sizeof(buf), ev, -1);

Please pay attention to your line lengths. You've got at least two lines
above that are over 79 characters.

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