ios7でのbluetooth le活用 @ mosa software meeting 2013

Download iOS7でのBluetooth LE活用 @ MOSA Software Meeting 2013

If you can't read please download the document

Upload: akihiro-uehara

Post on 10-May-2015

22.560 views

Category:

Technology


13 download

DESCRIPTION

2013年11月29日MOSAでのセミナー資料。

TRANSCRIPT

  • 1.iOS7Bluetooth LE!MOSA Software Meeting 2013 1129 ! ()

2. Bluetooth Low EnergyiOS7Bluetooth LE iBeacon iOS 3. Bluetooth Low Energy 1Bluetooth 3.0 50m(11 10)(20) 4. Bluetooth 200720092010Ver2.1Ver3.0Ver4.0Enhanced Data RateHigh Speed3.0Low Energy 20042006Bluetooth Low End ExtensionWibree 5. Bluetooth Smart 3.0Bluetooth 4.0 Ver 3.0 (iPhonePC)Low Energy () 6. Bluetooth Low EnergyBLEBluetooth SmartBluetooth3.0 iOS3 10k/ https://itunes.apple.com/sr/app/bluespeed/id579118786?mt=8 7. iOSBluetooth LE 8. iOSBLE 20112013iPhone4s iOS5 2012 iPhone5 iOS6iPhone5s iOS7BT4 MFi () 9. iOS7Bluetooth LE iOS7iOSBluetooth LE : HID Over GATT Prole (HOGP):MFiiBeaconApple Notication Center Service 10. iBeacon 11. iBeacon? Bluetooth LE GPS128bit16major/minor 11UUIDPaypal Beacon 12. iOSiBeacon CoreLocationiOS : : iOS 30m1m 13. PassbookiBeacon 14. Ad Ad AdAd AdAdBLE Android 15. http://www.ti.com/tool/cc2540emk-usb http://www.tij.co.jp/tool/jp/packet-snier 16. 02 01 1A AD Type 0x01, ag, General Discoverable Mode, Simultaneous LE and BR/EDR toSame Device Capable (Controller) Simultaneous LE and BR/EDR to Same Device Capable (Host) 17. ! 1A FFUUID, major, minor, RSSI RSSI-59dBm (1mRSSI)4C 0002 15AD Type|ID | |00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EC 4A 17 A5 C5UUID|major|minior|RSSI 18. iBeacon+iOS 19. iBeacon https://github.com/reinforce-lab/ CoreBluetooth_sampleshttp://www.slideshare.net/reinforcelab/()http://reinforce-lab.github.io/blog/2013/10/21/ibeacon/ 20. iOS CoreLocation 21. 1. 2. 3. / 22. 1. [CLLocationManager isMonitoringAvailableForClass: [CLBeaconRegion class]]iOS7 iPhone4Bluetooth LE 23. 2. CLBeaconRegion *region = [[CLBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:kBeaconUUID] identier:@ identier ]; !CLBeaconRegion BOOL notifyOnEntry : in, YES BOOL notifyOnExit : exit, YES BOOL notifyEntryStateOnDisplay : , NO 24. 3. / locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; ![locationManager startMonitoringForRegion:region]; [locationManager stopMonitoringForRegion:region]; ! CLBeaconRegion BOOL notifyOnEntry : in, YES BOOL notifyOnExit : exit, YES BOOL notifyEntryStateOnDisplay : , NOCLLocationManagerDelegate -(void)locationManager:didEnterRegion: -(void)locationManager:didExitRegion: -(void)locationManager:didDetermineState:forRegion: 25. (1/2) UUIDmajor/minor 120 (iOS 7.0.2)in/exit notifyOnEntryYESinnotifyOnExitYESexit 20200m (3550) inCLLocation Manager, - (void)requestStateForRegion: 26. (2/2) notifyEntryStateOnDisplayYES iOSterminated background 27. / (10) in/exit iPhone4s 150%, iPhone5 (7.0.2) notifyEntryStateOnDisplayiPhone4s/ ()Passbook 28. UUIDmajor/minor11 3 29. DetectorViewController.m 30. start/stop ONON (7.0.4) () () 31. CoreBluetoothCLBeaconRegion OS X 32. PassbookiBeacon Passbook Package Format Referencehttps://developer.apple.com/library/ios/documentation/UserExperience/ Reference/PassKit_Bundle/Chapters/Introduction.html iOS7 UUID/major/minor 33. iBeacon AndroidiBeacon? ? (API Level: 18. Android 4.3)AppleiBeacon? 34. iBeacon iBeacon CoreBluetoothApple Passbook 35. iBeacon JRiOS7.1 36. http://estimote.comhttps://www.sticknnd.com 37. Apple Notication Center Service !ANCS 38. ANCS iOSBLE /iWatch 39. ANCS Apple https://developer.apple.com/library/ios/documentation/ CoreBluetooth/Reference/ AppleNoticationCenterServiceSpecication/ http://reinforce-lab.github.io/blog/2013/10/28/ancs/ https://github.com/reinforce-lab/ CoreBluetooth_samples/tree/master/ANCS/ 40. ANCS iOS7 ANCSiOS iOSiOS7iOSiOS6 41. (Appcessory) Application + Accessory 42. http://www.tbit.com/jp 43. Appcessory 10,000 50% 30%20%20%2000 44. 45. http://getpebble.comhttp://www.lumoback.comhttp://www.kickstarter.comhttp://www.wahootness.com 46. http://www.haxlr8r.com pronounced Hackccelerator 47. iPhone SensorTag, Konashi, RFduino Bluetooth 48. http://goo.gl/d3HUL 49. TI Sensor taghttp://www.ti.com/tool/ cc2541dk-sensorIR temperature SensorHumidity SensorPressure SensorAccelerometerGyroscopeMagnetometer 50. Konashihttp://konashi.ux-xu.com 51. RFduinohttp://www.rfduino.com 52. RF (1)Bluetooth (1) 500 500http://www.bluegiga.com/ BLE112_Bluetooth_Smart_module 53. (iBeacon) = iOS(BTserver) (iOS) () 54. CoreBlutooth / , , 55. 1 iPhone10 (Central) (Peripheral) 56. AdAd20 1.3AdAd 57. 58. 59. 60. Bluetooth LE iOS (WiFi)(20)() Bluetooth 61. iOS Central : https://github.com/reinforce-lab/CoreBluetooth_samples/tree/master/ BSHSBTPT01_samples 62. @import CoreBluetoothCBCentralManagerDelegateCBPeripheralDelegateCBCentralManager (Central) (Peripheral)CBPeripheral 63. CBCentralManager CBCentralManager initWithDelegate:queue:options: CBCentralManagerOptionShowPowerAlertKey; Bluetooth OFF NOCBCentralManagerOptionRestoreIdentierKey; 64. Bluetooth centralManagerDidUpdateState:CBCentralManagerStatePoweredOff CBCentralManagerStatePoweredOn CBCentralManagerStateUnauthorized CBCentralManagerStateUnsupported 65. CBCentralManager, scanForPeripheralsWithServices:options: CBCentralManagerScanOptionAllowDuplicatesKeyNO 66. // // // advertisementData - (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)p advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI { // UUID // !!!! iOS6UUIDnilUUIDUUID /* CBUUID *targetUUID = [CBUUID UUIDWithString:@"00000000-0000-0000-2F0C-F0289947EA35"]; if(peripheral.UUID == nil || ! [[CBUUID UUIDWithCFUUID:peripheral.UUID].data isEqualToData:targetUUID.data]) return; */ NSString *localName = [advertisementData objectForKey:CBAdvertisementDataLocalNameKey]; if(localName != nil && [localName isEqualToString:kTargetDeviceName] ) { PeripheralContainer *c = [[PeripheralContainer alloc] init]; c.peripheral = p; c.RSSI = RSSI; [self findPeripheral:c]; } }KeyFobController.m 318 67. (1/1) CBAdvertisementDataLocalNameKeyCBAdvertisementDataTxPowerLevelKeyiPhoneRSSIiBeacon 68. (2/2) CBPeripheral nil identier : 128-bit (NSUUID)iPhoneRSSI : readRSSI: nilidentier 69. 70. -(void)connect:(PeripheralContainer *)c { // //peripheralcentral managerretain//peripheral// centralManager:didFailToConnectPeripheral:error//peripheral cancelPeripheralConnection !self.peripheral = c.peripheral; [_centralManager connectPeripheral:self.peripheral options:nil];} -(void)disconnect { // _peripheralnil // centralManager:didDisconnectPeripheral:error: // [_centralManager cancelPeripheralConnection:self.peripheral]; }- (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)p; - (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral: (CBPeripheral *)peripheral error:(NSError *)error;KeyFobController.m 256delegate 71. ! 72. Applications Applications Applications Core BluetoothBTserver GATT ATT L2CAPPHYGATT: Generic Attribute ProleLink LayerATT: Attribute ProtocolL2CAP: Logical Link Control and Adaptation Protocol 73. = Applications Applications Applications Core Bluetooth = BTserver //()/GATT ATT L2CAPPHYGATT: Generic Attribute ProleLink LayerATT: Attribute ProtocolL2CAP: Logical Link Control and Adaptation Protocol 74. () Find MEProleProximityProle ImmediateAlert Service Tx Power Service Link LossAlert Service http://developer.bluetooth.org/gatt/proles/Pages/ProleViewer.aspx?u=org.bluetooth.prole.nd_me.xml 75. 76. http://goo.gl/oYjrc 77. UUID 16-bit / 128-bit (read)/(write)/(notify) 78. ! 79. #define kImmediateAlertServiceUUID @"1802" #define kLinkLossServiceUUID @"1803" #define kAlertLevelUUID @"2A06" ... _linkLossServiceUUID = [CBUUID UUIDWithString:kLinkLossServiceUUID]; _immediateAlertServiceUUID = [CBUUID UUIDWithString:kImmediateAlertServiceUUID]; _alertLevelUUID = [CBUUID UUIDWithString:kAlertLevelUUID];KeyFobController.m 104 // - (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)p { // self.peripheral.delegate = self; [p discoverServices:[NSArray arrayWithObjects: _linkLossServiceUUID, _immediateAlertServiceUUID, _txPowerServiceUUID, _batteryLevelServiceUUID, nil]]; }KeyFobController.m 343 80. //Characteristics - (void)peripheral:(CBPeripheral *)p didDiscoverServices:(NSError *)error { for (CBService *service in p.services) { if ([service.UUID.data isEqualToData:_linkLossServiceUUID.data]) { [p discoverCharacteristics:[NSArray arrayWithObjects: _alertLevelUUID, nil] forService:service]; } else if ([service.UUID.data isEqualToData:_immediateAlertServiceUUID.data]) { [p discoverCharacteristics:[NSArray arrayWithObjects: _alertLevelUUID, nil] forService:service];KeyFobController.m 367 - (void)peripheral:(CBPeripheral *)p didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error { if ([service.UUID.data isEqualToData:_batteryLevelServiceUUID.data]) { _batteryLevelCharacteristics = [self findCharacteristics:service.characteristics uuid:_batteryLevelUUID]; _batteryLevelSwitchCharacteristics = [self findCharacteristics:service.characteristics uuid:_batteryLevelSwitchUUID]; [p setNotifyValue:YES forCharacteristic:_batteryLevelSwitchCharacteristics]; [p readValueForCharacteristic:_batteryLevelCharacteristics]; [p readValueForCharacteristic:_batteryLevelSwitchCharacteristics]; } }KeyFobController.m 396 81. 82. KeyFobController.m 410KeyFobController.m 429 83. KeyFobController.m 241 KeyFobController.m 419 84. 121 / 85. WF-BTLE https://www.facebook.com/groups/ 563064710384459/ 86. 87. 88. Apple https://developer.apple.com/videos/wwdc/ 2012/ Session 703: Core Bluetooth 101 Session 705 Advanced Core Bluetooth Apple Bluetooth Mailing list https://lists.apple.com/mailman/listinfo/ bluetooth-dev 89. AppleBluetoothBluetooth Low Energy Handbook http://www.amazon.co.jp/Bluetooth-Low-EnergyDevelopers-ebook/dp/B009XDA1G8/ Building iPhone and iPad Electronic Projects http://shop.oreilly.com/product/0636920029281.do Bluetooth4 Core Specicaiton () 90. Texus Instruments http://www.tij.co.jp/product/jp/cc2540http://processors.wiki.ti.com/index.php/ Category:BluetoothLE?DCMP=blestack&HQS=ble-wiki Nordic Semiconductor https://www.nordicsemi.com BlueGiga http://www.bluegiga.com 91. Facebook BTLE https://www.facebook.com/groups/ 563064710384459/ Kickstarter ? http://www.kickstarter.com/discover/ recently-launched 92. iBeacon https://db.tt/S0Wp3U8q (Dropbox zip) http://goo.gl/8DqaVK (Github) iBeacon/simpleBeacon.xcodeprojXcode5BLE 93. ()Bluetooth LE 94. ReginON RangingON ?! :UUID/Major/Minor Proximity: RSSI ( dBm) Accuracy:(m) 95. SW() 96. Bluetooth LE iOS iOS30 Bluetooth LE 97. iTunes 98. Passbook 99. Passbook(1/2) URL https://pass.is/1B7fvaX1VrrZMqn 100. Passbook(2/2) 101.