Bluetooth: Change GATT callback return values to ssize_t
Since the return value of these callbacks is a number of bytes ssize_t is more appropriate than int. Change-Id: I3406fb382975d62f51e7a195666d0ae88364fd2c Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
16cbf0ea97
commit
bab3b49fdb
12 changed files with 204 additions and 197 deletions
|
@ -214,7 +214,7 @@ struct bt_gatt_attr *bt_gatt_attr_next(const struct bt_gatt_attr *attr)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
ssize_t bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t buf_len, uint16_t offset,
|
||||
const void *value, uint16_t value_len)
|
||||
{
|
||||
|
@ -238,7 +238,7 @@ int bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
return len;
|
||||
}
|
||||
|
||||
int bt_gatt_attr_read_service(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_service(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -255,7 +255,7 @@ int bt_gatt_attr_read_service(struct bt_conn *conn,
|
|||
BT_UUID_128(uuid)->val, 16);
|
||||
}
|
||||
|
||||
int bt_gatt_attr_read_included(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_included(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -271,7 +271,7 @@ struct gatt_chrc {
|
|||
};
|
||||
} __packed;
|
||||
|
||||
int bt_gatt_attr_read_chrc(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_chrc(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -297,16 +297,16 @@ int bt_gatt_attr_read_chrc(struct bt_conn *conn,
|
|||
return bt_gatt_attr_read(conn, attr, buf, len, offset, &pdu, value_len);
|
||||
}
|
||||
|
||||
int bt_gatt_attr_read_ccc(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_ccc(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
return BT_GATT_ERR(BT_ATT_ERR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
int bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, const void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
ssize_t bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr,
|
||||
const void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
struct _bt_gatt_ccc *ccc = attr->user_data;
|
||||
const uint16_t *data = buf;
|
||||
|
@ -331,7 +331,7 @@ int bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
|||
return len;
|
||||
}
|
||||
|
||||
int bt_gatt_attr_read_cep(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_cep(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -342,14 +342,14 @@ int bt_gatt_attr_read_cep(struct bt_conn *conn,
|
|||
sizeof(props));
|
||||
}
|
||||
|
||||
int bt_gatt_attr_read_cud(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_cud(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
return BT_GATT_ERR(BT_ATT_ERR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
int bt_gatt_attr_read_cpf(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_cpf(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@ extern "C" {
|
|||
|
||||
#if defined(CONFIG_BLUETOOTH_CENTRAL) || defined(CONFIG_BLUETOOTH_PERIPHERAL)
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <misc/util.h>
|
||||
#include <bluetooth/conn.h>
|
||||
#include <bluetooth/uuid.h>
|
||||
|
@ -115,7 +116,7 @@ struct bt_gatt_attr {
|
|||
* @return Number fo bytes read, or in case of an error
|
||||
* BT_GATT_ERR() with a specific ATT error code.
|
||||
*/
|
||||
int (*read)(struct bt_conn *conn,
|
||||
ssize_t (*read)(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len,
|
||||
uint16_t offset);
|
||||
|
@ -131,7 +132,7 @@ struct bt_gatt_attr {
|
|||
* @return Number of bytes written, or in case of an error
|
||||
* BT_GATT_ERR() with a specific ATT error code.
|
||||
*/
|
||||
int (*write)(struct bt_conn *conn,
|
||||
ssize_t (*write)(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr,
|
||||
const void *buf, uint16_t len,
|
||||
uint16_t offset);
|
||||
|
@ -150,7 +151,7 @@ struct bt_gatt_attr {
|
|||
* @return Number of bytes flushed, or in case of an error
|
||||
* BT_GATT_ERR() with a specific ATT error code.
|
||||
*/
|
||||
int (*flush)(struct bt_conn *conn,
|
||||
ssize_t (*flush)(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr,
|
||||
uint8_t flags);
|
||||
|
||||
|
@ -358,7 +359,7 @@ struct bt_gatt_attr *bt_gatt_attr_next(const struct bt_gatt_attr *attr);
|
|||
* @return int number of bytes read in case of success or negative values in
|
||||
* case of error.
|
||||
*/
|
||||
int bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
ssize_t bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t buf_len, uint16_t offset,
|
||||
const void *value, uint16_t value_len);
|
||||
|
||||
|
@ -377,7 +378,7 @@ int bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
* @return int number of bytes read in case of success or negative values in
|
||||
* case of error.
|
||||
*/
|
||||
int bt_gatt_attr_read_service(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_service(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset);
|
||||
|
||||
|
@ -442,7 +443,7 @@ int bt_gatt_attr_read_service(struct bt_conn *conn,
|
|||
* @return int number of bytes read in case of success or negative values in
|
||||
* case of error.
|
||||
*/
|
||||
int bt_gatt_attr_read_included(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_included(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset);
|
||||
|
||||
|
@ -476,7 +477,7 @@ int bt_gatt_attr_read_included(struct bt_conn *conn,
|
|||
* @return number of bytes read in case of success or negative values in
|
||||
* case of error.
|
||||
*/
|
||||
int bt_gatt_attr_read_chrc(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_chrc(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset);
|
||||
|
||||
|
@ -530,7 +531,7 @@ struct _bt_gatt_ccc {
|
|||
* @return number of bytes read in case of success or negative values in
|
||||
* case of error.
|
||||
*/
|
||||
int bt_gatt_attr_read_ccc(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_ccc(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset);
|
||||
|
||||
|
@ -548,7 +549,7 @@ int bt_gatt_attr_read_ccc(struct bt_conn *conn,
|
|||
* @return number of bytes written in case of success or negative values in
|
||||
* case of error.
|
||||
*/
|
||||
int bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, const void *buf,
|
||||
uint16_t len, uint16_t offset);
|
||||
|
||||
|
@ -586,7 +587,7 @@ int bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
|||
* @return number of bytes read in case of success or negative values in
|
||||
* case of error.
|
||||
*/
|
||||
int bt_gatt_attr_read_cep(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_cep(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset);
|
||||
|
||||
|
@ -620,7 +621,7 @@ int bt_gatt_attr_read_cep(struct bt_conn *conn,
|
|||
* @return number of bytes read in case of success or negative values in
|
||||
* case of error.
|
||||
*/
|
||||
int bt_gatt_attr_read_cud(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_cud(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset);
|
||||
|
||||
|
@ -655,7 +656,7 @@ int bt_gatt_attr_read_cud(struct bt_conn *conn,
|
|||
* @return number of bytes read in case of success or negative values in
|
||||
* case of error.
|
||||
*/
|
||||
int bt_gatt_attr_read_cpf(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_cpf(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset);
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ populate:
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
ssize_t bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t buf_len, uint16_t offset,
|
||||
const void *value, uint16_t value_len)
|
||||
{
|
||||
|
@ -140,7 +140,7 @@ int bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
return len;
|
||||
}
|
||||
|
||||
int bt_gatt_attr_read_service(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_service(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -163,7 +163,7 @@ struct gatt_incl {
|
|||
uint16_t uuid16;
|
||||
} __packed;
|
||||
|
||||
int bt_gatt_attr_read_included(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_included(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -197,7 +197,7 @@ struct gatt_chrc {
|
|||
};
|
||||
} __packed;
|
||||
|
||||
int bt_gatt_attr_read_chrc(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_chrc(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -261,7 +261,7 @@ struct bt_gatt_attr *bt_gatt_attr_next(const struct bt_gatt_attr *attr)
|
|||
#endif /* CONFIG_BLUETOOTH_GATT_DYNAMIC_DB */
|
||||
}
|
||||
|
||||
int bt_gatt_attr_read_ccc(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_ccc(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -318,7 +318,7 @@ static bool is_bonded(const bt_addr_le_t *addr)
|
|||
#endif /* defined(CONFIG_BLUETOOTH_SMP) */
|
||||
}
|
||||
|
||||
int bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, const void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -370,7 +370,7 @@ int bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
|||
return len;
|
||||
}
|
||||
|
||||
int bt_gatt_attr_read_cep(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_cep(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -381,7 +381,7 @@ int bt_gatt_attr_read_cep(struct bt_conn *conn,
|
|||
sizeof(props));
|
||||
}
|
||||
|
||||
int bt_gatt_attr_read_cud(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_cud(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -390,7 +390,7 @@ int bt_gatt_attr_read_cud(struct bt_conn *conn,
|
|||
return bt_gatt_attr_read(conn, attr, buf, len, offset, value, strlen(value));
|
||||
}
|
||||
|
||||
int bt_gatt_attr_read_cpf(struct bt_conn *conn,
|
||||
ssize_t bt_gatt_attr_read_cpf(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
#define UDP_PORT 4242
|
||||
|
||||
static int read_name(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_name(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *name = attr->user_data;
|
||||
|
@ -57,7 +57,7 @@ static int read_name(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
strlen(name));
|
||||
}
|
||||
|
||||
static int read_appearance(struct bt_conn *conn,
|
||||
static ssize_t read_appearance(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -67,7 +67,7 @@ static int read_appearance(struct bt_conn *conn,
|
|||
sizeof(appearance));
|
||||
}
|
||||
|
||||
static int read_model(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_model(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *value = attr->user_data;
|
||||
|
@ -76,7 +76,7 @@ static int read_model(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
strlen(value));
|
||||
}
|
||||
|
||||
static int read_manuf(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_manuf(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *value = attr->user_data;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)
|
||||
#define HEART_RATE_APPEARANCE 0x0341
|
||||
|
||||
static int read_name(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_name(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *name = attr->user_data;
|
||||
|
@ -43,7 +43,7 @@ static int read_name(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
strlen(name));
|
||||
}
|
||||
|
||||
static int read_appearance(struct bt_conn *conn,
|
||||
static ssize_t read_appearance(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ static void hrmc_ccc_cfg_changed(uint16_t value)
|
|||
simulate_hrm = (value == BT_GATT_CCC_NOTIFY) ? 1 : 0;
|
||||
}
|
||||
|
||||
static int read_blsc(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_blsc(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
uint8_t value = 0x01;
|
||||
|
@ -80,7 +80,7 @@ static void blvl_ccc_cfg_changed(uint16_t value)
|
|||
simulate_blvl = (value == BT_GATT_CCC_NOTIFY) ? 1 : 0;
|
||||
}
|
||||
|
||||
static int read_blvl(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_blvl(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *value = attr->user_data;
|
||||
|
@ -126,7 +126,7 @@ static void ct_ccc_cfg_changed(uint16_t value)
|
|||
static uint8_t ct[10];
|
||||
static uint8_t ct_update = 0;
|
||||
|
||||
static int read_ct(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_ct(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *value = attr->user_data;
|
||||
|
@ -135,7 +135,7 @@ static int read_ct(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
sizeof(ct));
|
||||
}
|
||||
|
||||
static int write_ct(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t write_ct(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
const void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
uint8_t *value = attr->user_data;
|
||||
|
@ -150,7 +150,7 @@ static int write_ct(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
return len;
|
||||
}
|
||||
|
||||
static int read_model(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_model(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *value = attr->user_data;
|
||||
|
@ -159,7 +159,7 @@ static int read_model(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
strlen(value));
|
||||
}
|
||||
|
||||
static int read_manuf(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_manuf(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *value = attr->user_data;
|
||||
|
@ -183,7 +183,7 @@ static struct bt_uuid_128 vnd_auth_uuid = BT_UUID_INIT_128(
|
|||
|
||||
static uint8_t vnd_value[] = { 'V', 'e', 'n', 'd', 'o', 'r' };
|
||||
|
||||
static int read_vnd(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_vnd(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *value = attr->user_data;
|
||||
|
@ -192,7 +192,7 @@ static int read_vnd(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
strlen(value));
|
||||
}
|
||||
|
||||
static int write_vnd(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t write_vnd(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
const void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
uint8_t *value = attr->user_data;
|
||||
|
@ -216,7 +216,7 @@ static struct vnd_long_value {
|
|||
.data = { 'V', 'e', 'n', 'd', 'o', 'r' },
|
||||
};
|
||||
|
||||
static int read_long_vnd(struct bt_conn *conn,
|
||||
static ssize_t read_long_vnd(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -226,7 +226,7 @@ static int read_long_vnd(struct bt_conn *conn,
|
|||
sizeof(value->data));
|
||||
}
|
||||
|
||||
static int write_long_vnd(struct bt_conn *conn,
|
||||
static ssize_t write_long_vnd(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, const void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -242,7 +242,7 @@ static int write_long_vnd(struct bt_conn *conn,
|
|||
return len;
|
||||
}
|
||||
|
||||
static int flush_long_vnd(struct bt_conn *conn,
|
||||
static ssize_t flush_long_vnd(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, uint8_t flags)
|
||||
{
|
||||
struct vnd_long_value *value = attr->user_data;
|
||||
|
@ -271,7 +271,7 @@ static struct bt_gatt_cep vnd_long_cep = {
|
|||
|
||||
static int signed_value;
|
||||
|
||||
static int read_signed(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_signed(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *value = attr->user_data;
|
||||
|
@ -280,7 +280,7 @@ static int read_signed(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
sizeof(signed_value));
|
||||
}
|
||||
|
||||
static int write_signed(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t write_signed(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
const void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
uint8_t *value = attr->user_data;
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
|
||||
/* Generic Access Profile Service declaration */
|
||||
|
||||
static int read_device_name(struct bt_conn *conn,
|
||||
static ssize_t read_device_name(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -98,7 +98,7 @@ static int read_device_name(struct bt_conn *conn,
|
|||
strlen(name));
|
||||
}
|
||||
|
||||
static int read_appearance(struct bt_conn *conn,
|
||||
static ssize_t read_appearance(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -120,7 +120,7 @@ static struct bt_gatt_attr gap_attrs[] = {
|
|||
|
||||
/* Device Information Service declaration */
|
||||
|
||||
static int read_model(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_model(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *value = attr->user_data;
|
||||
|
@ -129,7 +129,7 @@ static int read_model(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
strlen(value));
|
||||
}
|
||||
|
||||
static int read_manuf(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_manuf(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *value = attr->user_data;
|
||||
|
@ -160,7 +160,7 @@ static void blvl_ccc_cfg_changed(uint16_t value)
|
|||
bas_simulate = value == BT_GATT_CCC_NOTIFY;
|
||||
}
|
||||
|
||||
static int read_blvl(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_blvl(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *value = attr->user_data;
|
||||
|
@ -198,7 +198,7 @@ static void ctrl_point_ccc_cfg_changed(uint16_t value)
|
|||
ctrl_point_configured = value == BT_GATT_CCC_INDICATE;
|
||||
}
|
||||
|
||||
static int read_location(struct bt_conn *conn,
|
||||
static ssize_t read_location(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -208,7 +208,7 @@ static int read_location(struct bt_conn *conn,
|
|||
sizeof(*value));
|
||||
}
|
||||
|
||||
static int read_csc_feature(struct bt_conn *conn,
|
||||
static ssize_t read_csc_feature(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -229,9 +229,9 @@ struct write_sc_ctrl_point_req {
|
|||
};
|
||||
} __packed;
|
||||
|
||||
static int write_ctrl_point(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, const void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
static ssize_t write_ctrl_point(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr,
|
||||
const void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const struct write_sc_ctrl_point_req *req = buf;
|
||||
uint8_t status;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)
|
||||
#define APPEARANCE 0x0000
|
||||
|
||||
static int read_appearance(struct bt_conn *conn,
|
||||
static ssize_t read_appearance(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -44,8 +44,9 @@ static int read_appearance(struct bt_conn *conn,
|
|||
sizeof(appearance));
|
||||
}
|
||||
|
||||
static int read_string(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
static ssize_t read_string(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *value = attr->user_data;
|
||||
|
||||
|
|
|
@ -73,8 +73,9 @@ static inline uint32_t le24_to_int(const uint8_t *u24)
|
|||
(uint32_t)u24[2] << 16);
|
||||
}
|
||||
|
||||
static int read_string(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
static ssize_t read_string(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *string = attr->user_data;
|
||||
|
||||
|
@ -82,7 +83,7 @@ static int read_string(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
strlen(string));
|
||||
}
|
||||
|
||||
static int read_u16(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_u16(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const uint16_t *u16 = attr->user_data;
|
||||
|
@ -94,7 +95,7 @@ static int read_u16(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
|
||||
/* Generic Access Profile Service Declaration */
|
||||
|
||||
static int read_appearance(struct bt_conn *conn,
|
||||
static ssize_t read_appearance(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -126,7 +127,7 @@ static void blvl_ccc_cfg_changed(uint16_t value)
|
|||
simulate_blvl = value == BT_GATT_CCC_NOTIFY;
|
||||
}
|
||||
|
||||
static int read_blvl(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_blvl(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const uint8_t *value = attr->user_data;
|
||||
|
@ -238,7 +239,7 @@ struct read_es_measurement_rp {
|
|||
uint8_t measurement_uncertainty;
|
||||
} __packed;
|
||||
|
||||
static int read_es_measurement(struct bt_conn *conn,
|
||||
static ssize_t read_es_measurement(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -256,7 +257,7 @@ static int read_es_measurement(struct bt_conn *conn,
|
|||
sizeof(rsp));
|
||||
}
|
||||
|
||||
static int read_temp_valid_range(struct bt_conn *conn,
|
||||
static ssize_t read_temp_valid_range(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -278,9 +279,10 @@ struct es_trigger_setting_reference {
|
|||
int16_t ref_val;
|
||||
} __packed;
|
||||
|
||||
static int read_temp_trigger_setting(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
static ssize_t read_temp_trigger_setting(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len,
|
||||
uint16_t offset)
|
||||
{
|
||||
const struct temperature_sensor *sensor = attr->user_data;
|
||||
|
||||
|
@ -322,7 +324,7 @@ struct write_es_trigger_setting_req {
|
|||
uint8_t operand[];
|
||||
} __packed;
|
||||
|
||||
static int write_temp_trigger_setting(struct bt_conn *conn,
|
||||
static ssize_t write_temp_trigger_setting(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr,
|
||||
const void *buf, uint16_t len,
|
||||
uint16_t offset)
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
struct bt_conn *default_conn;
|
||||
|
||||
static int read_name(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_name(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *name = attr->user_data;
|
||||
|
@ -45,7 +45,7 @@ static int read_name(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
strlen(name));
|
||||
}
|
||||
|
||||
static int read_appearance(struct bt_conn *conn,
|
||||
static ssize_t read_appearance(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ static void hrmc_ccc_cfg_changed(uint16_t value)
|
|||
simulate_hrm = (value == BT_GATT_CCC_NOTIFY) ? 1 : 0;
|
||||
}
|
||||
|
||||
static int read_blsc(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_blsc(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
uint8_t value = 0x01;
|
||||
|
@ -82,7 +82,7 @@ static void blvl_ccc_cfg_changed(uint16_t value)
|
|||
simulate_blvl = (value == BT_GATT_CCC_NOTIFY) ? 1 : 0;
|
||||
}
|
||||
|
||||
static int read_blvl(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_blvl(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *value = attr->user_data;
|
||||
|
@ -91,7 +91,7 @@ static int read_blvl(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
sizeof(*value));
|
||||
}
|
||||
|
||||
static int read_model(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_model(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *value = attr->user_data;
|
||||
|
@ -100,7 +100,7 @@ static int read_model(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
strlen(value));
|
||||
}
|
||||
|
||||
static int read_manuf(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_manuf(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *value = attr->user_data;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)
|
||||
#define APPEARANCE 0x0000
|
||||
|
||||
static int read_appearance(struct bt_conn *conn,
|
||||
static ssize_t read_appearance(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
@ -44,8 +44,9 @@ static int read_appearance(struct bt_conn *conn,
|
|||
sizeof(appearance));
|
||||
}
|
||||
|
||||
static int read_string(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
static ssize_t read_string(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *value = attr->user_data;
|
||||
|
||||
|
|
|
@ -206,8 +206,9 @@ static struct bt_conn_cb conn_callbacks = {
|
|||
.security_changed = security_changed,
|
||||
};
|
||||
|
||||
static int read_string(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
static ssize_t read_string(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
const char *str = attr->user_data;
|
||||
|
||||
|
@ -217,7 +218,7 @@ static int read_string(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
|
||||
static uint16_t appearance_value = 0x0001;
|
||||
|
||||
static int read_appearance(struct bt_conn *conn,
|
||||
static ssize_t read_appearance(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
|
|
|
@ -224,7 +224,7 @@ struct gatt_value {
|
|||
bool has_ccc;
|
||||
};
|
||||
|
||||
static int read_value(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
static ssize_t read_value(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
const struct gatt_value *value = attr->user_data;
|
||||
|
@ -238,8 +238,9 @@ static int read_value(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
value->len);
|
||||
}
|
||||
|
||||
static int write_value(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
const void *buf, uint16_t len, uint16_t offset)
|
||||
static ssize_t write_value(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, const void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
struct gatt_value *value = attr->user_data;
|
||||
|
||||
|
@ -266,7 +267,7 @@ static int write_value(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
return len;
|
||||
}
|
||||
|
||||
static int flush_value(struct bt_conn *conn,
|
||||
static ssize_t flush_value(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, uint8_t flags)
|
||||
{
|
||||
struct gatt_value *value = attr->user_data;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue