nrf5/sdk: Adding new function to the softdevice handler driver to add vendor specific uuids and return an index to the entry back by reference.

This commit is contained in:
Glenn Ruben Bakke 2017-02-09 23:56:32 +01:00
parent 8a551e1354
commit b93644221e
2 changed files with 20 additions and 0 deletions

View File

@ -26,12 +26,19 @@
#include <stdio.h>
#include <string.h>
#include "py/runtime.h"
#include "softdevice.h"
#include "mpconfigport.h"
#include "nrf_sdm.h"
#include "ble_gap.h"
#include "ble.h" // sd_ble_uuid_encode
#define SD_TEST_OR_ENABLE() \
if (sd_enabled() == 0) { \
(void)sd_enable(); \
}
#if (BLUETOOTH_SD != 100) && (BLUETOOTH_SD != 110)
#include "nrf_nvic.h"
@ -199,3 +206,14 @@ void sd_advertise(void) {
printf("Advertisment start status: " UINT_FMT "\n", (uint16_t)err_code);
}
bool sd_uuid_add_vs(uint8_t * p_uuid, uint8_t * idx) {
SD_TEST_OR_ENABLE();
if (sd_ble_uuid_vs_add((ble_uuid128_t const *)p_uuid, idx) != 0) {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError,
"Can not add Vendor Specific 128-bit UUID."));
}
return true;
}

View File

@ -25,6 +25,7 @@
*/
#include <stdint.h>
#include <stdbool.h>
uint32_t sd_enable(void);
@ -36,3 +37,4 @@ void sd_address_get(void);
void sd_advertise(void);
bool sd_uuid_add_vs(uint8_t * p_uuid, uint8_t * idx);