bt_gatt_service_remove()
Description
Function to remove a GATT service and characteristics associated with it.
Syntax
bt_gatt_service_remove(service_uuid[]);
Parameters
Variable | Input |
|---|---|
| Service UUID. Must be up to 16 bytes (128-bits) length. |
Returns
Return value | Return explanation |
SCRIPT_OPERATION_SUCCESS | Successfully removed a GATT service or the service was not registered. |
SCRIPT_OPERATION_FAILED | GATT service could not be unregistered. |
SCRIPT_NO_ACCESS | Bluetooth GATT server is not initialized. |
SCRIPT_PARAM_INVALID | Possible reasons:
|
Function call example
#include <io>
#include <read>
#include <float>
#include <string>
#include <core>
#include <write>
#include <define>
#include <socket>
#include <bluetooth>
new service_uuid[UUID_LENGTH_128_BIT] = [0x08, 0x07, 0x06, 0x05, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB];
new chrc_uuid_1[UUID_LENGTH_128_BIT] = [0x05, 0x12, 0x96, 0x99, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB];
main()
{
bt_init();
bt_gatt_server_init();
bt_gatt_service_create(service_uuid);
bt_gatt_chrc_create(chrc_uuid_1, GATT_CHRC_PROP_WRITE, 0, 0);
bt_gatt_server_start();
/* ... */
bt_gatt_service_remove(service_uuid);
for(;;)
{
Delay(100);
}
}