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

Characteristic descriptor discovery #105

Merged
merged 24 commits into from
Dec 23, 2015
Merged

Conversation

pan-
Copy link
Member

@pan- pan- commented Nov 18, 2015

This pull request provides:

  • API to make characteristic descriptor discovery
  • minor improvements for FunctionPointerWithContext

A characteristic descriptor discovery can be made on two levels:

  • directly from a characteristic using the discoverDescriptor member function
void whenCharacteristicDescriptorDiscovered(const CharacteristicDescriptorDiscovery::DiscoveryCallbackParams_t* params) {
   // do something with these
   (void) params->characteristic;
   (void) params->descriptor;
}

void whenCharacteristicDescriptorDiscoveryTerminate(const CharacteristicDescriptorDiscovery::TerminationCallbackParams_t* params) {
   // do something with these
   (void) params->characteristic;
   (void) params->status;
}

DiscoveredCharacteristic foo;
foo.discoverDescriptors(
    whenCharacteristicDescriptorDiscovered, 
    whenCharacteristicDescriptorDiscoveryTerminate
);
  • using the GattClient low level interface
ble_error_t discoverCharacteristicDescriptors(
        const DiscoveredCharacteristic& characteristic,
        const CharacteristicDescriptorDiscovery::DiscoveryCallback_t& discoveryCallback,
        const CharacteristicDescriptorDiscovery::TerminationCallback_t& terminationCallback);

bool isCharacteristicDescriptorsDiscoveryActive(const DiscoveredCharacteristic& characteristic) const;

virtual void terminateCharacteristicDescriptorsDiscovery(const DiscoveredCharacteristic& characteristic);

pan- added 10 commits November 10, 2015 17:07
FunctionPointerWithContext<ContextType> instances.
CharacteristicDescriptorDiscovery::DiscoveryCallback_t take a
DiscoveryCallBackParam instead of just the discovered descriptor
DiscoveredCharacteristicDescriptor is now a plain type.
DiscoveredCharacteristic support operator==
DiscoveredCharacteristic::Properties-t support operator==
DiscoveredCharacteristic now include the last Gatt handle of this
characteristic
FunctionPointer with context call() is now const, in order to mirror
std::function and call a const FunctionPointerWithContext
FunctionPointerWithContext support operator ==
GattClient support basic characteristic descriptor discovery operations
The implementation of DiscoveredCharacteristic::discoverDescriptors is now
fullfiled.
- all member of
  CharacteristicDescriptorDiscovery::DiscoveryCallbackParams_t are now
  const by default
- CharacteristicDescriptorDiscovery::TerminationCallbackParams_t now
  accept a status parameter which indicate if the operation ends properly
  or not
- Remove DiscoveredCharacteristicDescriptor declaration from
  DiscoveredCharacteristic.h file
- Add comparison operation to DiscoveredCharacteristic::Properties_t type
- Add lastHandle member to DiscoveredCharacteristic
- Add equality operator to DiscoveredCharacteristic
- make FunctionPointerWithContext call operation const, so that it mirror
  std::function and allow to call this kind of objects to be called when
  they are passed by const reference
- Add primitive operations to GattClient for dicovering characteristic
  descriptors
- Fullfil DiscoveredCharacteristic::discoverDescriptors function
  implementation
Fix operator== in DiscoveredCharacteristic.
add DiscoveredOperator::operator!=
add a function to set the last handle of a DiscoveredCharacteristic on the
fly
mbed os FunctionPointer implementation does not allow, yet, to use a const
member function This kind of workaround is needed to use
FunctionPointerWithContext class in minar
class DiscoveredCharacteristic;
class DiscoveredCharacteristicDescriptor;

class CharacteristicDescriptorDiscovery {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a doxygen header describing the purpose of this class. We'll need to do this for everything.

@rgrover
Copy link
Contributor

rgrover commented Dec 14, 2015

I believe it should be isCharacteristicDescriptorDiscoveryActive(). Singular. Consistent with isServiceDiscoveryActive where we are also discovering a set of services.

@pan-
Copy link
Member Author

pan- commented Dec 14, 2015

Thanks I will update all signatures.

  - isCharacteristicDescriptorsDiscoveryActive => isCharacteristicDescriptorDiscoveryActive
  - terminateCharacteristicDescriptorsDiscovery =>terminateCharacteristicDescriptorDiscovery
@pan-
Copy link
Member Author

pan- commented Dec 21, 2015

@rgrover, @andresag01 Could you review these changes ?

@andresag01
Copy link

+1

pan- added a commit that referenced this pull request Dec 23, 2015
Characteristic descriptor discovery
@pan- pan- merged commit 0e70683 into ARMmbed:develop Dec 23, 2015
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.

3 participants