<span class="wikiword">BLE\_Service</span>

Description

The data type used to declare a service.

Syntax

BLE_Char *arrayOfChars[] = {&char1, &char2, ...};
BLE_Service service =
{
  UUID,
  numChars, arrayOfChars
};

Parameters

UUID: The 2 or 16 byte identifier for the service. 2 byte UUID’s are reserved for officially adopted services. For creating a 16 byte UUID for custom services, see this [reference](http://processors.wiki.ti.com/index.php/Tutorial:_How_to_Create_a_Custom_Bluetooth_Smart_Embedded_Application_with_the_CC2650DK#UUID). numChars: The number of characteristics in the service and the number of elements in arrayOfChars. arrayOfChars: A pointer to an array of [BLE\_Char’s](http://energia.nu/reference/ble/ble-addservice/ble_char/), declared using the syntax above or below in the example.

Example

#include <BLE.h>
byte char1Value = 0;
int char2Value = 0;
long char3Value = 0;
String char4Value = String("Hello, world!");
BLE_Char char1 =
{
 {0xF1, 0xFF},
 BLE_READABLE | BLE_WRITABLE,
 "Characteristic 1"
};
BLE_Char char2 =
{
 {0xF2, 0xFF},
 BLE_READABLE,
 "Characteristic 2"
};
BLE_Char char3 =
{
 {0xF3, 0xFF},
 BLE_WRITABLE,
 "Characteristic 3"
};
BLE_Char char4 =
{
 {0xF4, 0xFF},
 BLE_NOTIFIABLE,
 "Characteristic 4"
};
BLE_Char *simpleServiceChars[] = {&char1, &char2, &char3, &char4};
BLE_Service simpleService =
{
 {0xF0, 0xFF},
 4, simpleServiceChars
};

[Reference Home](http://energia.nu/reference/ "Reference"){.wikilink}<span style="color: #202020;"> || </span>[BLE Library](http://energia.nu/reference/ble/ "WiFi")