Slide 1

Slide 1 text

ॴ༑ଠ:VUB5PLPSP J04UW04"QQ1SPHSBNNFS )PNF,JU J04%$+BQBO

Slide 2

Slide 2 text

@tokorom tokorom Spinners Inc. ॴ ༑ଠ / Yuta Tokoro

Slide 3

Slide 3 text

)PNF,JU֓ཁ )PNF,JUͱ͸

Slide 4

Slide 4 text

)PNF,JU֓ཁ )PNF,JUશମ૾ w J1IPOFͳͲͷ"QQMF੡඼͔Β༷ʑͳσόΠε Λ؅ཧɾίϯτϩʔϧ͢ΔͨΊͷ࿮૊Έ )PNF,JU

Slide 5

Slide 5 text

)PNF,JU֓ཁ )PNF,JU'SBNFXPSL w αʔυύʔςΟ੡ΞϓϦ͕ରԠ੡඼Λίϯτ ϩʔϧ͢ΔͨΊͷ'SBNFXPSL )PNF,JU 'SBNFXPSL

Slide 6

Slide 6 text

)PNF,JU֓ཁ )PNF,JU"%, w )PNF,JUʹରԠσόΠεΛ։ൃ͢ΔͨΊͷΩ οτ )PNF,JU "%,

Slide 7

Slide 7 text

)PNF,JU֓ཁ )"1 w "QQMF੡඼ͱ)PNF,JUରԠσόΠε͕૬ޓʹ ௨৴͢ΔͨΊͷϓϩτίϧ )PNF,JU "DDFTTPSZ 1SPUPDPM )"1

Slide 8

Slide 8 text

"HFOEB w )PNF,JU'SBNFXPSLͬ͘͟Γೖ໳ w )PNF,JUͷ#SJEHFʹ͍ͭͯ w )PNFCSJEHFͰ)PNF,JUະରԠ੡඼Λ)PNF,JUରԠ w )PNF,JU"%,Ͱ࡞Δࣗ࡞ΞΫηαϦ

Slide 9

Slide 9 text

"HFOEB w )PNF,JU'SBNFXPSLͬ͘͟Γೖ໳ w )PNF,JUͷ#SJEHFʹ͍ͭͯ w )PNFCSJEHFͰ)PNF,JUະରԠ੡඼Λ)PNF,JUରԠ w )PNF,JU"%,Ͱ࡞Δࣗ࡞ΞΫηαϦ

Slide 10

Slide 10 text

)PNF,JU'SBNFXPSLͬ͘͟Γೖ໳ )PNF,JU'SBNFXPSLͰͰ͖Δ͜ͱ

Slide 11

Slide 11 text

)PNF,JU'SBNFXPSLͬ͘͟Γೖ໳ )PNF,JU'SBNFXPSLͰͰ͖Δ͜ͱ

Slide 12

Slide 12 text

)PNF,JU'SBNFXPSLͬ͘͟Γೖ໳ )PNF,JU'SBNFXPSLͰͰ͖Δ͜ͱ w ϗʔϜ΍ϧʔϜͳͲͷάϧʔϐϯάͷ؅ཧ w σόΠεͷ؅ཧͱૢ࡞ w σόΠεΛҰ౓ʹૢ࡞͢Δγʔϯͷ؅ཧ w ΦʔτϝʔγϣϯͷͨΊͷτϦΨʔͷ؅ཧ w ϗʔϜʹΞΫηεͰ͖ΔϢʔβʔͷ؅ཧ w ϗʔϜ΍σόΠεͷมߋݕ஌

Slide 13

Slide 13 text

)PNF,JU'SBNFXPSLͬ͘͟Γೖ໳ ؅ཧཁૉͷߏ੒

Slide 14

Slide 14 text

)PNF,JU'SBNFXPSLͬ͘͟Γೖ໳ )PNF,JUͷߏ੒

Slide 15

Slide 15 text

)PNF,JU'SBNFXPSLͬ͘͟Γೖ໳ ిٿΛ఺౮ͤ͞Δίʔυ let power = home .servicesWithTypes([HMServiceTypeLightbulb])? .first? .characteristics .filter { $0.characteristicType == HMCharacteristicTypePowerState } .first power.writeValue(true) { error in }

Slide 16

Slide 16 text

)PNF,JU'SBNFXPSLͬ͘͟Γೖ໳ αϙʔτ͍ͯ͠ΔΩϟϥΫλʔ let power = home .servicesWithTypes([HMServiceTypeLightbulb])? .first? .characteristics .filter { $0.characteristicType == HMCharacteristicTypePowerState } .first power.writeValue(true) { error in }

Slide 17

Slide 17 text

)PNF,JU'SBNFXPSLͬ͘͟Γೖ໳ αϙʔτ͍ͯ͠ΔΩϟϥΫλʔ

Slide 18

Slide 18 text

)PNF,JU'SBNFXPSLͬ͘͟Γೖ໳ Ӆ͠ΩϟϥΫλʔΛࢀর͢Δ &MHBUP&WF8FBUIFS8JSFMFTT0VUEPPS4FOTPS

Slide 19

Slide 19 text

)PNF,JU'SBNFXPSLͬ͘͟Γೖ໳ Ӆ͠ΩϟϥΫλʔΛࢀর͢Δ w ؾԹ w ࣪౓ w ؾѹ)PNF,JUະαϙʔτͷΩϟϥΫλʔʂ

Slide 20

Slide 20 text

)PNF,JU'SBNFXPSLͬ͘͟Γೖ໳ Ӆ͠ΩϟϥΫλʔΛࢀর͢Δ let power = home .servicesWithTypes([HMServiceTypeLightbulb])? .first? .characteristics .filter { $0.characteristicType == HMCharacteristicTypePowerState } .first power.writeValue(true) { error in }

Slide 21

Slide 21 text

)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 }

Slide 22

Slide 22 text

)PNF,JU'SBNFXPSLͬ͘͟Γೖ໳ Ӆ͠ΩϟϥΫλʔΛࢀর͢Δ for characteristic in service.characteristics { print("ID: \(characteristic.characteristicType)”) print("આ໌: \(characteristic.metadata?.manufacturerDescription ?? "")") }

Slide 23

Slide 23 text

)PNF,JU'SBNFXPSLͬ͘͟Γೖ໳ ).$BNFSB7JFX

Slide 24

Slide 24 text

)PNF,JUͰͰ͖Δ͜ͱ۩ମྫ ଞϓϥοτϑΥʔϜΑΓࡉ΍͔ͳઃఆ w ΫϦεϚεϥΠτΛʮ೔ͷೖʯʹ఺౮͢Δ w Ոʹ୭΋͍ͳ͘ͳͬͨΒશͯͷిؾΛফ౮ͯ͠ώʔλʔΛࢭΊΔ w ࣗಈ఺౮ͨ͠ϥΠτΛඵޙʹফ౮͢Δ w ೔தͰτΠϨ͕े෼໌Δ͚Ε͹ࣗಈ఺౮͠ͳ͍

Slide 25

Slide 25 text

"HFOEB w )PNF,JU'SBNFXPSLͬ͘͟Γೖ໳ w )PNF,JUͷ#SJEHFʹ͍ͭͯ w )PNFCSJEHFͰ)PNF,JUະରԠ੡඼Λ)PNF,JUରԠ w )PNF,JU"%,Ͱ࡞Δࣗ࡞ΞΫηαϦ

Slide 26

Slide 26 text

)PNF,JUͷ#SJEHFʹ͍ͭͯ )VFͷྫ

Slide 27

Slide 27 text

)PNF,JUͷ#SJEHFʹ͍ͭͯ )VFͷྫ )PNF,JUະରԠʂʁ

Slide 28

Slide 28 text

)PNF,JUͷ#SJEHFʹ͍ͭͯ )VFͷྫ )VF#SJEHF

Slide 29

Slide 29 text

)PNF,JUͷ#SJEHFʹ͍ͭͯ )VFͷྫ )VF#SJEHF

Slide 30

Slide 30 text

)PNF,JUͷ#SJEHFʹ͍ͭͯ )PNFCSJEHF IUUQTIPNFCSJEHFJP

Slide 31

Slide 31 text

)PNF,JUͷ#SJEHFʹ͍ͭͯ )VFͷྫ )PNFCSJEHF " # $ %

Slide 32

Slide 32 text

"HFOEB w )PNF,JU'SBNFXPSLͬ͘͟Γೖ໳ w )PNF,JUͷ#SJEHFʹ͍ͭͯ w )PNFCSJEHFͰ)PNF,JUະରԠ੡඼Λ)PNF,JUରԠ w )PNF,JU"%,Ͱ࡞Δࣗ࡞ΞΫηαϦ

Slide 33

Slide 33 text

)PNFCSJEHF ରԠσόΠεͷ۩ମྫ ϧϯό #SPBEMJOL3.NJOJ ʢ੺֎ઢϦϞίϯʣ 4&4".& ʢεϚʔτϩοΫʣ Χϝϥ

Slide 34

Slide 34 text

)PNFCSJEHF ࣗ୐Ͱ)PNFCSJEHFΛ࢖͏ʹ͸ " # $ %

Slide 35

Slide 35 text

)PNFCSJEHF ࣗ୐Ͱ)PNFCSJEHFΛ࢖͏ʹ͸ " # $ % IUUQTIPNFCSJEHFJP

Slide 36

Slide 36 text

)PNFCSJEHF )PNFCSJEHFΛ)PNFʹ௥Ճ

Slide 37

Slide 37 text

)PNFCSJEHF ϓϥάΠϯΛࣗ࡞ IUUQTHJUIVCDPNIPNFCSJEHFIPNFCSJEHFQMVHJOUFNQMBUF

Slide 38

Slide 38 text

"HFOEB w )PNF,JU'SBNFXPSLͬ͘͟Γೖ໳ w )PNF,JUͷ#SJEHFʹ͍ͭͯ w )PNFCSJEHFͰ)PNF,JUະରԠ੡඼Λ)PNF,JUରԠ w )PNF,JU"%,Ͱ࡞Δࣗ࡞ΞΫηαϦ

Slide 39

Slide 39 text

)PNF,JU"%, ֓ཁ w )PNF,JU"DDFTTPSZ%FWFMPQNFOU,JU w ΞΫηαϦʔϝʔΧʔ͕)PNF,JUରԠσόΠεΛ։ൃ͢ΔͨΊͷΩοτ w ೥݄ʹΦʔϓϯιʔε൛͕ϦϦʔε w झຯͰͳΒࣗ༝ʹ։ൃͯ͠0,

Slide 40

Slide 40 text

)PNF,JU"%, )PNFCSJEHFͱͷҧ͍ )PNFCSJEHF # $ % "

Slide 41

Slide 41 text

)PNF,JU"%, )PNFCSJEHFͱͷҧ͍ "%, # $ % " "%, "%, "%,

Slide 42

Slide 42 text

)PNF,JU"%, ࣗ෼ͰΞΫηαϦʔΛ࡞Δ IUUQTHJUIVCDPNBQQMF)PNF,JU"%,

Slide 43

Slide 43 text

)PNF,JU"%, ࣗ෼ͰΞΫηαϦʔΛ࡞Δ $ brew install [υΩϡϝϯτʹॻ͔Ε͍ͯΔ΋ͷ͍͔ͭ͘] $ make all $ ./Output/লུ/Debug/IP/Applications/Lightbulb.OpenSSL

Slide 44

Slide 44 text

)PNF,JU"%, ࣗ෼ͰΞΫηαϦʔΛ࡞Δ Info [com.apple.mfi.HomeKit.Core:AccessoryServer] Accessory server starting.

Slide 45

Slide 45 text

)PNF,JU"%, ࣗ෼ͰΞΫηαϦʔΛ࡞Δ

Slide 46

Slide 46 text

)PNF,JU"%, ࣗ෼ͰΞΫηαϦʔΛ࡞Δ Info HandleLightBulbOnWrite: true ... Info HandleLightBulbOnWrite: false

Slide 47

Slide 47 text

)PNF,JU"%, ࣗ෼ͰΞΫηαϦʔΛ࡞Δ lightbulb_slack/Applications/Lightbulb/App.c #include HAPError HandleLightBulbOnWrite( // ... if (value) { system("./handleLightBulbOn"); } // ... }

Slide 48

Slide 48 text

)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()

Slide 49

Slide 49 text

)PNF,JU"%, ࣗ෼ͰΞΫηαϦʔΛ࡞Δ

Slide 50

Slide 50 text

.PSF*OGPSNBUJPO w J041SPHSBNNJOH w Ξοϓϧͷ)PNF1PEͱ)PNF,JUٕज़ຊ IUUQTQFBLTDDCPPLTJ04 IUUQTCPPUIQNKBJUFNT