Jira 857, 858, BLEPeripherial connect issues - #447
Conversation
…t triggered
1. Root casue: The callback regiter before the begin and the begin
reset the callback.
2. Solution: Remove it from the init method and init it when create.
1. Root casue: the stack need use connected device to get the state.
The current code used local address to get the link and get an error.
2. Solution: Use central's address to get connection state.
|
@bigdinotech , @eriknyquist , please review the code changes. @noelpaz , @russmcinnis , please system test the changes. Please use the sample sketch in the gitHub issues to check out the fixes. |
| #include "BLEPeripheral.h" | ||
|
|
||
| static BLEPeripheralEventHandler m_eventHandlers[BLEDeviceLastEvent]; | ||
| static BLEPeripheralEventHandler m_eventHandlers[BLEDeviceLastEvent] = {NULL, NULL, NULL, NULL}; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
@eriknyquist , correction made and it is in a new PR, #455.
Jira 857. BLEPeripheral::connect() return false, git 444.
Jira 858. Cannot trigger BLEConnected and BLEDisconnected events, git 445.
Both related connection issues are address in this PR.