The eddystone config service allows you to configure the eddystone frame data over BLE for a set period of time and then starts an eddystone beacon. This example defaults to 30 seconds of config time.

Dependencies:   BLE_API mbed nRF51822 X_NUCLEO_IDB0XA1

Fork of BLE_EddystoneBeaconConfigServiceRelease by Austin Blackstone

This is the eddystone config service. This code starts up and for a user configured time period (default 30 seconds) will advertise the configuration service.

The configuration service allows for modifying various frames of the eddystone specification.

For more details on the Configuration Service please see : https://github.com/google/eddystone/blob/master/eddystone-url/docs/config-service-spec.md

Committer:
andresag
Date:
Tue Nov 24 10:04:38 2015 +0000
Revision:
3:d0f3e00cbfdf
Update example to use new Eddystone implementation NOT included in ble/services.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andresag 3:d0f3e00cbfdf 1 /* mbed Microcontroller Library
andresag 3:d0f3e00cbfdf 2 * Copyright (c) 2006-2015 ARM Limited
andresag 3:d0f3e00cbfdf 3 *
andresag 3:d0f3e00cbfdf 4 * Licensed under the Apache License, Version 2.0 (the "License");
andresag 3:d0f3e00cbfdf 5 * you may not use this file except in compliance with the License.
andresag 3:d0f3e00cbfdf 6 * You may obtain a copy of the License at
andresag 3:d0f3e00cbfdf 7 *
andresag 3:d0f3e00cbfdf 8 * http://www.apache.org/licenses/LICENSE-2.0
andresag 3:d0f3e00cbfdf 9 *
andresag 3:d0f3e00cbfdf 10 * Unless required by applicable law or agreed to in writing, software
andresag 3:d0f3e00cbfdf 11 * distributed under the License is distributed on an "AS IS" BASIS,
andresag 3:d0f3e00cbfdf 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
andresag 3:d0f3e00cbfdf 13 * See the License for the specific language governing permissions and
andresag 3:d0f3e00cbfdf 14 * limitations under the License.
andresag 3:d0f3e00cbfdf 15 */
andresag 3:d0f3e00cbfdf 16
andresag 3:d0f3e00cbfdf 17 #include "UIDFrame.h"
andresag 3:d0f3e00cbfdf 18
andresag 3:d0f3e00cbfdf 19 UIDFrame::UIDFrame(void)
andresag 3:d0f3e00cbfdf 20 {
andresag 3:d0f3e00cbfdf 21 memset(uidNamespaceID, 0, sizeof(UIDNamespaceID_t));
andresag 3:d0f3e00cbfdf 22 memset(uidInstanceID, 0, sizeof(UIDInstanceID_t));
andresag 3:d0f3e00cbfdf 23 }
andresag 3:d0f3e00cbfdf 24
andresag 3:d0f3e00cbfdf 25 UIDFrame::UIDFrame(const UIDNamespaceID_t uidNamespaceIDIn, const UIDInstanceID_t uidInstanceIDIn)
andresag 3:d0f3e00cbfdf 26 {
andresag 3:d0f3e00cbfdf 27 memcpy(uidNamespaceID, uidNamespaceIDIn, sizeof(UIDNamespaceID_t));
andresag 3:d0f3e00cbfdf 28 memcpy(uidInstanceID, uidInstanceIDIn, sizeof(UIDInstanceID_t));
andresag 3:d0f3e00cbfdf 29 }
andresag 3:d0f3e00cbfdf 30
andresag 3:d0f3e00cbfdf 31 void UIDFrame::setUIDData(const UIDNamespaceID_t *uidNamespaceIDIn, const UIDInstanceID_t *uidInstanceIDIn)
andresag 3:d0f3e00cbfdf 32 {
andresag 3:d0f3e00cbfdf 33 memcpy(uidNamespaceID, uidNamespaceIDIn, sizeof(UIDNamespaceID_t));
andresag 3:d0f3e00cbfdf 34 memcpy(uidInstanceID, uidInstanceIDIn, sizeof(UIDInstanceID_t));
andresag 3:d0f3e00cbfdf 35 }
andresag 3:d0f3e00cbfdf 36
andresag 3:d0f3e00cbfdf 37 void UIDFrame::constructUIDFrame(uint8_t *rawFrame, int8_t advPowerLevel)
andresag 3:d0f3e00cbfdf 38 {
andresag 3:d0f3e00cbfdf 39 size_t index = 0;
andresag 3:d0f3e00cbfdf 40
andresag 3:d0f3e00cbfdf 41 rawFrame[index++] = EDDYSTONE_UUID[0]; // 16-bit Eddystone UUID
andresag 3:d0f3e00cbfdf 42 rawFrame[index++] = EDDYSTONE_UUID[1];
andresag 3:d0f3e00cbfdf 43 rawFrame[index++] = FRAME_TYPE_UID; // 1B Type
andresag 3:d0f3e00cbfdf 44 rawFrame[index++] = advPowerLevel; // 1B Power @ 0meter
andresag 3:d0f3e00cbfdf 45
andresag 3:d0f3e00cbfdf 46 memcpy(rawFrame + index, uidNamespaceID, sizeof(UIDNamespaceID_t)); // 10B Namespace ID
andresag 3:d0f3e00cbfdf 47 index += sizeof(UIDNamespaceID_t);
andresag 3:d0f3e00cbfdf 48 memcpy(rawFrame + index, uidInstanceID, sizeof(UIDInstanceID_t)); // 6B Instance ID
andresag 3:d0f3e00cbfdf 49 index += sizeof(UIDInstanceID_t);
andresag 3:d0f3e00cbfdf 50
andresag 3:d0f3e00cbfdf 51 memset(rawFrame + index, 0, 2 * sizeof(uint8_t)); // 2B RFU, which are unused
andresag 3:d0f3e00cbfdf 52 }
andresag 3:d0f3e00cbfdf 53
andresag 3:d0f3e00cbfdf 54 size_t UIDFrame::getRawFrameSize(void) const
andresag 3:d0f3e00cbfdf 55 {
andresag 3:d0f3e00cbfdf 56 return FRAME_SIZE_UID + EDDYSTONE_UUID_SIZE;
andresag 3:d0f3e00cbfdf 57 }
andresag 3:d0f3e00cbfdf 58
andresag 3:d0f3e00cbfdf 59 uint8_t* UIDFrame::getUIDNamespaceID(void)
andresag 3:d0f3e00cbfdf 60 {
andresag 3:d0f3e00cbfdf 61 return uidNamespaceID;
andresag 3:d0f3e00cbfdf 62 }
andresag 3:d0f3e00cbfdf 63
andresag 3:d0f3e00cbfdf 64 uint8_t* UIDFrame::getUIDInstanceID(void)
andresag 3:d0f3e00cbfdf 65 {
andresag 3:d0f3e00cbfdf 66 return uidInstanceID;
andresag 3:d0f3e00cbfdf 67 }