Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
[7 Masters] Wearables - WatchShaker
Search
Ezequiel Santos
October 26, 2017
Programming
1
330
[7 Masters] Wearables - WatchShaker
Ezequiel Santos
October 26, 2017
Tweet
Share
More Decks by Ezequiel Santos
See All by Ezequiel Santos
Comparative Analysis of AI Models in Managing Household Food Waste: OpenAI GPT-4, Google Gemini, Mistral, and Anthropic Claude
ezefranca
0
84
Decision-making algorithms and Planning Algorithms
ezefranca
1
59
Dependency Management in iOS Development: A Developer Survey Perspective
ezefranca
0
120
Mestrado: Gestos e jogos: reflexões e desenvolvimento de um sistema de detecção de gestos baseado em wearables para controle de jogos
ezefranca
0
330
Server-Driven UI na prática
ezefranca
0
280
Modelo Clássico e Jogos (Jesper Jull) e exergames.
ezefranca
0
130
Server Driven UI Diferença e evolução em 2010 e 2020
ezefranca
0
1.5k
[#2 Community day Shawee] Prototipação eletrônica em Hackathons: idéias makers ganhando vida
ezefranca
0
1.1k
[7 Masters - Intercon 2018] 7 dicas de performance Mobile
ezefranca
0
330
Other Decks in Programming
See All in Programming
Serverless Rust: Your Low-Risk Entry Point to Rust in Production (and the benefits are huge)
lmammino
1
170
Djangoにおける複数ユーザー種別認証の設計アプローチ@DjangoCongress JP 2025
delhi09
PRO
4
520
AWS Step Functions は CDK で書こう!
konokenj
5
930
Goで作るChrome Extensions / Fukuoka.go #21
n3xem
0
140
未経験でSRE、はじめました! 組織を支える役割と軌跡
curekoshimizu
1
220
データベースのオペレーターであるCloudNativePGがStatefulSetを使わない理由に迫る
nnaka2992
0
250
やっと腹落ち「スプリント毎に動くモノをリリースする」〜ゼロから始めるメガバンクグループのアジャイル実践〜
sasakendayo
0
230
Jakarta EE meets AI
ivargrimstad
0
830
Drawing Heighway’s Dragon- Recursive Function Rewrite- From Imperative Style in Pascal 64 To Functional Style in Scala 3
philipschwarz
PRO
0
180
From the Wild into the Clouds - Laravel Meetup Talk
neverything
0
190
ナレッジイネイブリングにAIを活用してみる ゆるSRE勉強会 #9
nealle
0
170
1年目の私に伝えたい!テストコードを怖がらなくなるためのヒント/Tips for not being afraid of test code
push_gawa
1
670
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.3k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
46
2.4k
Raft: Consensus for Rubyists
vanstee
137
6.8k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.6k
Optimizing for Happiness
mojombo
377
70k
Why You Should Never Use an ORM
jnunemaker
PRO
55
9.2k
Visualization
eitanlees
146
15k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
KATA
mclloyd
29
14k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
30
4.6k
Gamification - CAS2011
davidbonilla
80
5.2k
Transcript
7Masters - Wearables Ezequiel França WatchShaker! ⌚
Mecatrônica @ SENAI Automação Industrial @ IFSP Analise de Sistemas
@ FIAP Desenvolvedor iOS, Maker e open-source hacker. Ezequiel França
None
None
Heurística?
None
None
Let’s Shake
None
None
http://indiatoday.intoday.in/technology/story/apple-watch- handshakes-nfc-gestures/1/448093.html
None
None
lembrando rapidinho de protocolos delegates
protocol SomeProtocol { func someTypeMethod() }
protocol SomeProtocol { func someTypeMethod() } class SomeClass: SomeProtocol{ }
protocol WatchShakerDelegate { func watchShakerDidShake(_ watchShaker: WatchShaker) func watchShaker(_ watchShaker:WatchShaker,
didFailWith error: Error) }
protocol WatchShakerDelegate { func didShake() func didFail(error: Error) }
protocol WatchShakerDelegate { func watchShakerDidShake(_ watchShaker: WatchShaker) func watchShaker(_ watchShaker:WatchShaker,
didFailWith error: Error) }
class WatchShaker { public var delegate: WatchShakerDelegate? fileprivate var motionManager:
CMMotionManager! fileprivate var lastShakeDate: Date? !// The threshold for how much acceleration needs to happen before an event will register. fileprivate var threshold:Double !// Time between shakes fileprivate var delay:Double = 0.1
init(shakeSensibility to:ShakeSensibility, delay time:Double) { self.threshold = to.rawValue self.delay =
time self.motionManager = CMMotionManager() }
ShakeSensibility
enum ShakeSensibility: Double { case shakeSensibilitySoftest = 0.1 case shakeSensibilitySoft
= 0.7 case shakeSensibilityNormal = 1.0 case shakeSensibilityHard = 1.2 case shakeSensibilityHardest = 2.0 }
public func start(delay accelerometerUpdateInterval:Double = 0.02) { guard motionManager.isAccelerometerAvailable else
{ return } motionManager.accelerometerUpdateInterval = accelerometerUpdateInterval let motionQueue = OperationQueue() motionManager.startAccelerometerUpdates(to: motionQueue) { (accelerometerData, err) -> Void in guard err == nil else { self.delegate?.watchShaker(self, didFailWith: err!) return }
guard let data = accelerometerData else { let e =
NSError(domain: "No accelerometer data", code: 666, userInfo: ["No accelerometer data":"info"]) self.delegate?.watchShaker(self, didFailWith: e) return }
let valueX = fabs(data.acceleration.x) let valueY = fabs(data.acceleration.y) let maxValue
= valueX > valueY ? valueX : valueY if maxValue > self.threshold { if let lastDate = self.lastShakeDate { if Date().compare(lastDate.addingTimeInterval(self.delay)) !== .orderedDescending { self.lastShakeDate = Date() self.delegate!?.watchShakerDidShake(self) } return } self.lastShakeDate = Date() self.delegate!?.watchShakerDidShake(self) }
:) @ezefranca http://ezefranca.com