Comments (5)
I just committed a fix for this issue
from bluez_inc.
I believe you'd want to make the characteristic part of a service that isn't advertised. For example, using a modified peripheral.c
:
// Setup advertisement
GPtrArray *adv_service_uuids = g_ptr_array_new();
g_ptr_array_add(adv_service_uuids, HTS_ADVERTISING_SERVICE_UUID); // Make a service specifically for advertising
advertisement = binc_advertisement_create();
binc_advertisement_set_local_name(advertisement, "BINC");
binc_advertisement_set_services(advertisement, adv_service_uuids); // only add that service to the advertising services
g_ptr_array_free(adv_service_uuids, TRUE);
binc_adapter_start_advertising(default_adapter, advertisement);
// Start application
app = binc_create_application(default_adapter);
binc_application_add_service(app, HTS_ADVERTISING_SERVICE_UUID);
binc_application_add_service(app, HTS_SERVICE_UUID); // this is your real service, DON'T add it to the advertisement
binc_application_add_characteristic(
app,
HTS_SERVICE_UUID,
TEMPERATURE_CHAR_UUID,
GATT_CHR_PROP_READ | GATT_CHR_PROP_INDICATE | GATT_CHR_PROP_WRITE);
or at least that's how I'm doing it, which results in one service being advertised until the device is paired, there may be more to it that Martijn might know.
from bluez_inc.
Unfortunately it is not (yet) possible to create characteristics that require encryption. I will put that on the backlog....
from bluez_inc.
Thanks @weliem , @lizziemac ,
I have tried as below and it's working
modified peripheral.c:
agent = binc_agent_create(default_adapter, "/org/bluez/BincAgent", DISPLAY_YES_NO);
modified application.c:
-------------- /binc/application.c --------------
index bf36272..90126e8 100644
@@ -697,7 +697,7 @@ static GList *permissions2Flags(const guint8 permissions)
GList *list = NULL;
if (permissions & GATT_CHR_PROP_READ) {
-
list = g_list_append(list, g_strdup("read"));
-
}
list = g_list_append(list, g_strdup("encrypt-read"));
if (permissions & GATT_CHR_PROP_WRITE_WITHOUT_RESP) {
list = g_list_append(list, g_strdup("write-without-response"));
modified characteristic.c:
------------- binc/characteristic.c -------------
index dcb1e83..577f846 100644
@@ -521,7 +521,7 @@ static guint binc_characteristic_flags_to_int(GList *flags) {
char *property = (char *) iterator->data;
if (g_str_equal(property, "broadcast")) {
result += GATT_CHR_PROP_BROADCAST;
-
} else if (g_str_equal(property, "read")) {
-
} else if (g_str_equal(property, "encrypt-read")) { result += GATT_CHR_PROP_READ; } else if (g_str_equal(property, "write-without-response")) { result += GATT_CHR_PROP_WRITE_WITHOUT_RESP;
from bluez_inc.
Closing issue
from bluez_inc.
Related Issues (20)
- How to get the example applications to work? HOT 10
- `on_char_start_notify` is not being called when using `GATT_CHR_PROP_ENCRYPT_NOTIFY`. HOT 2
- Get CompanyID and Manufacturer Data on discovery callback HOT 3
- Missing notification enable callback on android phone HOT 4
- Handling RSSI threshold for device pair requests in peripheral mode HOT 2
- User data on all top-level `bluez_inc` types? HOT 3
- User-supplied log handler HOT 2
- scope enums with `BINC_` HOT 1
- GitHub CI HOT 1
- Does it support classic Bluetooth? HOT 1
- Raspberry Pi - Service Discovery Slow / Disconnect HOT 27
- Advertising, scan and connection parameters HOT 3
- Add Device into characteristic callbacks? HOT 2
- A couple more callbacks that I think should have a device object in them HOT 1
- Register multiple adveritisements HOT 1
- Concern about peripheral example. HOT 2
- How to rename bluetooth HOT 3
- Issue with scanning after turning bluetooth of and then back on HOT 3
- Reconnect to a previous device causes strange behavior HOT 5
- Peripheral - Device Information Service HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bluez_inc.