Skip to content
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

V4.2 Porting #534

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

V4.2 Porting #534

wants to merge 15 commits into from

Conversation

sgbihu
Copy link
Contributor

@sgbihu sgbihu commented Apr 21, 2017

Porting V4.2 to improve the performance. Please don't merge.

@@ -392,7 +400,7 @@ class BLEDeviceManager
uint8_t _peer_adv_data[BLE_MAX_ADV_BUFFER_CFG][BLE_MAX_ADV_SIZE];
uint8_t _peer_adv_data_len[BLE_MAX_ADV_BUFFER_CFG];
uint8_t _peer_scan_rsp_data[BLE_MAX_ADV_BUFFER_CFG][BLE_MAX_ADV_SIZE];
int8_t _peer_scan_rsp_data_len[BLE_MAX_ADV_BUFFER_CFG];
uint8_t _peer_scan_rsp_data_len[BLE_MAX_ADV_BUFFER_CFG];
Copy link
Contributor

Choose a reason for hiding this comment

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

@SidLeung @sgbihu I think PR #500 was reverted here. Is this change intended?

Copy link
Contributor Author

@sgbihu sgbihu May 3, 2017

Choose a reason for hiding this comment

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

This change has been considered. Your implementation has an assumption, the scan response should followed by advertisement. But this may has some corner case to make ADV not be reported to sketch.
Now I use timeout mechanism. The central will report ADV data after 800ms delay.

sgbihu added 11 commits May 5, 2017 10:11
Solution:
  Add service and appearance characteristic in the BLE lib.

Changed files
  BLEDevice.cpp - check the local device
  BLEDeviceManager.cpp - Change the calls
  BLEDeviceManager.h - remove appearance member
  BLEProfileManager.cpp - Add GAP service and appearance characteristic
  BLEProfileManager.h - Add set/get API
Make the BLE support more characteristics and services by separate the
  service registration

Changed files
  BLEProfileManager.cpp - Remove register all service at same time
  BLEProfileManager.h - Change the comments
  BLEServiceImp.cpp - Add the register service after update the characteristic
Root cause
1. The return value indecate the read/write request send successfully.
2. The subscribe will ignore the response and this will not be fixed.

Solution
1. Add the error detect based on read/write response.

Changed files
BLECallbacks.cpp - Delete the error check for read response.
BLECharacteristicImp.cpp
  - Add the error check.
  - Optimize the memory allocate and clear the allocated memory.
BLECharacteristicImp.h - Add varibles to flag the response error
1. Implement the subscribe changed event notify feature.

Changed files:
  BLECallbacks.cpp - Add subscribe changed handler and disconnect process
  BLECallbacks.h - Callback declaration
  BLECharacteristicImp.cpp - Add the event changed handler
  BLECharacteristicImp.h - Handler declaration
1. Subscribe/unsubscribe event cause notification can't send out
2. Delete unused code
3. Update the library.
1. Reconstruct the initial process to avoid call BLE API

Changed files
BLEDeviceManager.cpp - Change the init order
  ble_client.c - Add new call
  ble_service.h - Add new API declaration
  ble_service.c - Modify init logic
  ble_service_api.c - Delete unsed file
  nble_driver.c - Modify init logic
1. Fix Jira 769/git arduino#378. Discover GAP service by parameter.
2. Fix Jira 770/git arduino#379 to show the device name in central when discover
    GAP service.

Changed service
  BLEDevice.cpp - Modify the API
  BLEDevice.h - Modify the API
  BLEDeviceManager.cpp - Add get device name logic
  BLEProfileManager.cpp - Implement get devicename and dicovery logic
  BLEProfileManager.h - Add API to get devicename from characteristic
  BLEServiceImp.cpp - Modify the filter logic
  BLEServiceImp.h - Modify the API
…nexpected

Root cause:
1. The stack doesn't release the resource and makes peripheral crashed.
    Then central blocked.

Solution:
1. Fix memory leak issue and release the resource.

Changed File:
  gatt.c - Modify the code to make sure the resource can be released.
1. Dismiss the warnings.
2. Rebuild the library

Changed files:
  BLEProfileManager.cpp - Init member variable
  rpc_deserialize.c - Delete unreachable code
  dtm.c - Init the variables
  gap.c - Init the variables
  gatt.c - Init the variables
sgbihu added 4 commits May 5, 2017 14:28
1. Reinitial the BLE MAC address to avoid BLE start timer
Root cause
  1. The central powered off peripherial device and make it not give response.

Solution
  1. Exit the wait loop when connection lost.

Changed file
  BLECharacteristicImp.cpp - Change the wait logic
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants