* GATT Server Request type
*/
typedef enum {
- BLUETOOTH_GATT_REQUEST_TYPE_READ = 0x00, /* Read Requested */
- BLUETOOTH_GATT_REQUEST_TYPE_WRITE = 0x01, /* Write Requested */
- BLUETOOTH_GATT_REQUEST_TYPE_EXEC_WRITE = 0x02, /* Exec Write Requested */
+ BLUETOOTH_GATT_REQUEST_TYPE_READ = 0x00, /* Read Requested */
+ BLUETOOTH_GATT_REQUEST_TYPE_WRITE = 0x01, /* Write Requested */
+ BLUETOOTH_GATT_REQUEST_TYPE_EXEC_WRITE = 0x02, /* Exec Write Requested */
} bluetooth_gatt_att_request_type_e;
/**
* GATT Server Response/Indication data
*/
typedef struct {
- guint8 data[BLUETOOTH_GATT_ATT_DATA_LENGTH_MAX];
- int length;
- int offset;
+ guint8 data[BLUETOOTH_GATT_ATT_DATA_LENGTH_MAX];
+ int length;
+ int offset;
} bluetooth_gatt_att_data_t;
/**
* GATT Server service add data
*/
typedef struct {
- int service_type;
- int num_handles;
- int instance_id;
+ int service_type;
+ int num_handles;
+ int instance_id;
} bluetooth_gatt_server_service_params_t;
/**
* GATT Server attributes(characteristic/descriptors) add data
*/
typedef struct {
- bt_gatt_permission_t permissions;
- bt_gatt_characteristic_property_t properties;
- int service_handle;
- int instance_id;
+ bt_gatt_permission_t permissions;
+ bt_gatt_characteristic_property_t properties;
+ int service_handle;
+ int instance_id;
} bluetooth_gatt_server_attribute_params_t;
/**
* GATT Server Indication data
*/
typedef struct {
- int atrribute_handle;
+ int atrribute_handle;
bluetooth_device_address_t device_address; /**< device address */
- gboolean need_confirmation;
- int instance_id;
+ gboolean need_confirmation;
+ int instance_id;
} bluetooth_gatt_server_indication_params_t;
/**
* GATT Server connection/disconnection info
*/
typedef struct {
- bluetooth_device_address_t device_address; /** < Device address */
- int server_instance; /** < GATT Server Instance Id */
+ bluetooth_device_address_t device_address; /** < Device address */
+ int server_instance; /** < GATT Server Instance Id */
} bluetooth_gatt_server_connection_info_t;
/**
* GATT Server Service Added info
*/
typedef struct {
- int server_instance; /** < GATT Server Instance Id */
- int service_handle; /** < GATT Server Service handle */
- int is_primary; /** < GATT Server Is Primary Service */
- char uuid[BLUETOOTH_UUID_STRING_MAX];
+ int server_instance; /** < GATT Server Instance Id */
+ int service_handle; /** < GATT Server Service handle */
+ int is_primary; /** < GATT Server Is Primary Service */
+ char uuid[BLUETOOTH_UUID_STRING_MAX];
} bluetooth_gatt_server_service_added_info_t;
/**
* GATT Server Included Service Added info
*/
typedef struct {
- int server_instance; /** < GATT Server Instance Id */
- int service_handle; /** < GATT Server Service handle */
- int included_service_handle; /** < GATT Server Included service handle */
+ int server_instance; /** < GATT Server Instance Id */
+ int service_handle; /** < GATT Server Service handle */
+ int included_service_handle; /** < GATT Server Included service handle */
} bluetooth_gatt_server_included_service_added_info_t;
* GATT Server write attribute data received from Remote GATT client: Max Size is 600 bytes
*/
typedef struct {
- char data[BLUETOOTH_GATT_ATT_DATA_LENGTH_MAX + 1];
+ char data[BLUETOOTH_GATT_ATT_DATA_LENGTH_MAX + 1];
} bluetooth_gatt_server_write_data_t;
* GATT Server Attribute Added Info
*/
typedef struct {
- int server_instance; /** < GATT Server Instance Id */
- int service_handle; /** < GATT Server Service handle */
- int attr_handle; /** < GATT Server Attribute Handle (Characteristic or Descriptor) */
- char uuid[BLUETOOTH_UUID_STRING_MAX]; /** < GATT Server Atribute UUID */
+ int server_instance; /** < GATT Server Instance Id */
+ int service_handle; /** < GATT Server Service handle */
+ int attr_handle; /** < GATT Server Attribute Handle (Characteristic or Descriptor) */
+ char uuid[BLUETOOTH_UUID_STRING_MAX]; /** < GATT Server Atribute UUID */
} bluetooth_gatt_server_attribute_added_info_t;
/**
* GATT Server Service Info
*/
typedef struct {
- int server_instance; /** < GATT Server Instance Id */
- int service_handle; /** < GATT Server Service handle */
+ int server_instance; /** < GATT Server Instance Id */
+ int service_handle; /** < GATT Server Service handle */
} bluetooth_gatt_server_service_status_t;
/**
* GATT Server Read Requested Info
*/
typedef struct {
- int connection_id; /** < GATT Server Connection ID */
- int request_id; /** < GATT Server Read Request ID */
- int attribute_handle; /** < GATT Server att handle */
- int offset; /** < GATT Server attribute offset */
- gboolean is_long; /** < GATT Server Is Long attribute */
- bluetooth_device_address_t device_address; /**< Remote GATT client device address */
+ int connection_id; /** < GATT Server Connection ID */
+ int request_id; /** < GATT Server Read Request ID */
+ int attribute_handle; /** < GATT Server att handle */
+ int offset; /** < GATT Server attribute offset */
+ gboolean is_long; /** < GATT Server Is Long attribute */
+ bluetooth_device_address_t device_address; /**< Remote GATT client device address */
} bluetooth_gatt_server_read_requested_info_t;
/**
* GATT Server Write Requested Info
*/
typedef struct {
- int connection_id; /** < GATT Server Connection ID */
- int request_id; /** < GATT Server Write Request ID */
- int attribute_handle; /** < GATT Server Write att handle */
- int offset; /** < GATT Server attribute offset */
- gboolean need_resp; /** < GATT Server Write req needs response */
- gboolean is_prep_write; /** < GATT Server Is Prepared write */
- int length; /** < GATT Server Write attribute length */
+ int connection_id; /** < GATT Server Connection ID */
+ int request_id; /** < GATT Server Write Request ID */
+ int attribute_handle; /** < GATT Server Write att handle */
+ int offset; /** < GATT Server attribute offset */
+ gboolean need_resp; /** < GATT Server Write req needs response */
+ gboolean is_prep_write; /** < GATT Server Is Prepared write */
+ int length; /** < GATT Server Write attribute length */
bluetooth_gatt_server_write_data_t data; /** < Write attribute data */
- bluetooth_device_address_t device_address; /** < Remote GATT client device address */
+ bluetooth_device_address_t device_address; /** < Remote GATT client device address */
} bluetooth_gatt_server_write_requested_info_t;
/**
-* GATT Server Update Characteristic Value
-*/
+ * GATT Server Update Characteristic Value
+ */
typedef struct {
- int attribute_handle; /** < GATT Server Write att handle */
- int length; /** < GATT Server Write attribute length */
+ int attribute_handle; /** < GATT Server Write att handle */
+ int length; /** < GATT Server Write attribute length */
bluetooth_gatt_server_write_data_t data; /** < Write attribute data */
} bluetooth_gatt_server_update_value_t;
/**
-* GATT Server Exec write Requested Info
-*/
+ * GATT Server Exec write Requested Info
+ */
typedef struct {
- int connection_id; /** < GATT Server Connection ID */
- int request_id; /** < GATT Server Exec Write Request ID */
- int exec_write; /** < GATT Server Exec Write */
- bluetooth_device_address_t device_address; /** < Remote GATT client device address */
+ int connection_id; /** < GATT Server Connection ID */
+ int request_id; /** < GATT Server Exec Write Request ID */
+ int exec_write; /** < GATT Server Exec Write */
+ bluetooth_device_address_t device_address; /** < Remote GATT client device address */
} bluetooth_gatt_server_exec_write_requested_info_t;
/**
-* GATT Server Indicate confirmed Info
-*/
+ * GATT Server Indicate confirmed Info
+ */
typedef struct {
- int handle; /** < GATT Attribute handle */
- gboolean completed; /** < GATT Server Exec Write Request ID */
- bluetooth_device_address_t device_address; /** < Remote GATT client device address */
+ int handle; /** < GATT Attribute handle */
+ gboolean completed; /** < GATT Server Exec Write Request ID */
+ bluetooth_device_address_t device_address; /** < Remote GATT client device address */
} bluetooth_gatt_server_indicate_confirmed_info_t;
/**
-* GATT Server Indicate confirmed Info
-*/
+ * GATT Server Indicate confirmed Info
+ */
typedef struct {
- int handle; /** < GATT Attribute handle */
- gboolean notification; /** < GATT CCCD Notification changed */
- bluetooth_device_address_t device_address; /** < Remote GATT client device address */
+ int handle; /** < GATT Attribute handle */
+ gboolean notification; /** < GATT CCCD Notification changed */
+ bluetooth_device_address_t device_address; /** < Remote GATT client device address */
} bluetooth_gatt_server_notification_changed_t;
/**
*/
typedef struct {
bluetooth_gatt_att_request_type_e req_type;
- int request_id;
- int response_status;
- gboolean auth_req;
+ int request_id;
+ int response_status;
+ gboolean auth_req;
} bluetooth_gatt_server_response_params_t;
/**
* GATT Server Bluedroid Specific Permission Mask
*/
typedef enum {
- BLUETOOTH_PRODUCT_GATT_PERMISSION_READ = 0x01,
- BLUETOOTH_PRODUCT_GATT_PERMISSION_ENCRYPT_READ = 0x02,
- BLUETOOTH_PRODUCT_GATT_PERMISSION_ENCRYPT_READ_MITM = 0x04,
- BLUETOOTH_PRODUCT_GATT_PERMISSION_WRITE = 0x10,
- BLUETOOTH_PRODUCT_GATT_PERMISSION_ENCRYPT_WRITE = 0x20,
- BLUETOOTH_PRODUCT_GATT_PERMISSION_ENCRYPT_WRITE_MITM = 0x40,
- BLUETOOTH_PRODUCT_GATT_PERMISSION_WRITE_SIGNED = 0x80,
- BLUETOOTH_PRODUCT_GATT_PERMISSION_WRITE_SIGNED_MITM = 0x100,
- BLUETOOTH_PRODUCT_GATT_PERMISSION_INVALID = 0xffff,
+ BLUETOOTH_PRODUCT_GATT_PERMISSION_READ = 0x01,
+ BLUETOOTH_PRODUCT_GATT_PERMISSION_ENCRYPT_READ = 0x02,
+ BLUETOOTH_PRODUCT_GATT_PERMISSION_ENCRYPT_READ_MITM = 0x04,
+ BLUETOOTH_PRODUCT_GATT_PERMISSION_WRITE = 0x10,
+ BLUETOOTH_PRODUCT_GATT_PERMISSION_ENCRYPT_WRITE = 0x20,
+ BLUETOOTH_PRODUCT_GATT_PERMISSION_ENCRYPT_WRITE_MITM = 0x40,
+ BLUETOOTH_PRODUCT_GATT_PERMISSION_WRITE_SIGNED = 0x80,
+ BLUETOOTH_PRODUCT_GATT_PERMISSION_WRITE_SIGNED_MITM = 0x100,
+ BLUETOOTH_PRODUCT_GATT_PERMISSION_INVALID = 0xffff,
} bt_product_gatt_permission_t;
typedef struct {
*
*/
int bluetooth_gatt_server_init(int *instance_id, gatt_server_cb_func_ptr callback_ptr,
- void *user_data);
+ void *user_data);
//int bluetooth_gatt_register_application(int instance_id);
//int bluetooth_gatt_server_init(gatt_server_cb_func_ptr callback_ptr, void *user_data);
int bluetooth_gatt_server_add_descriptor(const char *desc_uuid, bt_gatt_permission_t permissions, int service_handle,
- int instance_id, int *descriptor_handle);
+ int instance_id, int *descriptor_handle);
int bluetooth_gatt_server_start_service(int service_handle, int instance_id);
int bluetooth_gatt_server_delete_service(int service_handle, int instance_id);
int bluetooth_gatt_server_send_indication(bluetooth_device_address_t *addr_hex,
- const bluetooth_gatt_server_indication_params_t *param,
- const bluetooth_gatt_att_data_t *att_value);
+ const bluetooth_gatt_server_indication_params_t *param,
+ const bluetooth_gatt_att_data_t *att_value);
int bluetooth_gatt_server_send_response(const bluetooth_gatt_server_response_params_t *param,
- const bluetooth_gatt_att_data_t *value);
+ const bluetooth_gatt_att_data_t *value);
int bluetooth_gatt_server_update_multi_adv_instance(const gchar *unique_name, int instance_id);