mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
examples/nimble_gatt: drop build-in init calls
This commit is contained in:
parent
0cca1769cc
commit
4e49fa5cc5
@ -35,6 +35,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "nimble_riot.h"
|
||||
#include "net/bluetil/ad.h"
|
||||
|
||||
#include "host/ble_hs.h"
|
||||
@ -65,7 +66,6 @@ static const ble_uuid128_t gatt_svr_chr_rw_demo_readonly_uuid
|
||||
0x4d, 0xd5, 0x40, 0x3f, 0x11, 0xdd, 0xcc);
|
||||
|
||||
static const char *device_name = "NimBLE on RIOT";
|
||||
static uint8_t own_addr_type;
|
||||
|
||||
static char rm_demo_write_data[64] = "This characteristic is read- and writeable!";
|
||||
|
||||
@ -159,7 +159,7 @@ static void start_advertise(void)
|
||||
memset(&advp, 0, sizeof advp);
|
||||
advp.conn_mode = BLE_GAP_CONN_MODE_UND;
|
||||
advp.disc_mode = BLE_GAP_DISC_MODE_GEN;
|
||||
rc = ble_gap_adv_start(own_addr_type, NULL, BLE_HS_FOREVER,
|
||||
rc = ble_gap_adv_start(nimble_riot_own_addr_type, NULL, BLE_HS_FOREVER,
|
||||
&advp, gap_event_cb, NULL);
|
||||
assert(rc == 0);
|
||||
(void)rc;
|
||||
@ -311,32 +311,17 @@ int main(void)
|
||||
|
||||
int rc = 0;
|
||||
|
||||
/* verify and add our custom services */
|
||||
rc = ble_gatts_count_cfg(gatt_svr_svcs);
|
||||
assert(rc == 0);
|
||||
|
||||
rc = ble_gatts_add_svcs(gatt_svr_svcs);
|
||||
assert(rc == 0);
|
||||
|
||||
/* set the device name */
|
||||
ble_svc_gap_device_name_set(device_name);
|
||||
|
||||
/* initialize the GAP and GATT services */
|
||||
ble_svc_gap_init();
|
||||
ble_svc_gatt_init();
|
||||
/* XXX: seems to be needed to apply the added services */
|
||||
/* reload the GATT server to link our added services */
|
||||
ble_gatts_start();
|
||||
|
||||
/* make sure synchronization of host and controller is done, this should
|
||||
* always be the case */
|
||||
while (!ble_hs_synced()) {}
|
||||
|
||||
/* configure device address */
|
||||
rc = ble_hs_util_ensure_addr(0);
|
||||
assert(rc == 0);
|
||||
rc = ble_hs_id_infer_auto(0, &own_addr_type);
|
||||
assert(rc == 0);
|
||||
(void)rc;
|
||||
|
||||
/* configure and set the advertising data */
|
||||
uint8_t buf[BLE_HS_ADV_MAX_SZ];
|
||||
bluetil_ad_t ad;
|
||||
|
Loading…
Reference in New Issue
Block a user