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 dos Santos
October 26, 2017
Programming
1
750
[7 Masters] Wearables - WatchShaker
Ezequiel dos Santos
October 26, 2017
Tweet
Share
More Decks by Ezequiel dos Santos
See All by Ezequiel dos Santos
ICECER 2025: Cross-Device Motion Interaction via Apple’s Native System Frameworks
ezefranca
0
29
Fruta Feia – ICT in Circular Food Networks: A Scoping Review
ezefranca
0
16
[Segah 2025] Gamified Interventions for Composting Behavior in the Workplace
ezefranca
0
240
Gamified Interventions for Composting Behavior: A Case Study Using the Gamiflow Framework in a Workplace Setting
ezefranca
1
450
Comparative Analysis of AI Models in Managing Household Food Waste: OpenAI GPT-4, Google Gemini, Mistral, and Anthropic Claude
ezefranca
0
660
Decision-making algorithms and Planning Algorithms
ezefranca
1
510
Dependency Management in iOS Development: A Developer Survey Perspective
ezefranca
0
580
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
800
Server-Driven UI na prática
ezefranca
0
720
Other Decks in Programming
See All in Programming
RubyとGoでゼロから作る証券システム: 高信頼性が求められるシステムのコードの外側にある設計と運用のリアル
free_world21
0
260
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
540
ロボットのための工場に灯りは要らない
watany
10
2.6k
AHC061解説
shun_pi
0
360
技術検証結果の整理と解析をAIに任せよう!
keisukeikeda
0
110
GC言語のWasm化とComponent Modelサポートの実践と課題 - Scalaの場合
tanishiking
0
110
Codexに役割を持たせる 他のAIエージェントと組み合わせる実務Tips
o8n
4
1.3k
猫の手も借りたい!ので AIエージェント猫を作って社内に放した話 Claude Code × Container Lambda の Slack Bot "DevNeko"
naramomi7
0
260
コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions
handlename
0
190
どんと来い、データベース信頼性エンジニアリング / Introduction to DBRE
nnaka2992
1
280
Ruby x Terminal
a_matsuda
7
590
New in Go 1.26 Implementing go fix in product development
sunecosuri
0
420
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
We Have a Design System, Now What?
morganepeng
55
8k
Into the Great Unknown - MozCon
thekraken
40
2.3k
So, you think you're a good person
axbom
PRO
2
2k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
68
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.5k
WENDY [Excerpt]
tessaabrams
9
36k
Statistics for Hackers
jakevdp
799
230k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
190
Scaling GitHub
holman
464
140k
Embracing the Ebb and Flow
colly
88
5k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.9k
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