3.
Add
dis_init_service
and
at_ble_primary_service_define
functions, as called above
the advertisement start in main routine.
/* Initialize Device Info service in GATT */
printf("\n*** Assignment 3.2: Start Device Info Service");
dis_init_service (&dis_service_handler) ;
/* Define the primary service in the GATT server database */
if ((dis_primary_service_define (&dis_service_handler)) != AT_BLE_SUCCESS)
{
printf("Device Information Service definition failed");
}
/* Start Advertising process */
start_advertisement();
4.
Click "
" to save the project <Ctrl+S> and compile the project by pressing "
" button <F7>.
5.
Verify that no build error appears in Atmel Studio output window.
Figure 4-7. Atmel Studio Output Window
6.
Click "
" to program the project binary on the SAM L21 Xplained Pro. <Ctrl+Alt+F5>.
7.
Open “Microchip SmartConnect” application on Android or iOS device.
8.
Press <Start Scan> button and connect to peripheral.
Note:
The device name is a characteristic and contains the name of the device. This device name
can be read by the central device to know the name of the device in order to differentiate the
devices. This is being set using
at_ble_device_name_set()API
. The device name is set by
default, when
ble_device_init
is called and the value is pre-defined using
BLE_DEVICE_NAME
.
The device name can also be sent as part of advertisement payload to be same as the one
configured in
at_ble_adv_data_set() API
. It is the responsibility of users to keep the device
name set in advertisement payload the same as that configured in
at_ble_device_name_set()
.
9.
The Service must now be visible after pairing with peripheral under Microchip SmartConnect
application.
ATBTLC1000
Setting/Handling of Pre-Defined Service
©
2017 Microchip Technology Inc.
Training Manual
DS00002599A-page 35