Skip to content

Jira 857, 858, BLEPeripherial connect issues #447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions libraries/CurieBLE/src/BLEPeripheral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "BLEPeripheral.h"

static BLEPeripheralEventHandler m_eventHandlers[BLEDeviceLastEvent];
static BLEPeripheralEventHandler m_eventHandlers[BLEDeviceLastEvent] = {NULL, NULL, NULL, NULL};
Copy link
Contributor

@eriknyquist eriknyquist Feb 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unncessary-- m_evenHandlers is declared static, so it will be located in .bss
All elements will be initialized to 0 by default, so there is no need to explicitly initialize.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. The global variable is in _bss segment and it is clear out on boot. In addition, the initialization is hard code to 4 which may not be true in future.

@sgbihu , please remove the initialization, stay with the previous code for this item. Please make the correction and make another push ASAP. Pencil down this Friday.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eriknyquist , correction made and it is in a new PR, #455.


void bleBackCompatiblePeripheralConnectHandler(BLEDevice central)
{
Expand Down Expand Up @@ -146,15 +146,15 @@ BLECentral BLEPeripheral::central(void)

bool BLEPeripheral::connected(void)
{
return BLE.connected();
BLEDevice centralBle = BLE.central();
return centralBle.connected();
}

void BLEPeripheral::init()
{
if (!_initCalled)
{
BLE.begin();
memset(m_eventHandlers, 0, sizeof(m_eventHandlers));
_initCalled = true;
}
}
Expand Down