•
device_info_serv [In/out] :
pointer to device info, GATT description handler to be
updated.
Return :
None
Here is a picture of GATT device info service descriptor definition in Host memory:
device_info_serv->serv_handle = 0;
device_info_serv->serv_uuid.type = AT_BLE_UUID_16;
device_info_serv->serv_uuid.uuid[0] = (uint8_t) DIS_SERVICE_UUID;
device_info_serv->serv_uuid.uuid[1] = (uint8_t) (DIS_SERVICE_UUID >> 8);
//Characteristic Info for Manufacturer Name String
device_info_serv->serv_chars[0].char_val_handle = 0; /* handle stored here */
device_info_serv->serv_chars[0].uuid.type = AT_BLE_UUID_16;
device_info_serv->serv_chars[0].uuid.uuid[0] = (uint8_t) IS_CHAR_MANUFACTURER_NAME_UUID; /*
UUID : Manufacturer Name String */
device_info_serv->serv_chars[0].uuid.uuid[1] = (uint8_t) (DIS_CHAR_MANUFACTURER_NAME_UUID >>
8);
/* UUID : Manufacturer Name String */
device_info_serv->serv_chars[0].properties = AT_BLE_CHAR_READ; /* Properties */
memcpy
(char_value.manufacturer_name,DEFAULT_MANUFACTURER_NAME,DIS_CHAR_MANUFACTURER_NAME_INIT_
LEN);
device_info_serv->serv_chars[0].init_value = char_value.manufacturer_name;
device_info_serv->serv_chars[0].value_init_len = DIS_CHAR_MANUFACTURER_NAME_INIT_LEN;
device_info_serv->serv_chars[0].value_max_len = DIS_CHAR_MANUFACTURER_NAME_MAX_LEN;
#if BLE_PAIR_ENABLE
device_info_serv->serv_chars[0].value_permissions =
AT_BLE_ATTR_READABLE_REQ_AUTHN_NO_AUTHR; /* permissions */
#else
device_info_serv->serv_chars[0].value_permissions =
AT_BLE_ATTR_READABLE_NO_AUTHN_NO_AUTHR; /* permissions */
#endif
device_info_serv->serv_chars[0].user_desc =
NULL
; /* user defined name */
device_info_serv->serv_chars[0].user_desc_len = 0;
device_info_serv->serv_chars[0].user_desc_max_len = 0;
device_info_serv->serv_chars[0].user_desc_permissions = AT_BLE_ATTR_NO_PERMISSIONS; /*user
description permissions*/
device_info_serv->serv_chars[0].client_config_permissions = AT_BLE_ATTR_NO_PERMISSIONS; /
*client config permissions*/
device_info_serm hdsv->serv_chars[0].server_config_permissions = AT_BLE_ATTR_NO_PERMISSIONS; /
*server config permissions*/
device_info_serv->serv_chars[0].user_desc_handle = 0; /*user desc handles*/
device_info_serv->serv_chars[0].client_config_handle = 0; /*client config handles*/
device_info_serv->serv_chars[0].server_config_handle = 0; /*server config handles*/
device_info_serv->serv_chars[0].presentation_format =
NULL
; /* presentation format */
Note:
In case of custom service, the above definition initialization must be taken care of by the
developer.
4.2.1
Procedure to Configure and Load Device Info Service
1.
Include device info service header file (
device_info.h
) at the beginning of
startup_template.c
file.
#include <asf.h>
#include "platform.h"
#include "at_ble_api.h"
#include "profiles.h"
#include "console_serial.h"
#include "timer_hw.h"
#include "conf_extint.h"
#include "ble_manager.h"
#include "ble_utils.h"
#include "conf_serialdrv.h"
#include "startup_template.h"
#include "device_info.h"
2.
Define a device info service handler as global in
startup_template.c
file.
/* Services
handlers */dis_gatt_service_handler_t dis_service_handler;
ATBTLC1000
Setting/Handling of Pre-Defined Service
©
2017 Microchip Technology Inc.
Training Manual
DS00002599A-page 34