Skip to content

BLE: Add generic GAP implementation. #5311

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

Merged
merged 6 commits into from
Dec 12, 2017
Merged

Conversation

pan-
Copy link
Member

@pan- pan- commented Oct 12, 2017

Description

Add a generic implementation of the GAP class. It allows porters to have a working Gap implementation by implementing the following abstraction layer primitives:

  • pal::Gap: Adaptation for GAP related primitives.
  • pal::EventQueue: simple interface to the inner event queue of the stack. pal::SimpleEventQueue can also be used as an implementation.
  • pal::GenericAccessService: Accessors to the Generic Access Service present in the GATT server.

Note: the implementation contains many TODO which cannot be solved at the moment due to lack of definitions in the Gap interface. These questions exist for all existing ports out there. Those points will be addressed by the work on the Security manager and by addition in the Gap layer.

Status

READY

Migrations

NO

Related PRs

#5300

Note

Diff can be found here: https://github.com/pan-/mbed/compare/ble-pal-event-queue..pan-:ble-generic-gap

@pan-
Copy link
Member Author

pan- commented Oct 12, 2017

@marcbonnici @nvlsianpu @apalmieriGH Could you review this PR ?

/**
* @see Gap::startAdvertising
*/
virtual ble_error_t startAdvertising(const GapAdvertisingParams& params);

Choose a reason for hiding this comment

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

Style for location of & changes from here?
GapAdvertisingData &scanResponse -> GapAdvertisingParams& params

Copy link
Member Author

Choose a reason for hiding this comment

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

According to our guidelines the ampersand should be close to the noun. Thanks for the notification.

Choose a reason for hiding this comment

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

In that case does this need changing in the other files?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm afraid it should 😓

}

// TODO check the random part if applicable
return true;

Choose a reason for hiding this comment

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

Should this TODO still be here?

Copy link
Member Author

Choose a reason for hiding this comment

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

No this one can be fix be checking the prand 24 of the resolvable private address.

{
switch (reason) {
/**
* Note: acceptect reasons are:

Choose a reason for hiding this comment

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

"acceptect" -> "accepted"

const BLEProtocol::Address_t& potential_device = whitelist.addresses[i];

if (potential_device.type != device.type) {
break;

Choose a reason for hiding this comment

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

Should this be continue?

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch, I'll fix it.

@pan- pan- force-pushed the ble-generic-gap branch 2 times, most recently from fae6bc5 to 9a31ab3 Compare October 15, 2017 16:32
@0xc0170
Copy link
Contributor

0xc0170 commented Oct 19, 2017

@marcbonnici @nvlsianpu @apalmieriGH Could you review this PR ?

Anyone to review more this PR ?

pan- added 5 commits October 31, 2017 17:32
This interface expose the primitives needed to realize operations defined in
the GAP layer. Data types, event and function definitions follow closely HCI
commands and events defined in the Bluetooth specification.
Add an abstraction which manage the state of the GAP service exposed by the GATT server.
This filter prevent events to be signaled multiple times to the upper layer. It
also signal events to a newly set event processor hook.
To help generic code, an interface of an event queue at the PAL level has been
added. Implementation can either rely on the event mechanism internal to the
stack or use the SimpleEventQueue implementation provided by this patch.
Generic implementation of the GAP class. It allows porters to have a working Gap
implementation by implementing the following abstraction layer primitives:
- pal::Gap: Adaptation for GAP related primitives.
- pal::EventQueue: simple interface to the inner event queue of the stack.
  pal::SimpleEventQueue can also be used as an implementation.
- pal::GenericAccessService: Accessors to the Generic Access Service present in
  the GATT server.
return BLE_ERROR_NONE;
}

ble_error_t GenericGap::setWhitelist(const Whitelist_t &whitelist)
Copy link
Contributor

Choose a reason for hiding this comment

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

I dont get why this actoion is so complicated - why it;s not about just clearing the whitelist and filing it again?

Copy link
Member Author

Choose a reason for hiding this comment

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

The goal is to reduce HCI transactions; Clearing the whitelist and add a new one is simpler but not optimal.

@0xc0170
Copy link
Contributor

0xc0170 commented Dec 11, 2017

/morph build

@mbed-ci
Copy link

mbed-ci commented Dec 11, 2017

Build : SUCCESS

Build number : 677
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5311/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Dec 11, 2017

@mbed-ci
Copy link

mbed-ci commented Dec 11, 2017

@0xc0170 0xc0170 merged commit 484b4a2 into ARMmbed:master Dec 12, 2017
@pan- pan- deleted the ble-generic-gap branch July 3, 2018 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants