Skip to content

Commit

Permalink
- set advertisement data after enabling advertising (fixes #18 and #20)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepmistry committed Feb 6, 2014
1 parent 24a8a21 commit ccf79c1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/hci-ble.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,17 @@ int main(int argc, const char* argv[])
// stop advertising
hci_le_set_advertise_enable(hciSocket, 0, 1000);
} else if (SIGUSR1 == lastSignal) {
// restart advertising
// stop advertising
hci_le_set_advertise_enable(hciSocket, 0, 1000);

// set advertisement and scan data
hci_le_set_advertising_data(hciSocket, (uint8_t*)&advertisementDataBuf, advertisementDataLen, 1000);
// set scan data
hci_le_set_scan_response_data(hciSocket, (uint8_t*)&scanDataBuf, scanDataLen, 1000);

// start advertising
hci_le_set_advertise_enable(hciSocket, 1, 1000);

// set advertisement data
hci_le_set_advertising_data(hciSocket, (uint8_t*)&advertisementDataBuf, advertisementDataLen, 1000);
}
} else if (selectRetval) {
if (FD_ISSET(0, &rfds)) {
Expand Down Expand Up @@ -219,12 +222,14 @@ int main(int argc, const char* argv[])
// stop advertising
hci_le_set_advertise_enable(hciSocket, 0, 1000);

// set advertisement and scan data
hci_le_set_advertising_data(hciSocket, (uint8_t*)&advertisementDataBuf, advertisementDataLen, 1000);
// set scan data
hci_le_set_scan_response_data(hciSocket, (uint8_t*)&scanDataBuf, scanDataLen, 1000);

// start advertising
hci_le_set_advertise_enable(hciSocket, 1, 1000);

// set advertisement data
hci_le_set_advertising_data(hciSocket, (uint8_t*)&advertisementDataBuf, advertisementDataLen, 1000);
}
}
}
Expand Down

0 comments on commit ccf79c1

Please sign in to comment.