#include "btstack_defines.h"
#include "ble/att_db.h"
#include "ble/att_server.h"
#include "btstack_util.h"
#include "bluetooth_gatt.h"
#include "ble/gatt-service/device_information_service_server.h"
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.
Enumerator | |
---|---|
MANUFACTURER_NAME | |
MODEL_NUMBER | |
SERIAL_NUMBER | |
HARDWARE_REVISION | |
FIRMWARE_REVISION | |
SOFTWARE_REVISION | |
SYSTEM_ID | |
IEEE_REGULATORY_CERTIFICATION | |
PNP_ID | |
NUM_INFORMATION_FIELDS |
|
static |
References btstack_min(), device_information_field_t::len, NUM_INFORMATION_FIELDS, and UNUSED.
Referenced by device_information_service_server_init().
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.
battery_value | in 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 | ) |
void device_information_service_server_set_hardware_revision | ( | const char * | hardware_revision | ) |
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.
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 | ) |
void device_information_service_server_set_model_number | ( | const char * | model_number | ) |
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.
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 | ) |
void device_information_service_server_set_software_revision | ( | const char * | software_revision | ) |
void device_information_service_server_set_system_id | ( | uint64_t | manufacturer_identifier, |
uint32_t | organizationally_unique_identifier | ||
) |
Set System ID.
manufacturer_identifier | uint40 |
organizationally_unique_identifier | uint24 |
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.
|
static |
References device_information_field_t::data, and device_information_field_t::len.
Referenced by device_information_service_server_set_firmware_revision(), device_information_service_server_set_hardware_revision(), device_information_service_server_set_manufacturer_name(), device_information_service_server_set_model_number(), device_information_service_server_set_serial_number(), and device_information_service_server_set_software_revision().
const uint16_t device_information_characteristic_uuids[] |
Referenced by device_information_service_server_init().
|
static |
|
static |
|
static |
Referenced by device_information_service_server_set_pnp_id().
|
static |
|
static |
Referenced by device_information_service_server_set_system_id().