introduce implementation for nRF51GattClient

This commit is contained in:
Rohit Grover 2015-06-03 13:53:05 +01:00
parent 1fc421bad1
commit 0cc48daf77
3 changed files with 79 additions and 0 deletions

View file

@ -22,6 +22,7 @@
#include "BLEDevice.h"
#include "nRF51Gap.h"
#include "nRF51GattServer.h"
#include "nRF51GattClient.h"
#include "btle.h"
#include "btle_security.h"
@ -39,6 +40,9 @@ public:
virtual GattServer &getGattServer() {
return nRF51GattServer::getInstance();
};
virtual GattClient &getGattClient() {
return nRF51GattClient::getInstance();
}
virtual ble_error_t setTxPower(int8_t txPower);
virtual void getPermittedTxPowerValues(const int8_t **valueArrayPP, size_t *countP);

22
nRF51GattClient.cpp Normal file
View file

@ -0,0 +1,22 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "nRF51GattClient.h"
nRF51GattClient &nRF51GattClient::getInstance(void) {
static nRF51GattClient m_instance;
return m_instance;
}

53
nRF51GattClient.h Normal file
View file

@ -0,0 +1,53 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __NRF51822_GATT_CLIENT_H__
#define __NRF51822_GATT_CLIENT_H__
#include "GattClient.h"
class nRF51GattClient : public GattClient
{
public:
static nRF51GattClient &getInstance();
#if 0
/* Functions that must be implemented from GattClient */
virtual ble_error_t addService(GattService &);
virtual ble_error_t readValue(GattAttribute::Handle_t attributeHandle, uint8_t buffer[], uint16_t *lengthP);
virtual ble_error_t readValue(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, uint8_t buffer[], uint16_t *lengthP);
virtual ble_error_t updateValue(GattAttribute::Handle_t, const uint8_t[], uint16_t, bool localOnly = false);
virtual ble_error_t updateValue(Gap::Handle_t connectionHandle, GattAttribute::Handle_t, const uint8_t[], uint16_t, bool localOnly = false);
virtual ble_error_t initializeGATTDatabase(void);
/* nRF51 Functions */
void eventCallback(void);
void hwCallback(ble_evt_t *p_ble_evt);
private:
#endif
public:
nRF51GattClient() {
/* empty */
}
private:
nRF51GattClient(const nRF51GattClient &);
const nRF51GattClient& operator=(const nRF51GattClient &);
};
#endif // ifndef __NRF51822_GATT_CLIENT_H__