aboutsummaryrefslogtreecommitdiff
path: root/LinuxBluetooth.cpp
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-02-15 11:01:46 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2015-02-15 11:01:46 +0100
commit60d5440dd3514e71b87948ff5ed30ee38445b8a5 (patch)
tree0d983caed47449c875c5188e604e81da29e1b82c /LinuxBluetooth.cpp
parent041bbe24b39190ac0b624b2709fc38dea17ad0a7 (diff)
downloadble-toys-60d5440dd3514e71b87948ff5ed30ee38445b8a5.tar.gz
ble-toys-60d5440dd3514e71b87948ff5ed30ee38445b8a5.tar.bz2
ble-toys-60d5440dd3514e71b87948ff5ed30ee38445b8a5.tar.xz
ble-toys-60d5440dd3514e71b87948ff5ed30ee38445b8a5.zip
o wip. Test cases!
Diffstat (limited to 'LinuxBluetooth.cpp')
-rw-r--r--LinuxBluetooth.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/LinuxBluetooth.cpp b/LinuxBluetooth.cpp
index a15f350..c30a2b7 100644
--- a/LinuxBluetooth.cpp
+++ b/LinuxBluetooth.cpp
@@ -129,12 +129,12 @@ namespace trygvis {
addr.l2_family = AF_BLUETOOTH;
addr.l2_cid = htobs(ATT_CID);
addr.l2_bdaddr_type = BDADDR_LE_RANDOM;
- _mac.copy(addr.l2_bdaddr.b[0],
- addr.l2_bdaddr.b[1],
- addr.l2_bdaddr.b[2],
- addr.l2_bdaddr.b[3],
+ _mac.copy(addr.l2_bdaddr.b[5],
addr.l2_bdaddr.b[4],
- addr.l2_bdaddr.b[5]);
+ addr.l2_bdaddr.b[3],
+ addr.l2_bdaddr.b[2],
+ addr.l2_bdaddr.b[1],
+ addr.l2_bdaddr.b[0]);
if (::connect(l2cap, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
close(l2cap);
@@ -165,15 +165,13 @@ namespace trygvis {
D << "read: " << r << " bytes";
- vector<AttributeData *> *values = AttPdu::parseReadByGroupType(in);
+ vector<AttributeData> values = AttPdu::parseReadByGroupType(in);
- D << "READ_BY_GROUP_TYPE response has " + to_string(values->size()) + " values";
+ D << "READ_BY_GROUP_TYPE response has " + to_string(values.size()) + " values";
- for (auto &data: *values) {
- D << "handle: " << data->handle << ", value: " << data->value.toString();
+ for (auto &data: values) {
+ D << "handle: " << data.handle << ", value: " << data.value.toString();
}
-
- delete values;
}
// -----------------------------------------------------------------------