SlideShare a Scribd company logo
1 of 34
Download to read offline
YmsCoreBluetooth
A block-based API for Core Bluetooth
YmsCoreBluetooth
Core Bluetooth
▸ Bluetooth 4.0 Low Energy (BLE) API
▸ Released 2012 (iOS 5, macOS 10.10)
▸ Delegate-based
▸ Many updates, but very few API changes
▸ Established BLE as the standard Personal Area Network
(PAN) for mobile
Gadgets!
TI SensorTag
Mid-2013
YmsCoreBluetooth
TI SensorTag
▸ IR Temperature Sensor
▸ Humidity Sensor
▸ Gyroscope
▸ Accelerometer
▸ Magnetometer
▸ Barometric Pressure Sensor
▸ Temperature Sensor
▸ Battery/voltage Sensor
▸ Push Buttons
BLE!
Core Bluetooth!
Using the Core Bluetooth
API felt kinda awkward.
YmsCoreBluetooth
Programming the SensorTag with Core Bluetooth
▸ Delegation pattern for CBCentralManager and CBPeripheral
was clumsy to use
▸ 8 sensors = 8 services
▸ Each service had at least two characteristics
▸ Control, Data
▸ A lot of state to keep track of in different places
In 2013, ObjC blocks were
a thing. Why not use them
here?
History
YmsCoreBluetooth
▸ Inspired by AFNetworking
▸ Use Obj-C block to process response from a BLE request
▸ Captures state
▸ In-line syntax describes control flow in “one place”
▸ Released late 2013 on GitHub
▸ https://github.com/kickingvegas/YmsCoreBluetooth
Design Goals
YmsCoreBluetooth Design Goals
▸ Get a BLE app up and running fast
▸ Be ready to use in a production app
▸ Use SensorTag as reference model to sanity check above
Design Goals
API Design
▸ Wrapper classes around each Core Bluetooth class
▸ YMSCBCentralManager
▸ YMSCBPeripheral
▸ YMSCBService
▸ YMSCBCharacteristic
▸ YMSCBDescriptor
▸ Subclass off appropriate YMSCB* to personalize
YMSCBCentralManager
CBCentralManager
Design Goals
Hierarchical Object Operation
▸ Core Bluetooth API designed operations in terms of 

sender sends message to receiver with matching delegate
response
▸ CBCentralManager connects to CBPeripheral
▸ CBPeripheral discovers its CBServices
▸ CBPeripheral discovers the CBCharacteristics for a CBService
▸ CBPeripheral writes to CBCharacteristic
▸ High cognitive load
Design Goals
Hierarchical Object Operation
▸ YmsCoreBluetooth API designed operations in terms of 

sending a command to an object
▸ [YMSCBPeripheral connectWithOptions:withBlock:]
▸ [YMSCBPeripheral discoverServices:withBlock:]
▸ [YMSCBService discoverCharacteristics:withBlock:]
▸ [YMSCBCharacteristic writeValue:withBlock:]
Where are we now
YmsCoreBluetooth in the Wild
▸ First released on GitHub late 2013
▸ Last update 2015
▸ As of 4/12/17
▸ 498 stars
▸ 128 forks
Coming Real Soon
YmsCoreBluetooth Updates Coming!
▸ Improved YMSCBPeripheral collection handling
▸ Improved BLE scanning API
▸ Improved YMSCBCharacteristic subscription API
▸ Dependency Injection Everywhere
▸ Testability
▸ Decouple from Core Bluetooth objects
▸ Obj-C Nullability & Generics
▸ May 2017
github.com/

kickingvegas/

YmsCoreBluetooth
twitter: cy_choi
Deep Core Bluetooth
Learning stuff the hard way
HMM… THAT’S FUNNY, IT
WORKS FOR ME.
Any developer writing a Core Bluetooth app
Deep Core Bluetooth
Learning 1: Your app
doesn’t have direct access
to the hardware
CBCentralManager
CBPeripheral
App A
BLE Peripheral
CBCentralManager
CBPeripheral
App A
BT Server
BLE Peripheral
BLE HW
CBCentralManager
CBPeripheral
CBCentralManager
CBPeripheral
App A
BT Server
BLE Peripheral
BLE HW
CBCentralManager
CBPeripheral
CBCentralManager
CBPeripheral
App A
CBCentralManager
CBPeripheral
CBCentralManager
CBPeripheral
App B
BT Server
BLE Peripheral
BLE HW
Deep Core Bluetooth
Learning 1: Your app doesn’t have direct access to the hardware
▸ CBPeripheral connection is a logical connection
▸ BT Server manages the physical connection to an actual BLE
peripheral
▸ Core Bluetooth state restoration works because of this
▸ Core Bluetooth background execution is decoupled from the
app state
Learning 2: Unpaired
CBPeripheral identifiers
are cached values
BLE Peripheral BT Server App
advertising MAC: 1235
didDiscoverPeripheral: FRED
advertising MAC: 1235
didDiscoverPeripheral: FRED
Map MAC to Identifier
Map MAC to Identifier
Map MAC to Identifier Full
advertising MAC: 1235
didDiscoverPeripheral: JANE
Deep Core Bluetooth
Learning 2: Unpaired CBPeripheral Identifiers are Cached
▸ There is a fixed size table for mapping MAC addresses to
CBPeripheral identifiers in BT Server
▸ When this table is full, an identifier will be invalidated
▸ To test an identifier, you must call 

[CBCentralManager retrievePeripheralsWithIdentifiers:]
▸ iOS 10 made this table really big
Learning 3: If BT Server resets
when your backgrounded BLE app
is not running, you won’t hear of it.
BLE Peripheral BT Server App
connectPeripheral:
connectPeripheral:
didConnectPeripheral: didConnectPeripheral:
Resets!
App terminated 

in background
centralManagerDidUpdateState:
Deep Core Bluetooth
Learning 3: If BT Server resets when your background app is not running, you won’t hear of it
▸ Core Bluetooth background execution is reliant on BT Server
always running perfectly
▸ If BT Server resets and your app that supports background
execution is not running, you will not receive the
centralManagerDidUpdateState: message
Learning 4: BLE state
restoration is a lot of work
Text
Learning 4: BLE state restoration is a lot of work
▸ Restore ServiceUUIDs that were scanned for
▸ You must restore your scan handler
▸ Restore Peripherals that central manager was trying to connect to or had
already connected to
▸ You must restore your connection and discovery handlers
▸ Restore Characteristics the central manager was subscribed to
▸ You must restore your notification handlers
▸ Run-time state you keep for a connected peripheral must be restored too!
Deep Core Bluetooth
Core Bluetooth Abstracts BLE
▸ Core Bluetooth is an abstraction API on top of the BLE
protocol
▸ Mimics BLE link-layer transactions
▸ Exercises only a sub-set of BLE protocol
▸ Your central never has direct communication with your
peripheral
We ❤ Core Bluetooth

More Related Content

What's hot

Architecting for continuous delivery (33rd Degree)
Architecting for continuous delivery (33rd Degree)Architecting for continuous delivery (33rd Degree)
Architecting for continuous delivery (33rd Degree)Axel Fontaine
 
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...Cloud Native Day Tel Aviv
 
Jenkins Docker
Jenkins DockerJenkins Docker
Jenkins DockerAlex Soto
 
How Atlassian's Build Engineering Team Has Scaled to 150k Builds Per Month an...
How Atlassian's Build Engineering Team Has Scaled to 150k Builds Per Month an...How Atlassian's Build Engineering Team Has Scaled to 150k Builds Per Month an...
How Atlassian's Build Engineering Team Has Scaled to 150k Builds Per Month an...Peter Leschev
 
Game of Codes: the Battle for CI
Game of Codes: the Battle for CIGame of Codes: the Battle for CI
Game of Codes: the Battle for CIAtlassian
 
Hello elixir (and otp)
Hello elixir (and otp)Hello elixir (and otp)
Hello elixir (and otp)Abel Muíño
 
How to setup jenkins
How to setup jenkinsHow to setup jenkins
How to setup jenkinslinuxdady
 
Security in serverless world
Security in serverless worldSecurity in serverless world
Security in serverless worldYan Cui
 
DevOps with Serverless
DevOps with ServerlessDevOps with Serverless
DevOps with ServerlessYan Cui
 
Serverless in production, an experience report
Serverless in production, an experience reportServerless in production, an experience report
Serverless in production, an experience reportYan Cui
 
There is No Server: Immutable Infrastructure and Serverless Architecture
There is No Server: Immutable Infrastructure and Serverless ArchitectureThere is No Server: Immutable Infrastructure and Serverless Architecture
There is No Server: Immutable Infrastructure and Serverless ArchitectureSonatype
 
AtlasCamp 2015 Docker continuous integration training
AtlasCamp 2015 Docker continuous integration trainingAtlasCamp 2015 Docker continuous integration training
AtlasCamp 2015 Docker continuous integration trainingSteve Smith
 
mykola marzhan - jenkins on aws spot instance
mykola marzhan - jenkins on aws spot instancemykola marzhan - jenkins on aws spot instance
mykola marzhan - jenkins on aws spot instanceDariia Seimova
 
Tech trends 2018 2019
Tech trends 2018 2019Tech trends 2018 2019
Tech trends 2018 2019Johan Norm
 
State of Puppet 2013 - Puppet Camp DC
State of Puppet 2013 - Puppet Camp DCState of Puppet 2013 - Puppet Camp DC
State of Puppet 2013 - Puppet Camp DCPuppet
 
Selenium Grid
Selenium GridSelenium Grid
Selenium Gridnirvdrum
 
Docker, Continuous Integration, and You
Docker, Continuous Integration, and YouDocker, Continuous Integration, and You
Docker, Continuous Integration, and YouAtlassian
 
Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...
Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...
Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...eZ Systems
 

What's hot (20)

Architecting for continuous delivery (33rd Degree)
Architecting for continuous delivery (33rd Degree)Architecting for continuous delivery (33rd Degree)
Architecting for continuous delivery (33rd Degree)
 
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...
 
Jenkins Docker
Jenkins DockerJenkins Docker
Jenkins Docker
 
How Atlassian's Build Engineering Team Has Scaled to 150k Builds Per Month an...
How Atlassian's Build Engineering Team Has Scaled to 150k Builds Per Month an...How Atlassian's Build Engineering Team Has Scaled to 150k Builds Per Month an...
How Atlassian's Build Engineering Team Has Scaled to 150k Builds Per Month an...
 
Game of Codes: the Battle for CI
Game of Codes: the Battle for CIGame of Codes: the Battle for CI
Game of Codes: the Battle for CI
 
Hello elixir (and otp)
Hello elixir (and otp)Hello elixir (and otp)
Hello elixir (and otp)
 
How to setup jenkins
How to setup jenkinsHow to setup jenkins
How to setup jenkins
 
Security in serverless world
Security in serverless worldSecurity in serverless world
Security in serverless world
 
DevOps with Serverless
DevOps with ServerlessDevOps with Serverless
DevOps with Serverless
 
Serverless in production, an experience report
Serverless in production, an experience reportServerless in production, an experience report
Serverless in production, an experience report
 
There is No Server: Immutable Infrastructure and Serverless Architecture
There is No Server: Immutable Infrastructure and Serverless ArchitectureThere is No Server: Immutable Infrastructure and Serverless Architecture
There is No Server: Immutable Infrastructure and Serverless Architecture
 
AtlasCamp 2015 Docker continuous integration training
AtlasCamp 2015 Docker continuous integration trainingAtlasCamp 2015 Docker continuous integration training
AtlasCamp 2015 Docker continuous integration training
 
mykola marzhan - jenkins on aws spot instance
mykola marzhan - jenkins on aws spot instancemykola marzhan - jenkins on aws spot instance
mykola marzhan - jenkins on aws spot instance
 
Tech trends 2018 2019
Tech trends 2018 2019Tech trends 2018 2019
Tech trends 2018 2019
 
fmcsadmin 1.0.0
fmcsadmin 1.0.0fmcsadmin 1.0.0
fmcsadmin 1.0.0
 
State of Puppet 2013 - Puppet Camp DC
State of Puppet 2013 - Puppet Camp DCState of Puppet 2013 - Puppet Camp DC
State of Puppet 2013 - Puppet Camp DC
 
Selenium Grid
Selenium GridSelenium Grid
Selenium Grid
 
Ansible Case Studies
Ansible Case StudiesAnsible Case Studies
Ansible Case Studies
 
Docker, Continuous Integration, and You
Docker, Continuous Integration, and YouDocker, Continuous Integration, and You
Docker, Continuous Integration, and You
 
Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...
Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...
Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...
 

Similar to SV iOS Meetup Slides: YmsCoreBluetooth and Deep Core Bluetooth

BTLE (Bluetooth Low Energy) and CoreBluetooth
BTLE (Bluetooth Low Energy) and CoreBluetooth BTLE (Bluetooth Low Energy) and CoreBluetooth
BTLE (Bluetooth Low Energy) and CoreBluetooth Zach Dennis
 
Gatekeeper: API gateway
Gatekeeper: API gatewayGatekeeper: API gateway
Gatekeeper: API gatewayChengHui Weng
 
Why do we even have Kubernetes?
Why do we even have Kubernetes?Why do we even have Kubernetes?
Why do we even have Kubernetes?Sean Walberg
 
Lunar Way and the Cloud Native "stack"
Lunar Way and the Cloud Native "stack"Lunar Way and the Cloud Native "stack"
Lunar Way and the Cloud Native "stack"Kasper Nissen
 
Cloud Native Data Warehouses - Intro to ClickHouse on Kubernetes-2021-07.pdf
Cloud Native Data Warehouses - Intro to ClickHouse on Kubernetes-2021-07.pdfCloud Native Data Warehouses - Intro to ClickHouse on Kubernetes-2021-07.pdf
Cloud Native Data Warehouses - Intro to ClickHouse on Kubernetes-2021-07.pdfAltinity Ltd
 
Using eBPF to Measure the k8s Cluster Health
Using eBPF to Measure the k8s Cluster HealthUsing eBPF to Measure the k8s Cluster Health
Using eBPF to Measure the k8s Cluster HealthScyllaDB
 
Introduction to Kubernetes with demo
Introduction to Kubernetes with demoIntroduction to Kubernetes with demo
Introduction to Kubernetes with demoOpsta
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceBen Hall
 
Keynote #Tech - Google : aperçu de la gestion des services distribués chez Go...
Keynote #Tech - Google : aperçu de la gestion des services distribués chez Go...Keynote #Tech - Google : aperçu de la gestion des services distribués chez Go...
Keynote #Tech - Google : aperçu de la gestion des services distribués chez Go...Paris Open Source Summit
 
Deploy Application on Kubernetes
Deploy Application on KubernetesDeploy Application on Kubernetes
Deploy Application on KubernetesOpsta
 
Developer-Friendly CI / CD for Kubernetes
Developer-Friendly CI / CD for KubernetesDeveloper-Friendly CI / CD for Kubernetes
Developer-Friendly CI / CD for KubernetesDevOps Indonesia
 
Kubernetes - Sailing a Sea of Containers
Kubernetes - Sailing a Sea of ContainersKubernetes - Sailing a Sea of Containers
Kubernetes - Sailing a Sea of ContainersKel Cecil
 
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UIData Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UIAltinity Ltd
 
Ignacy Kowalczyk
Ignacy KowalczykIgnacy Kowalczyk
Ignacy KowalczykCodeFest
 
Introduction to Kubernetes and GKE
Introduction to Kubernetes and GKEIntroduction to Kubernetes and GKE
Introduction to Kubernetes and GKEOpsta
 
Core Bluetooth and BLE 101
Core Bluetooth and BLE 101Core Bluetooth and BLE 101
Core Bluetooth and BLE 101Li Lin
 
Communication Amongst Microservices: Kubernetes, Istio, and Spring Cloud with...
Communication Amongst Microservices: Kubernetes, Istio, and Spring Cloud with...Communication Amongst Microservices: Kubernetes, Istio, and Spring Cloud with...
Communication Amongst Microservices: Kubernetes, Istio, and Spring Cloud with...VMware Tanzu
 
'DOCKER' & CLOUD: ENABLERS For DEVOPS
'DOCKER' & CLOUD:  ENABLERS For DEVOPS'DOCKER' & CLOUD:  ENABLERS For DEVOPS
'DOCKER' & CLOUD: ENABLERS For DEVOPSACA IT-Solutions
 
Docker and Cloud - Enables for DevOps - by ACA-IT
Docker and Cloud - Enables for DevOps - by ACA-ITDocker and Cloud - Enables for DevOps - by ACA-IT
Docker and Cloud - Enables for DevOps - by ACA-ITStijn Wijndaele
 

Similar to SV iOS Meetup Slides: YmsCoreBluetooth and Deep Core Bluetooth (20)

BTLE (Bluetooth Low Energy) and CoreBluetooth
BTLE (Bluetooth Low Energy) and CoreBluetooth BTLE (Bluetooth Low Energy) and CoreBluetooth
BTLE (Bluetooth Low Energy) and CoreBluetooth
 
Where should I run my code? Serverless, Containers, Virtual Machines and more
Where should I run my code? Serverless, Containers, Virtual Machines and moreWhere should I run my code? Serverless, Containers, Virtual Machines and more
Where should I run my code? Serverless, Containers, Virtual Machines and more
 
Gatekeeper: API gateway
Gatekeeper: API gatewayGatekeeper: API gateway
Gatekeeper: API gateway
 
Why do we even have Kubernetes?
Why do we even have Kubernetes?Why do we even have Kubernetes?
Why do we even have Kubernetes?
 
Lunar Way and the Cloud Native "stack"
Lunar Way and the Cloud Native "stack"Lunar Way and the Cloud Native "stack"
Lunar Way and the Cloud Native "stack"
 
Cloud Native Data Warehouses - Intro to ClickHouse on Kubernetes-2021-07.pdf
Cloud Native Data Warehouses - Intro to ClickHouse on Kubernetes-2021-07.pdfCloud Native Data Warehouses - Intro to ClickHouse on Kubernetes-2021-07.pdf
Cloud Native Data Warehouses - Intro to ClickHouse on Kubernetes-2021-07.pdf
 
Using eBPF to Measure the k8s Cluster Health
Using eBPF to Measure the k8s Cluster HealthUsing eBPF to Measure the k8s Cluster Health
Using eBPF to Measure the k8s Cluster Health
 
Introduction to Kubernetes with demo
Introduction to Kubernetes with demoIntroduction to Kubernetes with demo
Introduction to Kubernetes with demo
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container Service
 
Keynote #Tech - Google : aperçu de la gestion des services distribués chez Go...
Keynote #Tech - Google : aperçu de la gestion des services distribués chez Go...Keynote #Tech - Google : aperçu de la gestion des services distribués chez Go...
Keynote #Tech - Google : aperçu de la gestion des services distribués chez Go...
 
Deploy Application on Kubernetes
Deploy Application on KubernetesDeploy Application on Kubernetes
Deploy Application on Kubernetes
 
Developer-Friendly CI / CD for Kubernetes
Developer-Friendly CI / CD for KubernetesDeveloper-Friendly CI / CD for Kubernetes
Developer-Friendly CI / CD for Kubernetes
 
Kubernetes - Sailing a Sea of Containers
Kubernetes - Sailing a Sea of ContainersKubernetes - Sailing a Sea of Containers
Kubernetes - Sailing a Sea of Containers
 
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UIData Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
 
Ignacy Kowalczyk
Ignacy KowalczykIgnacy Kowalczyk
Ignacy Kowalczyk
 
Introduction to Kubernetes and GKE
Introduction to Kubernetes and GKEIntroduction to Kubernetes and GKE
Introduction to Kubernetes and GKE
 
Core Bluetooth and BLE 101
Core Bluetooth and BLE 101Core Bluetooth and BLE 101
Core Bluetooth and BLE 101
 
Communication Amongst Microservices: Kubernetes, Istio, and Spring Cloud with...
Communication Amongst Microservices: Kubernetes, Istio, and Spring Cloud with...Communication Amongst Microservices: Kubernetes, Istio, and Spring Cloud with...
Communication Amongst Microservices: Kubernetes, Istio, and Spring Cloud with...
 
'DOCKER' & CLOUD: ENABLERS For DEVOPS
'DOCKER' & CLOUD:  ENABLERS For DEVOPS'DOCKER' & CLOUD:  ENABLERS For DEVOPS
'DOCKER' & CLOUD: ENABLERS For DEVOPS
 
Docker and Cloud - Enables for DevOps - by ACA-IT
Docker and Cloud - Enables for DevOps - by ACA-ITDocker and Cloud - Enables for DevOps - by ACA-IT
Docker and Cloud - Enables for DevOps - by ACA-IT
 

Recently uploaded

Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 

Recently uploaded (20)

Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 

SV iOS Meetup Slides: YmsCoreBluetooth and Deep Core Bluetooth

  • 2. YmsCoreBluetooth Core Bluetooth ▸ Bluetooth 4.0 Low Energy (BLE) API ▸ Released 2012 (iOS 5, macOS 10.10) ▸ Delegate-based ▸ Many updates, but very few API changes ▸ Established BLE as the standard Personal Area Network (PAN) for mobile
  • 5. YmsCoreBluetooth TI SensorTag ▸ IR Temperature Sensor ▸ Humidity Sensor ▸ Gyroscope ▸ Accelerometer ▸ Magnetometer ▸ Barometric Pressure Sensor ▸ Temperature Sensor ▸ Battery/voltage Sensor ▸ Push Buttons BLE! Core Bluetooth!
  • 6. Using the Core Bluetooth API felt kinda awkward.
  • 7. YmsCoreBluetooth Programming the SensorTag with Core Bluetooth ▸ Delegation pattern for CBCentralManager and CBPeripheral was clumsy to use ▸ 8 sensors = 8 services ▸ Each service had at least two characteristics ▸ Control, Data ▸ A lot of state to keep track of in different places
  • 8. In 2013, ObjC blocks were a thing. Why not use them here?
  • 9. History YmsCoreBluetooth ▸ Inspired by AFNetworking ▸ Use Obj-C block to process response from a BLE request ▸ Captures state ▸ In-line syntax describes control flow in “one place” ▸ Released late 2013 on GitHub ▸ https://github.com/kickingvegas/YmsCoreBluetooth
  • 10. Design Goals YmsCoreBluetooth Design Goals ▸ Get a BLE app up and running fast ▸ Be ready to use in a production app ▸ Use SensorTag as reference model to sanity check above
  • 11. Design Goals API Design ▸ Wrapper classes around each Core Bluetooth class ▸ YMSCBCentralManager ▸ YMSCBPeripheral ▸ YMSCBService ▸ YMSCBCharacteristic ▸ YMSCBDescriptor ▸ Subclass off appropriate YMSCB* to personalize YMSCBCentralManager CBCentralManager
  • 12. Design Goals Hierarchical Object Operation ▸ Core Bluetooth API designed operations in terms of 
 sender sends message to receiver with matching delegate response ▸ CBCentralManager connects to CBPeripheral ▸ CBPeripheral discovers its CBServices ▸ CBPeripheral discovers the CBCharacteristics for a CBService ▸ CBPeripheral writes to CBCharacteristic ▸ High cognitive load
  • 13. Design Goals Hierarchical Object Operation ▸ YmsCoreBluetooth API designed operations in terms of 
 sending a command to an object ▸ [YMSCBPeripheral connectWithOptions:withBlock:] ▸ [YMSCBPeripheral discoverServices:withBlock:] ▸ [YMSCBService discoverCharacteristics:withBlock:] ▸ [YMSCBCharacteristic writeValue:withBlock:]
  • 14. Where are we now YmsCoreBluetooth in the Wild ▸ First released on GitHub late 2013 ▸ Last update 2015 ▸ As of 4/12/17 ▸ 498 stars ▸ 128 forks
  • 15. Coming Real Soon YmsCoreBluetooth Updates Coming! ▸ Improved YMSCBPeripheral collection handling ▸ Improved BLE scanning API ▸ Improved YMSCBCharacteristic subscription API ▸ Dependency Injection Everywhere ▸ Testability ▸ Decouple from Core Bluetooth objects ▸ Obj-C Nullability & Generics ▸ May 2017
  • 17. Deep Core Bluetooth Learning stuff the hard way
  • 18. HMM… THAT’S FUNNY, IT WORKS FOR ME. Any developer writing a Core Bluetooth app Deep Core Bluetooth
  • 19. Learning 1: Your app doesn’t have direct access to the hardware
  • 24. Deep Core Bluetooth Learning 1: Your app doesn’t have direct access to the hardware ▸ CBPeripheral connection is a logical connection ▸ BT Server manages the physical connection to an actual BLE peripheral ▸ Core Bluetooth state restoration works because of this ▸ Core Bluetooth background execution is decoupled from the app state
  • 25. Learning 2: Unpaired CBPeripheral identifiers are cached values
  • 26. BLE Peripheral BT Server App advertising MAC: 1235 didDiscoverPeripheral: FRED advertising MAC: 1235 didDiscoverPeripheral: FRED Map MAC to Identifier Map MAC to Identifier Map MAC to Identifier Full advertising MAC: 1235 didDiscoverPeripheral: JANE
  • 27. Deep Core Bluetooth Learning 2: Unpaired CBPeripheral Identifiers are Cached ▸ There is a fixed size table for mapping MAC addresses to CBPeripheral identifiers in BT Server ▸ When this table is full, an identifier will be invalidated ▸ To test an identifier, you must call 
 [CBCentralManager retrievePeripheralsWithIdentifiers:] ▸ iOS 10 made this table really big
  • 28. Learning 3: If BT Server resets when your backgrounded BLE app is not running, you won’t hear of it.
  • 29. BLE Peripheral BT Server App connectPeripheral: connectPeripheral: didConnectPeripheral: didConnectPeripheral: Resets! App terminated 
 in background centralManagerDidUpdateState:
  • 30. Deep Core Bluetooth Learning 3: If BT Server resets when your background app is not running, you won’t hear of it ▸ Core Bluetooth background execution is reliant on BT Server always running perfectly ▸ If BT Server resets and your app that supports background execution is not running, you will not receive the centralManagerDidUpdateState: message
  • 31. Learning 4: BLE state restoration is a lot of work
  • 32. Text Learning 4: BLE state restoration is a lot of work ▸ Restore ServiceUUIDs that were scanned for ▸ You must restore your scan handler ▸ Restore Peripherals that central manager was trying to connect to or had already connected to ▸ You must restore your connection and discovery handlers ▸ Restore Characteristics the central manager was subscribed to ▸ You must restore your notification handlers ▸ Run-time state you keep for a connected peripheral must be restored too!
  • 33. Deep Core Bluetooth Core Bluetooth Abstracts BLE ▸ Core Bluetooth is an abstraction API on top of the BLE protocol ▸ Mimics BLE link-layer transactions ▸ Exercises only a sub-set of BLE protocol ▸ Your central never has direct communication with your peripheral
  • 34. We ❤ Core Bluetooth