Shuta Nakamae / nRF51822

Fork of nRF51822 by Nordic Semiconductor

Files at this revision

API Documentation at this revision

Comitter:
rgrover1
Date:
Fri Jun 19 15:55:32 2015 +0100
Parent:
327:0ea2b4d48212
Child:
329:d11ef9cc041b
Commit message:
Synchronized with git rev 0cc48daf
Author: Rohit Grover
introduce implementation for nRF51GattClient

Changed in this revision

nRF51822n.h Show annotated file Show diff for this revision Revisions of this file
nRF51GattClient.cpp Show annotated file Show diff for this revision Revisions of this file
nRF51GattClient.h Show annotated file Show diff for this revision Revisions of this file
--- a/nRF51822n.h	Fri Jun 19 15:55:32 2015 +0100
+++ b/nRF51822n.h	Fri Jun 19 15:55:32 2015 +0100
@@ -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 @@
     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);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nRF51GattClient.cpp	Fri Jun 19 15:55:32 2015 +0100
@@ -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;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nRF51GattClient.h	Fri Jun 19 15:55:32 2015 +0100
@@ -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__
\ No newline at end of file