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
340
[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
87
Decision-making algorithms and Planning Algorithms
ezefranca
1
61
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
Final Project FIAP - Poumon
ezefranca
0
2
Other Decks in Programming
See All in Programming
Jasprが凄い話
hyshu
0
270
JavaOne 2025: Advancing Java Profiling
jbachorik
1
230
運用しながらリアーキテクチャ
nealle
0
320
Scala 3 で GLSL のための c-like-for を実装してみた
exoego
1
150
もう一人で悩まない! 個の知見をチームの知見にする3つの習慣と工夫 / Into team knowledge.
honyanya
3
470
⚪⚪の⚪⚪をSwiftUIで再現す る
u503
0
160
CIBMTR振り返り+敗北から学ぶコンペの取り組み方反省
takanao
1
420
RecSys2024 参加報告
unonao
1
160
AWS CDKにおけるL2 Constructの仕組み / aws-cdk-l2-construct
gotok365
4
860
生産性アップのためのAI個人活用
kunoyasu
0
440
Devin , 正しい付き合い方と使い方 / Living and Working with Devin
yukinagae
1
420
バックエンドNode.js × フロントエンドDeno で開発して得られた知見
ayame113
4
1.2k
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
693
190k
Java REST API Framework Comparison - PWX 2021
mraible
29
8.4k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.7k
Speed Design
sergeychernyshev
28
840
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
7.1k
Become a Pro
speakerdeck
PRO
26
5.2k
The World Runs on Bad Software
bkeepers
PRO
67
11k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
11
580
Stop Working from a Prison Cell
hatefulcrawdad
268
20k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
176
52k
Designing for Performance
lara
605
69k
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