ghz 2000 / nRF51822_BLE_UART_HRM1017

Fork of nRF51822 by Nordic Semiconductor

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers nRF51Gap.h Source File

nRF51Gap.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_GAP_H__
00018 #define __NRF51822_GAP_H__
00019 
00020 #include "mbed.h"
00021 #include "blecommon.h"
00022 #include "ble.h"
00023 #include "GapAdvertisingParams.h"
00024 #include "GapAdvertisingData.h"
00025 #include "hw/Gap.h"
00026 
00027 /**************************************************************************/
00028 /*!
00029     \brief
00030 
00031 */
00032 /**************************************************************************/
00033 class nRF51Gap : public Gap
00034 {
00035 public:
00036     static nRF51Gap &getInstance() {
00037         static nRF51Gap m_instance;
00038         return m_instance;
00039     }
00040 
00041     /* Functions that must be implemented from Gap */
00042     virtual ble_error_t setAddress(addr_type_t   type,
00043                                    const uint8_t address[6]);
00044     virtual ble_error_t setAdvertisingData(const GapAdvertisingData &,
00045                                            const GapAdvertisingData &);
00046     virtual ble_error_t startAdvertising(const GapAdvertisingParams &);
00047     virtual ble_error_t stopAdvertising(void);
00048     virtual ble_error_t disconnect(void);
00049 
00050     void     setConnectionHandle(uint16_t con_handle);
00051     uint16_t getConnectionHandle(void);
00052 
00053 private:
00054     uint16_t m_connectionHandle;
00055     nRF51Gap() {
00056         m_connectionHandle = BLE_CONN_HANDLE_INVALID;
00057     }
00058 
00059     nRF51Gap(nRF51Gap const &);
00060     void operator=(nRF51Gap const &);
00061 };
00062 
00063 #endif // ifndef __NRF51822_GAP_H__