* [PATCH BlueZ] Recognize Eddystone Configuration Service UUIDs
2016-04-20 9:16 [PATCH BlueZ] Add Eddystone GATT Config Service to known UUIDs Francois Beaufort
@ 2016-04-20 9:16 ` Francois Beaufort
2016-04-20 12:45 ` Marcel Holtmann
0 siblings, 1 reply; 8+ messages in thread
From: Francois Beaufort @ 2016-04-20 9:16 UTC (permalink / raw)
To: linux-bluetooth
---
monitor/uuid.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/monitor/uuid.c b/monitor/uuid.c
index 54adb0d..6c60a67 100644
--- a/monitor/uuid.c
+++ b/monitor/uuid.c
@@ -540,6 +540,26 @@ static struct {
{ }
};
+static struct {
+ const char *uuid;
+ const char *str;
+} uuid128_table[] = {
+ { "a3c87500-8ed3-4bdf-8a39-a01bebede295", "Eddystone Configuration Service" },
+ { "a3c87501-8ed3-4bdf-8a39-a01bebede295", "Capabilities" },
+ { "a3c87502-8ed3-4bdf-8a39-a01bebede295", "Active Slot" },
+ { "a3c87503-8ed3-4bdf-8a39-a01bebede295", "Advertising Interval" },
+ { "a3c87504-8ed3-4bdf-8a39-a01bebede295", "Radio Tx Power" },
+ { "a3c87505-8ed3-4bdf-8a39-a01bebede295", "(Advanced) Advertised Tx Power" },
+ { "a3c87506-8ed3-4bdf-8a39-a01bebede295", "Lock State" },
+ { "a3c87507-8ed3-4bdf-8a39-a01bebede295", "Unlock" },
+ { "a3c87508-8ed3-4bdf-8a39-a01bebede295", "Public ECDH Key" },
+ { "a3c87509-8ed3-4bdf-8a39-a01bebede295", "EID Identity Key" },
+ { "a3c8750a-8ed3-4bdf-8a39-a01bebede295", "ADV Slot Data" },
+ { "a3c8750b-8ed3-4bdf-8a39-a01bebede295", "(Advanced) Factory reset" },
+ { "a3c8750c-8ed3-4bdf-8a39-a01bebede295", "(Advanced) Remain Connectable" },
+ { NULL, NULL }
+};
+
const char *uuid16_to_str(uint16_t uuid)
{
int i;
@@ -567,6 +587,7 @@ const char *uuid128_to_str(const unsigned char *uuid)
const char *uuidstr_to_str(const char *uuid)
{
+ int i;
uint32_t val;
if (!uuid)
@@ -575,6 +596,11 @@ const char *uuidstr_to_str(const char *uuid)
if (strlen(uuid) != 36)
return NULL;
+ for (i = 0; uuid128_table[i].str; i++) {
+ if (strcasecmp(uuid128_table[i].uuid, uuid) == 0)
+ return uuid128_table[i].str;
+ }
+
if (strncasecmp(uuid + 8, "-0000-1000-8000-00805f9b34fb", 28))
return "Vendor specific";
--
2.7.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH BlueZ] Recognize Eddystone Configuration Service UUIDs
2016-04-20 9:16 ` [PATCH BlueZ] Recognize Eddystone Configuration Service UUIDs Francois Beaufort
@ 2016-04-20 12:45 ` Marcel Holtmann
0 siblings, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2016-04-20 12:45 UTC (permalink / raw)
To: Francois Beaufort; +Cc: linux-bluetooth
Hi Francois,
> ---
> monitor/uuid.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/monitor/uuid.c b/monitor/uuid.c
> index 54adb0d..6c60a67 100644
> --- a/monitor/uuid.c
> +++ b/monitor/uuid.c
> @@ -540,6 +540,26 @@ static struct {
> { }
> };
>
> +static struct {
lets make the table also const.
> + const char *uuid;
> + const char *str;
> +} uuid128_table[] = {
> + { "a3c87500-8ed3-4bdf-8a39-a01bebede295", "Eddystone Configuration Service" },
> + { "a3c87501-8ed3-4bdf-8a39-a01bebede295", "Capabilities" },
> + { "a3c87502-8ed3-4bdf-8a39-a01bebede295", "Active Slot" },
> + { "a3c87503-8ed3-4bdf-8a39-a01bebede295", "Advertising Interval" },
> + { "a3c87504-8ed3-4bdf-8a39-a01bebede295", "Radio Tx Power" },
> + { "a3c87505-8ed3-4bdf-8a39-a01bebede295", "(Advanced) Advertised Tx Power" },
> + { "a3c87506-8ed3-4bdf-8a39-a01bebede295", "Lock State" },
> + { "a3c87507-8ed3-4bdf-8a39-a01bebede295", "Unlock" },
> + { "a3c87508-8ed3-4bdf-8a39-a01bebede295", "Public ECDH Key" },
> + { "a3c87509-8ed3-4bdf-8a39-a01bebede295", "EID Identity Key" },
> + { "a3c8750a-8ed3-4bdf-8a39-a01bebede295", "ADV Slot Data" },
> + { "a3c8750b-8ed3-4bdf-8a39-a01bebede295", "(Advanced) Factory reset" },
> + { "a3c8750c-8ed3-4bdf-8a39-a01bebede295", "(Advanced) Remain Connectable" },
> + { NULL, NULL }
Just us an empty { } here.
> +};
> +
I am fine doing it this way, but since we might add more than just Eddystone, maybe this should be split in a prefix match table and then subtable for UUID-16 or UUID-32 matches. Main reason is so that we can prefix these with Eddystone or other project/company/vendor names. Other a UUID name that just says "Unlock" for example is a bit to generic and misleading.
> const char *uuid16_to_str(uint16_t uuid)
> {
> int i;
> @@ -567,6 +587,7 @@ const char *uuid128_to_str(const unsigned char *uuid)
>
> const char *uuidstr_to_str(const char *uuid)
> {
> + int i;
> uint32_t val;
Generally I prefer that i iteration variable come last.
>
> if (!uuid)
> @@ -575,6 +596,11 @@ const char *uuidstr_to_str(const char *uuid)
> if (strlen(uuid) != 36)
> return NULL;
>
> + for (i = 0; uuid128_table[i].str; i++) {
> + if (strcasecmp(uuid128_table[i].uuid, uuid) == 0)
> + return uuid128_table[i].str;
> + }
> +
> if (strncasecmp(uuid + 8, "-0000-1000-8000-00805f9b34fb", 28))
> return "Vendor specific";
Regards
Marcel
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH BlueZ] Recognize Eddystone Configuration Service UUIDs
@ 2016-04-20 13:04 Francois Beaufort
2016-04-20 13:04 ` Francois Beaufort
0 siblings, 1 reply; 8+ messages in thread
From: Francois Beaufort @ 2016-04-20 13:04 UTC (permalink / raw)
To: linux-bluetooth
Francois Beaufort (1):
Recognize Eddystone Configuration Service UUIDs
monitor/uuid.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
--
2.7.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH BlueZ] Recognize Eddystone Configuration Service UUIDs
2016-04-20 13:04 [PATCH BlueZ] Recognize Eddystone Configuration Service UUIDs Francois Beaufort
@ 2016-04-20 13:04 ` Francois Beaufort
0 siblings, 0 replies; 8+ messages in thread
From: Francois Beaufort @ 2016-04-20 13:04 UTC (permalink / raw)
To: linux-bluetooth
---
monitor/uuid.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/monitor/uuid.c b/monitor/uuid.c
index 54adb0d..deaf14f 100644
--- a/monitor/uuid.c
+++ b/monitor/uuid.c
@@ -31,7 +31,7 @@
#include "uuid.h"
-static struct {
+static const struct {
uint16_t uuid;
const char *str;
} uuid16_table[] = {
@@ -540,6 +540,26 @@ static struct {
{ }
};
+static const struct {
+ const char *uuid;
+ const char *str;
+} uuid128_table[] = {
+ { "a3c87500-8ed3-4bdf-8a39-a01bebede295", "Eddystone Configuration Service" },
+ { "a3c87501-8ed3-4bdf-8a39-a01bebede295", "Capabilities" },
+ { "a3c87502-8ed3-4bdf-8a39-a01bebede295", "Active Slot" },
+ { "a3c87503-8ed3-4bdf-8a39-a01bebede295", "Advertising Interval" },
+ { "a3c87504-8ed3-4bdf-8a39-a01bebede295", "Radio Tx Power" },
+ { "a3c87505-8ed3-4bdf-8a39-a01bebede295", "(Advanced) Advertised Tx Power" },
+ { "a3c87506-8ed3-4bdf-8a39-a01bebede295", "Lock State" },
+ { "a3c87507-8ed3-4bdf-8a39-a01bebede295", "Unlock" },
+ { "a3c87508-8ed3-4bdf-8a39-a01bebede295", "Public ECDH Key" },
+ { "a3c87509-8ed3-4bdf-8a39-a01bebede295", "EID Identity Key" },
+ { "a3c8750a-8ed3-4bdf-8a39-a01bebede295", "ADV Slot Data" },
+ { "a3c8750b-8ed3-4bdf-8a39-a01bebede295", "(Advanced) Factory reset" },
+ { "a3c8750c-8ed3-4bdf-8a39-a01bebede295", "(Advanced) Remain Connectable" },
+ { }
+};
+
const char *uuid16_to_str(uint16_t uuid)
{
int i;
@@ -568,6 +588,7 @@ const char *uuid128_to_str(const unsigned char *uuid)
const char *uuidstr_to_str(const char *uuid)
{
uint32_t val;
+ int i;
if (!uuid)
return NULL;
@@ -575,6 +596,11 @@ const char *uuidstr_to_str(const char *uuid)
if (strlen(uuid) != 36)
return NULL;
+ for (i = 0; uuid128_table[i].str; i++) {
+ if (strcasecmp(uuid128_table[i].uuid, uuid) == 0)
+ return uuid128_table[i].str;
+ }
+
if (strncasecmp(uuid + 8, "-0000-1000-8000-00805f9b34fb", 28))
return "Vendor specific";
--
2.7.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH BlueZ] Recognize Eddystone Configuration Service UUIDs
@ 2016-04-22 14:20 Francois Beaufort
2016-04-22 14:20 ` Francois Beaufort
0 siblings, 1 reply; 8+ messages in thread
From: Francois Beaufort @ 2016-04-22 14:20 UTC (permalink / raw)
To: linux-bluetooth
Francois Beaufort (1):
Recognize Eddystone Configuration Service UUIDs
monitor/uuid.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
--
2.7.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH BlueZ] Recognize Eddystone Configuration Service UUIDs
2016-04-22 14:20 Francois Beaufort
@ 2016-04-22 14:20 ` Francois Beaufort
2016-04-25 9:03 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 8+ messages in thread
From: Francois Beaufort @ 2016-04-22 14:20 UTC (permalink / raw)
To: linux-bluetooth
---
monitor/uuid.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/monitor/uuid.c b/monitor/uuid.c
index 54adb0d..1ceaa6f 100644
--- a/monitor/uuid.c
+++ b/monitor/uuid.c
@@ -31,7 +31,7 @@
#include "uuid.h"
-static struct {
+static const struct {
uint16_t uuid;
const char *str;
} uuid16_table[] = {
@@ -540,6 +540,31 @@ static struct {
{ }
};
+static const struct {
+ const char *uuid;
+ const char *str;
+} uuid128_table[] = {
+ { "a3c87500-8ed3-4bdf-8a39-a01bebede295",
+ "Eddystone Configuration Service" },
+ { "a3c87501-8ed3-4bdf-8a39-a01bebede295", "Capabilities" },
+ { "a3c87502-8ed3-4bdf-8a39-a01bebede295", "Active Slot" },
+ { "a3c87503-8ed3-4bdf-8a39-a01bebede295",
+ "Advertising Interval" },
+ { "a3c87504-8ed3-4bdf-8a39-a01bebede295", "Radio Tx Power" },
+ { "a3c87505-8ed3-4bdf-8a39-a01bebede295",
+ "(Advanced) Advertised Tx Power" },
+ { "a3c87506-8ed3-4bdf-8a39-a01bebede295", "Lock State" },
+ { "a3c87507-8ed3-4bdf-8a39-a01bebede295", "Unlock" },
+ { "a3c87508-8ed3-4bdf-8a39-a01bebede295", "Public ECDH Key" },
+ { "a3c87509-8ed3-4bdf-8a39-a01bebede295", "EID Identity Key" },
+ { "a3c8750a-8ed3-4bdf-8a39-a01bebede295", "ADV Slot Data" },
+ { "a3c8750b-8ed3-4bdf-8a39-a01bebede295",
+ "(Advanced) Factory reset" },
+ { "a3c8750c-8ed3-4bdf-8a39-a01bebede295",
+ "(Advanced) Remain Connectable" },
+ { }
+};
+
const char *uuid16_to_str(uint16_t uuid)
{
int i;
@@ -568,6 +593,7 @@ const char *uuid128_to_str(const unsigned char *uuid)
const char *uuidstr_to_str(const char *uuid)
{
uint32_t val;
+ int i;
if (!uuid)
return NULL;
@@ -575,6 +601,11 @@ const char *uuidstr_to_str(const char *uuid)
if (strlen(uuid) != 36)
return NULL;
+ for (i = 0; uuid128_table[i].str; i++) {
+ if (strcasecmp(uuid128_table[i].uuid, uuid) == 0)
+ return uuid128_table[i].str;
+ }
+
if (strncasecmp(uuid + 8, "-0000-1000-8000-00805f9b34fb", 28))
return "Vendor specific";
--
2.7.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH BlueZ] Recognize Eddystone Configuration Service UUIDs
2016-04-22 14:20 ` Francois Beaufort
@ 2016-04-25 9:03 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 8+ messages in thread
From: Luiz Augusto von Dentz @ 2016-04-25 9:03 UTC (permalink / raw)
To: Francois Beaufort; +Cc: linux-bluetooth@vger.kernel.org
Hi Francois,
On Fri, Apr 22, 2016 at 5:20 PM, Francois Beaufort
<beaufort.francois@gmail.com> wrote:
> ---
> monitor/uuid.c | 33 ++++++++++++++++++++++++++++++++-
> 1 file changed, 32 insertions(+), 1 deletion(-)
>
> diff --git a/monitor/uuid.c b/monitor/uuid.c
> index 54adb0d..1ceaa6f 100644
> --- a/monitor/uuid.c
> +++ b/monitor/uuid.c
> @@ -31,7 +31,7 @@
>
> #include "uuid.h"
>
> -static struct {
> +static const struct {
> uint16_t uuid;
> const char *str;
> } uuid16_table[] = {
> @@ -540,6 +540,31 @@ static struct {
> { }
> };
>
> +static const struct {
> + const char *uuid;
> + const char *str;
> +} uuid128_table[] = {
> + { "a3c87500-8ed3-4bdf-8a39-a01bebede295",
> + "Eddystone Configuration Service" },
> + { "a3c87501-8ed3-4bdf-8a39-a01bebede295", "Capabilities" },
> + { "a3c87502-8ed3-4bdf-8a39-a01bebede295", "Active Slot" },
> + { "a3c87503-8ed3-4bdf-8a39-a01bebede295",
> + "Advertising Interval" },
> + { "a3c87504-8ed3-4bdf-8a39-a01bebede295", "Radio Tx Power" },
> + { "a3c87505-8ed3-4bdf-8a39-a01bebede295",
> + "(Advanced) Advertised Tx Power" },
> + { "a3c87506-8ed3-4bdf-8a39-a01bebede295", "Lock State" },
> + { "a3c87507-8ed3-4bdf-8a39-a01bebede295", "Unlock" },
> + { "a3c87508-8ed3-4bdf-8a39-a01bebede295", "Public ECDH Key" },
> + { "a3c87509-8ed3-4bdf-8a39-a01bebede295", "EID Identity Key" },
> + { "a3c8750a-8ed3-4bdf-8a39-a01bebede295", "ADV Slot Data" },
> + { "a3c8750b-8ed3-4bdf-8a39-a01bebede295",
> + "(Advanced) Factory reset" },
> + { "a3c8750c-8ed3-4bdf-8a39-a01bebede295",
> + "(Advanced) Remain Connectable" },
> + { }
> +};
> +
> const char *uuid16_to_str(uint16_t uuid)
> {
> int i;
> @@ -568,6 +593,7 @@ const char *uuid128_to_str(const unsigned char *uuid)
> const char *uuidstr_to_str(const char *uuid)
> {
> uint32_t val;
> + int i;
>
> if (!uuid)
> return NULL;
> @@ -575,6 +601,11 @@ const char *uuidstr_to_str(const char *uuid)
> if (strlen(uuid) != 36)
> return NULL;
>
> + for (i = 0; uuid128_table[i].str; i++) {
> + if (strcasecmp(uuid128_table[i].uuid, uuid) == 0)
> + return uuid128_table[i].str;
> + }
> +
> if (strncasecmp(uuid + 8, "-0000-1000-8000-00805f9b34fb", 28))
> return "Vendor specific";
>
> --
> 2.7.0
Applied, thanks.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH BlueZ] Recognize Eddystone Configuration Service UUIDs
2016-04-26 8:30 [PATCH BlueZ] FIx select-attribute behaviour Francois Beaufort
@ 2016-04-26 8:30 ` Francois Beaufort
0 siblings, 0 replies; 8+ messages in thread
From: Francois Beaufort @ 2016-04-26 8:30 UTC (permalink / raw)
To: linux-bluetooth
---
monitor/uuid.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/monitor/uuid.c b/monitor/uuid.c
index 54adb0d..1ceaa6f 100644
--- a/monitor/uuid.c
+++ b/monitor/uuid.c
@@ -31,7 +31,7 @@
#include "uuid.h"
-static struct {
+static const struct {
uint16_t uuid;
const char *str;
} uuid16_table[] = {
@@ -540,6 +540,31 @@ static struct {
{ }
};
+static const struct {
+ const char *uuid;
+ const char *str;
+} uuid128_table[] = {
+ { "a3c87500-8ed3-4bdf-8a39-a01bebede295",
+ "Eddystone Configuration Service" },
+ { "a3c87501-8ed3-4bdf-8a39-a01bebede295", "Capabilities" },
+ { "a3c87502-8ed3-4bdf-8a39-a01bebede295", "Active Slot" },
+ { "a3c87503-8ed3-4bdf-8a39-a01bebede295",
+ "Advertising Interval" },
+ { "a3c87504-8ed3-4bdf-8a39-a01bebede295", "Radio Tx Power" },
+ { "a3c87505-8ed3-4bdf-8a39-a01bebede295",
+ "(Advanced) Advertised Tx Power" },
+ { "a3c87506-8ed3-4bdf-8a39-a01bebede295", "Lock State" },
+ { "a3c87507-8ed3-4bdf-8a39-a01bebede295", "Unlock" },
+ { "a3c87508-8ed3-4bdf-8a39-a01bebede295", "Public ECDH Key" },
+ { "a3c87509-8ed3-4bdf-8a39-a01bebede295", "EID Identity Key" },
+ { "a3c8750a-8ed3-4bdf-8a39-a01bebede295", "ADV Slot Data" },
+ { "a3c8750b-8ed3-4bdf-8a39-a01bebede295",
+ "(Advanced) Factory reset" },
+ { "a3c8750c-8ed3-4bdf-8a39-a01bebede295",
+ "(Advanced) Remain Connectable" },
+ { }
+};
+
const char *uuid16_to_str(uint16_t uuid)
{
int i;
@@ -568,6 +593,7 @@ const char *uuid128_to_str(const unsigned char *uuid)
const char *uuidstr_to_str(const char *uuid)
{
uint32_t val;
+ int i;
if (!uuid)
return NULL;
@@ -575,6 +601,11 @@ const char *uuidstr_to_str(const char *uuid)
if (strlen(uuid) != 36)
return NULL;
+ for (i = 0; uuid128_table[i].str; i++) {
+ if (strcasecmp(uuid128_table[i].uuid, uuid) == 0)
+ return uuid128_table[i].str;
+ }
+
if (strncasecmp(uuid + 8, "-0000-1000-8000-00805f9b34fb", 28))
return "Vendor specific";
--
2.7.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-04-26 8:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-20 13:04 [PATCH BlueZ] Recognize Eddystone Configuration Service UUIDs Francois Beaufort
2016-04-20 13:04 ` Francois Beaufort
-- strict thread matches above, loose matches on Subject: below --
2016-04-26 8:30 [PATCH BlueZ] FIx select-attribute behaviour Francois Beaufort
2016-04-26 8:30 ` [PATCH BlueZ] Recognize Eddystone Configuration Service UUIDs Francois Beaufort
2016-04-22 14:20 Francois Beaufort
2016-04-22 14:20 ` Francois Beaufort
2016-04-25 9:03 ` Luiz Augusto von Dentz
2016-04-20 9:16 [PATCH BlueZ] Add Eddystone GATT Config Service to known UUIDs Francois Beaufort
2016-04-20 9:16 ` [PATCH BlueZ] Recognize Eddystone Configuration Service UUIDs Francois Beaufort
2016-04-20 12:45 ` Marcel Holtmann
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).