Microchip® Advanced Software Framework

tip_app.c File Reference

Time Information Profile Application.

Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>
#include "platform.h"
#include "at_ble_api.h"
#include "tip_app.h"
#include "time_info.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 "current_time.h"
#include "next_dst.h"
#include "reference_time.h"

Macros

#define APP_BUTTON_EVENT_ID   (2)
 
#define APP_INVALID_EVENT_ID   (0)
 
#define APP_TIMER_EVENT_ID   (1)
 

Functions

static at_ble_status_t app_read_response_cb (void *param)
 Callback registered for characteristic read response. More...
 
void button_cb (void)
 Button Press Callback. More...
 
int main (void)
 Main Function for Time Information Callback. More...
 
void timer_callback_handler (void)
 Timer Callback. More...
 
static at_ble_status_t tip_app_custom_event (void *param)
 
static at_ble_status_t tip_disconnect_cb (void *params)
 
static at_ble_status_t tip_discovery_complete_cb (void *params)
 
static at_ble_status_t tip_encryption_status_changed_cb (void *params)
 
static at_ble_status_t tip_pair_done_cb (void *params)
 

Variables

user_custom_event_t app_custom_event [2]
 
bool app_exec_flag = false
 To keep the app executing continuously. More...
 
volatile bool app_init_done = false
 
ble_connected_dev_info_t ble_dev_info [BLE_MAX_DEVICE_CONNECTION]
 Initialize the service with its included service, characteristics, and descriptors. More...
 
volatile bool button_pressed = false
 
static bool completed_prev_read = true
 
gatt_cts_handler_t cts_handle
 CTS Service Handle. More...
 
volatile bool current_time_char_found
 
bool discovery_flag = false
 
gatt_dst_handler_t dst_handle
 Next DST Change Service Handle. More...
 
volatile bool local_time_char_found
 
volatile bool ref_time_char_found
 
gatt_rtu_handler_t rtu_handle
 Reference Time Update Service Handle. More...
 
volatile bool time_update_cp_char_found
 
volatile bool time_update_state_char_found
 
volatile bool time_with_dst_char_found
 
static const ble_gap_event_cb_t tip_app_gap_handle
 
static const
ble_gatt_client_event_cb_t 
tip_app_gatt_client_handle
 
static const ble_custom_event_cb_t tip_custom_event_cb
 

#define APP_BUTTON_EVENT_ID   (2)

Referenced by tip_app_custom_event().

#define APP_INVALID_EVENT_ID   (0)
#define APP_TIMER_EVENT_ID   (1)

void button_cb ( void  )

Button Press Callback.

References app_init_done, at_ble_event_user_defined_post(), and button_pressed.

void timer_callback_handler ( void  )

Timer Callback.

callback handler called on timer expiry

Timer call back handler called on timer expiry.

static at_ble_status_t tip_disconnect_cb ( void *  params)
static
static at_ble_status_t tip_discovery_complete_cb ( void *  params)
static
static at_ble_status_t tip_encryption_status_changed_cb ( void *  params)
static
static at_ble_status_t tip_pair_done_cb ( void *  params)
static

user_custom_event_t app_custom_event[2]
Initial value:
= {
{
.bptr = NULL,
},
{
.bptr = NULL
}
}
#define NULL
Definition: def.h:47
#define APP_TIMER_EVENT_ID
Definition: tip_app.c:174
#define APP_BUTTON_EVENT_ID
Definition: tip_app.c:175
bool app_exec_flag = false

To keep the app executing continuously.

Referenced by tip_app_custom_event(), tip_disconnect_cb(), tip_encryption_status_changed_cb(), and tip_pair_done_cb().

volatile bool app_init_done = false

Initialize the service with its included service, characteristics, and descriptors.

Peer Connected device info

Parameters
[in]scan_paramgatt service information
Returns
none
volatile bool button_pressed = false
bool completed_prev_read = true
static
gatt_cts_handler_t cts_handle

CTS Service Handle.

gatt_dst_handler_t dst_handle

Next DST Change Service Handle.

gatt_rtu_handler_t rtu_handle

Reference Time Update Service Handle.

volatile bool time_update_cp_char_found
const ble_gap_event_cb_t tip_app_gap_handle
static
Initial value:
= {
.pair_done = tip_pair_done_cb,
.encryption_status_changed = tip_encryption_status_changed_cb,
.disconnected = tip_disconnect_cb
}
static at_ble_status_t tip_encryption_status_changed_cb(void *params)
Definition: tip_app.c:261
static at_ble_status_t tip_disconnect_cb(void *params)
Definition: tip_app.c:286
static at_ble_status_t tip_pair_done_cb(void *params)
Definition: tip_app.c:248
const ble_gatt_client_event_cb_t tip_app_gatt_client_handle
static
Initial value:
= {
.discovery_complete = tip_discovery_complete_cb,
.characteristic_read_by_uuid_response = app_read_response_cb
}
static at_ble_status_t app_read_response_cb(void *params)
Callback registered for characteristic read response.
Definition: tip_app.c:301
static at_ble_status_t tip_discovery_complete_cb(void *params)
Definition: tip_app.c:274
const ble_custom_event_cb_t tip_custom_event_cb
static
Initial value:
= {
.custom_event = tip_app_custom_event
}
static at_ble_status_t tip_app_custom_event(void *param)
Definition: tip_app.c:353