We are writing a pair of Core Bluetooth applications. The MacOS application is implementing a CBCentral​Manager and the iOS application is implementing a CBPeripheralManager. The iOS peripheral's UIBackgroundModes key is set to bluetooth-peripheral in its Info.plist file. The apps are paired and are successfully sending messages back and forth over Bluetooth every 30 seconds. This works whether the iOS app is in the foreground or background. The Mac application is receiving the RSSI value of the iPhone. With the iPhone sitting next to the Mac the RSSI value fluctuates generally in the range of -45 to -65 dBs (with occasional drops to -75 dBs). But after an extended length of time without the iPhone moving the RSSI drops to a range of -55 to -75 dBs (with occasional drops to -85 dBs or more). The graph below illustrates the behavior. The X axis is time in seconds and the Y axis is dBs. In this example the RSSI stays in the range -45 to -55 dBs for 300 seconds. But then for seemingly no reason the RSSI drops to the range -55 to -75 dBs and stays in the range indefinitely. During this period of lower RSSI value the apps continue to successfully send messages back and forth so it does not appear that the iOS app has been suspended. At about 600 seconds the iPhone is picked up (which is appears to be correlated with a small uptick of RSSI value) and then the iPhone is moved 20 feet away (which causes the RSSI to drop as we expected). Then at 900 seconds the iPhone is moved back to its starting location which corresponds to the last rise in RSSI value. We are obviously expecting the RSSI value to drop when the iPhone is moved away and to increase when the iPhone is moved close again. But we have no explanation for why there was the initial drop of RSSI value at around 300 seconds. Our problem is that we cannot differentiate between the RSSI dropping for that unexplained reason and the RSSI dropping because the iPhone is moved away from the Mac. Questions: 1) Is there an explanation for the RSSI dropping on its own without any change in the environment? Could iOS be reducing the Transmit Power? 2) Is there any way to prevent the RSSI from dropping or force it back up programmatically? 3) Is there a way to programmatically recognize that the system has reduced the signal strength which would allow us to calibrate subsequent values? Any explanations, fixes, and/or suggestions would be greatly appreciated.
RSSI vs Time (in seconds) |