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
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
170
Ethereum_.pdf
nekomatu
0
460
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
530
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
250
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
190
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
330
Better Code Design in PHP
afilina
PRO
0
120
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
330
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Docker and Python
trallard
40
3.1k
Producing Creativity
orderedlist
PRO
341
39k
Being A Developer After 40
akosma
86
590k
The Language of Interfaces
destraynor
154
24k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Visualization
eitanlees
145
15k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Why Our Code Smells
bkeepers
PRO
334
57k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Practical Orchestrator
shlominoach
186
10k
The World Runs on Bad Software
bkeepers
PRO
65
11k
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