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
560
SharePlayの歴史と進化 そしてvisionOSへ (iOSDC 2023)
tokorom
2
880
5分でSharePlay入門
tokorom
2
1.4k
Advanced Segue 2019年のSegue事情
tokorom
9
5.8k
tvOSアプリUIの勘所
tokorom
1
2k
カッコ悪くリアクティブじゃダメですか?
tokorom
7
12k
古き良きsendAction (in potatotips #26)
tokorom
1
3.6k
画面遷移と私(iOS)
tokorom
4
3.7k
長生きするために心臓に悪いリリースはもうやめよう
tokorom
21
33k
Other Decks in Programming
See All in Programming
Realtime API 入門
riofujimon
0
150
Contemporary Test Cases
maaretp
0
140
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
940
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
2k
Click-free releases & the making of a CLI app
oheyadam
2
120
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
150
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
300
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
130
最新TCAキャッチアップ
0si43
0
190
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
340
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
6
1.7k
Featured
See All Featured
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Thoughts on Productivity
jonyablonski
67
4.3k
Ruby is Unlike a Banana
tanoku
97
11k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
How STYLIGHT went responsive
nonsquared
95
5.2k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
110
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Embracing the Ebb and Flow
colly
84
4.5k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
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