Microchip® Advanced Software Framework

device_information_service_server.c File Reference

Data Structures

struct  device_information_field_t
 

Macros

#define __BTSTACK_FILE__   "device_information_service_server.c"
 

Enumerations

enum  device_information_field_id_t {
  MANUFACTURER_NAME = 0,
  MODEL_NUMBER,
  SERIAL_NUMBER,
  HARDWARE_REVISION,
  FIRMWARE_REVISION,
  SOFTWARE_REVISION,
  SYSTEM_ID,
  IEEE_REGULATORY_CERTIFICATION,
  PNP_ID,
  NUM_INFORMATION_FIELDS
}
 Implementation of the Device Information Service Server. More...
 

Functions

static uint16_t device_information_service_read_callback (hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t offset, uint8_t *buffer, uint16_t buffer_size)
 
void device_information_service_server_init (void)
 Implementation of the Device Information Service Server. More...
 
void device_information_service_server_set_firmware_revision (const char *firmware_revision)
 Set Firmware Revision. More...
 
void device_information_service_server_set_hardware_revision (const char *hardware_revision)
 Set Hardware Revision. More...
 
void device_information_service_server_set_ieee_regulatory_certification (uint16_t value_a, uint16_t value_b)
 Set IEEE 11073-20601 regulatory certification data list. More...
 
void device_information_service_server_set_manufacturer_name (const char *manufacturer_name)
 Set Manufacturer Name. More...
 
void device_information_service_server_set_model_number (const char *model_number)
 Set Model Number. More...
 
void device_information_service_server_set_pnp_id (uint8_t vendor_source_id, uint16_t vendor_id, uint16_t product_id, uint16_t product_version)
 Set PNP ID. More...
 
void device_information_service_server_set_serial_number (const char *serial_number)
 Set Serial Number. More...
 
void device_information_service_server_set_software_revision (const char *software_revision)
 Set Software Revision. More...
 
void device_information_service_server_set_system_id (uint64_t manufacturer_identifier, uint32_t organizationally_unique_identifier)
 Set System ID. More...
 
static void set_string (device_information_field_id_t field_id, const char *text)
 

Variables

const uint16_t device_information_characteristic_uuids []
 
static device_information_field_t device_information_fields [NUM_INFORMATION_FIELDS]
 
static uint8_t device_information_ieee_regulatory_certification [4]
 
static uint8_t device_information_pnp_id [7]
 
static att_service_handler_t device_information_service
 
static uint8_t device_information_system_id [8]
 

#define __BTSTACK_FILE__   "device_information_service_server.c"

Implementation of the Device Information Service Server.

To use with your application, add '#import <device_information_sevice.gatt' to your .gatt file and call all functions below. All strings and blobs need to stay valid after calling the functions.

Note
: instead of calling all setters, you can create a local copy of the .gatt file and remove all Characteristics that are not relevant for your application.
Enumerator
MANUFACTURER_NAME 
MODEL_NUMBER 
SERIAL_NUMBER 
HARDWARE_REVISION 
FIRMWARE_REVISION 
SOFTWARE_REVISION 
SYSTEM_ID 
IEEE_REGULATORY_CERTIFICATION 
PNP_ID 
NUM_INFORMATION_FIELDS 

static uint16_t device_information_service_read_callback ( hci_con_handle_t  con_handle,
uint16_t  attribute_handle,
uint16_t  offset,
uint8_t *  buffer,
uint16_t  buffer_size 
)
static
void device_information_service_server_init ( void  )

Implementation of the Device Information Service Server.

To use with your application, add '#import <device_information_sevice.gatt' to your .gatt file and call all functions below. All strings and blobs need to stay valid after calling the functions.

Note
: instead of calling all setters, you can create a local copy of the .gatt file and remove all Characteristics that are not relevant for your application and define all fixed values in the .gatt file Init Device Information Service Server with ATT DB
Parameters
battery_valuein range 0-100

References att_register_service_handler(), device_information_characteristic_uuids, device_information_service_read_callback(), att_service_handler::end_handle, gatt_server_get_get_handle_range_for_service_with_uuid16(), gatt_server_get_value_handle_for_characteristic_with_uuid16(), NULL, NUM_INFORMATION_FIELDS, ORG_BLUETOOTH_SERVICE_DEVICE_INFORMATION, att_service_handler::read_callback, att_service_handler::start_handle, device_information_field_t::value_handle, and att_service_handler::write_callback.

void device_information_service_server_set_firmware_revision ( const char *  firmware_revision)

Set Firmware Revision.

Parameters
firmware_revision

References FIRMWARE_REVISION, and set_string().

void device_information_service_server_set_hardware_revision ( const char *  hardware_revision)

Set Hardware Revision.

Parameters
hardware_revision

References HARDWARE_REVISION, and set_string().

void device_information_service_server_set_ieee_regulatory_certification ( uint16_t  value_a,
uint16_t  value_b 
)

Set IEEE 11073-20601 regulatory certification data list.

Note
: format duint16. duint16 is two uint16 values concatenated together.
Parameters
ieee_regulatory_certification

References device_information_field_t::data, device_information_ieee_regulatory_certification, IEEE_REGULATORY_CERTIFICATION, device_information_field_t::len, and little_endian_store_16().

void device_information_service_server_set_manufacturer_name ( const char *  manufacturer_name)

Set Manufacturer Name.

Parameters
manufacturer_name

References MANUFACTURER_NAME, and set_string().

void device_information_service_server_set_model_number ( const char *  model_number)

Set Model Number.

Parameters
model_number

References MODEL_NUMBER, and set_string().

void device_information_service_server_set_pnp_id ( uint8_t  vendor_source_id,
uint16_t  vendor_id,
uint16_t  product_id,
uint16_t  product_version 
)

Set PNP ID.

Set PnP ID.

Parameters
vendor_source_id
vendor_id
product_id

References device_information_field_t::data, device_information_pnp_id, device_information_field_t::len, little_endian_store_16(), and PNP_ID.

void device_information_service_server_set_serial_number ( const char *  serial_number)

Set Serial Number.

Parameters
serial_number

References SERIAL_NUMBER, and set_string().

void device_information_service_server_set_software_revision ( const char *  software_revision)

Set Software Revision.

Parameters
software_revision

References set_string(), and SOFTWARE_REVISION.

void device_information_service_server_set_system_id ( uint64_t  manufacturer_identifier,
uint32_t  organizationally_unique_identifier 
)

Set System ID.

Parameters
manufacturer_identifieruint40
organizationally_unique_identifieruint24

References device_information_field_t::data, device_information_system_id, device_information_field_t::len, little_endian_store_16(), little_endian_store_32(), and SYSTEM_ID.

const uint16_t device_information_characteristic_uuids[]
Initial value:
= {
}
#define ORG_BLUETOOTH_CHARACTERISTIC_HARDWARE_REVISION_STRING
Definition: bluetooth_gatt.h:199
#define ORG_BLUETOOTH_CHARACTERISTIC_MANUFACTURER_NAME_STRING
Definition: bluetooth_gatt.h:101
#define ORG_BLUETOOTH_CHARACTERISTIC_FIRMWARE_REVISION_STRING
Definition: bluetooth_gatt.h:236
#define ORG_BLUETOOTH_CHARACTERISTIC_SYSTEM_ID
Definition: bluetooth_gatt.h:139
#define ORG_BLUETOOTH_CHARACTERISTIC_IEEE_11073_20601_REGULATORY_CERTIFICATION_DATA_LIST
Definition: bluetooth_gatt.h:209
#define ORG_BLUETOOTH_CHARACTERISTIC_PNP_ID
Definition: bluetooth_gatt.h:78
#define ORG_BLUETOOTH_CHARACTERISTIC_SOFTWARE_REVISION_STRING
Definition: bluetooth_gatt.h:146
#define ORG_BLUETOOTH_CHARACTERISTIC_SERIAL_NUMBER_STRING
Definition: bluetooth_gatt.h:145
#define ORG_BLUETOOTH_CHARACTERISTIC_MODEL_NUMBER_STRING
Definition: bluetooth_gatt.h:98

Referenced by device_information_service_server_init().

device_information_field_t device_information_fields[NUM_INFORMATION_FIELDS]
static
uint8_t device_information_ieee_regulatory_certification[4]
static
uint8_t device_information_pnp_id[7]
static
att_service_handler_t device_information_service
static
uint8_t device_information_system_id[8]
static