Skip to content

Commit 2365825

Browse files
committed
fix start of BLE when requesting BLE MAC Address with the SerialAgent
1 parent 2d33a66 commit 2365825

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/ConfiguratorAgents/AgentsManager.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,10 @@ void AgentsManagerClass::handleGetBleMacAddressCommand() {
343343
uint8_t mac[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
344344

345345
#ifdef BOARD_HAS_BLE
346-
if(!isBLEAgentEnabled()){
346+
bool activated = false;
347+
if(!isBLEAgentEnabled() || (_selectedAgent != nullptr &&
348+
_selectedAgent->getAgentType() != ConfiguratorAgent::AgentTypes::BLE)) {
349+
activated = true;
347350
BLE.begin();
348351
}
349352

@@ -354,6 +357,9 @@ void AgentsManagerClass::handleGetBleMacAddressCommand() {
354357
mac[i] = mac[5-i];
355358
mac[5-i] = byte;
356359
}
360+
if (activated) {
361+
BLE.end();
362+
}
357363
#endif
358364

359365
ProvisioningOutputMessage outputMsg;

0 commit comments

Comments
 (0)