diff --git a/client/advertising.c b/client/advertising.c
index a7474d6..a9b865a 100644
--- a/client/advertising.c
+++ b/client/advertising.c
};
struct data {
+ bool valid;
uint8_t type;
struct ad_data data;
};
ad.manufacturer.data.len);
}
- if (ad.data.data.len) {
+ if (ad.data.valid) {
bt_shell_printf("Data Type: 0x%02x\n", ad.data.type);
bt_shell_hexdump(ad.data.data.data, ad.data.data.len);
}
static gboolean data_exists(const GDBusPropertyTable *property, void *data)
{
- return ad.data.type != 0;
+ return ad.data.valid;
}
static gboolean get_data(const GDBusPropertyTable *property,
static void ad_clear_data(void)
{
- memset(&ad.manufacturer, 0, sizeof(ad.manufacturer));
+ memset(&ad.data, 0, sizeof(ad.data));
return bt_shell_noninteractive_quit(EXIT_SUCCESS);
}
return bt_shell_noninteractive_quit(EXIT_FAILURE);
ad_clear_data();
+ ad.data.valid = true;
ad.data.type = val;
ad.data.data = data;