From: Johan Hedberg <johan.hedberg@gmail.com>
To: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
Cc: linux-bluetooth@vger.kernel.org, szymon.janc@tieto.com,
Jakub Tyszkowski <jakub.tyszkowski@tieto.com>
Subject: Re: [PATCH 15/36] android/gatt: Register device information service
Date: Tue, 29 Apr 2014 11:08:42 +0300 [thread overview]
Message-ID: <20140429080842.GE21742@t440s.lan> (raw)
In-Reply-To: <1398734107-4793-17-git-send-email-lukasz.rymanowski@tieto.com>
On Tue, Apr 29, 2014, Lukasz Rymanowski wrote:
> This adds placeholder data to device information service. To get
> real data we should figure out the best way to get Android's system
> properties and expose them to profiles for reading.
> ---
> android/gatt.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 90 insertions(+)
>
> diff --git a/android/gatt.c b/android/gatt.c
> index d2b1684..2ad5936 100644
> --- a/android/gatt.c
> +++ b/android/gatt.c
> @@ -3811,6 +3811,95 @@ static void register_gap_service(void)
>
> gatt_db_service_set_active(gatt_db, gap_srvc_data.srvc , true);
> }
> +
> +/* TODO: Figure out the best way for this to be not hard coded. */
> +static struct device_info {
> + const char *manufacturer_name;
> + const char *system_id;
> + const char *model_number;
> + const char *serial_number;
> + const char *firmware_rev;
> + const char *hardware_rev;
> + const char *software_rev;
> +} device_info = {
> + .manufacturer_name = "BlueZ",
> + .system_id = "BlueZ for Android",
> + .model_number = "model no",
> + .serial_number = "serial no",
> + .firmware_rev = "firmware rev",
> + .hardware_rev = "hardware rev",
> + .software_rev = "software rev",
> +};
Again, you'll want to hook up at least some of these, like the system_id
to information from android/bluetooth.c
> + bt_uuid16_create(&uuid, GATT_CHARAC_SYSTEM_ID);
> + gatt_db_add_characteristic(gatt_db, srvc_handle, &uuid, 0,
> + GATT_CHR_PROP_READ,
> + device_info_read_cb, NULL,
> + (void *)device_info.system_id);
> +
> + bt_uuid16_create(&uuid, GATT_CHARAC_MODEL_NUMBER_STRING);
> + gatt_db_add_characteristic(gatt_db, srvc_handle, &uuid, 0,
> + GATT_CHR_PROP_READ,
> + device_info_read_cb, NULL,
> + (void *)device_info.model_number);
> +
> + bt_uuid16_create(&uuid, GATT_CHARAC_SERIAL_NUMBER_STRING);
> + gatt_db_add_characteristic(gatt_db, srvc_handle, &uuid, 0,
> + GATT_CHR_PROP_READ,
> + device_info_read_cb, NULL,
> + (void *)device_info.serial_number);
> +
> + bt_uuid16_create(&uuid, GATT_CHARAC_FIRMWARE_REVISION_STRING);
> + gatt_db_add_characteristic(gatt_db, srvc_handle, &uuid, 0,
> + GATT_CHR_PROP_READ,
> + device_info_read_cb, NULL,
> + (void *)device_info.firmware_rev);
> +
> + bt_uuid16_create(&uuid, GATT_CHARAC_HARDWARE_REVISION_STRING);
> + gatt_db_add_characteristic(gatt_db, srvc_handle, &uuid, 0,
> + GATT_CHR_PROP_READ,
> + device_info_read_cb, NULL,
> + (void *) device_info.hardware_rev);
> +
> + bt_uuid16_create(&uuid, GATT_CHARAC_SOFTWARE_REVISION_STRING);
> + gatt_db_add_characteristic(gatt_db, srvc_handle, &uuid, 0,
> + GATT_CHR_PROP_READ,
> + device_info_read_cb, NULL,
> + (void *) device_info.software_rev);
> +
> + bt_uuid16_create(&uuid, GATT_CHARAC_MANUFACTURER_NAME_STRING);
> + gatt_db_add_characteristic(gatt_db, srvc_handle, &uuid, 0,
> + GATT_CHR_PROP_READ,
> + device_info_read_cb, NULL,
> + (void *)device_info.manufacturer_name);
Space after all of the (void *) type casts here. You'll also probably
want to add a comment why it's needed, i.e. because these variables are
const while the user_data parameter is not.
Johan
next prev parent reply other threads:[~2014-04-29 8:08 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-29 1:14 [PATCH 00/36] android/gatt: GATT server implementation Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 01/36] android/gatt: Add comment about event type being sent Lukasz Rymanowski
2014-04-29 7:57 ` Johan Hedberg
2014-04-29 10:20 ` Szymon Janc
2014-04-29 9:47 ` Tyszkowski Jakub
2014-04-29 1:14 ` [PATCH] android/gatt: Add support for send indication Lukasz Rymanowski
2014-04-29 1:19 ` Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 02/36] android/gatt: Add service functionality Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 03/36] android/gatt: Add implementation of delete service Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 04/36] android/gatt: Add included service implementation Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 05/36] android/gatt: Add characteristic implementation Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 06/36] android/gatt: Add handling of start service command Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 07/36] android/gatt: Add stop service command handling Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 08/36] android/gatt: Add descriptor implementation Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 09/36] android/gatt: Add listening socket for GATT Lukasz Rymanowski
2014-04-29 8:01 ` Johan Hedberg
2014-04-29 10:41 ` Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 10/36] android/gatt: Add ATT msg handler Lukasz Rymanowski
2014-04-29 8:03 ` Johan Hedberg
2014-04-29 10:44 ` Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 11/36] shared: Use pointer for request data instead of int Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 12/36] shared/gatt: Extend read callback with offset Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 13/36] android/gatt: Add register GAP Service Lukasz Rymanowski
2014-04-29 8:05 ` Johan Hedberg
2014-04-29 11:15 ` Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 14/36] gatt: Add some characteristics uuids Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 15/36] android/gatt: Register device information service Lukasz Rymanowski
2014-04-29 8:08 ` Johan Hedberg [this message]
2014-04-29 11:35 ` Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 16/36] shared: Extend write callback with offset Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 17/36] android/gatt: Register GATT service Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 18/36] shared/gatt: Add function to read by group type Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 19/36] shared/gatt: Add function to find by type Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 20/36] shared/gatt: Add function to read " Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 21/36] android/gatt: Add support for ATT read by group type Lukasz Rymanowski
2014-04-29 8:11 ` Johan Hedberg
2014-04-29 1:14 ` [PATCH 22/36] android/gatt: Add support for ATT read by type Lukasz Rymanowski
2014-04-29 8:12 ` Johan Hedberg
2014-04-29 11:37 ` Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 23/36] shared/gatt: Add support to read from database Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 24/36] android/gatt: Move struct req_data up in the file Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 25/36] android/gatt: Add support to read request Lukasz Rymanowski
2014-04-29 8:13 ` Johan Hedberg
2014-04-29 12:12 ` Lukasz Rymanowski
2014-04-29 12:56 ` Johan Hedberg
2014-04-29 16:32 ` Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 26/36] android/gatt: Add MTU request cmd handling Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 27/36] android/gatt: Add Find info gatt server " Lukasz Rymanowski
2014-04-29 1:14 ` [PATCH 28/36] shared/gatt: Add support for write request Lukasz Rymanowski
2014-04-29 1:15 ` [PATCH 29/36] android/gatt: " Lukasz Rymanowski
2014-04-29 8:15 ` Johan Hedberg
2014-04-29 1:15 ` [PATCH 30/36] android/gatt: Add support for execute write Lukasz Rymanowski
2014-04-29 1:15 ` [PATCH 31/36] android/gatt: Move struct req_data upper in the file Lukasz Rymanowski
2014-04-29 1:15 ` [PATCH 32/36] android/gatt: Add write callback to server Lukasz Rymanowski
2014-04-29 8:16 ` Johan Hedberg
2014-04-30 9:14 ` Lukasz Rymanowski
2014-04-29 1:15 ` [PATCH 33/36] android/gatt: Add read_cb for GATT Server Lukasz Rymanowski
2014-04-29 1:15 ` [PATCH 34/36] android/hal-gatt-api: Fix IPC definition for send response Lukasz Rymanowski
2014-04-29 1:15 ` [PATCH 35/36] android/gatt: Add support for GATT server " Lukasz Rymanowski
2014-04-29 1:15 ` [PATCH 36/36] android/gatt: Add support for send indication Lukasz Rymanowski
2014-04-29 1:21 ` [PATCH 00/36] android/gatt: GATT server implementation Lukasz Rymanowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140429080842.GE21742@t440s.lan \
--to=johan.hedberg@gmail.com \
--cc=jakub.tyszkowski@tieto.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=lukasz.rymanowski@tieto.com \
--cc=szymon.janc@tieto.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).