Microchip® Advanced Software Framework

ancs_client.c File Reference
#include "btstack_config.h"
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ancs_client.h"
#include "ble/att_db.h"
#include "ble/core.h"
#include "ble/gatt_client.h"
#include "ble/sm.h"
#include "btstack_debug.h"
#include "btstack_event.h"
#include "btstack_run_loop.h"
#include "classic/sdp_util.h"
#include "gap.h"

Macros

#define __BTSTACK_FILE__   "ancs_client.c"
 

Typedefs

typedef enum
ancs_chunk_parser_state 
ancs_chunk_parser_state_t
 

Enumerations

enum  ancs_chunk_parser_state {
  W4_ATTRIBUTE_ID,
  W4_ATTRIBUTE_LEN,
  W4_ATTRIBUTE_COMPLETE
}
 
enum  tc_state_t {
  TC_IDLE,
  TC_W4_ENCRYPTED_CONNECTION,
  TC_W4_SERVICE_RESULT,
  TC_W4_CHARACTERISTIC_RESULT,
  TC_W4_DATA_SOURCE_SUBSCRIBED,
  TC_W4_NOTIFICATION_SOURCE_SUBSCRIBED,
  TC_SUBSCRIBED,
  TC_W4_DISCONNECT
}
 

Functions

static void ancs_chunk_parser_handle_byte (uint8_t data)
 
static void ancs_chunk_parser_init (void)
 
const char * ancs_client_attribute_name_for_id (int id)
 
void ancs_client_init (void)
 
void ancs_client_register_callback (btstack_packet_handler_t handler)
 
static void handle_hci_event (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size)
 
static void notify_client_simple (int event_type)
 
static void notify_client_text (int event_type)
 

Variables

static const int ANCS_ATTRBUTE_NAMES_COUNT = sizeof(ancs_attribute_names) / sizeof(char *)
 
static uint8_t ancs_attribute_id
 
static uint16_t ancs_attribute_len
 
static const char * ancs_attribute_names []
 
static uint16_t ancs_bytes_needed
 
static uint16_t ancs_bytes_received
 
static int ancs_characteristcs
 
static gatt_client_characteristic_t ancs_control_point_characteristic
 
static const uint8_t ancs_control_point_uuid [] = {0x69,0xD1,0xD8,0xF3,0x45,0xE1,0x49,0xA8,0x98,0x21,0x9B,0xBD,0xFD,0xAA,0xD9,0xD9}
 
static gatt_client_characteristic_t ancs_data_source_characteristic
 
static gatt_client_notification_t ancs_data_source_notification
 
static const uint8_t ancs_data_source_uuid [] = {0x22,0xEA,0xC6,0xE9,0x24,0xD6,0x4B,0xB5,0xBE,0x44,0xB3,0x6A,0xCE,0x7C,0x7B,0xFB}
 
static uint8_t ancs_notification_buffer [50]
 
static gatt_client_characteristic_t ancs_notification_source_characteristic
 
static gatt_client_notification_t ancs_notification_source_notification
 
static const uint8_t ancs_notification_source_uuid [] = {0x9F,0xBF,0x12,0x0D,0x63,0x01,0x42,0xD9,0x8C,0x58,0x25,0xE6,0x99,0xA2,0x1D,0xBD}
 
static uint32_t ancs_notification_uid
 
static gatt_client_service_t ancs_service
 
static int ancs_service_found
 
static const uint8_t ancs_service_uuid [] = {0x79,0x05,0xF4,0x31,0xB5,0xCE,0x4E,0x99,0xA4,0x0F,0x4B,0x1E,0x12,0x2D,0x00,0xD0}
 
static ancs_chunk_parser_state_t chunk_parser_state
 
static btstack_packet_handler_t client_handler
 
static uint16_t gc_handle
 
static
btstack_packet_callback_registration_t 
hci_event_callback_registration
 
static tc_state_t tc_state = TC_IDLE
 

#define __BTSTACK_FILE__   "ancs_client.c"

Enumerator
W4_ATTRIBUTE_ID 
W4_ATTRIBUTE_LEN 
W4_ATTRIBUTE_COMPLETE 
enum tc_state_t
Enumerator
TC_IDLE 
TC_W4_ENCRYPTED_CONNECTION 
TC_W4_SERVICE_RESULT 
TC_W4_CHARACTERISTIC_RESULT 
TC_W4_DATA_SOURCE_SUBSCRIBED 
TC_W4_NOTIFICATION_SOURCE_SUBSCRIBED 
TC_SUBSCRIBED 
TC_W4_DISCONNECT 

static void ancs_chunk_parser_init ( void  )
static

References W4_ATTRIBUTE_ID.

Referenced by handle_hci_event().

const char* ancs_client_attribute_name_for_id ( int  id)
void ancs_client_register_callback ( btstack_packet_handler_t  handler)
static void notify_client_simple ( int  event_type)
static
static void notify_client_text ( int  event_type)
static

const int ANCS_ATTRBUTE_NAMES_COUNT = sizeof(ancs_attribute_names) / sizeof(char *)
static
uint8_t ancs_attribute_id
static
uint16_t ancs_attribute_len
static
const char* ancs_attribute_names[]
static
Initial value:
= {
"AppIdentifier",
"IDTitle",
"IDSubtitle",
"IDMessage",
"IDMessageSize",
"IDDate"
}

Referenced by ancs_client_attribute_name_for_id().

uint16_t ancs_bytes_needed
static
uint16_t ancs_bytes_received
static
int ancs_characteristcs
static
gatt_client_characteristic_t ancs_control_point_characteristic
static
const uint8_t ancs_control_point_uuid[] = {0x69,0xD1,0xD8,0xF3,0x45,0xE1,0x49,0xA8,0x98,0x21,0x9B,0xBD,0xFD,0xAA,0xD9,0xD9}
static
gatt_client_characteristic_t ancs_data_source_characteristic
static
gatt_client_notification_t ancs_data_source_notification
static
const uint8_t ancs_data_source_uuid[] = {0x22,0xEA,0xC6,0xE9,0x24,0xD6,0x4B,0xB5,0xBE,0x44,0xB3,0x6A,0xCE,0x7C,0x7B,0xFB}
static
uint8_t ancs_notification_buffer[50]
static

Referenced by notify_client_text().

gatt_client_characteristic_t ancs_notification_source_characteristic
static
gatt_client_notification_t ancs_notification_source_notification
static
const uint8_t ancs_notification_source_uuid[] = {0x9F,0xBF,0x12,0x0D,0x63,0x01,0x42,0xD9,0x8C,0x58,0x25,0xE6,0x99,0xA2,0x1D,0xBD}
static
uint32_t ancs_notification_uid
static
gatt_client_service_t ancs_service
static
int ancs_service_found
static
const uint8_t ancs_service_uuid[] = {0x79,0x05,0xF4,0x31,0xB5,0xCE,0x4E,0x99,0xA4,0x0F,0x4B,0x1E,0x12,0x2D,0x00,0xD0}
static
ancs_chunk_parser_state_t chunk_parser_state
static
btstack_packet_handler_t client_handler
static
uint16_t gc_handle
static
btstack_packet_callback_registration_t hci_event_callback_registration
static
tc_state_t tc_state = TC_IDLE
static