SlideShare una empresa de Scribd logo
1 de 71
Descargar para leer sin conexión
BLE server profile

Steven lin
Steven.lin08@gmail.com
About BLE,BT Explanation
 BLE, it is important to understand that all the profile and

service support is entirely in the application space.
 This means that with BLE, there isn't really a need for a
serial port service to transmit custom data, since you can
easily make your custom service, that is specially tailored
for the data your application needs to transfer.
About BLE,BT Explanation
 This avoids the need for cramming all kinds of data into

serial packages, and most often this leads to much cleaner
data handling strategies and hence applications.
About BLE,BT create custom profile
 To create a custom service, you should try to follow the

general flow of the existing services, and mor or less
copy them. The battery service (ble_bas.c/ble_bas.h) is
probably the simplest one, and should provde a good
starting point.
 If you look at it, you can see that the init function first
adds a service, using the sd_ble_gatts_service_add()
function, then calls an internal function to add a
characteristic. This internal functions sets up a lot of
parameter structures, that in different ways affect the
characteristic added.
About BLE,BT Explanation
 Most services also needs to know what happens on run-

time, so you need to create a event handler to handle
events coming from the stack. This should be named
service_name_on_ble_evt(), and be called from the
applications main.c-file's ble_evt_dispatch() method.
Finally, most services also need some API function to
actually do something useful, for example the battery
service's method to update the measured battery value.
Builder custom profile
 Start ble_app_template project.

 File structure :( reference Keil C Interger develop suit)
Builder custom profile
 Client v.s Server
 Client is no have data(information).
 Client can send Request, Command and Confirmation
 Server is have data .(information,so the device usually is

server)
 Server can send Response, Notification and Indication
Builder custom profile
Builder custom profile
Builder custom profile
Builder custom profile
Builder custom profile
Nordic BLE Framework
 The Software Structure
 It have three parts: AP,GAP and GATTS.
 The SVC and ble event is the Software interrupt.
Nordic BLE Framework
 The Software Structure
 SVC
 Event
Nordic BLE Framework
 GAP : Advertiser , GAP Service(device ,appearance ..),

Connection and Security。
Nordic BLE Framework
 GAP API: GAP SVC
Nordic BLE Framework
 GAP API: GAP Event
 The GAP Events association with GATT Events.
Nordic BLE Framework
 GAP With Center:
Nordic BLE Framework
 GAP module:
Nordic BLE Framework
 GATT Structure:
Nordic BLE Framework
 GATT API:
Nordic BLE Framework
 GATT Events:
Nordic BLE Framework
 GATT module:
Nordic BLE Framework
 GATT module:
Builder custom profile


















1.main loop( have to sure the order function caller)
int main(void)
{
ble_stack_init(); //Encodes the required advertising data and passes it to the stack
bond_manager_init();//if it have .
gap_params_init();
//GAP initialization, setup all the necessary GAP,set device name
//permissions and appearance,reference appearance device
advertising_init(); //adverrising the service (profile),advertising data to stack
services_init(); //** advertising data and passes it to the stack
conn_params_init();//Connection Parameters module
sec_params_init();//security parameters
radio_notification_init();//Radio Notification event handler
// Start execution
application_timers_start();
advertising_start();
}
Builder custom profile
 Static void services_init(void)
 init function first adds a service, using the

sd_ble_gatts_service_add() function, then calls an internal
function to add a characteristic. This internal functions sets
up a lot of parameter structures, that in different ways affect
the characteristic added.
 what happens on run-time, so you need to create a event
handler to handle events coming from the stack. This should
be named service_name_on_ble_evt(), and be called from
the applications main.c-file's ble_evt_dispatch() method.
 1.caller sd_ble_gatts_service_add() then add char,last

register the event handler
Builder custom profile
 Static void services_init(void)
Builder custom profile
 Static void services_init(void)

https://www.bluetooth.org/en-us/specification/adopted-specifications
Builder custom profile
 Static void services_init(void)

https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=or
g.bluetooth.service.battery_service.xml
Builder custom profile
 Static void services_init(void)

https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=or
g.bluetooth.service.battery_service.xml
Builder custom profile
 Profile , service , Characteristic ,descriptor and declare.

 Battery service :
 實作,提供value 及notify
 Service , 0x180F
 Characteristics, 0x2A19
 Descriptors(Client Characteristic Configuration), 0x2902

https://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorsHomePage.aspx
 File structure:
 C:KeilARMDeviceNordicnrf51822Includebleble_servicesble_bas.h
 C:KeilARMDeviceNordicnrf51822Sourcebleble_servicesble_bas.c

 Data structure:
 Struct:
1. ble_bas_evt_t//Battery Service event
2. ble_bas_init_t//Battery Service init structure
3. ble_bas_t//Battery Service structure
 Functioin:
1. uint32_t ble_bas_init(ble_bas_t * p_bas, const ble_bas_init_t *
p_bas_init);
2. void ble_bas_on_ble_evt(ble_bas_t * p_bas, ble_evt_t * p_ble_evt);
3. uint32_t ble_bas_battery_level_update(ble_bas_t * p_bas, uint8_t
battery_level);

 /**@brief Battery Service event handler type. */
1. typedef void (*ble_bas_evt_handler_t) (ble_bas_t * p_bas,
ble_bas_evt_t * p_evt);
 /**@brief Battery Service event type. */
 typedef enum

 {

BLE_BAS_EVT_NOTIFICATION_ENABLED,
value notification enabled event. */

BLE_BAS_EVT_NOTIFICATION_DISABLED
value notification disabled event. */
 } ble_bas_evt_type_t;


/**< Battery
/**< Battery

 /**@brief Battery Service event. */
 typedef struct
 {

ble_bas_evt_type_t evt_type;
 } ble_bas_evt_t;


/**< Type of event. */













/**@brief Battery Service init structure. This contains all options and data needed for
*
initialization of the service.*/
typedef struct
{
ble_bas_evt_handler_t
evt_handler;
/**< Event handler to be called for
handling events in the Battery Service. */
bool
support_notification;
/**< TRUE if notification of Battery
Level measurement is supported. */
ble_srv_report_ref_t *
p_report_ref;
/**< If not NULL, a Report Reference
descriptor with the specified value will be added to the Battery Level characteristic */
uint8_t
initial_batt_level;
/**< Initial battery level */
ble_srv_cccd_security_mode_t battery_level_char_attr_md; /**< Initial security level for
battery characteristics attribute */
ble_gap_conn_sec_mode_t
battery_level_report_read_perm; /**< Initial security level
for battery report read attribute */
} ble_bas_init_t;
//for pc












/**@brief Battery Service structure. This contains various status information for the service. */
typedef struct ble_bas_s
{
ble_bas_evt_handler_t
evt_handler;
/**< Event handler to be called for
handling events in the Battery Service. */
uint16_t
service_handle;
/**< Handle of Battery Service (as
provided by the BLE stack). */
ble_gatts_char_handles_t
battery_level_handles;
/**< Handles related to the
Battery Level characteristic. */
uint16_t
report_ref_handle;
/**< Handle of the Report Reference
descriptor. */
uint8_t
battery_level_last;
/**< Last Battery Level measurement
passed to the Battery Service. */
uint16_t
conn_handle;
/**< Handle of the current connection (as
provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */
bool
is_notification_supported;
/**< TRUE if notification of Battery
Level is supported. */
} ble_bas_t;



// Initialize Battery Service
memset(&bas_init, 0, sizeof(bas_init));







// Here the sec level for the Battery Service can be changed/increased.
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_char_attr_md.cccd_write_perm);
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_char_attr_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&bas_init.battery_level_char_attr_md.write_perm);



BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_report_read_perm);



bas_init.evt_handler
= NULL;
bas_init.support_notification = true;
bas_init.p_report_ref
= NULL;
bas_init.initial_batt_level = 100;








err_code = ble_bas_init(&m_bas, &bas_init);
APP_ERROR_CHECK(err_code);






















uint32_t ble_bas_init(ble_bas_t * p_bas, const ble_bas_init_t * p_bas_init)
{
uint32_t err_code;
ble_uuid_t ble_uuid;
// Initialize service structure
p_bas->evt_handler
= p_bas_init->evt_handler;
p_bas->conn_handle
= BLE_CONN_HANDLE_INVALID;
p_bas->is_notification_supported = p_bas_init->support_notification;
p_bas->battery_level_last
= INVALID_BATTERY_LEVEL;
// Add service
BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_BATTERY_SERVICE);
err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_bas->service_handle);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
// Add battery level characteristic
return battery_level_char_add(p_bas, p_bas_init);
}



















/**@brief Add Battery Level characteristic.
*
* @param[in] p_bas
Battery Service structure.
* @param[in] p_bas_init Information needed to initialize the service.
*
* @return
NRF_SUCCESS on success, otherwise an error code.
*/
static uint32_t battery_level_char_add(ble_bas_t * p_bas, const ble_bas_init_t * p_bas_init)
{
uint32_t
err_code;
ble_gatts_char_md_t char_md;
ble_gatts_attr_md_t cccd_md;
ble_gatts_attr_t attr_char_value;
ble_uuid_t
ble_uuid;
ble_gatts_attr_md_t attr_md;
uint8_t
initial_battery_level;
uint8_t
encoded_report_ref[BLE_SRV_ENCODED_REPORT_REF_LEN];
uint8_t
init_len;
 以battery service 中,由上可知有一個characteristics/及

一個CCCD .而每一個characteristics由上到下:
1. ble_gatts_char_md_t char_md;//GATT Characteristic metadata
Characteristic Properties, user description descriptor, Pointer to a
presentation format structure and Attribute metadata for the
Client(server) Characteristic Configuration Descriptor.

ble_gatts_attr_md_t attr_md;//Attribute metadata

A.
A.

Read(write) permissions, Variable length, Value location and
Read(write) Authorization on every read(write) operation

ble_gatts_attr_md_t cccd_md //Attribute metadata

B.
A.

Read(write) permissions, Variable length, Value location and
Read(write) Authorization
2.

ble_gatts_attr_t

attr_char_value;//GATT Attribute

 Pointer to the attribute UUID, Pointer to the attribute metadata

structure, attribute value length in bytes and Pointer to the attribute
data if the @ref BLE_GATTS_VLOC_USER value location is
selected in the attribute metadata, this will have to point to a buffer















/**@brief GATT Characteristic metadata. */
typedef struct
{
ble_gatt_char_props_t
char_props;
/**< Characteristic Properties. */
ble_gatt_char_ext_props_t char_ext_props;
/**< Characteristic Extended Properties. */
uint8_t*
p_char_user_desc;
/**< Pointer to a UTF-8, NULL if the descriptor is not
required. */
uint16_t
char_user_desc_max_size; /**< The maximum size in bytes of the user description
descriptor. */
uint16_t
char_user_desc_size;
/**< The size of the user description, must be smaller or
equal to char_user_desc_max_size. */
ble_gatts_char_pf_t*
p_char_pf;
/**< Pointer to a presentation format structure or NULL if
the descriptor is not required. */
ble_gatts_attr_md_t*
p_user_desc_md;
/**< Attribute metadata for the User Description
descriptor, or NULL for default values. */
ble_gatts_attr_md_t*
p_cccd_md;
/**< Attribute metadata for the Client Characteristic
Configuration Descriptor, or NULL for default values. */
ble_gatts_attr_md_t*
p_sccd_md;
/**< Attribute metadata for the Server Characteristic
Configuration Descriptor, or NULL for default values. */
} ble_gatts_char_md_t;
 /**@brief GATT Characteristic Properties. */
 typedef struct

 {












/* Standard properties */
uint8_t broadcast
:1; /**< Broadcasting of value permitted. */
uint8_t read
:1; /**< Reading value permitted. */
uint8_t write_wo_resp :1; /**< Writing value with Write Command permitted. */
uint8_t write
:1; /**< Writing value with Write Request permitted. */
uint8_t notify
:1; /**< Notications of value permitted. */
uint8_t indicate
:1; /**< Indications of value permitted. */
uint8_t auth_signed_wr :1; /**< Writing value with Signed Write Command
permitted. */
} ble_gatt_char_props_t;
 /**@brief Attribute metadata. */
 typedef struct
 {
 ble_gap_conn_sec_mode_t read_perm;
/**< Read permissions. */
 ble_gap_conn_sec_mode_t write_perm;
/**< Write permissions. */
 uint8_t
vlen
:1; /**< Variable length attribute. */
 uint8_t
vloc
:2; /**< Value location, see @ref

BLE_GATTS_VLOCS.*/
 uint8_t
rd_auth :1; /**< Read Authorization and value will
be requested from the application on every read operation. */
 uint8_t
wr_auth :1; /**< Write Authorization will be
requested from the application on every Write Request operation (but not
Write Command). */
 } ble_gatts_attr_md_t;














/**@brief GATT Attribute. */
typedef struct
{
ble_uuid_t*
p_uuid;
/**< Pointer to the attribute UUID. */
ble_gatts_attr_md_t* p_attr_md;
/**< Pointer to the attribute metadata structure. */
uint16_t
init_len;
/**< Initial attribute value length in bytes. */
uint16_t
init_offs;
/**< Initial attribute value offset in bytes. If different from zero, the first
init_offs bytes of the attribute value will be left uninitialized. */
uint16_t
max_len;
/**< Maximum attribute value length in bytes, see @ref
BLE_GATTS_ATTR_LENS_MAX for maximum values. */
uint8_t*
p_value;
/**< Pointer to the attribute data. Please note that if the @ref
BLE_GATTS_VLOC_USER value location is selected in the attribute metadata, this will have to point to a
buffer
that remains valid through the lifetime of the attribute. This excludes usage
of automatic variables that may go out of scope or any other temporary location.
The stack may access that memory directly without the application's
knowledge. */
} ble_gatts_attr_t;
 設定

 1.cccd_md,//notify
 2. char_md
 3.BLE_UUID_BLE_ASSIGN

 4. attr_md
 5. attr_char_value
 6. sd_ble_gatts_characteristic_add







// Add Battery Level characteristic
if (p_bas->is_notification_supported)
{
memset(&cccd_md, 0, sizeof(cccd_md));

// According to BAS_SPEC_V10, the read operation on cccd should
be possible without

// authentication.


BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);

cccd_md.write_perm = p_bas_init>battery_level_char_attr_md.cccd_write_perm;

cccd_md.vloc = BLE_GATTS_VLOC_STACK;

}
 memset(&char_md, 0, sizeof(char_md));









char_md.char_props.read = 1;
char_md.char_props.notify = (p_bas>is_notification_supported) ? 1 : 0;
char_md.p_char_user_desc = NULL;
char_md.p_char_pf
= NULL;
char_md.p_user_desc_md = NULL;
char_md.p_cccd_md
= (p_bas>is_notification_supported) ? &cccd_md : NULL;
char_md.p_sccd_md
= NULL;
 BLE_UUID_BLE_ASSIGN(ble_uuid,

BLE_UUID_BATTERY_LEVEL_CHAR);










memset(&attr_md, 0, sizeof(attr_md));
attr_md.read_perm = p_bas_init>battery_level_char_attr_md.read_perm;
attr_md.write_perm = p_bas_init>battery_level_char_attr_md.write_perm;
attr_md.vloc
= BLE_GATTS_VLOC_STACK;
attr_md.rd_auth = 0;
attr_md.wr_auth = 0;
attr_md.vlen
= 0;
 initial_battery_level = p_bas_init->initial_batt_level;




memset(&attr_char_value, 0, sizeof(attr_char_value));



attr_char_value.p_uuid
attr_char_value.p_attr_md
attr_char_value.init_len
attr_char_value.init_offs
attr_char_value.max_len
attr_char_value.p_value








= &ble_uuid;
= &attr_md;
= sizeof(uint8_t);
= 0;
= sizeof(uint8_t);
= &initial_battery_level;
 err_code = sd_ble_gatts_characteristic_add(p_bas-

>service_handle, &char_md,







&attr_char_value,
&p_bas>battery_level_handles);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
if (p_bas_init->p_report_ref != NULL)

{

// Add Report Reference descriptor

BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_REPORT_REF_DESCR);





memset(&attr_md, 0, sizeof(attr_md));



attr_md.read_perm = p_bas_init->battery_level_report_read_perm;
BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.write_perm);








attr_md.vloc
= BLE_GATTS_VLOC_STACK;
attr_md.rd_auth = 0;
attr_md.wr_auth = 0;
attr_md.vlen
= 0;
 init_len = ble_srv_report_ref_encode(encoded_report_ref,

p_bas_init->p_report_ref);



memset(&attr_char_value, 0, sizeof(attr_char_value));



attr_char_value.p_uuid
attr_char_value.p_attr_md
attr_char_value.init_len
attr_char_value.init_offs
attr_char_value.max_len
attr_char_value.p_value








= &ble_uuid;
= &attr_md;
= init_len;
= 0;
= attr_char_value.init_len;
= encoded_report_ref;













err_code = sd_ble_gatts_descriptor_add(p_bas->battery_level_handles.value_handle,
&attr_char_value,
&p_bas->report_ref_handle);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
}
else
{
p_bas->report_ref_handle = BLE_GATT_HANDLE_INVALID;
}



return NRF_SUCCESS;




}











/**@brief Disconnect event handler.
*
* @param[in] p_bas
Battery Service structure.
* @param[in] p_ble_evt Event received from the BLE
stack.
*/
static void on_disconnect(ble_bas_t * p_bas, ble_evt_t *
p_ble_evt)
{
UNUSED_PARAMETER(p_ble_evt);
p_bas->conn_handle = BLE_CONN_HANDLE_INVALID;
}
 /**@brief Connect event handler.
 *
 * @param[in] p_bas








Battery Service structure.
* @param[in] p_ble_evt Event received from the BLE
stack.
*/
static void on_connect(ble_bas_t * p_bas, ble_evt_t *
p_ble_evt)
{
p_bas->conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
}









void ble_bas_on_ble_evt(ble_bas_t * p_bas, ble_evt_t * p_ble_evt)
{
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_CONNECTED:
on_connect(p_bas, p_ble_evt);
break;



case BLE_GAP_EVT_DISCONNECTED:
on_disconnect(p_bas, p_ble_evt);
break;






case BLE_GATTS_EVT_WRITE:
on_write(p_bas, p_ble_evt);
break;






default:
break;




}




}











/**@brief Write event handler.
*
* @param[in] p_bas
Battery Service structure.
* @param[in] p_ble_evt Event received from the BLE stack.
*/
static void on_write(ble_bas_t * p_bas, ble_evt_t * p_ble_evt)
{
if (p_bas->is_notification_supported)
{
ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write;









if (
(p_evt_write->handle == p_bas->battery_level_handles.cccd_handle)
&&
(p_evt_write->len == 2)
)


{
// CCCD written, call application event handler
if (p_bas->evt_handler != NULL)
{
ble_bas_evt_t evt;










if (ble_srv_is_notification_enabled(p_evt_write->data))
{
evt.evt_type = BLE_BAS_EVT_NOTIFICATION_ENABLED;
}
else
{
evt.evt_type = BLE_BAS_EVT_NOTIFICATION_DISABLED;
}



p_bas->evt_handler(p_bas, &evt);









}



}



}




}
Nordic FrameWork support service
 Alert Notification Service Client,ble_ans_c

 Energon bank Service module, ble_band
 Battery Service module,ble_bas
 Blood Pressure Service module. ble_bps

 Cycling Speed and Cadence Service, ble_cscs
 Device Information Service, ble_dis
 Glucose Service module. ble_gls
 Glucose Database Service. ble_gls_db
 Human Interface Device Service, ble_hids
Nordic FrameWork support service
 Heart Rate Service ,ble_hrs

 Health Thermometer Service ,ble_hts
 Immediate Alert Service,ble_ias
 Immediate Alert Service Client,ble_ias_c

 Link Loss Service,ble_lls
 Running Speed and Cadence Service,ble_rscs
 TX Power Service,ble_tps
Reference
 Battery Service (BAS)
 http://developer.bluetooth.org/TechnologyOverview/Pages/B

AS.aspx


The external appearance of this
https://developer.bluetooth.org/gatt/characteristics/Pa
ges/CharacteristicViewer.aspx?u=org.bluetooth.characte
ristic.gap.appearance.xml
 Other Service
 Other Service
 Other Service
 Other Service
 Other Service
 Other Service
 Other Service
Builder custom profile
 Static void services_init(void)

Más contenido relacionado

Destacado

Android Gadgets, Bluetooth Low Energy, and the WunderBar
Android Gadgets, Bluetooth Low Energy, and the WunderBarAndroid Gadgets, Bluetooth Low Energy, and the WunderBar
Android Gadgets, Bluetooth Low Energy, and the WunderBarrelayr
 
Bluetooth and profiles on WEC7
Bluetooth and profiles on WEC7Bluetooth and profiles on WEC7
Bluetooth and profiles on WEC7gnkeshava
 
2014 App Dev Confr. - iBeacons, BLE Beacons and Everything in Between.
2014 App Dev Confr. - iBeacons, BLE Beacons and Everything in Between.2014 App Dev Confr. - iBeacons, BLE Beacons and Everything in Between.
2014 App Dev Confr. - iBeacons, BLE Beacons and Everything in Between.John Donohoe
 
Getting Started with SainSmart SIM900 GPRS (Autosaved)
Getting Started with SainSmart SIM900 GPRS (Autosaved)Getting Started with SainSmart SIM900 GPRS (Autosaved)
Getting Started with SainSmart SIM900 GPRS (Autosaved)Devrhoid Davis
 
Attacking and Crashing IoT Devices via Bluetooth LE protocol
Attacking and Crashing IoT Devices via Bluetooth LE protocolAttacking and Crashing IoT Devices via Bluetooth LE protocol
Attacking and Crashing IoT Devices via Bluetooth LE protocolCysinfo Cyber Security Community
 
Bluetooth Secure Simple Pairing Using NFC Part 1
Bluetooth Secure Simple Pairing Using NFC Part 1 Bluetooth Secure Simple Pairing Using NFC Part 1
Bluetooth Secure Simple Pairing Using NFC Part 1 NFC Forum
 
AT COMMAND SET FOR SENDING DATA VIA TCP USING SIM900
AT COMMAND SET FOR SENDING DATA VIA TCP USING SIM900AT COMMAND SET FOR SENDING DATA VIA TCP USING SIM900
AT COMMAND SET FOR SENDING DATA VIA TCP USING SIM900Devrhoid Davis
 
The Internet of Things: BLE / Beacons / iBeacons
The Internet of Things: BLE / Beacons / iBeaconsThe Internet of Things: BLE / Beacons / iBeacons
The Internet of Things: BLE / Beacons / iBeaconsVectorform
 
GSM GPRS SIM900A Modem
GSM GPRS SIM900A ModemGSM GPRS SIM900A Modem
GSM GPRS SIM900A ModemRaghav Shetty
 
Bluetooth low energy(ble) wireless technology
Bluetooth low energy(ble) wireless technologyBluetooth low energy(ble) wireless technology
Bluetooth low energy(ble) wireless technologyLin Steven
 
Gsm based campus display system project report
Gsm based campus display system project reportGsm based campus display system project report
Gsm based campus display system project reportKashyap Shah
 
Smart LED Notice Board
Smart LED Notice BoardSmart LED Notice Board
Smart LED Notice Boardswarnimmaurya
 
Automatic meter reading
Automatic meter readingAutomatic meter reading
Automatic meter readingSajan Sahu
 
Project report on gsm based digital notice board
Project report on gsm based digital notice boardProject report on gsm based digital notice board
Project report on gsm based digital notice boardmanish katara
 
Introduction to Bluetooth Low Energy
Introduction to Bluetooth Low EnergyIntroduction to Bluetooth Low Energy
Introduction to Bluetooth Low Energyyeokm1
 
Whats the best micro-location technology? We compare: ibeacon, ble, nfc, qr a...
Whats the best micro-location technology? We compare: ibeacon, ble, nfc, qr a...Whats the best micro-location technology? We compare: ibeacon, ble, nfc, qr a...
Whats the best micro-location technology? We compare: ibeacon, ble, nfc, qr a...Localz
 

Destacado (20)

Carwhisperer Bluetooth Attack
Carwhisperer Bluetooth AttackCarwhisperer Bluetooth Attack
Carwhisperer Bluetooth Attack
 
Android Gadgets, Bluetooth Low Energy, and the WunderBar
Android Gadgets, Bluetooth Low Energy, and the WunderBarAndroid Gadgets, Bluetooth Low Energy, and the WunderBar
Android Gadgets, Bluetooth Low Energy, and the WunderBar
 
Bluetooth and profiles on WEC7
Bluetooth and profiles on WEC7Bluetooth and profiles on WEC7
Bluetooth and profiles on WEC7
 
Hijacking bluetooth headsets
Hijacking bluetooth headsetsHijacking bluetooth headsets
Hijacking bluetooth headsets
 
2014 App Dev Confr. - iBeacons, BLE Beacons and Everything in Between.
2014 App Dev Confr. - iBeacons, BLE Beacons and Everything in Between.2014 App Dev Confr. - iBeacons, BLE Beacons and Everything in Between.
2014 App Dev Confr. - iBeacons, BLE Beacons and Everything in Between.
 
GET and POST in PHP
GET and POST in PHPGET and POST in PHP
GET and POST in PHP
 
Getting Started with SainSmart SIM900 GPRS (Autosaved)
Getting Started with SainSmart SIM900 GPRS (Autosaved)Getting Started with SainSmart SIM900 GPRS (Autosaved)
Getting Started with SainSmart SIM900 GPRS (Autosaved)
 
Attacking and Crashing IoT Devices via Bluetooth LE protocol
Attacking and Crashing IoT Devices via Bluetooth LE protocolAttacking and Crashing IoT Devices via Bluetooth LE protocol
Attacking and Crashing IoT Devices via Bluetooth LE protocol
 
Bluetooth Secure Simple Pairing Using NFC Part 1
Bluetooth Secure Simple Pairing Using NFC Part 1 Bluetooth Secure Simple Pairing Using NFC Part 1
Bluetooth Secure Simple Pairing Using NFC Part 1
 
AT COMMAND SET FOR SENDING DATA VIA TCP USING SIM900
AT COMMAND SET FOR SENDING DATA VIA TCP USING SIM900AT COMMAND SET FOR SENDING DATA VIA TCP USING SIM900
AT COMMAND SET FOR SENDING DATA VIA TCP USING SIM900
 
The Internet of Things: BLE / Beacons / iBeacons
The Internet of Things: BLE / Beacons / iBeaconsThe Internet of Things: BLE / Beacons / iBeacons
The Internet of Things: BLE / Beacons / iBeacons
 
GSM GPRS SIM900A Modem
GSM GPRS SIM900A ModemGSM GPRS SIM900A Modem
GSM GPRS SIM900A Modem
 
Bluetooth low energy(ble) wireless technology
Bluetooth low energy(ble) wireless technologyBluetooth low energy(ble) wireless technology
Bluetooth low energy(ble) wireless technology
 
Gsm based campus display system project report
Gsm based campus display system project reportGsm based campus display system project report
Gsm based campus display system project report
 
Smart Meter Basics and Benefits
Smart Meter Basics and BenefitsSmart Meter Basics and Benefits
Smart Meter Basics and Benefits
 
Smart LED Notice Board
Smart LED Notice BoardSmart LED Notice Board
Smart LED Notice Board
 
Automatic meter reading
Automatic meter readingAutomatic meter reading
Automatic meter reading
 
Project report on gsm based digital notice board
Project report on gsm based digital notice boardProject report on gsm based digital notice board
Project report on gsm based digital notice board
 
Introduction to Bluetooth Low Energy
Introduction to Bluetooth Low EnergyIntroduction to Bluetooth Low Energy
Introduction to Bluetooth Low Energy
 
Whats the best micro-location technology? We compare: ibeacon, ble, nfc, qr a...
Whats the best micro-location technology? We compare: ibeacon, ble, nfc, qr a...Whats the best micro-location technology? We compare: ibeacon, ble, nfc, qr a...
Whats the best micro-location technology? We compare: ibeacon, ble, nfc, qr a...
 

Similar a About BLE server profile

dokumen.tips_spring-boot-actuator.pdf
dokumen.tips_spring-boot-actuator.pdfdokumen.tips_spring-boot-actuator.pdf
dokumen.tips_spring-boot-actuator.pdfAppster1
 
ArcSight Actor Model Import Connector for Microsoft Active Directory Configur...
ArcSight Actor Model Import Connector for Microsoft Active Directory Configur...ArcSight Actor Model Import Connector for Microsoft Active Directory Configur...
ArcSight Actor Model Import Connector for Microsoft Active Directory Configur...Protect724tk
 
Spring Boot Actuator
Spring Boot ActuatorSpring Boot Actuator
Spring Boot ActuatorRowell Belen
 
SpringBootCompleteBootcamp.pptx
SpringBootCompleteBootcamp.pptxSpringBootCompleteBootcamp.pptx
SpringBootCompleteBootcamp.pptxSUFYAN SATTAR
 
Asset Model Import FlexConnector Developer's Guide
Asset Model Import FlexConnector Developer's GuideAsset Model Import FlexConnector Developer's Guide
Asset Model Import FlexConnector Developer's GuideProtect724migration
 
Accel_Series_2023Autumn_En.pptx
Accel_Series_2023Autumn_En.pptxAccel_Series_2023Autumn_En.pptx
Accel_Series_2023Autumn_En.pptxNTTDATA INTRAMART
 
PyData Berlin 2023 - Mythical ML Pipeline.pdf
PyData Berlin 2023 - Mythical ML Pipeline.pdfPyData Berlin 2023 - Mythical ML Pipeline.pdf
PyData Berlin 2023 - Mythical ML Pipeline.pdfJim Dowling
 
Dnyaneshwar_Anantwar_Resume
Dnyaneshwar_Anantwar_ResumeDnyaneshwar_Anantwar_Resume
Dnyaneshwar_Anantwar_Resumearyan9011079624
 
Understanding router state in angular 7 passing data through angular router s...
Understanding router state in angular 7 passing data through angular router s...Understanding router state in angular 7 passing data through angular router s...
Understanding router state in angular 7 passing data through angular router s...Katy Slemon
 
A Brief Introduction to Bluetooth Low Energy (BLE) on iOS
A Brief Introduction to Bluetooth Low Energy (BLE) on iOSA Brief Introduction to Bluetooth Low Energy (BLE) on iOS
A Brief Introduction to Bluetooth Low Energy (BLE) on iOSMatt Whitlock
 
Asset modelimportconn devguide_5.2.1.6190.0
Asset modelimportconn devguide_5.2.1.6190.0Asset modelimportconn devguide_5.2.1.6190.0
Asset modelimportconn devguide_5.2.1.6190.0Protect724
 
Asset modelimportconn devguide_5.2.1.6190.0
Asset modelimportconn devguide_5.2.1.6190.0Asset modelimportconn devguide_5.2.1.6190.0
Asset modelimportconn devguide_5.2.1.6190.0Protect724
 
Kubernetes Controller for Pull Request Based Environment
Kubernetes Controller for Pull Request Based EnvironmentKubernetes Controller for Pull Request Based Environment
Kubernetes Controller for Pull Request Based EnvironmentVishal Banthia
 
Externalized Distributed Configuration Management with Spring Cloud Config-Se...
Externalized Distributed Configuration Management with Spring Cloud Config-Se...Externalized Distributed Configuration Management with Spring Cloud Config-Se...
Externalized Distributed Configuration Management with Spring Cloud Config-Se...Nikhil Hiremath
 
Maciej Treder ''Angular Universal - a medicine for the Angular + SEO/CDN issu...
Maciej Treder ''Angular Universal - a medicine for the Angular + SEO/CDN issu...Maciej Treder ''Angular Universal - a medicine for the Angular + SEO/CDN issu...
Maciej Treder ''Angular Universal - a medicine for the Angular + SEO/CDN issu...OdessaJS Conf
 
ESM Asset Model FlexConnector Developer's Guide for ESM 6.8c
ESM Asset Model FlexConnector Developer's Guide for ESM 6.8cESM Asset Model FlexConnector Developer's Guide for ESM 6.8c
ESM Asset Model FlexConnector Developer's Guide for ESM 6.8cProtect724v3
 
Dynamic_UI_Concepts_version_2.pdf
Dynamic_UI_Concepts_version_2.pdfDynamic_UI_Concepts_version_2.pdf
Dynamic_UI_Concepts_version_2.pdfJoeRodriguez477329
 
Shibboleth 2.0 SP slides - Installfest
Shibboleth 2.0 SP slides - InstallfestShibboleth 2.0 SP slides - Installfest
Shibboleth 2.0 SP slides - InstallfestJISC.AM
 

Similar a About BLE server profile (20)

dokumen.tips_spring-boot-actuator.pdf
dokumen.tips_spring-boot-actuator.pdfdokumen.tips_spring-boot-actuator.pdf
dokumen.tips_spring-boot-actuator.pdf
 
ArcSight Actor Model Import Connector for Microsoft Active Directory Configur...
ArcSight Actor Model Import Connector for Microsoft Active Directory Configur...ArcSight Actor Model Import Connector for Microsoft Active Directory Configur...
ArcSight Actor Model Import Connector for Microsoft Active Directory Configur...
 
Spring Boot Actuator
Spring Boot ActuatorSpring Boot Actuator
Spring Boot Actuator
 
SpringBootCompleteBootcamp.pptx
SpringBootCompleteBootcamp.pptxSpringBootCompleteBootcamp.pptx
SpringBootCompleteBootcamp.pptx
 
Asset Model Import FlexConnector Developer's Guide
Asset Model Import FlexConnector Developer's GuideAsset Model Import FlexConnector Developer's Guide
Asset Model Import FlexConnector Developer's Guide
 
Accel_Series_2023Autumn_En.pptx
Accel_Series_2023Autumn_En.pptxAccel_Series_2023Autumn_En.pptx
Accel_Series_2023Autumn_En.pptx
 
PyData Berlin 2023 - Mythical ML Pipeline.pdf
PyData Berlin 2023 - Mythical ML Pipeline.pdfPyData Berlin 2023 - Mythical ML Pipeline.pdf
PyData Berlin 2023 - Mythical ML Pipeline.pdf
 
Dnyaneshwar_Anantwar_Resume
Dnyaneshwar_Anantwar_ResumeDnyaneshwar_Anantwar_Resume
Dnyaneshwar_Anantwar_Resume
 
Understanding router state in angular 7 passing data through angular router s...
Understanding router state in angular 7 passing data through angular router s...Understanding router state in angular 7 passing data through angular router s...
Understanding router state in angular 7 passing data through angular router s...
 
A Brief Introduction to Bluetooth Low Energy (BLE) on iOS
A Brief Introduction to Bluetooth Low Energy (BLE) on iOSA Brief Introduction to Bluetooth Low Energy (BLE) on iOS
A Brief Introduction to Bluetooth Low Energy (BLE) on iOS
 
Asset modelimportconn devguide_5.2.1.6190.0
Asset modelimportconn devguide_5.2.1.6190.0Asset modelimportconn devguide_5.2.1.6190.0
Asset modelimportconn devguide_5.2.1.6190.0
 
Asset modelimportconn devguide_5.2.1.6190.0
Asset modelimportconn devguide_5.2.1.6190.0Asset modelimportconn devguide_5.2.1.6190.0
Asset modelimportconn devguide_5.2.1.6190.0
 
Kubernetes Controller for Pull Request Based Environment
Kubernetes Controller for Pull Request Based EnvironmentKubernetes Controller for Pull Request Based Environment
Kubernetes Controller for Pull Request Based Environment
 
Externalized Distributed Configuration Management with Spring Cloud Config-Se...
Externalized Distributed Configuration Management with Spring Cloud Config-Se...Externalized Distributed Configuration Management with Spring Cloud Config-Se...
Externalized Distributed Configuration Management with Spring Cloud Config-Se...
 
Maciej Treder ''Angular Universal - a medicine for the Angular + SEO/CDN issu...
Maciej Treder ''Angular Universal - a medicine for the Angular + SEO/CDN issu...Maciej Treder ''Angular Universal - a medicine for the Angular + SEO/CDN issu...
Maciej Treder ''Angular Universal - a medicine for the Angular + SEO/CDN issu...
 
vite-en.pdf
vite-en.pdfvite-en.pdf
vite-en.pdf
 
ESM Asset Model FlexConnector Developer's Guide for ESM 6.8c
ESM Asset Model FlexConnector Developer's Guide for ESM 6.8cESM Asset Model FlexConnector Developer's Guide for ESM 6.8c
ESM Asset Model FlexConnector Developer's Guide for ESM 6.8c
 
WCF - In a Week
WCF - In a WeekWCF - In a Week
WCF - In a Week
 
Dynamic_UI_Concepts_version_2.pdf
Dynamic_UI_Concepts_version_2.pdfDynamic_UI_Concepts_version_2.pdf
Dynamic_UI_Concepts_version_2.pdf
 
Shibboleth 2.0 SP slides - Installfest
Shibboleth 2.0 SP slides - InstallfestShibboleth 2.0 SP slides - Installfest
Shibboleth 2.0 SP slides - Installfest
 

Último

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 

Último (20)

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 

About BLE server profile

  • 1. BLE server profile Steven lin Steven.lin08@gmail.com
  • 2. About BLE,BT Explanation  BLE, it is important to understand that all the profile and service support is entirely in the application space.  This means that with BLE, there isn't really a need for a serial port service to transmit custom data, since you can easily make your custom service, that is specially tailored for the data your application needs to transfer.
  • 3. About BLE,BT Explanation  This avoids the need for cramming all kinds of data into serial packages, and most often this leads to much cleaner data handling strategies and hence applications.
  • 4. About BLE,BT create custom profile  To create a custom service, you should try to follow the general flow of the existing services, and mor or less copy them. The battery service (ble_bas.c/ble_bas.h) is probably the simplest one, and should provde a good starting point.  If you look at it, you can see that the init function first adds a service, using the sd_ble_gatts_service_add() function, then calls an internal function to add a characteristic. This internal functions sets up a lot of parameter structures, that in different ways affect the characteristic added.
  • 5. About BLE,BT Explanation  Most services also needs to know what happens on run- time, so you need to create a event handler to handle events coming from the stack. This should be named service_name_on_ble_evt(), and be called from the applications main.c-file's ble_evt_dispatch() method. Finally, most services also need some API function to actually do something useful, for example the battery service's method to update the measured battery value.
  • 6. Builder custom profile  Start ble_app_template project.  File structure :( reference Keil C Interger develop suit)
  • 7. Builder custom profile  Client v.s Server  Client is no have data(information).  Client can send Request, Command and Confirmation  Server is have data .(information,so the device usually is server)  Server can send Response, Notification and Indication
  • 13. Nordic BLE Framework  The Software Structure  It have three parts: AP,GAP and GATTS.  The SVC and ble event is the Software interrupt.
  • 14. Nordic BLE Framework  The Software Structure  SVC  Event
  • 15. Nordic BLE Framework  GAP : Advertiser , GAP Service(device ,appearance ..), Connection and Security。
  • 16. Nordic BLE Framework  GAP API: GAP SVC
  • 17. Nordic BLE Framework  GAP API: GAP Event  The GAP Events association with GATT Events.
  • 18. Nordic BLE Framework  GAP With Center:
  • 20. Nordic BLE Framework  GATT Structure:
  • 22. Nordic BLE Framework  GATT Events:
  • 23. Nordic BLE Framework  GATT module:
  • 24. Nordic BLE Framework  GATT module:
  • 25. Builder custom profile                  1.main loop( have to sure the order function caller) int main(void) { ble_stack_init(); //Encodes the required advertising data and passes it to the stack bond_manager_init();//if it have . gap_params_init(); //GAP initialization, setup all the necessary GAP,set device name //permissions and appearance,reference appearance device advertising_init(); //adverrising the service (profile),advertising data to stack services_init(); //** advertising data and passes it to the stack conn_params_init();//Connection Parameters module sec_params_init();//security parameters radio_notification_init();//Radio Notification event handler // Start execution application_timers_start(); advertising_start(); }
  • 26. Builder custom profile  Static void services_init(void)  init function first adds a service, using the sd_ble_gatts_service_add() function, then calls an internal function to add a characteristic. This internal functions sets up a lot of parameter structures, that in different ways affect the characteristic added.  what happens on run-time, so you need to create a event handler to handle events coming from the stack. This should be named service_name_on_ble_evt(), and be called from the applications main.c-file's ble_evt_dispatch() method.  1.caller sd_ble_gatts_service_add() then add char,last register the event handler
  • 27. Builder custom profile  Static void services_init(void)
  • 28. Builder custom profile  Static void services_init(void) https://www.bluetooth.org/en-us/specification/adopted-specifications
  • 29. Builder custom profile  Static void services_init(void) https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=or g.bluetooth.service.battery_service.xml
  • 30. Builder custom profile  Static void services_init(void) https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=or g.bluetooth.service.battery_service.xml
  • 31. Builder custom profile  Profile , service , Characteristic ,descriptor and declare.  Battery service :  實作,提供value 及notify  Service , 0x180F  Characteristics, 0x2A19  Descriptors(Client Characteristic Configuration), 0x2902 https://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorsHomePage.aspx
  • 32.  File structure:  C:KeilARMDeviceNordicnrf51822Includebleble_servicesble_bas.h  C:KeilARMDeviceNordicnrf51822Sourcebleble_servicesble_bas.c  Data structure:  Struct: 1. ble_bas_evt_t//Battery Service event 2. ble_bas_init_t//Battery Service init structure 3. ble_bas_t//Battery Service structure
  • 33.  Functioin: 1. uint32_t ble_bas_init(ble_bas_t * p_bas, const ble_bas_init_t * p_bas_init); 2. void ble_bas_on_ble_evt(ble_bas_t * p_bas, ble_evt_t * p_ble_evt); 3. uint32_t ble_bas_battery_level_update(ble_bas_t * p_bas, uint8_t battery_level);  /**@brief Battery Service event handler type. */ 1. typedef void (*ble_bas_evt_handler_t) (ble_bas_t * p_bas, ble_bas_evt_t * p_evt);
  • 34.  /**@brief Battery Service event type. */  typedef enum  { BLE_BAS_EVT_NOTIFICATION_ENABLED, value notification enabled event. */  BLE_BAS_EVT_NOTIFICATION_DISABLED value notification disabled event. */  } ble_bas_evt_type_t;  /**< Battery /**< Battery  /**@brief Battery Service event. */  typedef struct  { ble_bas_evt_type_t evt_type;  } ble_bas_evt_t;  /**< Type of event. */
  • 35.             /**@brief Battery Service init structure. This contains all options and data needed for * initialization of the service.*/ typedef struct { ble_bas_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Battery Service. */ bool support_notification; /**< TRUE if notification of Battery Level measurement is supported. */ ble_srv_report_ref_t * p_report_ref; /**< If not NULL, a Report Reference descriptor with the specified value will be added to the Battery Level characteristic */ uint8_t initial_batt_level; /**< Initial battery level */ ble_srv_cccd_security_mode_t battery_level_char_attr_md; /**< Initial security level for battery characteristics attribute */ ble_gap_conn_sec_mode_t battery_level_report_read_perm; /**< Initial security level for battery report read attribute */ } ble_bas_init_t; //for pc
  • 36.            /**@brief Battery Service structure. This contains various status information for the service. */ typedef struct ble_bas_s { ble_bas_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Battery Service. */ uint16_t service_handle; /**< Handle of Battery Service (as provided by the BLE stack). */ ble_gatts_char_handles_t battery_level_handles; /**< Handles related to the Battery Level characteristic. */ uint16_t report_ref_handle; /**< Handle of the Report Reference descriptor. */ uint8_t battery_level_last; /**< Last Battery Level measurement passed to the Battery Service. */ uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */ bool is_notification_supported; /**< TRUE if notification of Battery Level is supported. */ } ble_bas_t;
  • 37.   // Initialize Battery Service memset(&bas_init, 0, sizeof(bas_init));      // Here the sec level for the Battery Service can be changed/increased. BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_char_attr_md.cccd_write_perm); BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_char_attr_md.read_perm); BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&bas_init.battery_level_char_attr_md.write_perm);  BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_report_read_perm);  bas_init.evt_handler = NULL; bas_init.support_notification = true; bas_init.p_report_ref = NULL; bas_init.initial_batt_level = 100;       err_code = ble_bas_init(&m_bas, &bas_init); APP_ERROR_CHECK(err_code);
  • 38.                    uint32_t ble_bas_init(ble_bas_t * p_bas, const ble_bas_init_t * p_bas_init) { uint32_t err_code; ble_uuid_t ble_uuid; // Initialize service structure p_bas->evt_handler = p_bas_init->evt_handler; p_bas->conn_handle = BLE_CONN_HANDLE_INVALID; p_bas->is_notification_supported = p_bas_init->support_notification; p_bas->battery_level_last = INVALID_BATTERY_LEVEL; // Add service BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_BATTERY_SERVICE); err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_bas->service_handle); if (err_code != NRF_SUCCESS) { return err_code; } // Add battery level characteristic return battery_level_char_add(p_bas, p_bas_init); }
  • 39.                   /**@brief Add Battery Level characteristic. * * @param[in] p_bas Battery Service structure. * @param[in] p_bas_init Information needed to initialize the service. * * @return NRF_SUCCESS on success, otherwise an error code. */ static uint32_t battery_level_char_add(ble_bas_t * p_bas, const ble_bas_init_t * p_bas_init) { uint32_t err_code; ble_gatts_char_md_t char_md; ble_gatts_attr_md_t cccd_md; ble_gatts_attr_t attr_char_value; ble_uuid_t ble_uuid; ble_gatts_attr_md_t attr_md; uint8_t initial_battery_level; uint8_t encoded_report_ref[BLE_SRV_ENCODED_REPORT_REF_LEN]; uint8_t init_len;
  • 40.
  • 41.  以battery service 中,由上可知有一個characteristics/及 一個CCCD .而每一個characteristics由上到下: 1. ble_gatts_char_md_t char_md;//GATT Characteristic metadata Characteristic Properties, user description descriptor, Pointer to a presentation format structure and Attribute metadata for the Client(server) Characteristic Configuration Descriptor. ble_gatts_attr_md_t attr_md;//Attribute metadata A. A. Read(write) permissions, Variable length, Value location and Read(write) Authorization on every read(write) operation ble_gatts_attr_md_t cccd_md //Attribute metadata B. A. Read(write) permissions, Variable length, Value location and Read(write) Authorization
  • 42. 2. ble_gatts_attr_t attr_char_value;//GATT Attribute  Pointer to the attribute UUID, Pointer to the attribute metadata structure, attribute value length in bytes and Pointer to the attribute data if the @ref BLE_GATTS_VLOC_USER value location is selected in the attribute metadata, this will have to point to a buffer
  • 43.              /**@brief GATT Characteristic metadata. */ typedef struct { ble_gatt_char_props_t char_props; /**< Characteristic Properties. */ ble_gatt_char_ext_props_t char_ext_props; /**< Characteristic Extended Properties. */ uint8_t* p_char_user_desc; /**< Pointer to a UTF-8, NULL if the descriptor is not required. */ uint16_t char_user_desc_max_size; /**< The maximum size in bytes of the user description descriptor. */ uint16_t char_user_desc_size; /**< The size of the user description, must be smaller or equal to char_user_desc_max_size. */ ble_gatts_char_pf_t* p_char_pf; /**< Pointer to a presentation format structure or NULL if the descriptor is not required. */ ble_gatts_attr_md_t* p_user_desc_md; /**< Attribute metadata for the User Description descriptor, or NULL for default values. */ ble_gatts_attr_md_t* p_cccd_md; /**< Attribute metadata for the Client Characteristic Configuration Descriptor, or NULL for default values. */ ble_gatts_attr_md_t* p_sccd_md; /**< Attribute metadata for the Server Characteristic Configuration Descriptor, or NULL for default values. */ } ble_gatts_char_md_t;
  • 44.  /**@brief GATT Characteristic Properties. */  typedef struct  {          /* Standard properties */ uint8_t broadcast :1; /**< Broadcasting of value permitted. */ uint8_t read :1; /**< Reading value permitted. */ uint8_t write_wo_resp :1; /**< Writing value with Write Command permitted. */ uint8_t write :1; /**< Writing value with Write Request permitted. */ uint8_t notify :1; /**< Notications of value permitted. */ uint8_t indicate :1; /**< Indications of value permitted. */ uint8_t auth_signed_wr :1; /**< Writing value with Signed Write Command permitted. */ } ble_gatt_char_props_t;
  • 45.  /**@brief Attribute metadata. */  typedef struct  {  ble_gap_conn_sec_mode_t read_perm; /**< Read permissions. */  ble_gap_conn_sec_mode_t write_perm; /**< Write permissions. */  uint8_t vlen :1; /**< Variable length attribute. */  uint8_t vloc :2; /**< Value location, see @ref BLE_GATTS_VLOCS.*/  uint8_t rd_auth :1; /**< Read Authorization and value will be requested from the application on every read operation. */  uint8_t wr_auth :1; /**< Write Authorization will be requested from the application on every Write Request operation (but not Write Command). */  } ble_gatts_attr_md_t;
  • 46.             /**@brief GATT Attribute. */ typedef struct { ble_uuid_t* p_uuid; /**< Pointer to the attribute UUID. */ ble_gatts_attr_md_t* p_attr_md; /**< Pointer to the attribute metadata structure. */ uint16_t init_len; /**< Initial attribute value length in bytes. */ uint16_t init_offs; /**< Initial attribute value offset in bytes. If different from zero, the first init_offs bytes of the attribute value will be left uninitialized. */ uint16_t max_len; /**< Maximum attribute value length in bytes, see @ref BLE_GATTS_ATTR_LENS_MAX for maximum values. */ uint8_t* p_value; /**< Pointer to the attribute data. Please note that if the @ref BLE_GATTS_VLOC_USER value location is selected in the attribute metadata, this will have to point to a buffer that remains valid through the lifetime of the attribute. This excludes usage of automatic variables that may go out of scope or any other temporary location. The stack may access that memory directly without the application's knowledge. */ } ble_gatts_attr_t;
  • 47.  設定  1.cccd_md,//notify  2. char_md  3.BLE_UUID_BLE_ASSIGN  4. attr_md  5. attr_char_value  6. sd_ble_gatts_characteristic_add
  • 48.       // Add Battery Level characteristic if (p_bas->is_notification_supported) { memset(&cccd_md, 0, sizeof(cccd_md)); // According to BAS_SPEC_V10, the read operation on cccd should be possible without  // authentication.  BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);  cccd_md.write_perm = p_bas_init>battery_level_char_attr_md.cccd_write_perm;  cccd_md.vloc = BLE_GATTS_VLOC_STACK;  }
  • 49.  memset(&char_md, 0, sizeof(char_md));         char_md.char_props.read = 1; char_md.char_props.notify = (p_bas>is_notification_supported) ? 1 : 0; char_md.p_char_user_desc = NULL; char_md.p_char_pf = NULL; char_md.p_user_desc_md = NULL; char_md.p_cccd_md = (p_bas>is_notification_supported) ? &cccd_md : NULL; char_md.p_sccd_md = NULL;
  • 50.  BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_BATTERY_LEVEL_CHAR);         memset(&attr_md, 0, sizeof(attr_md)); attr_md.read_perm = p_bas_init>battery_level_char_attr_md.read_perm; attr_md.write_perm = p_bas_init>battery_level_char_attr_md.write_perm; attr_md.vloc = BLE_GATTS_VLOC_STACK; attr_md.rd_auth = 0; attr_md.wr_auth = 0; attr_md.vlen = 0;
  • 51.  initial_battery_level = p_bas_init->initial_batt_level;   memset(&attr_char_value, 0, sizeof(attr_char_value));  attr_char_value.p_uuid attr_char_value.p_attr_md attr_char_value.init_len attr_char_value.init_offs attr_char_value.max_len attr_char_value.p_value      = &ble_uuid; = &attr_md; = sizeof(uint8_t); = 0; = sizeof(uint8_t); = &initial_battery_level;
  • 52.  err_code = sd_ble_gatts_characteristic_add(p_bas- >service_handle, &char_md,       &attr_char_value, &p_bas>battery_level_handles); if (err_code != NRF_SUCCESS) { return err_code; }
  • 53. if (p_bas_init->p_report_ref != NULL)  {  // Add Report Reference descriptor  BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_REPORT_REF_DESCR);    memset(&attr_md, 0, sizeof(attr_md));  attr_md.read_perm = p_bas_init->battery_level_report_read_perm; BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.write_perm);      attr_md.vloc = BLE_GATTS_VLOC_STACK; attr_md.rd_auth = 0; attr_md.wr_auth = 0; attr_md.vlen = 0;
  • 54.  init_len = ble_srv_report_ref_encode(encoded_report_ref, p_bas_init->p_report_ref);   memset(&attr_char_value, 0, sizeof(attr_char_value));  attr_char_value.p_uuid attr_char_value.p_attr_md attr_char_value.init_len attr_char_value.init_offs attr_char_value.max_len attr_char_value.p_value      = &ble_uuid; = &attr_md; = init_len; = 0; = attr_char_value.init_len; = encoded_report_ref;
  • 55.             err_code = sd_ble_gatts_descriptor_add(p_bas->battery_level_handles.value_handle, &attr_char_value, &p_bas->report_ref_handle); if (err_code != NRF_SUCCESS) { return err_code; } } else { p_bas->report_ref_handle = BLE_GATT_HANDLE_INVALID; }  return NRF_SUCCESS;   }
  • 56.           /**@brief Disconnect event handler. * * @param[in] p_bas Battery Service structure. * @param[in] p_ble_evt Event received from the BLE stack. */ static void on_disconnect(ble_bas_t * p_bas, ble_evt_t * p_ble_evt) { UNUSED_PARAMETER(p_ble_evt); p_bas->conn_handle = BLE_CONN_HANDLE_INVALID; }
  • 57.  /**@brief Connect event handler.  *  * @param[in] p_bas       Battery Service structure. * @param[in] p_ble_evt Event received from the BLE stack. */ static void on_connect(ble_bas_t * p_bas, ble_evt_t * p_ble_evt) { p_bas->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; }
  • 58.        void ble_bas_on_ble_evt(ble_bas_t * p_bas, ble_evt_t * p_ble_evt) { switch (p_ble_evt->header.evt_id) { case BLE_GAP_EVT_CONNECTED: on_connect(p_bas, p_ble_evt); break;  case BLE_GAP_EVT_DISCONNECTED: on_disconnect(p_bas, p_ble_evt); break;     case BLE_GATTS_EVT_WRITE: on_write(p_bas, p_ble_evt); break;     default: break;   }   }
  • 59.           /**@brief Write event handler. * * @param[in] p_bas Battery Service structure. * @param[in] p_ble_evt Event received from the BLE stack. */ static void on_write(ble_bas_t * p_bas, ble_evt_t * p_ble_evt) { if (p_bas->is_notification_supported) { ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write;       if ( (p_evt_write->handle == p_bas->battery_level_handles.cccd_handle) && (p_evt_write->len == 2) )
  • 60.  { // CCCD written, call application event handler if (p_bas->evt_handler != NULL) { ble_bas_evt_t evt;       if (ble_srv_is_notification_enabled(p_evt_write->data)) { evt.evt_type = BLE_BAS_EVT_NOTIFICATION_ENABLED; } else { evt.evt_type = BLE_BAS_EVT_NOTIFICATION_DISABLED; }  p_bas->evt_handler(p_bas, &evt);        }  }  }   }
  • 61. Nordic FrameWork support service  Alert Notification Service Client,ble_ans_c  Energon bank Service module, ble_band  Battery Service module,ble_bas  Blood Pressure Service module. ble_bps  Cycling Speed and Cadence Service, ble_cscs  Device Information Service, ble_dis  Glucose Service module. ble_gls  Glucose Database Service. ble_gls_db  Human Interface Device Service, ble_hids
  • 62. Nordic FrameWork support service  Heart Rate Service ,ble_hrs  Health Thermometer Service ,ble_hts  Immediate Alert Service,ble_ias  Immediate Alert Service Client,ble_ias_c  Link Loss Service,ble_lls  Running Speed and Cadence Service,ble_rscs  TX Power Service,ble_tps
  • 63. Reference  Battery Service (BAS)  http://developer.bluetooth.org/TechnologyOverview/Pages/B AS.aspx  The external appearance of this https://developer.bluetooth.org/gatt/characteristics/Pa ges/CharacteristicViewer.aspx?u=org.bluetooth.characte ristic.gap.appearance.xml
  • 71. Builder custom profile  Static void services_init(void)