Thanks Vincent!
I'm also encountering an odd bug, I'm wondering if anyone can help out.
I have a central application that is working perfectly using the S130. It continually scans, reports devices, connects and disconnect, etc. I decided that for my purposes I'd also like to have a completely separate iBeacon that does not interact in any way with the central I have. To save money, I figured since the S130 has the ability to concurrently run a central and peripheral, I'd just run the iBeacon on the same chip and have no programmatic interaction at all (except using the same BLE instance). Here's my code for the iBeacon:
void startIBeaconAdvertising(uint16_t majorNumber, uint16_t minorNumber)
{
this->_ble.gap().clearAdvertisingPayload();
iBeacon *ibeacon = new iBeacon(this->_ble, ServiceUUID, majorNumber, minorNumber, IBEACON_TX_POWER);
this->_ble.gap().setAdvertisingInterval(IBEACON_ADV_INTERVAL);
this->_ble.gap().setAdvertisingTimeout(0);
ble_error_t error = this->_ble.gap().startAdvertising();
if (error != BLE_ERROR_NONE)
{
this->queueError(FailedToStartIBeaconAdvertising, error);
}
}
This works great for a short while. The central scans, connects, and disconnects appropriately and I see the iBeacon advertising properly. But the issue occurs after 1 connection with the central. Suddenly it stops reporting any discoveries. The weird part is, if I simply comment the "startAdvertising" call for the iBeacon, the central will behave properly and never fail to report discoveries.
I was under the assumption that the peripheral and central would be operating completely independently, but that seems like it's not the case. Anyone know what's going on here?
Thanks Rohit and Vincent! That's a really helpful example, much appreciated.