iBeacon を利用したサービス開発のポイント
- 29. Estimote StickNFind Aplix shopbeacon
価格 3500円 3500円 1000円 4000円
技適 ○ ○ ○ ×
電池 2年 1年 1年 5年
その他 デザイ
ンが
おしゃ
れ
サイズが
小さい。
探し物ア
プリを販
売。
安い。
セキュリ
ティ機能
が強い。
米国の
百貨店
Macy’s
実績アリ
- 37. NFCとiBeaconの比較
NFC iBeacon
最大距離 20cm 50m
検知 タッチ
(能動的)
Bluetooth ON で
PUSH受信
(受動的)
対応 iOS 8
Android 2.3
iOS 7
Android 4.3
価格 100円 1000円~
電池 不要 1年~
通信 424kbps 1024kbps
同時接続 1対1 N対N
- 62. UUID定義
// 観測対象のUUIDと識別子を定義して、
// CLBeaconRegionを作成する
let uuidString = “00000000-1234-A123-B456-E123C456D789”
let beaconIdentifier = “gmo-beacon”
let beaconUUID:NSUUID = NSUUID(UUIDString: uuidString)
let beaconRegion:CLBeaconRegion
= CLBeaconRegion(proximityUUID: beaconUUID, identifier:
beaconIdentifier )
- 66. didEnterRegion
func locationManager( manager: CLLocationManager!,
didEnterRegion region: CLRegion!) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_P
RIORITY_DEFAULT, 0), {
// 境界に入ったので、レンジング観測を開始
manager.startRangingBeaconsInRegion(region as
CLBeaconRegion)
})
}
- 69. didRangeBeacons
func locationManager( manager: CLLocationManager!,
didRangeBeacons beacons: [CLBeacon]!,
inRegion region: CLBeaconRegion!) {
for beacon in beacons {
// 指定範囲に入っていなければスキップ
If (inRangeProximity.filter {$0 == beacon.proximity}).count == 0 {
continue
}
// 同じmajor,minorの最後の測定状態を取得
var arr: [CLBeacon] = []
for lb in lastBeacons {
if lb.major == beacon.major {
if lb.minor == beacon.minor{
arr.insert(lb, atIndex: arr.count)
}
}
}
- 78. UUID、Major、Minor
if(scanRecord.length > 30){
//iBeacon の場合 6 byte 目から、 9 byte 目はこの値に固定されている。
if((scanRecord[5] == (byte)0x4c) && (scanRecord[6] == (byte)0x00)
&& (scanRecord[7] == (byte)0x02) && (scanRecord[8] == (byte)0x15))
{
String uuid = IntToHex2(scanRecord[9] & 0xff)
+ IntToHex2(scanRecord[10] & 0xff) + IntToHex2(scanRecord[11] & 0xff)
+ IntToHex2(scanRecord[12] & 0xff) + "-"
+ IntToHex2(scanRecord[13] & 0xff) + IntToHex2(scanRecord[14] & 0xff)
+ "-” + IntToHex2(scanRecord[15] & 0xff) + IntToHex2(scanRecord[16] & 0xff)
+ "-” + IntToHex2(scanRecord[17] & 0xff) + IntToHex2(scanRecord[18] & 0xff)
+ "-” + IntToHex2(scanRecord[19] & 0xff) + IntToHex2(scanRecord[20] & 0xff)
+ IntToHex2(scanRecord[21] & 0xff) + IntToHex2(scanRecord[22] & 0xff)
+ IntToHex2(scanRecord[23] & 0xff) + IntToHex2(scanRecord[24] & 0xff);
String major = IntToHex2(scanRecord[25] & 0xff) + IntToHex2(scanRecord[26] & 0xff);
String minor = IntToHex2(scanRecord[27] & 0xff) + IntToHex2(scanRecord[28] & 0xff);
}
}
- 79. scanRecord
Byte 数 説明
1 1 ブロック目のバイト数
2,3 flag
4 2 ブロック目のバイト数
5 メーカー固有の AD type データ
6,7 会社コード(0x004C が Apple の会社コード)
8 データのタイプ(0×02 が iBeacon)
9 連なる iBeacon データのバイト数
10~25 UUID
26,27 major
28,29 minor
30
校正された電波強度(距離を求めるときの基
準値、2 の補数)