Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning ibeacon

You're reading from  Learning ibeacon

Product type Book
Published in Nov 2014
Publisher
ISBN-13 9781784397128
Pages 196 pages
Edition 1st Edition
Languages
Author (1):
Craig Gilchrist Craig Gilchrist
Profile icon Craig Gilchrist

Table of Contents (16) Chapters

Learning iBeacon
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Welcome to iBeacon Detecting Beacons – Showing an Advert Broadcasting Advertisements – Sending Offers Ranging Beacons – Hunting for Treasure Detecting Beacons in the Background – Location Dating Leaving Regions – Don't Forget Your Stuff Vendor SDKs – Buying and Configuring Beacons Advanced Tutorial – iBeacon Museum iBeacon Security – Understanding the Risks Index

Chapter 3. Broadcasting Advertisements – Sending Offers

In the previous chapter, we used the companion beacon app and learned how to react when we come into the range of beacons. We built the Matey's offers app to show offers around the store. In this chapter, we're going to look at the other side and we're going to become Matey's by actually using our iOS device to broadcast offers.

Introducing the Core Bluetooth framework


Let's start with a new framework that makes broadcasting possible: Core Bluetooth. In this chapter, we'll still be using the Core Location framework but only to configure our transmitter. This chapter is all about the technology behind beacons.

The Core Bluetooth framework provides the classes needed for your iOS and Mac apps to communicate with the Bluetooth's low energy wireless technology.

Core Bluetooth has been available since iOS 6.0 and is intended solely for the implementation of centrals and peripherals.

Understanding centrals and peripherals

Before we understand how to broadcast as a beacon, it's worth understanding what centrals and peripherals are. If you think about peripherals as devices that have data and centrals as devices that want data, this makes the concept much easier to understand.

Peripherals are things such as thermostats, heart monitors, blood pressure monitors, proximity sensors, lamps, lights, and LED bulbs. They are devices...

Obtaining broadcast values from CLBeaconRegion


In order to use the startAdvertising method of the CBPeripheralManage class, we need to know what we're broadcasting. We do this by calling the peripheralDataWithMeasuredPower: method of CLBeaconRegion. The resulting NSMutableDictionary class can be used with the startAdvertising method of the CBPeripheralManage class.

Measured power (TXPower)

Back in Chapter 1, Welcome to iBeacon, we discussed RSSI and measured power to adjust the power of the transmission so that the distance could be better understood. We'll put this principle into effect during the tutorial by using the measured power of -63 dBm, which should give the correct RSSI value at distance of 1 meter. This might not be completely accurate as it's hardware-dependent, but it should be pretty close.

Let's get started

To build our app, we need two devices. One device should be running the tutorial from Chapter 2, Detecting Beacons – Showing an Advert as a receiver and the second device...

Summary


We've covered quite a lot for such a short chapter. You learned about the Core Bluetooth framework and a very small subset of the features contained within. I'd recommend delving deeper into this framework using off the shelf hardware. There's an excellent article on Ray Wenderlich's website about using an iPhone to interact with the Polar Bluetooth heart rate monitor, which you can find at http://bit.ly/hr-monitor.

In the next chapter, we're going to cover determining distance to build a treasure hunt app. We're going to make it exciting by making the app talk as we get closer to the treasure. So, what are ye waiting for me hearties? Let's go!

lock icon The rest of the chapter is locked
You have been reading a chapter from
Learning ibeacon
Published in: Nov 2014 Publisher: ISBN-13: 9781784397128
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}