/* Register GAP Callbacks */
printf("\n*** Assignment 2.2: Register ATBTLC1000 callbacks");
ble_status = ble_mgr_events_callback_handler(REGISTER_CALL_BACK,\
BLE_GAP_EVENT_TYPE,&app_gap_handle);
if (ble_status != true)
printf("\n##Error when Registering ATBTLC1000 callbacks");
}
/* timer callback function */
static void timer_callback_fn(void)
{
/* Add timer callback functionality here */
timer_flag = true;
}
void button_cb(void)
{
/* Add button callback functionality here */
}
static uint8_t Temperature_value = 25;
/* Register GATT callbacks at BLE manager level*/
void send_temperature_notification(void){
/* Register GAP Callbacks */
printf("\n*** Assignment 4.2: Send temperature update notification");
/* Dummy temperature value */
Temperatur+;
if(Temperature_value > 75)
Temperature_value = 25;
/* Update attribute data base */
ble_status = at_ble_characteristic_value_set(\
environment_service_characs[0].char_val_handle,\
(uint8_t *)&Temperature_value,\
sizeof(Temperature_value));
ble_status = at_ble_notification_send(0,\
environment_service_characs[0].char_val_handle);
if(ble_status != AT_BLE_SUCCESS){
printf("fail to send temperature update notification ");
}
}
int main(void)
{
#if SAMG55 || SAM4S
/* Initialize the SAM system. */
sysclk_init();
board_init();
#elif SAM0
system_init();
#endif
/* Initialize serial console */
serial_console_init();
/* Hardware timer */
hw_timer_init();
/* button initialization */
button_init();
hw_timer_register_callback(timer_callback_fn);
DBG_LOG("Initializing BLE Application");
/* initialize the BLE chip and Set the Device Address */
ble_device_init(NULL);
/* Register Gap ATBTLC1000 Callbacks */
register_btlc1000_callbacks();
/* Custom service init */
custom_environment_service_init();
ATBTLC1000
Appendix B: Software Solution - Custom Service
©
2017 Microchip Technology Inc.
Training Manual
DS00002599A-page 51