Skip to content

Commit 7dcf8af

Browse files
committed
Add bluetoothCommandIsConnected()
1 parent 3195344 commit 7dcf8af

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Firmware/RTK_Everywhere/Bluetooth.ino

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,36 @@ bool bluetoothIsConnected()
118118
return (false);
119119
}
120120

121+
// Return true if the BLE Command channel is connected
122+
bool bluetoothCommandIsConnected()
123+
{
124+
#ifdef COMPILE_BT
125+
if (bluetoothGetState() == BT_OFF)
126+
return (false);
127+
128+
if (settings.bluetoothRadioType == BLUETOOTH_RADIO_SPP_AND_BLE)
129+
{
130+
if (bluetoothSerialBleCommands->connected() == true)
131+
return (true);
132+
}
133+
else if (settings.bluetoothRadioType == BLUETOOTH_RADIO_SPP)
134+
{
135+
return (false);
136+
}
137+
else if (settings.bluetoothRadioType == BLUETOOTH_RADIO_BLE)
138+
{
139+
if (bluetoothSerialBleCommands->connected() == true)
140+
return (true);
141+
}
142+
else if (settings.bluetoothRadioType == BLUETOOTH_RADIO_SPP_ACCESSORY_MODE)
143+
{
144+
return (false);
145+
}
146+
#endif // COMPILE_BT
147+
148+
return (false);
149+
}
150+
121151
// Return the Bluetooth state
122152
byte bluetoothGetState()
123153
{

0 commit comments

Comments
 (0)