Qi Yao / LinkNode---test123

Dependencies:   mbed

Fork of LinkNode-Test by Qi Yao

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers nRF5xn.h Source File

nRF5xn.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2006-2013 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef __NRF51822_H__
00018 #define __NRF51822_H__
00019 
00020 #include "ble/BLE.h"
00021 #include "ble/blecommon.h"
00022 #include "ble/BLEInstanceBase.h"
00023 
00024 #include "nRF5xGap.h"
00025 #include "nRF5xGattServer.h"
00026 #include "nRF5xGattClient.h"
00027 #include "nRF5xSecurityManager.h"
00028 
00029 #include "btle.h"
00030 
00031 class nRF5xn : public BLEInstanceBase
00032 {
00033 public:
00034     nRF5xn(void);
00035     virtual ~nRF5xn(void);
00036 
00037     virtual ble_error_t init(BLE::InstanceID_t instanceID, FunctionPointerWithContext<BLE::InitializationCompleteCallbackContext *> callback);
00038     virtual bool        hasInitialized(void) const {
00039         return initialized;
00040     }
00041     virtual ble_error_t shutdown(void);
00042     virtual const char *getVersion(void);
00043 
00044     virtual Gap &getGap() {
00045         return nRF5xGap::getInstance();
00046     };
00047     virtual const Gap &getGap() const  {
00048         return nRF5xGap::getInstance();
00049     };
00050     virtual GattServer &getGattServer() {
00051         return nRF5xGattServer::getInstance();
00052     };
00053     virtual const GattServer &getGattServer() const {
00054         return nRF5xGattServer::getInstance();
00055     };
00056     virtual GattClient &getGattClient() {
00057         return nRF5xGattClient::getInstance();
00058     }
00059     virtual const SecurityManager &getSecurityManager() const {
00060         return nRF5xSecurityManager::getInstance();
00061     }
00062     virtual SecurityManager &getSecurityManager() {
00063         return nRF5xSecurityManager::getInstance();
00064     }
00065     virtual void waitForEvent(void);
00066 
00067 private:
00068     bool              initialized;
00069     BLE::InstanceID_t instanceID;
00070 };
00071 
00072 #endif