SlideShare a Scribd company logo
HomeKit Framework
Carlos Raventos
Martial Lienert
Produits MFi
Station météo
Caméras : Welcome, Presence
+ HomeKit
Thermostat
Healthy Home Coach
Plan
Finalité
Technologies impliquées, spécificités
Configuration initiale d’un accessoire
Contrôle
Retour d’expérience
Finalité
Concerne les accessoires de contrôle de la maison : Thermostats, Prises,
Interrupteurs, Ampoules, Fenêtres, volets, sensors, etc.
Coordonner et contrôler des accessoires de différents fabricants, avec :
➔Apps tierces iOS, watchOS, tvOS : Framework Homekit
➔Siri
➔Apple Home : automations
Technologies impliquées
Base de données partagée : iCloud (structure de la maison, nommage)
Clés cryptographiques partagées à travers iCloud Keychain
HomeKit Accessory Protocol : entre un contrôleur (iPhone, Apple TV) et un
accessoire (BLE, IP)
Framework : Découverte, contrôle, monitoring accessoires
Spécificités
Pas de compte utilisateur à créer
Pas de serveur tiers
Securité end to end:
➔Clés stockées seulement dans iOS et l’accessoire
➔Un seul master
Accès distant avec Apple TV et iPad
Hiérarchie de données
HMHome
HMRoom
HMAccessory
HMService
HMCharacteristic
Configuration initiale
WiFi
Créer/choisir une maison
Appairage Homekit
Créer/choisir une pièce
Nommer les services contrôlables
WiFi avant iOS 10 : EAWiFiUnconfiguredAccessoryBrowser
let externalAccessoryBrowser = EAWiFiUnconfiguredAccessoryBrowser(delegate: self, queue: dispatch_get_main_queue())
externalAccessoryBrowser.startSearchingForUnconfiguredAccessoriesMatchingPredicate(nil)
// MARK: EAWiFiUnconfiguredAccessoryBrowserDelegate Methods
func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser, didFindUnconfiguredAccessories accessories:
Set<EAWiFiUnconfiguredAccessory>) {
}
func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser, didRemoveUnconfiguredAccessories accessories:
Set<EAWiFiUnconfiguredAccessory>) {
}
func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser, didUpdateState state:
EAWiFiUnconfiguredAccessoryBrowserState) {
}
func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser, didFinishConfiguringAccessory accessory:
EAWiFiUnconfiguredAccessory, withStatus status: EAWiFiUnconfiguredAccessoryConfigurationStatus) {
if status == .Success {
// store accessory name and proceed to add to HMHome
}
}
externalAccessoryBrowser.configureAccessory(accessory, withConfigurationUIOnViewController: self)
WiFi depuis iOS 10 : HMAccessoryBrowser
let accessoryBrowser = HMAccessoryBrowser()
accessoryBrowser.delegate = self
accessoryBrowser.startSearchingForNewAccessories()
// MARK: HMAccessoryBrowserDelegate Methods
func accessoryBrowser(browser: HMAccessoryBrowser, didFindNewAccessory accessory: HMAccessory) {
}
func accessoryBrowser(browser: HMAccessoryBrowser, didRemoveNewAccessory accessory: HMAccessory) {
}
var home: HMHome? = HMHomeManager().primaryHome
home?.addAccessory(accessory) { error in
if let error = error {
// handle error
} else {
// Once it's successfully added to the home, add it to the room that's selected.
}
}
Appairage HomeKit : HMAccessoryBrowser
Créer/choisir une pièce
//func home(home: HMHome, assignAccessory accessory: HMAccessory, toRoom room: HMRoom) {
home.assignAccessory(accessory, toRoom: room) { error in
if let error = error {
//displayError(error)
} else {
//update view
}
//}
Nommer les services
//func updateName(name: String, forAccessory accessory: HMAccessory) {
accessory.updateName(name) { error in
if let error = error {
//displayError(error)
} else {
//update view
}
//}
Observe Home Database updates
public protocol HMHomeManagerDelegate : NSObjectProtocol {
optional public func homeManagerDidUpdateHomes(_ manager: HMHomeManager)
optional public func homeManagerDidUpdatePrimaryHome(_ manager: HMHomeManager)
optional public func homeManager(_ manager: HMHomeManager, didAddHome: HMHome)
optional public func homeManager(_ manager: HMHomeManager, didRemoveHome: HMHome)
}
Observe Home Database updates
public protocol HMHomeDelegate : NSObjectProtocol {
optional public func homeDidUpdateName(_ home: HMHome)
optional public func home(_ home: HMHome, didAddAccessory: HMAccessory)
optional public func home(_ home: HMHome, didRemoveAccessory: HMAccessory)
optional public func home(_ home: HMHome, didUpdateRoom: HMRoom, forAccessory: HMAccessory)
optional public func home(_ home: HMHome, didAddRoom: HMRoom)
optional public func home(_ home: HMHome, didRemoveRoom: HMRoom)
// (... a lot more)
}
Observe Home Database updates
public protocol HMHomeDelegate : NSObjectProtocol {
optional public func homeDidUpdateName(_ home: HMHome)
optional public func home(_ home: HMHome, didAddAccessory: HMAccessory)
optional public func home(_ home: HMHome, didRemoveAccessory: HMAccessory)
optional public func home(_ home: HMHome, didUpdateRoom: HMRoom, forAccessory: HMAccessory)
optional public func home(_ home: HMHome, didAddRoom: HMRoom)
optional public func home(_ home: HMHome, didRemoveRoom: HMRoom)
// (... a lot more)
}
// Notifications are only received
// if the database is modified by
// another device/app !
Contrôle de l’accessoire
Actions possibles:
Lire une caractéristique
Ecrire une caractéristique
Ecouter les notifications
Créer des scènes (écritures groupées de caractéristiques)
Triggers (Réagir aux changements de valeur des caractéristiques)
Contrôle de l’accessoire
import HomeKit
var lightBulb: HMAccessory?
// Get the PowerState characteristic through the LightBulb service
let lightBulbOn = lightBulb?.services.first(where: { (service) -> Bool in
service.serviceType == HMServiceTypeLightbulb
})?.characteristics.first(where: { (characteristic) -> Bool in
characteristic.characteristicType == HMCharacteristicTypePowerState
})
Lecture d’une caractéristique
// func readValue(completionHandler completion: @escaping (Error?) -> Void)
// var value: Any? { get }
lightBulbOn?.readValue(completionHandler: { (error) in
if let error = error {
// Handle the error
} else if let isOn = lightBulbOn?.value as? Bool {
print("Light bulb is (isOn ? "ON" : "OFF")")
}
})
Ecriture d’une caractéristique
// func writeValue(_ value: Any?, completionHandler completion: @escaping (Error?) -> Void)
lightBulbOn?.writeValue(false, completionHandler: { (error) in
if let error = error {
// Handle the error
} else {
print("Light bulb is OFF")
}
})
Notifications
// func enableNotification(_ enable: Bool, completionHandler completion: @escaping (Error?) -> Void)
lightBulbOn?.enableNotification(true, completionHandler: { (error) in
if let error = error {
// Handle error
} else {
print("Notifications are enabled")
}
})
class AccDelegate : NSObject, HMAccessoryDelegate {
public func accessory(_ accessory: HMAccessory, service: HMService, didUpdateValueForCharacteristic: HMCharacteristic) {
if let isOn = characteristic.value as? Bool {
print("Light bulb is now (isOn ? "ON" : "OFF")")
}
}
}
let delegate = AccDelegate()
lightBulb?.delegate = delegate;

More Related Content

What's hot

Callbacks and control flow in Node js
Callbacks and control flow in Node jsCallbacks and control flow in Node js
Callbacks and control flow in Node js
Thomas Roch
 
New Design of OneRing
New Design of OneRingNew Design of OneRing
New Design of OneRing
Qiangning Hong
 
Understanding Asynchronous JavaScript
Understanding Asynchronous JavaScriptUnderstanding Asynchronous JavaScript
Understanding Asynchronous JavaScript
jnewmanux
 
Callbacks, promises, generators - asynchronous javascript
Callbacks, promises, generators - asynchronous javascriptCallbacks, promises, generators - asynchronous javascript
Callbacks, promises, generators - asynchronous javascript
Łukasz Kużyński
 
Containers & Dependency in Ember.js
Containers & Dependency in Ember.jsContainers & Dependency in Ember.js
Containers & Dependency in Ember.js
Matthew Beale
 
ES6: The Awesome Parts
ES6: The Awesome PartsES6: The Awesome Parts
ES6: The Awesome Parts
Domenic Denicola
 
Talk KVO with rac by Philippe Converset
Talk KVO with rac by Philippe ConversetTalk KVO with rac by Philippe Converset
Talk KVO with rac by Philippe Converset
CocoaHeads France
 
Asynchronous programming done right - Node.js
Asynchronous programming done right - Node.jsAsynchronous programming done right - Node.js
Asynchronous programming done right - Node.js
Piotr Pelczar
 
Map kit light
Map kit lightMap kit light
Map kit light
CocoaHeads France
 
HomeKit Inside And Out
HomeKit Inside And OutHomeKit Inside And Out
HomeKit Inside And Out
Rolf Rando
 
Promise pattern
Promise patternPromise pattern
Promise pattern
Sebastiaan Deckers
 
Declarative UIs with Jetpack Compose
Declarative UIs with Jetpack ComposeDeclarative UIs with Jetpack Compose
Declarative UIs with Jetpack Compose
Ramon Ribeiro Rabello
 
Promises, Promises
Promises, PromisesPromises, Promises
Promises, Promises
Domenic Denicola
 
How to send gzipped requests with boto3
How to send gzipped requests with boto3How to send gzipped requests with boto3
How to send gzipped requests with boto3
Luciano Mammino
 
JavaScript Promise
JavaScript PromiseJavaScript Promise
JavaScript Promise
Joseph Chiang
 
Javascript Promises/Q Library
Javascript Promises/Q LibraryJavascript Promises/Q Library
Javascript Promises/Q Library
async_io
 
Intro to Ember.JS 2016
Intro to Ember.JS 2016Intro to Ember.JS 2016
Intro to Ember.JS 2016
Sandino Núñez
 
React native-firebase startup-mtup
React native-firebase startup-mtupReact native-firebase startup-mtup
React native-firebase startup-mtup
t k
 
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c HermioneJS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
JSFestUA
 
Angular promises and http
Angular promises and httpAngular promises and http
Angular promises and http
Alexe Bogdan
 

What's hot (20)

Callbacks and control flow in Node js
Callbacks and control flow in Node jsCallbacks and control flow in Node js
Callbacks and control flow in Node js
 
New Design of OneRing
New Design of OneRingNew Design of OneRing
New Design of OneRing
 
Understanding Asynchronous JavaScript
Understanding Asynchronous JavaScriptUnderstanding Asynchronous JavaScript
Understanding Asynchronous JavaScript
 
Callbacks, promises, generators - asynchronous javascript
Callbacks, promises, generators - asynchronous javascriptCallbacks, promises, generators - asynchronous javascript
Callbacks, promises, generators - asynchronous javascript
 
Containers & Dependency in Ember.js
Containers & Dependency in Ember.jsContainers & Dependency in Ember.js
Containers & Dependency in Ember.js
 
ES6: The Awesome Parts
ES6: The Awesome PartsES6: The Awesome Parts
ES6: The Awesome Parts
 
Talk KVO with rac by Philippe Converset
Talk KVO with rac by Philippe ConversetTalk KVO with rac by Philippe Converset
Talk KVO with rac by Philippe Converset
 
Asynchronous programming done right - Node.js
Asynchronous programming done right - Node.jsAsynchronous programming done right - Node.js
Asynchronous programming done right - Node.js
 
Map kit light
Map kit lightMap kit light
Map kit light
 
HomeKit Inside And Out
HomeKit Inside And OutHomeKit Inside And Out
HomeKit Inside And Out
 
Promise pattern
Promise patternPromise pattern
Promise pattern
 
Declarative UIs with Jetpack Compose
Declarative UIs with Jetpack ComposeDeclarative UIs with Jetpack Compose
Declarative UIs with Jetpack Compose
 
Promises, Promises
Promises, PromisesPromises, Promises
Promises, Promises
 
How to send gzipped requests with boto3
How to send gzipped requests with boto3How to send gzipped requests with boto3
How to send gzipped requests with boto3
 
JavaScript Promise
JavaScript PromiseJavaScript Promise
JavaScript Promise
 
Javascript Promises/Q Library
Javascript Promises/Q LibraryJavascript Promises/Q Library
Javascript Promises/Q Library
 
Intro to Ember.JS 2016
Intro to Ember.JS 2016Intro to Ember.JS 2016
Intro to Ember.JS 2016
 
React native-firebase startup-mtup
React native-firebase startup-mtupReact native-firebase startup-mtup
React native-firebase startup-mtup
 
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c HermioneJS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
 
Angular promises and http
Angular promises and httpAngular promises and http
Angular promises and http
 

Viewers also liked

What's new in iOS9
What's new in iOS9What's new in iOS9
What's new in iOS9
CocoaHeads France
 
Make Acccessibility Great Again
Make Acccessibility Great AgainMake Acccessibility Great Again
Make Acccessibility Great Again
Geoffrey Goutallier
 
Quoi de neuf dans iOS 10.3
Quoi de neuf dans iOS 10.3Quoi de neuf dans iOS 10.3
Quoi de neuf dans iOS 10.3
CocoaHeads France
 
L'intégration continue avec Bitrise
L'intégration continue avec BitriseL'intégration continue avec Bitrise
L'intégration continue avec Bitrise
CocoaHeads France
 
La sécurité sur iOS par Arnaud de Bock
La sécurité sur iOS par Arnaud de BockLa sécurité sur iOS par Arnaud de Bock
La sécurité sur iOS par Arnaud de Bock
Nicolas Lourenço
 
BitTorrent on iOS
BitTorrent on iOSBitTorrent on iOS
BitTorrent on iOS
CocoaHeads France
 
CloudKit as a backend
CloudKit as a backendCloudKit as a backend
CloudKit as a backend
CocoaHeads France
 
Comment faire de HLS votre solution vidéo préférée ?
Comment faire de HLS votre solution vidéo préférée ?Comment faire de HLS votre solution vidéo préférée ?
Comment faire de HLS votre solution vidéo préférée ?
CocoaHeads France
 
Project Entourage
Project EntourageProject Entourage
Project Entourage
CocoaHeads France
 
Rebranding an ios application
Rebranding an ios applicationRebranding an ios application
Rebranding an ios application
CocoaHeads France
 
J'ai fait une app native en React Native
J'ai fait une app native en React NativeJ'ai fait une app native en React Native
J'ai fait une app native en React Native
CocoaHeads France
 
Alamofire
AlamofireAlamofire
Design like a developer
Design like a developerDesign like a developer
Design like a developer
CocoaHeads France
 
Monads in Swift
Monads in SwiftMonads in Swift
Monads in Swift
Vincent Pradeilles
 
Chainable datasource
Chainable datasourceChainable datasource
Chainable datasource
CocoaHeads France
 
MVC-RS par Grégoire Lhotelier
MVC-RS par Grégoire LhotelierMVC-RS par Grégoire Lhotelier
MVC-RS par Grégoire Lhotelier
CocoaHeads France
 
Handle the error
Handle the errorHandle the error
Handle the error
CocoaHeads France
 
SwiftyGPIO
SwiftyGPIOSwiftyGPIO
SwiftyGPIO
CocoaHeads France
 
Programme MFI retour d'expérience
Programme MFI retour d'expérienceProgramme MFI retour d'expérience
Programme MFI retour d'expérience
CocoaHeads France
 
How to communicate with Smart things?
How to communicate with Smart things?How to communicate with Smart things?
How to communicate with Smart things?
CocoaHeads France
 

Viewers also liked (20)

What's new in iOS9
What's new in iOS9What's new in iOS9
What's new in iOS9
 
Make Acccessibility Great Again
Make Acccessibility Great AgainMake Acccessibility Great Again
Make Acccessibility Great Again
 
Quoi de neuf dans iOS 10.3
Quoi de neuf dans iOS 10.3Quoi de neuf dans iOS 10.3
Quoi de neuf dans iOS 10.3
 
L'intégration continue avec Bitrise
L'intégration continue avec BitriseL'intégration continue avec Bitrise
L'intégration continue avec Bitrise
 
La sécurité sur iOS par Arnaud de Bock
La sécurité sur iOS par Arnaud de BockLa sécurité sur iOS par Arnaud de Bock
La sécurité sur iOS par Arnaud de Bock
 
BitTorrent on iOS
BitTorrent on iOSBitTorrent on iOS
BitTorrent on iOS
 
CloudKit as a backend
CloudKit as a backendCloudKit as a backend
CloudKit as a backend
 
Comment faire de HLS votre solution vidéo préférée ?
Comment faire de HLS votre solution vidéo préférée ?Comment faire de HLS votre solution vidéo préférée ?
Comment faire de HLS votre solution vidéo préférée ?
 
Project Entourage
Project EntourageProject Entourage
Project Entourage
 
Rebranding an ios application
Rebranding an ios applicationRebranding an ios application
Rebranding an ios application
 
J'ai fait une app native en React Native
J'ai fait une app native en React NativeJ'ai fait une app native en React Native
J'ai fait une app native en React Native
 
Alamofire
AlamofireAlamofire
Alamofire
 
Design like a developer
Design like a developerDesign like a developer
Design like a developer
 
Monads in Swift
Monads in SwiftMonads in Swift
Monads in Swift
 
Chainable datasource
Chainable datasourceChainable datasource
Chainable datasource
 
MVC-RS par Grégoire Lhotelier
MVC-RS par Grégoire LhotelierMVC-RS par Grégoire Lhotelier
MVC-RS par Grégoire Lhotelier
 
Handle the error
Handle the errorHandle the error
Handle the error
 
SwiftyGPIO
SwiftyGPIOSwiftyGPIO
SwiftyGPIO
 
Programme MFI retour d'expérience
Programme MFI retour d'expérienceProgramme MFI retour d'expérience
Programme MFI retour d'expérience
 
How to communicate with Smart things?
How to communicate with Smart things?How to communicate with Smart things?
How to communicate with Smart things?
 

Similar to Présentation de HomeKit

JavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the PlatformJavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the Platform
Robert Nyman
 
Apache FTP Server Integration
Apache FTP Server IntegrationApache FTP Server Integration
Apache FTP Server Integration
WO Community
 
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiGrâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Jérémy Derussé
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for Joomla
Luke Summerfield
 
vite-en.pdf
vite-en.pdfvite-en.pdf
vite-en.pdf
ssuser65180a
 
A First Date With Scala
A First Date With ScalaA First Date With Scala
A First Date With Scala
Franco Lombardo
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingeXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction Training
Hoat Le
 
JavaScript Basics
JavaScript BasicsJavaScript Basics
JavaScript Basics
Mats Bryntse
 
A Series of Fortunate Events - PHP Benelux Conference 2015
A Series of Fortunate Events - PHP Benelux Conference 2015A Series of Fortunate Events - PHP Benelux Conference 2015
A Series of Fortunate Events - PHP Benelux Conference 2015
Matthias Noback
 
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W... 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Robert Nyman
 
Drupal 8 Every Day: An Intro to Developing With Drupal 8
Drupal 8 Every Day: An Intro to Developing With Drupal 8Drupal 8 Every Day: An Intro to Developing With Drupal 8
Drupal 8 Every Day: An Intro to Developing With Drupal 8
Acquia
 
Presentation - Windows App Development - II - Mr. Chandan Gupta
Presentation - Windows App Development - II - Mr. Chandan GuptaPresentation - Windows App Development - II - Mr. Chandan Gupta
Presentation - Windows App Development - II - Mr. Chandan Gupta
MobileNepal
 
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years laterSymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
Haehnchen
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidence
John Congdon
 
22Flutter.pdf
22Flutter.pdf22Flutter.pdf
22Flutter.pdf
dbaman
 
Baruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion WorkshopBaruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion Workshop
Brian Sam-Bodden
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
ciklum_ods
 
Using FakeIteasy
Using FakeIteasyUsing FakeIteasy
Using FakeIteasy
Dror Helper
 
MCE^3 - Gregory Kick - Dagger 2
MCE^3 - Gregory Kick - Dagger 2 MCE^3 - Gregory Kick - Dagger 2
MCE^3 - Gregory Kick - Dagger 2
PROIDEA
 
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
Wim Selles
 

Similar to Présentation de HomeKit (20)

JavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the PlatformJavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the Platform
 
Apache FTP Server Integration
Apache FTP Server IntegrationApache FTP Server Integration
Apache FTP Server Integration
 
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiGrâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for Joomla
 
vite-en.pdf
vite-en.pdfvite-en.pdf
vite-en.pdf
 
A First Date With Scala
A First Date With ScalaA First Date With Scala
A First Date With Scala
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingeXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction Training
 
JavaScript Basics
JavaScript BasicsJavaScript Basics
JavaScript Basics
 
A Series of Fortunate Events - PHP Benelux Conference 2015
A Series of Fortunate Events - PHP Benelux Conference 2015A Series of Fortunate Events - PHP Benelux Conference 2015
A Series of Fortunate Events - PHP Benelux Conference 2015
 
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W... 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 
Drupal 8 Every Day: An Intro to Developing With Drupal 8
Drupal 8 Every Day: An Intro to Developing With Drupal 8Drupal 8 Every Day: An Intro to Developing With Drupal 8
Drupal 8 Every Day: An Intro to Developing With Drupal 8
 
Presentation - Windows App Development - II - Mr. Chandan Gupta
Presentation - Windows App Development - II - Mr. Chandan GuptaPresentation - Windows App Development - II - Mr. Chandan Gupta
Presentation - Windows App Development - II - Mr. Chandan Gupta
 
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years laterSymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidence
 
22Flutter.pdf
22Flutter.pdf22Flutter.pdf
22Flutter.pdf
 
Baruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion WorkshopBaruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion Workshop
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
Using FakeIteasy
Using FakeIteasyUsing FakeIteasy
Using FakeIteasy
 
MCE^3 - Gregory Kick - Dagger 2
MCE^3 - Gregory Kick - Dagger 2 MCE^3 - Gregory Kick - Dagger 2
MCE^3 - Gregory Kick - Dagger 2
 
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
 

More from CocoaHeads France

Mutation testing for a safer Future
Mutation testing for a safer FutureMutation testing for a safer Future
Mutation testing for a safer Future
CocoaHeads France
 
iOS App Group for Debugging
iOS App Group for DebuggingiOS App Group for Debugging
iOS App Group for Debugging
CocoaHeads France
 
Asynchronous swift
Asynchronous swiftAsynchronous swift
Asynchronous swift
CocoaHeads France
 
Visual accessibility in iOS11
Visual accessibility in iOS11Visual accessibility in iOS11
Visual accessibility in iOS11
CocoaHeads France
 
My script - One year of CocoaHeads
My script - One year of CocoaHeadsMy script - One year of CocoaHeads
My script - One year of CocoaHeads
CocoaHeads France
 
Ui testing dealing with push notifications
Ui testing dealing with push notificationsUi testing dealing with push notifications
Ui testing dealing with push notifications
CocoaHeads France
 
CONTINUOUS DELIVERY WITH FASTLANE
CONTINUOUS DELIVERY WITH FASTLANECONTINUOUS DELIVERY WITH FASTLANE
CONTINUOUS DELIVERY WITH FASTLANE
CocoaHeads France
 
Super combinators
Super combinatorsSuper combinators
Super combinators
CocoaHeads France
 
Build a lego app with CocoaPods
Build a lego app with CocoaPodsBuild a lego app with CocoaPods
Build a lego app with CocoaPods
CocoaHeads France
 
Un retour d'expérience sur Apple Pay
Un retour d'expérience sur Apple PayUn retour d'expérience sur Apple Pay
Un retour d'expérience sur Apple Pay
CocoaHeads France
 
Firebase par nicolas lehovetzki
Firebase par nicolas lehovetzkiFirebase par nicolas lehovetzki
Firebase par nicolas lehovetzki
CocoaHeads France
 
Safari app extensions cleared up by Sanaa Squalli
Safari app extensions cleared up by Sanaa SqualliSafari app extensions cleared up by Sanaa Squalli
Safari app extensions cleared up by Sanaa Squalli
CocoaHeads France
 

More from CocoaHeads France (12)

Mutation testing for a safer Future
Mutation testing for a safer FutureMutation testing for a safer Future
Mutation testing for a safer Future
 
iOS App Group for Debugging
iOS App Group for DebuggingiOS App Group for Debugging
iOS App Group for Debugging
 
Asynchronous swift
Asynchronous swiftAsynchronous swift
Asynchronous swift
 
Visual accessibility in iOS11
Visual accessibility in iOS11Visual accessibility in iOS11
Visual accessibility in iOS11
 
My script - One year of CocoaHeads
My script - One year of CocoaHeadsMy script - One year of CocoaHeads
My script - One year of CocoaHeads
 
Ui testing dealing with push notifications
Ui testing dealing with push notificationsUi testing dealing with push notifications
Ui testing dealing with push notifications
 
CONTINUOUS DELIVERY WITH FASTLANE
CONTINUOUS DELIVERY WITH FASTLANECONTINUOUS DELIVERY WITH FASTLANE
CONTINUOUS DELIVERY WITH FASTLANE
 
Super combinators
Super combinatorsSuper combinators
Super combinators
 
Build a lego app with CocoaPods
Build a lego app with CocoaPodsBuild a lego app with CocoaPods
Build a lego app with CocoaPods
 
Un retour d'expérience sur Apple Pay
Un retour d'expérience sur Apple PayUn retour d'expérience sur Apple Pay
Un retour d'expérience sur Apple Pay
 
Firebase par nicolas lehovetzki
Firebase par nicolas lehovetzkiFirebase par nicolas lehovetzki
Firebase par nicolas lehovetzki
 
Safari app extensions cleared up by Sanaa Squalli
Safari app extensions cleared up by Sanaa SqualliSafari app extensions cleared up by Sanaa Squalli
Safari app extensions cleared up by Sanaa Squalli
 

Recently uploaded

Empowering Businesses with Intelligent Software Solutions - Grawlix
Empowering Businesses with Intelligent Software Solutions - GrawlixEmpowering Businesses with Intelligent Software Solutions - Grawlix
Empowering Businesses with Intelligent Software Solutions - Grawlix
Aarisha Shaikh
 
A Step-by-Step Guide to Selecting the Right Automated Software Testing Tools.pdf
A Step-by-Step Guide to Selecting the Right Automated Software Testing Tools.pdfA Step-by-Step Guide to Selecting the Right Automated Software Testing Tools.pdf
A Step-by-Step Guide to Selecting the Right Automated Software Testing Tools.pdf
kalichargn70th171
 
AI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdf
AI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdfAI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdf
AI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdf
Daniel Zivkovic
 
Hotel Management Software Development Company
Hotel Management Software Development CompanyHotel Management Software Development Company
Hotel Management Software Development Company
XongoLab Technologies LLP
 
Fantastic Design Patterns and Where to use them No Notes.pdf
Fantastic Design Patterns and Where to use them No Notes.pdfFantastic Design Patterns and Where to use them No Notes.pdf
Fantastic Design Patterns and Where to use them No Notes.pdf
6m9p7qnjj8
 
Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...
Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...
Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...
rachitkumar09887
 
Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...
Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...
Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...
3610stuck
 
Applitools Autonomous 2.0 Sneak Peek.pdf
Applitools Autonomous 2.0 Sneak Peek.pdfApplitools Autonomous 2.0 Sneak Peek.pdf
Applitools Autonomous 2.0 Sneak Peek.pdf
Applitools
 
Mobile App Development Company in Noida - Drona Infotech.
Mobile App Development Company in Noida - Drona Infotech.Mobile App Development Company in Noida - Drona Infotech.
Mobile App Development Company in Noida - Drona Infotech.
Mobile App Development Company in Noida - Drona Infotech
 
Celebrity Girls Call Mumbai 🛵🚡9910780858 💃 Choose Best And Top Girl Service A...
Celebrity Girls Call Mumbai 🛵🚡9910780858 💃 Choose Best And Top Girl Service A...Celebrity Girls Call Mumbai 🛵🚡9910780858 💃 Choose Best And Top Girl Service A...
Celebrity Girls Call Mumbai 🛵🚡9910780858 💃 Choose Best And Top Girl Service A...
norina2645
 
High Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 ...
High Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 ...High Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 ...
High Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 ...
singhlata50dh
 
Girls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in City
Girls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in CityGirls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in City
Girls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in City
neshakor5152
 
Predicting Test Results without Execution (FSE 2024)
Predicting Test Results without Execution (FSE 2024)Predicting Test Results without Execution (FSE 2024)
Predicting Test Results without Execution (FSE 2024)
andrehoraa
 
Amadeus Travel API, Amadeus Booking API, Amadeus GDS
Amadeus Travel API, Amadeus Booking API, Amadeus GDSAmadeus Travel API, Amadeus Booking API, Amadeus GDS
Amadeus Travel API, Amadeus Booking API, Amadeus GDS
aadhiyaeliza
 
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
87tomato
 
SEO Cheat Sheet with Learning Resources by Balti Bloggers.pdf
SEO Cheat Sheet with Learning Resources by Balti Bloggers.pdfSEO Cheat Sheet with Learning Resources by Balti Bloggers.pdf
SEO Cheat Sheet with Learning Resources by Balti Bloggers.pdf
Balti Bloggers
 
Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...
Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...
Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...
OnePlan Solutions
 
PathSpotter: Exploring Tested Paths to Discover Missing Tests (FSE 2024)
PathSpotter: Exploring Tested Paths to Discover Missing Tests (FSE 2024)PathSpotter: Exploring Tested Paths to Discover Missing Tests (FSE 2024)
PathSpotter: Exploring Tested Paths to Discover Missing Tests (FSE 2024)
andrehoraa
 
Celebrity Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Servic...
Celebrity Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Servic...Celebrity Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Servic...
Celebrity Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Servic...
45unexpected
 
Independent Girls call Service Pune 000XX00000 Provide Best And Top Girl Serv...
Independent Girls call Service Pune 000XX00000 Provide Best And Top Girl Serv...Independent Girls call Service Pune 000XX00000 Provide Best And Top Girl Serv...
Independent Girls call Service Pune 000XX00000 Provide Best And Top Girl Serv...
bhumivarma35300
 

Recently uploaded (20)

Empowering Businesses with Intelligent Software Solutions - Grawlix
Empowering Businesses with Intelligent Software Solutions - GrawlixEmpowering Businesses with Intelligent Software Solutions - Grawlix
Empowering Businesses with Intelligent Software Solutions - Grawlix
 
A Step-by-Step Guide to Selecting the Right Automated Software Testing Tools.pdf
A Step-by-Step Guide to Selecting the Right Automated Software Testing Tools.pdfA Step-by-Step Guide to Selecting the Right Automated Software Testing Tools.pdf
A Step-by-Step Guide to Selecting the Right Automated Software Testing Tools.pdf
 
AI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdf
AI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdfAI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdf
AI - Your Startup Sidekick (Leveraging AI to Bootstrap a Lean Startup).pdf
 
Hotel Management Software Development Company
Hotel Management Software Development CompanyHotel Management Software Development Company
Hotel Management Software Development Company
 
Fantastic Design Patterns and Where to use them No Notes.pdf
Fantastic Design Patterns and Where to use them No Notes.pdfFantastic Design Patterns and Where to use them No Notes.pdf
Fantastic Design Patterns and Where to use them No Notes.pdf
 
Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...
Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...
Agra Girls Call Agra 0X0000000X Unlimited Short Providing Girls Service Avail...
 
Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...
Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...
Mumbai Girls Call Mumbai 🎈🔥9930687706 🔥💋🎈 Provide Best And Top Girl Service A...
 
Applitools Autonomous 2.0 Sneak Peek.pdf
Applitools Autonomous 2.0 Sneak Peek.pdfApplitools Autonomous 2.0 Sneak Peek.pdf
Applitools Autonomous 2.0 Sneak Peek.pdf
 
Mobile App Development Company in Noida - Drona Infotech.
Mobile App Development Company in Noida - Drona Infotech.Mobile App Development Company in Noida - Drona Infotech.
Mobile App Development Company in Noida - Drona Infotech.
 
Celebrity Girls Call Mumbai 🛵🚡9910780858 💃 Choose Best And Top Girl Service A...
Celebrity Girls Call Mumbai 🛵🚡9910780858 💃 Choose Best And Top Girl Service A...Celebrity Girls Call Mumbai 🛵🚡9910780858 💃 Choose Best And Top Girl Service A...
Celebrity Girls Call Mumbai 🛵🚡9910780858 💃 Choose Best And Top Girl Service A...
 
High Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 ...
High Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 ...High Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 ...
High Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 ...
 
Girls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in City
Girls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in CityGirls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in City
Girls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in City
 
Predicting Test Results without Execution (FSE 2024)
Predicting Test Results without Execution (FSE 2024)Predicting Test Results without Execution (FSE 2024)
Predicting Test Results without Execution (FSE 2024)
 
Amadeus Travel API, Amadeus Booking API, Amadeus GDS
Amadeus Travel API, Amadeus Booking API, Amadeus GDSAmadeus Travel API, Amadeus Booking API, Amadeus GDS
Amadeus Travel API, Amadeus Booking API, Amadeus GDS
 
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
 
SEO Cheat Sheet with Learning Resources by Balti Bloggers.pdf
SEO Cheat Sheet with Learning Resources by Balti Bloggers.pdfSEO Cheat Sheet with Learning Resources by Balti Bloggers.pdf
SEO Cheat Sheet with Learning Resources by Balti Bloggers.pdf
 
Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...
Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...
Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...
 
PathSpotter: Exploring Tested Paths to Discover Missing Tests (FSE 2024)
PathSpotter: Exploring Tested Paths to Discover Missing Tests (FSE 2024)PathSpotter: Exploring Tested Paths to Discover Missing Tests (FSE 2024)
PathSpotter: Exploring Tested Paths to Discover Missing Tests (FSE 2024)
 
Celebrity Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Servic...
Celebrity Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Servic...Celebrity Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Servic...
Celebrity Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Servic...
 
Independent Girls call Service Pune 000XX00000 Provide Best And Top Girl Serv...
Independent Girls call Service Pune 000XX00000 Provide Best And Top Girl Serv...Independent Girls call Service Pune 000XX00000 Provide Best And Top Girl Serv...
Independent Girls call Service Pune 000XX00000 Provide Best And Top Girl Serv...
 

Présentation de HomeKit

  • 2. Produits MFi Station météo Caméras : Welcome, Presence + HomeKit Thermostat Healthy Home Coach
  • 3. Plan Finalité Technologies impliquées, spécificités Configuration initiale d’un accessoire Contrôle Retour d’expérience
  • 4. Finalité Concerne les accessoires de contrôle de la maison : Thermostats, Prises, Interrupteurs, Ampoules, Fenêtres, volets, sensors, etc. Coordonner et contrôler des accessoires de différents fabricants, avec : ➔Apps tierces iOS, watchOS, tvOS : Framework Homekit ➔Siri ➔Apple Home : automations
  • 5. Technologies impliquées Base de données partagée : iCloud (structure de la maison, nommage) Clés cryptographiques partagées à travers iCloud Keychain HomeKit Accessory Protocol : entre un contrôleur (iPhone, Apple TV) et un accessoire (BLE, IP) Framework : Découverte, contrôle, monitoring accessoires
  • 6. Spécificités Pas de compte utilisateur à créer Pas de serveur tiers Securité end to end: ➔Clés stockées seulement dans iOS et l’accessoire ➔Un seul master Accès distant avec Apple TV et iPad
  • 8. Configuration initiale WiFi Créer/choisir une maison Appairage Homekit Créer/choisir une pièce Nommer les services contrôlables
  • 9. WiFi avant iOS 10 : EAWiFiUnconfiguredAccessoryBrowser let externalAccessoryBrowser = EAWiFiUnconfiguredAccessoryBrowser(delegate: self, queue: dispatch_get_main_queue()) externalAccessoryBrowser.startSearchingForUnconfiguredAccessoriesMatchingPredicate(nil) // MARK: EAWiFiUnconfiguredAccessoryBrowserDelegate Methods func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser, didFindUnconfiguredAccessories accessories: Set<EAWiFiUnconfiguredAccessory>) { } func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser, didRemoveUnconfiguredAccessories accessories: Set<EAWiFiUnconfiguredAccessory>) { } func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser, didUpdateState state: EAWiFiUnconfiguredAccessoryBrowserState) { } func accessoryBrowser(browser: EAWiFiUnconfiguredAccessoryBrowser, didFinishConfiguringAccessory accessory: EAWiFiUnconfiguredAccessory, withStatus status: EAWiFiUnconfiguredAccessoryConfigurationStatus) { if status == .Success { // store accessory name and proceed to add to HMHome } } externalAccessoryBrowser.configureAccessory(accessory, withConfigurationUIOnViewController: self)
  • 10. WiFi depuis iOS 10 : HMAccessoryBrowser let accessoryBrowser = HMAccessoryBrowser() accessoryBrowser.delegate = self accessoryBrowser.startSearchingForNewAccessories() // MARK: HMAccessoryBrowserDelegate Methods func accessoryBrowser(browser: HMAccessoryBrowser, didFindNewAccessory accessory: HMAccessory) { } func accessoryBrowser(browser: HMAccessoryBrowser, didRemoveNewAccessory accessory: HMAccessory) { } var home: HMHome? = HMHomeManager().primaryHome home?.addAccessory(accessory) { error in if let error = error { // handle error } else { // Once it's successfully added to the home, add it to the room that's selected. } }
  • 11. Appairage HomeKit : HMAccessoryBrowser
  • 12. Créer/choisir une pièce //func home(home: HMHome, assignAccessory accessory: HMAccessory, toRoom room: HMRoom) { home.assignAccessory(accessory, toRoom: room) { error in if let error = error { //displayError(error) } else { //update view } //}
  • 13. Nommer les services //func updateName(name: String, forAccessory accessory: HMAccessory) { accessory.updateName(name) { error in if let error = error { //displayError(error) } else { //update view } //}
  • 14. Observe Home Database updates public protocol HMHomeManagerDelegate : NSObjectProtocol { optional public func homeManagerDidUpdateHomes(_ manager: HMHomeManager) optional public func homeManagerDidUpdatePrimaryHome(_ manager: HMHomeManager) optional public func homeManager(_ manager: HMHomeManager, didAddHome: HMHome) optional public func homeManager(_ manager: HMHomeManager, didRemoveHome: HMHome) }
  • 15. Observe Home Database updates public protocol HMHomeDelegate : NSObjectProtocol { optional public func homeDidUpdateName(_ home: HMHome) optional public func home(_ home: HMHome, didAddAccessory: HMAccessory) optional public func home(_ home: HMHome, didRemoveAccessory: HMAccessory) optional public func home(_ home: HMHome, didUpdateRoom: HMRoom, forAccessory: HMAccessory) optional public func home(_ home: HMHome, didAddRoom: HMRoom) optional public func home(_ home: HMHome, didRemoveRoom: HMRoom) // (... a lot more) }
  • 16. Observe Home Database updates public protocol HMHomeDelegate : NSObjectProtocol { optional public func homeDidUpdateName(_ home: HMHome) optional public func home(_ home: HMHome, didAddAccessory: HMAccessory) optional public func home(_ home: HMHome, didRemoveAccessory: HMAccessory) optional public func home(_ home: HMHome, didUpdateRoom: HMRoom, forAccessory: HMAccessory) optional public func home(_ home: HMHome, didAddRoom: HMRoom) optional public func home(_ home: HMHome, didRemoveRoom: HMRoom) // (... a lot more) } // Notifications are only received // if the database is modified by // another device/app !
  • 17. Contrôle de l’accessoire Actions possibles: Lire une caractéristique Ecrire une caractéristique Ecouter les notifications Créer des scènes (écritures groupées de caractéristiques) Triggers (Réagir aux changements de valeur des caractéristiques)
  • 18. Contrôle de l’accessoire import HomeKit var lightBulb: HMAccessory? // Get the PowerState characteristic through the LightBulb service let lightBulbOn = lightBulb?.services.first(where: { (service) -> Bool in service.serviceType == HMServiceTypeLightbulb })?.characteristics.first(where: { (characteristic) -> Bool in characteristic.characteristicType == HMCharacteristicTypePowerState })
  • 19. Lecture d’une caractéristique // func readValue(completionHandler completion: @escaping (Error?) -> Void) // var value: Any? { get } lightBulbOn?.readValue(completionHandler: { (error) in if let error = error { // Handle the error } else if let isOn = lightBulbOn?.value as? Bool { print("Light bulb is (isOn ? "ON" : "OFF")") } })
  • 20. Ecriture d’une caractéristique // func writeValue(_ value: Any?, completionHandler completion: @escaping (Error?) -> Void) lightBulbOn?.writeValue(false, completionHandler: { (error) in if let error = error { // Handle the error } else { print("Light bulb is OFF") } })
  • 21. Notifications // func enableNotification(_ enable: Bool, completionHandler completion: @escaping (Error?) -> Void) lightBulbOn?.enableNotification(true, completionHandler: { (error) in if let error = error { // Handle error } else { print("Notifications are enabled") } }) class AccDelegate : NSObject, HMAccessoryDelegate { public func accessory(_ accessory: HMAccessory, service: HMService, didUpdateValueForCharacteristic: HMCharacteristic) { if let isOn = characteristic.value as? Bool { print("Light bulb is now (isOn ? "ON" : "OFF")") } } } let delegate = AccDelegate() lightBulb?.delegate = delegate;