android/tester: Add macro improving pdu send procedure

As of now when we want to send response from remote device, we compose
pdu from handle and value, which are then copied into fixed size pdu
with predefined header. With this macro we will be able to pass up to
3 iovectors which are then send without additional copying. It also
quite generic and can be used to any other kind of data processing nad
not only for sending pdus.
This commit is contained in:
Jakub Tyszkowski 2015-01-08 10:17:40 +01:00 committed by Szymon Janc
parent 20c6a6cd64
commit 51a8bb208d
2 changed files with 12 additions and 3 deletions

View File

@ -1079,7 +1079,7 @@ static void gatt_att_pdu_modify(void)
{
struct test_data *data = tester_get_data();
struct step *current_data_step = queue_peek_head(data->steps);
struct iovec *store_pdu = current_data_step->set_data_to;
struct iovec *store_pdu = current_data_step->set_data_2;
struct step *step = g_new0(struct step, 1);
unsigned char *raw_pdu = store_pdu->iov_base;
int set_data_len = current_data_step->set_data_len;

View File

@ -68,10 +68,18 @@ struct pdu_set {
.action_status = status, \
.action = modif_fun, \
.set_data = from, \
.set_data_to = to, \
.set_data_2 = to, \
.set_data_len = len, \
}
#define PROCESS_DATA(status, proc_fun, data1, data2, data3) { \
.action_status = status, \
.action = proc_fun, \
.set_data = data1, \
.set_data_2 = data2, \
.set_data_3 = data3, \
}
#define ACTION(status, act_fun, data_set) { \
.action_status = status, \
.action = act_fun, \
@ -706,7 +714,8 @@ struct step {
struct bt_callback_data callback_result;
void *set_data;
void *set_data_to;
void *set_data_2;
void *set_data_3;
int set_data_len;
uint16_t *store_srvc_handle;