Uses of the UUID/major/minor broadcasting triplet
In the last chapter, we covered the reasons behind the broadcasting triplet; we're going to use the triplet with a more realistic scenario. Let's go over the three values again in some more detail.
UUID – Universally Unique Identifier
The UUID is meant to be unique to your app. It can be spoofed, which we'll cover in Chapter 9, iBeacon Security – Understanding the Risks, but generally, your app would be the only app looking for that UUID.
The UUID identifies a region, which is the maximum broadcast range of a beacon from its center point. Think of a region as a circle of broadcast with the beacon in the middle.
If lots of beacons with the same UUID have overlapping broadcasting ranges, then the region is represented by the broadcasting range of all the beacons combined as shown in the following figure. The combined range of all the beacons with the same UUID becomes the region.
Broadcast range
More specifically, the region is represented by an instance of the CLBeaconRegion
class, which we'll cover in more detail later in this chapter. The following code shows how to configure CLBeaconRegion
:
NSString * uuidString = @"78BC6634-A424-4E05-A2AE-A59A25CAC4A9"; NSUUID * regionUUID; regionUUID = [[NSUUID alloc] initWithUUIDString:uuidString"]; CLBeaconRegion * region; region = [[CLBeaconRegion alloc] initWithProximityUUID:regionUUID identifier:@"My Region"];
Generally, most apps will be monitoring only for one region. This is normally sufficient since the major and minor values are 16-bit unsigned integers, which means that each value can be a number up to 65,535 giving 4,294,836,225 unique beacon combinations per UUID.
Since the major and minor values are used to represent a subsection of the use case, there may be a time when 65,535 combinations of a major value may not be enough and so, this would be the rare time that your app can monitor multiple regions with different UUIDs. Another more likely example is that your app has multiple use cases, which are more logically split by UUID.
An example where an app has multiple use cases would be a loyalty app that has offers for many different retailers when the app is within the vicinity of the retail stores. Here you can have a different UUID for every retailer.
Major
The major value further identifies your use case. The major value should separate your use case along logical categories. This could be sections in a shopping mall or exhibits in a museum. In our example, a use case of the major value represents the different types of service within a department store.
In some cases, you may wish to separate logical categories into more than one major value. This would only be if each category has more than 65,535 beacons.
Minor
The minor value ultimately identifies the beacon itself. If you consider the major value as the category, then the minor value is the beacon within that category.
An example of a use case
The example laid out in this chapter uses the following UUID/major/minor values to broadcast different adverts for Matey's: