updates

Dependencies:   BLE_API mbed-dev-bin nRF51822

Fork of microbit-dal-eddystone by Martin Woolley

Committer:
wwbluetooth
Date:
Mon Jul 17 21:32:11 2017 +0000
Revision:
77:151a3b864991
Parent:
75:739b6a1c1b50
updates

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bluetooth_mdw 74:a8f5674a0079 1 /*
bluetooth_mdw 74:a8f5674a0079 2 The MIT License (MIT)
bluetooth_mdw 74:a8f5674a0079 3
bluetooth_mdw 74:a8f5674a0079 4 Copyright (c) 2016 British Broadcasting Corporation.
bluetooth_mdw 74:a8f5674a0079 5 This software is provided by Lancaster University by arrangement with the BBC.
bluetooth_mdw 74:a8f5674a0079 6
bluetooth_mdw 74:a8f5674a0079 7 Permission is hereby granted, free of charge, to any person obtaining a
bluetooth_mdw 74:a8f5674a0079 8 copy of this software and associated documentation files (the "Software"),
bluetooth_mdw 74:a8f5674a0079 9 to deal in the Software without restriction, including without limitation
bluetooth_mdw 74:a8f5674a0079 10 the rights to use, copy, modify, merge, publish, distribute, sublicense,
bluetooth_mdw 74:a8f5674a0079 11 and/or sell copies of the Software, and to permit persons to whom the
bluetooth_mdw 74:a8f5674a0079 12 Software is furnished to do so, subject to the following conditions:
bluetooth_mdw 74:a8f5674a0079 13
bluetooth_mdw 74:a8f5674a0079 14 The above copyright notice and this permission notice shall be included in
bluetooth_mdw 74:a8f5674a0079 15 all copies or substantial portions of the Software.
bluetooth_mdw 74:a8f5674a0079 16
bluetooth_mdw 74:a8f5674a0079 17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
bluetooth_mdw 74:a8f5674a0079 18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
bluetooth_mdw 74:a8f5674a0079 19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
bluetooth_mdw 74:a8f5674a0079 20 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
bluetooth_mdw 74:a8f5674a0079 21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
bluetooth_mdw 74:a8f5674a0079 22 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
bluetooth_mdw 74:a8f5674a0079 23 DEALINGS IN THE SOFTWARE.
bluetooth_mdw 74:a8f5674a0079 24 */
bluetooth_mdw 74:a8f5674a0079 25
bluetooth_mdw 74:a8f5674a0079 26 #ifndef MICROBIT_EDDYSTONE_H
bluetooth_mdw 74:a8f5674a0079 27 #define MICROBIT_EDDYSTONE_H
bluetooth_mdw 74:a8f5674a0079 28
bluetooth_mdw 74:a8f5674a0079 29 #include "MicroBitConfig.h"
bluetooth_mdw 74:a8f5674a0079 30
bluetooth_mdw 74:a8f5674a0079 31 /*
bluetooth_mdw 74:a8f5674a0079 32 * Return to our predefined compiler settings.
bluetooth_mdw 74:a8f5674a0079 33 */
bluetooth_mdw 74:a8f5674a0079 34 #if !defined(__arm)
bluetooth_mdw 74:a8f5674a0079 35 #pragma GCC diagnostic pop
bluetooth_mdw 74:a8f5674a0079 36 #endif
bluetooth_mdw 74:a8f5674a0079 37
bluetooth_mdw 74:a8f5674a0079 38 #include "MicroBitBLEManager.h"
bluetooth_mdw 74:a8f5674a0079 39
bluetooth_mdw 74:a8f5674a0079 40 /**
bluetooth_mdw 74:a8f5674a0079 41 * Class definition for the MicroBitEddystone.
bluetooth_mdw 74:a8f5674a0079 42 *
bluetooth_mdw 74:a8f5674a0079 43 */
bluetooth_mdw 74:a8f5674a0079 44 class MicroBitEddystone
bluetooth_mdw 74:a8f5674a0079 45 {
bluetooth_mdw 74:a8f5674a0079 46 public:
bluetooth_mdw 74:a8f5674a0079 47
bluetooth_mdw 74:a8f5674a0079 48 static MicroBitEddystone* getInstance();
bluetooth_mdw 74:a8f5674a0079 49
bluetooth_mdw 74:a8f5674a0079 50 #if CONFIG_ENABLED(MICROBIT_BLE_EDDYSTONE_URL)
bluetooth_mdw 74:a8f5674a0079 51
bluetooth_mdw 74:a8f5674a0079 52 /**
bluetooth_mdw 74:a8f5674a0079 53 * Set the content of Eddystone URL frames
bluetooth_mdw 74:a8f5674a0079 54 *
bluetooth_mdw 74:a8f5674a0079 55 * @param url The url to broadcast
bluetooth_mdw 74:a8f5674a0079 56 *
bluetooth_mdw 74:a8f5674a0079 57 * @param calibratedPower the transmission range of the beacon (Defaults to: 0xF0 ~10m).
bluetooth_mdw 74:a8f5674a0079 58 *
bluetooth_mdw 74:a8f5674a0079 59 * @note The calibratedPower value ranges from -100 to +20 to a resolution of 1. The calibrated power should be binary encoded.
bluetooth_mdw 74:a8f5674a0079 60 * More information can be found at https://github.com/google/eddystone/tree/master/eddystone-uid#tx-power
bluetooth_mdw 74:a8f5674a0079 61 */
bluetooth_mdw 74:a8f5674a0079 62 int setURL(BLEDevice* ble, const char *url, int8_t calibratedPower = 0xF0);
bluetooth_mdw 74:a8f5674a0079 63
bluetooth_mdw 74:a8f5674a0079 64 /**
bluetooth_mdw 74:a8f5674a0079 65 * Set the content of Eddystone URL frames, but accepts a ManagedString as a url.
bluetooth_mdw 74:a8f5674a0079 66 *
bluetooth_mdw 74:a8f5674a0079 67 * @param url The url to broadcast
bluetooth_mdw 74:a8f5674a0079 68 *
bluetooth_mdw 74:a8f5674a0079 69 * @param calibratedPower the transmission range of the beacon (Defaults to: 0xF0 ~10m).
bluetooth_mdw 74:a8f5674a0079 70 *
bluetooth_mdw 74:a8f5674a0079 71 * @note The calibratedPower value ranges from -100 to +20 to a resolution of 1. The calibrated power should be binary encoded.
bluetooth_mdw 74:a8f5674a0079 72 * More information can be found at https://github.com/google/eddystone/tree/master/eddystone-uid#tx-power
bluetooth_mdw 74:a8f5674a0079 73 */
bluetooth_mdw 74:a8f5674a0079 74 int setURL(BLEDevice* ble, ManagedString url, int8_t calibratedPower = 0xF0);
bluetooth_mdw 74:a8f5674a0079 75
bluetooth_mdw 74:a8f5674a0079 76 #endif
bluetooth_mdw 74:a8f5674a0079 77
wwbluetooth 75:739b6a1c1b50 78 //#if CONFIG_ENABLED(MICROBIT_BLE_EDDYSTONE_UID)
bluetooth_mdw 74:a8f5674a0079 79 /**
bluetooth_mdw 74:a8f5674a0079 80 * Set the content of Eddystone UID frames
bluetooth_mdw 74:a8f5674a0079 81 *
bluetooth_mdw 74:a8f5674a0079 82 * @param uid_namespace the uid namespace. Must 10 bytes long.
bluetooth_mdw 74:a8f5674a0079 83 *
bluetooth_mdw 74:a8f5674a0079 84 * @param uid_instance the uid instance value. Must 6 bytes long.
bluetooth_mdw 74:a8f5674a0079 85 *
bluetooth_mdw 74:a8f5674a0079 86 * @param calibratedPower the transmission range of the beacon (Defaults to: 0xF0 ~10m).
bluetooth_mdw 74:a8f5674a0079 87 *
bluetooth_mdw 74:a8f5674a0079 88 * @note The calibratedPower value ranges from -100 to +20 to a resolution of 1. The calibrated power should be binary encoded.
bluetooth_mdw 74:a8f5674a0079 89 * More information can be found at https://github.com/google/eddystone/tree/master/eddystone-uid#tx-power
bluetooth_mdw 74:a8f5674a0079 90 */
wwbluetooth 75:739b6a1c1b50 91 // int setUID(BLEDevice* ble, const char* uid_namespace, const char* uid_instance, int8_t calibratedPower = 0xF0);
wwbluetooth 75:739b6a1c1b50 92 //#endif
bluetooth_mdw 74:a8f5674a0079 93
bluetooth_mdw 74:a8f5674a0079 94 private:
bluetooth_mdw 74:a8f5674a0079 95
bluetooth_mdw 74:a8f5674a0079 96 /**
bluetooth_mdw 74:a8f5674a0079 97 * Private constructor.
bluetooth_mdw 74:a8f5674a0079 98 */
bluetooth_mdw 74:a8f5674a0079 99 MicroBitEddystone();
bluetooth_mdw 74:a8f5674a0079 100
bluetooth_mdw 74:a8f5674a0079 101 static MicroBitEddystone *_instance;
bluetooth_mdw 74:a8f5674a0079 102 };
bluetooth_mdw 74:a8f5674a0079 103
bluetooth_mdw 74:a8f5674a0079 104 #endif