add iBeacon functionality
Dependencies: BLE_API mbed-dev-bin nRF51822
Fork of microbit-dal by
MicroBitIBeacon.h
00001 /* 00002 The MIT License (MIT) 00003 00004 Copyright (c) 2016 British Broadcasting Corporation. 00005 This software is provided by Lancaster University by arrangement with the BBC. 00006 00007 Permission is hereby granted, free of charge, to any person obtaining a 00008 copy of this software and associated documentation files (the "Software"), 00009 to deal in the Software without restriction, including without limitation 00010 the rights to use, copy, modify, merge, publish, distribute, sublicense, 00011 and/or sell copies of the Software, and to permit persons to whom the 00012 Software is furnished to do so, subject to the following conditions: 00013 00014 The above copyright notice and this permission notice shall be included in 00015 all copies or substantial portions of the Software. 00016 00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00018 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00019 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00020 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00021 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00022 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00023 DEALINGS IN THE SOFTWARE. 00024 */ 00025 00026 #ifndef MICROBIT_IBEACON_H 00027 #define MICROBIT_IBEACON_H 00028 00029 #include "MicroBitConfig.h" 00030 00031 /* 00032 * Return to our predefined compiler settings. 00033 */ 00034 #if !defined(__arm) 00035 #pragma GCC diagnostic pop 00036 #endif 00037 00038 #include "MicroBitBLEManager.h" 00039 00040 /** 00041 * Class definition for the MicroBitIBeacon. 00042 * 00043 */ 00044 class MicroBitIBeacon 00045 { 00046 public: 00047 00048 static MicroBitIBeacon* getInstance(); 00049 00050 00051 /** 00052 * Set the content of iBeacon frames 00053 * 00054 * @param proximityUUID 16-byte proximity UUID 00055 * 00056 * @param major 2-byte major value 00057 * 00058 * @param minor 2-byte minor value 00059 * 00060 * @param calibratedPower the transmission range of the beacon (Defaults to: 0xF0 ~10m). 00061 * 00062 * @note The calibratedPower value ranges from -100 to +20 to a resolution of 1. The calibrated power should be binary encoded. 00063 * More information can be found at https://github.com/google/eddystone/tree/master/eddystone-uid#tx-power 00064 */ 00065 int setParams(BLEDevice* ble, const UUID &proximityUUID, int16_t major, int16_t minor, int8_t calibratedPower = 0xF0); 00066 00067 private: 00068 00069 /** 00070 * Private constructor. 00071 */ 00072 MicroBitIBeacon(); 00073 00074 static MicroBitIBeacon *_instance; 00075 }; 00076 00077 #endif
Generated on Tue Jul 12 2022 21:36:42 by
1.7.2
