summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Skamra <mariusz.skamra@tieto.com>2016-02-24 15:45:08 +0100
committerMariusz Skamra <mariusz.skamra@tieto.com>2016-03-02 11:38:00 +0100
commitc76bd33d614dbf365df0284d1cfcd8d31751bbde (patch)
tree147357f358d7002683b18daff735b319c1558259
parent0abe6e85ba7766581cd1a78feec6c4b8eb44252c (diff)
Bluetooth: tester: Fix supported commands to use uint8_t array
Fixes endianess issues. Change-Id: I9c308187d34a832cc875c9037235cedc8bee033c Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
-rw-r--r--tests/bluetooth/tester/src/bttester.c16
-rw-r--r--tests/bluetooth/tester/src/gap.c30
2 files changed, 26 insertions, 20 deletions
diff --git a/tests/bluetooth/tester/src/bttester.c b/tests/bluetooth/tester/src/bttester.c
index 847ac1784..e06e4bc93 100644
--- a/tests/bluetooth/tester/src/bttester.c
+++ b/tests/bluetooth/tester/src/bttester.c
@@ -43,9 +43,11 @@ static void supported_commands(uint8_t *data, uint16_t len)
uint8_t buf[1];
struct core_read_supported_commands_rp *rp = (void *) buf;
- buf[0] = BIT(CORE_READ_SUPPORTED_COMMANDS);
- buf[0] |= BIT(CORE_READ_SUPPORTED_SERVICES);
- buf[0] |= BIT(CORE_REGISTER_SERVICE);
+ memset(buf, 0, sizeof(buf));
+
+ tester_set_bit(buf, CORE_READ_SUPPORTED_COMMANDS);
+ tester_set_bit(buf, CORE_READ_SUPPORTED_SERVICES);
+ tester_set_bit(buf, CORE_REGISTER_SERVICE);
tester_send(BTP_SERVICE_ID_CORE, CORE_READ_SUPPORTED_COMMANDS,
BTP_INDEX_NONE, (uint8_t *) rp, sizeof(buf));
@@ -56,9 +58,11 @@ static void supported_services(uint8_t *data, uint16_t len)
uint8_t buf[1];
struct core_read_supported_services_rp *rp = (void *) buf;
- buf[0] = BIT(BTP_SERVICE_ID_CORE);
- buf[0] |= BIT(BTP_SERVICE_ID_GAP);
- buf[0] |= BIT(BTP_SERVICE_ID_GATT);
+ memset(buf, 0, sizeof(buf));
+
+ tester_set_bit(buf, BTP_SERVICE_ID_CORE);
+ tester_set_bit(buf, BTP_SERVICE_ID_GAP);
+ tester_set_bit(buf, BTP_SERVICE_ID_GATT);
tester_send(BTP_SERVICE_ID_CORE, CORE_READ_SUPPORTED_SERVICES,
BTP_INDEX_NONE, (uint8_t *) rp, sizeof(buf));
diff --git a/tests/bluetooth/tester/src/gap.c b/tests/bluetooth/tester/src/gap.c
index e05de41ef..94cdc5f90 100644
--- a/tests/bluetooth/tester/src/gap.c
+++ b/tests/bluetooth/tester/src/gap.c
@@ -72,22 +72,24 @@ static struct bt_conn_cb conn_callbacks = {
static void supported_commands(uint8_t *data, uint16_t len)
{
- uint16_t cmds;
+ uint8_t cmds[3];
struct gap_read_supported_commands_rp *rp = (void *) &cmds;
- cmds = BIT(GAP_READ_SUPPORTED_COMMANDS);
- cmds |= BIT(GAP_READ_CONTROLLER_INDEX_LIST);
- cmds |= BIT(GAP_READ_CONTROLLER_INFO);
- cmds |= BIT(GAP_SET_CONNECTABLE);
- cmds |= BIT(GAP_SET_DISCOVERABLE);
- cmds |= BIT(GAP_START_ADVERTISING);
- cmds |= BIT(GAP_STOP_ADVERTISING);
- cmds |= BIT(GAP_START_DISCOVERY);
- cmds |= BIT(GAP_STOP_DISCOVERY);
- cmds |= BIT(GAP_DISCONNECT);
- cmds |= BIT(GAP_SET_IO_CAP);
- cmds |= BIT(GAP_PAIR);
- cmds |= BIT(GAP_PASSKEY_ENTRY);
+ memset(cmds, 0, sizeof(cmds));
+
+ tester_set_bit(cmds, GAP_READ_SUPPORTED_COMMANDS);
+ tester_set_bit(cmds, GAP_READ_CONTROLLER_INDEX_LIST);
+ tester_set_bit(cmds, GAP_READ_CONTROLLER_INFO);
+ tester_set_bit(cmds, GAP_SET_CONNECTABLE);
+ tester_set_bit(cmds, GAP_SET_DISCOVERABLE);
+ tester_set_bit(cmds, GAP_START_ADVERTISING);
+ tester_set_bit(cmds, GAP_STOP_ADVERTISING);
+ tester_set_bit(cmds, GAP_START_DISCOVERY);
+ tester_set_bit(cmds, GAP_STOP_DISCOVERY);
+ tester_set_bit(cmds, GAP_DISCONNECT);
+ tester_set_bit(cmds, GAP_SET_IO_CAP);
+ tester_set_bit(cmds, GAP_PAIR);
+ tester_set_bit(cmds, GAP_PASSKEY_ENTRY);
tester_send(BTP_SERVICE_ID_GAP, GAP_READ_SUPPORTED_COMMANDS,
CONTROLLER_INDEX, (uint8_t *) rp, sizeof(cmds));