SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Downloaden Sie, um offline zu lesen
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;

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (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
 

Andere mochten auch

Andere mochten auch (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?
 

Ähnlich wie 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
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for Joomla
Luke Summerfield
 
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
 
Baruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion WorkshopBaruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion Workshop
Brian Sam-Bodden
 

Ähnlich wie 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...
 

Mehr von CocoaHeads France

Mehr von 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
 

Kürzlich hochgeladen

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Kürzlich hochgeladen (20)

AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 

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;