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
320
[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
4
Decision-making algorithms and Planning Algorithms
ezefranca
1
35
Dependency Management in iOS Development: A Developer Survey Perspective
ezefranca
0
92
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
300
Server-Driven UI na prática
ezefranca
0
270
Modelo Clássico e Jogos (Jesper Jull) e exergames.
ezefranca
0
110
Server Driven UI Diferença e evolução em 2010 e 2020
ezefranca
0
1.4k
[#2 Community day Shawee] Prototipação eletrônica em Hackathons: idéias makers ganhando vida
ezefranca
0
1k
[7 Masters - Intercon 2018] 7 dicas de performance Mobile
ezefranca
0
300
Other Decks in Programming
See All in Programming
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
250
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
6
1.1k
詳細解説! ArrayListの仕組みと実装
yujisoftware
0
580
ヤプリ新卒SREの オンボーディング
masaki12
0
130
初めてDefinitelyTypedにPRを出した話
syumai
0
400
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
250
OSSで起業してもうすぐ10年 / Open Source Conference 2024 Shimane
furukawayasuto
0
100
CSC509 Lecture 11
javiergs
PRO
0
180
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
1.8k
Featured
See All Featured
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
The Language of Interfaces
destraynor
154
24k
Practical Orchestrator
shlominoach
186
10k
KATA
mclloyd
29
14k
A Philosophy of Restraint
colly
203
16k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
Six Lessons from altMBA
skipperchong
27
3.5k
A better future with KSS
kneath
238
17k
Docker and Python
trallard
40
3.1k
Thoughts on Productivity
jonyablonski
67
4.3k
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