Skip to content

BLE: Nordic pal client implementation #5739

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 12 commits into from
Jan 11, 2018
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions features/FEATURE_BLE/ble/UUID.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#ifndef MBED_UUID_H__
#define MBED_UUID_H__

#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <algorithm>
Expand Down
32 changes: 12 additions & 20 deletions features/FEATURE_BLE/ble/generic/GenericGattClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,12 @@
namespace ble {
namespace generic {

// forward declarations
struct procedure_control_block_t;
struct discovery_control_block_t;
struct read_control_block_t;
struct write_control_block_t;
struct descriptor_discovery_control_block_t;

/**
* Generic implementation of the GattClient.
* It requires a pal::GattClient injected at construction site.
* @important: Not part of the public interface of BLE API.
*/
class GenericGattClient : public GattClient {

// give access to control block classes
friend struct procedure_control_block_t;
friend struct discovery_control_block_t;
friend struct read_control_block_t;
friend struct write_control_block_t;
friend struct descriptor_discovery_control_block_t;

public:
/**
* Create a GenericGattClient from a pal::GattClient
Expand Down Expand Up @@ -130,10 +115,16 @@ class GenericGattClient : public GattClient {
virtual ble_error_t reset(void);

private:
procedure_control_block_t* get_control_block(Gap::Handle_t connection);
const procedure_control_block_t* get_control_block(Gap::Handle_t connection) const;
void insert_control_block(procedure_control_block_t* cb) const;
void remove_control_block(procedure_control_block_t* cb) const;
struct ProcedureControlBlock;
struct DiscoveryControlBlock;
struct ReadControlBlock;
struct WriteControlBlock;
struct DescriptorDiscoveryControlBlock;

ProcedureControlBlock* get_control_block(Gap::Handle_t connection);
const ProcedureControlBlock* get_control_block(Gap::Handle_t connection) const;
void insert_control_block(ProcedureControlBlock* cb) const;
void remove_control_block(ProcedureControlBlock* cb) const;

void on_termination(Gap::Handle_t connection_handle);
void on_server_message_received(connection_handle_t, const pal::AttServerMessage&);
Expand All @@ -145,7 +136,8 @@ class GenericGattClient : public GattClient {

pal::GattClient* const _pal_client;
ServiceDiscovery::TerminationCallback_t _termination_callback;
mutable procedure_control_block_t* control_blocks;
mutable ProcedureControlBlock* control_blocks;
bool _is_reseting;
};

}
Expand Down
Loading