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
HomeKit 2020
Search
tokorom
September 19, 2020
Programming
7
2.4k
HomeKit 2020
iOSDC Japan 2020 9/19 TrackA のセッション
tokorom
September 19, 2020
Tweet
Share
More Decks by tokorom
See All by tokorom
続・SharePlayの歴史と進化 iOS18とApple Vision Proにおける新展開
tokorom
3
520
SharePlayの歴史と進化 そしてvisionOSへ (iOSDC 2023)
tokorom
2
870
5分でSharePlay入門
tokorom
2
1.4k
Advanced Segue 2019年のSegue事情
tokorom
9
5.8k
tvOSアプリUIの勘所
tokorom
1
1.9k
カッコ悪くリアクティブじゃダメですか?
tokorom
7
12k
古き良きsendAction (in potatotips #26)
tokorom
1
3.5k
画面遷移と私(iOS)
tokorom
4
3.7k
長生きするために心臓に悪いリリースはもうやめよう
tokorom
21
33k
Other Decks in Programming
See All in Programming
推し活としてのrails new/oshikatsu_ha_iizo
sakahukamaki
3
1.7k
go.mod、DockerfileやCI設定に分散しがちなGoのバージョンをまとめて管理する / Go Connect #3
arthur1
10
2.4k
Vitest Browser Mode への期待 / Vitest Browser Mode
odanado
PRO
2
1.7k
RailsのPull requestsのレビューの時に私が考えていること
yahonda
5
1.7k
hotwire_or_react
harunatsujita
8
4k
Identifying User Idenity
moro
6
7.8k
2万ページのSSG運用における工夫と注意点 / Vue Fes Japan 2024
chinen
3
1.3k
Vaporモードを大規模サービスに最速導入して学びを共有する
kazukishimamoto
4
4.3k
外部システム連携先が10を超えるシステムでのアーキテクチャ設計・実装事例
kiwasaki
1
220
Modern Angular: Renovation for Your Applications
manfredsteyer
PRO
0
200
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
130
推し活の ハイトラフィックに立ち向かう Railsとアーキテクチャ - Kaigi on Rails 2024
falcon8823
6
2.2k
Featured
See All Featured
Making Projects Easy
brettharned
115
5.9k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
13
1.9k
Building Applications with DynamoDB
mza
90
6.1k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
How STYLIGHT went responsive
nonsquared
95
5.2k
How GitHub (no longer) Works
holman
311
140k
Docker and Python
trallard
40
3.1k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
27
1.9k
Bash Introduction
62gerente
608
210k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Building an army of robots
kneath
302
42k
Transcript
ॴ༑ଠ:VUB5PLPSP J04UW04"QQ1SPHSBNNFS )PNF,JU J04%$+BQBO
@tokorom tokorom Spinners Inc. ॴ ༑ଠ / Yuta Tokoro
)PNF,JU֓ཁ )PNF,JUͱ
)PNF,JU֓ཁ )PNF,JUશମ૾ w J1IPOFͳͲͷ"QQMF͔Β༷ʑͳσόΠε Λཧɾίϯτϩʔϧ͢ΔͨΊͷΈ )PNF,JU
)PNF,JU֓ཁ )PNF,JU'SBNFXPSL w αʔυύʔςΟΞϓϦ͕ରԠΛίϯτ ϩʔϧ͢ΔͨΊͷ'SBNFXPSL )PNF,JU 'SBNFXPSL
)PNF,JU֓ཁ )PNF,JU"%, w )PNF,JUʹରԠσόΠεΛ։ൃ͢ΔͨΊͷΩ οτ )PNF,JU "%,
)PNF,JU֓ཁ )"1 w "QQMFͱ)PNF,JUରԠσόΠε͕૬ޓʹ ௨৴͢ΔͨΊͷϓϩτίϧ )PNF,JU "DDFTTPSZ 1SPUPDPM )"1
"HFOEB w )PNF,JU'SBNFXPSLͬ͘͟Γೖ w )PNF,JUͷ#SJEHFʹ͍ͭͯ w )PNFCSJEHFͰ)PNF,JUະରԠΛ)PNF,JUରԠ w )PNF,JU"%,Ͱ࡞Δࣗ࡞ΞΫηαϦ
"HFOEB w )PNF,JU'SBNFXPSLͬ͘͟Γೖ w )PNF,JUͷ#SJEHFʹ͍ͭͯ w )PNFCSJEHFͰ)PNF,JUະରԠΛ)PNF,JUରԠ w )PNF,JU"%,Ͱ࡞Δࣗ࡞ΞΫηαϦ
)PNF,JU'SBNFXPSLͬ͘͟Γೖ )PNF,JU'SBNFXPSLͰͰ͖Δ͜ͱ
)PNF,JU'SBNFXPSLͬ͘͟Γೖ )PNF,JU'SBNFXPSLͰͰ͖Δ͜ͱ
)PNF,JU'SBNFXPSLͬ͘͟Γೖ )PNF,JU'SBNFXPSLͰͰ͖Δ͜ͱ w ϗʔϜϧʔϜͳͲͷάϧʔϐϯάͷཧ w σόΠεͷཧͱૢ࡞ w σόΠεΛҰʹૢ࡞͢Δγʔϯͷཧ w ΦʔτϝʔγϣϯͷͨΊͷτϦΨʔͷཧ
w ϗʔϜʹΞΫηεͰ͖ΔϢʔβʔͷཧ w ϗʔϜσόΠεͷมߋݕ
)PNF,JU'SBNFXPSLͬ͘͟Γೖ ཧཁૉͷߏ
)PNF,JU'SBNFXPSLͬ͘͟Γೖ )PNF,JUͷߏ
)PNF,JU'SBNFXPSLͬ͘͟Γೖ ిٿΛ౮ͤ͞Δίʔυ let power = home .servicesWithTypes([HMServiceTypeLightbulb])? .first? .characteristics .filter
{ $0.characteristicType == HMCharacteristicTypePowerState } .first power.writeValue(true) { error in }
)PNF,JU'SBNFXPSLͬ͘͟Γೖ αϙʔτ͍ͯ͠ΔΩϟϥΫλʔ let power = home .servicesWithTypes([HMServiceTypeLightbulb])? .first? .characteristics .filter
{ $0.characteristicType == HMCharacteristicTypePowerState } .first power.writeValue(true) { error in }
)PNF,JU'SBNFXPSLͬ͘͟Γೖ αϙʔτ͍ͯ͠ΔΩϟϥΫλʔ
)PNF,JU'SBNFXPSLͬ͘͟Γೖ Ӆ͠ΩϟϥΫλʔΛࢀর͢Δ &MHBUP&WF8FBUIFS8JSFMFTT0VUEPPS4FOTPS
)PNF,JU'SBNFXPSLͬ͘͟Γೖ Ӆ͠ΩϟϥΫλʔΛࢀর͢Δ w ؾԹ w ࣪ w ؾѹ)PNF,JUະαϙʔτͷΩϟϥΫλʔʂ
)PNF,JU'SBNFXPSLͬ͘͟Γೖ Ӆ͠ΩϟϥΫλʔΛࢀর͢Δ let power = home .servicesWithTypes([HMServiceTypeLightbulb])? .first? .characteristics .filter
{ $0.characteristicType == HMCharacteristicTypePowerState } .first power.writeValue(true) { error in }
)PNF,JU'SBNFXPSLͬ͘͟Γೖ Ӆ͠ΩϟϥΫλʔΛࢀর͢Δ let airPressure = home .servicesWithTypes(["E863F00A-079E-48FF-8F27-9C2605A29F52"])? .first? .characteristics .filter
{ $0.characteristicType == "E863F10F-079E-48FF-8F27-9C2605A29F52" } .first airPressure.readValue { error in let value = airPressure.value as? Float }
)PNF,JU'SBNFXPSLͬ͘͟Γೖ Ӆ͠ΩϟϥΫλʔΛࢀর͢Δ for characteristic in service.characteristics { print("ID: \(characteristic.characteristicType)”) print("આ໌:
\(characteristic.metadata?.manufacturerDescription ?? "")") }
)PNF,JU'SBNFXPSLͬ͘͟Γೖ ).$BNFSB7JFX
)PNF,JUͰͰ͖Δ͜ͱ۩ମྫ ଞϓϥοτϑΥʔϜΑΓࡉ͔ͳઃఆ w ΫϦεϚεϥΠτΛʮͷೖʯʹ౮͢Δ w Ոʹ୭͍ͳ͘ͳͬͨΒશͯͷిؾΛফ౮ͯ͠ώʔλʔΛࢭΊΔ w ࣗಈ౮ͨ͠ϥΠτΛඵޙʹফ౮͢Δ w தͰτΠϨ͕े໌Δ͚Εࣗಈ౮͠ͳ͍
"HFOEB w )PNF,JU'SBNFXPSLͬ͘͟Γೖ w )PNF,JUͷ#SJEHFʹ͍ͭͯ w )PNFCSJEHFͰ)PNF,JUະରԠΛ)PNF,JUରԠ w )PNF,JU"%,Ͱ࡞Δࣗ࡞ΞΫηαϦ
)PNF,JUͷ#SJEHFʹ͍ͭͯ )VFͷྫ
)PNF,JUͷ#SJEHFʹ͍ͭͯ )VFͷྫ )PNF,JUະରԠʂʁ
)PNF,JUͷ#SJEHFʹ͍ͭͯ )VFͷྫ )VF#SJEHF
)PNF,JUͷ#SJEHFʹ͍ͭͯ )VFͷྫ )VF#SJEHF
)PNF,JUͷ#SJEHFʹ͍ͭͯ )PNFCSJEHF IUUQTIPNFCSJEHFJP
)PNF,JUͷ#SJEHFʹ͍ͭͯ )VFͷྫ )PNFCSJEHF " # $ %
"HFOEB w )PNF,JU'SBNFXPSLͬ͘͟Γೖ w )PNF,JUͷ#SJEHFʹ͍ͭͯ w )PNFCSJEHFͰ)PNF,JUະରԠΛ)PNF,JUରԠ w )PNF,JU"%,Ͱ࡞Δࣗ࡞ΞΫηαϦ
)PNFCSJEHF ରԠσόΠεͷ۩ମྫ ϧϯό #SPBEMJOL3.NJOJ ʢ֎ઢϦϞίϯʣ 4&4".& ʢεϚʔτϩοΫʣ Χϝϥ
)PNFCSJEHF ࣗͰ)PNFCSJEHFΛ͏ʹ " # $ %
)PNFCSJEHF ࣗͰ)PNFCSJEHFΛ͏ʹ " # $ % IUUQTIPNFCSJEHFJP
)PNFCSJEHF )PNFCSJEHFΛ)PNFʹՃ
)PNFCSJEHF ϓϥάΠϯΛࣗ࡞ IUUQTHJUIVCDPNIPNFCSJEHFIPNFCSJEHFQMVHJOUFNQMBUF
"HFOEB w )PNF,JU'SBNFXPSLͬ͘͟Γೖ w )PNF,JUͷ#SJEHFʹ͍ͭͯ w )PNFCSJEHFͰ)PNF,JUະରԠΛ)PNF,JUରԠ w )PNF,JU"%,Ͱ࡞Δࣗ࡞ΞΫηαϦ
)PNF,JU"%, ֓ཁ w )PNF,JU"DDFTTPSZ%FWFMPQNFOU,JU w ΞΫηαϦʔϝʔΧʔ͕)PNF,JUରԠσόΠεΛ։ൃ͢ΔͨΊͷΩοτ w ݄ʹΦʔϓϯιʔε൛͕ϦϦʔε w झຯͰͳΒࣗ༝ʹ։ൃͯ͠0,
)PNF,JU"%, )PNFCSJEHFͱͷҧ͍ )PNFCSJEHF # $ % "
)PNF,JU"%, )PNFCSJEHFͱͷҧ͍ "%, # $ % " "%, "%, "%,
)PNF,JU"%, ࣗͰΞΫηαϦʔΛ࡞Δ IUUQTHJUIVCDPNBQQMF)PNF,JU"%,
)PNF,JU"%, ࣗͰΞΫηαϦʔΛ࡞Δ $ brew install [υΩϡϝϯτʹॻ͔Ε͍ͯΔͷ͍͔ͭ͘] $ make all $
./Output/লུ/Debug/IP/Applications/Lightbulb.OpenSSL
)PNF,JU"%, ࣗͰΞΫηαϦʔΛ࡞Δ Info [com.apple.mfi.HomeKit.Core:AccessoryServer] Accessory server starting.
)PNF,JU"%, ࣗͰΞΫηαϦʔΛ࡞Δ
)PNF,JU"%, ࣗͰΞΫηαϦʔΛ࡞Δ Info HandleLightBulbOnWrite: true ... Info HandleLightBulbOnWrite: false
)PNF,JU"%, ࣗͰΞΫηαϦʔΛ࡞Δ lightbulb_slack/Applications/Lightbulb/App.c #include <stdlib.h> HAPError HandleLightBulbOnWrite( // ... if
(value) { system("./handleLightBulbOn"); } // ... }
)PNF,JU"%, ࣗͰΞΫηαϦʔΛ࡞Δ #!/usr/bin/swift import Foundation let slackURL = URL(string: "Incoming
Webhook URL") var request = URLRequest(url: slackURL!) request.httpMethod = "POST" request.setValue("application/json", forHTTPHeaderField: "Content-type") let message = "ϥΠτ͕౮" let postData = "{\"text\": \"\(message)\"}".data(using: .utf8) request.httpBody = postData let semaphore = DispatchSemaphore(value: 0) let session = URLSession(configuration: URLSessionConfiguration.default) let task = session.dataTask(with: request) { _, _, _ in semaphore.signal() } task.resume() semaphore.wait()
)PNF,JU"%, ࣗͰΞΫηαϦʔΛ࡞Δ
.PSF*OGPSNBUJPO w J041SPHSBNNJOH w Ξοϓϧͷ)PNF1PEͱ)PNF,JUٕज़ຊ IUUQTQFBLTDDCPPLTJ04 IUUQTCPPUIQNKBJUFNT