Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PHP で NFC リーダーを実装する

PHP で NFC リーダーを実装する

English Title: Implementation of an NFC Reader with PHP

Yet Another Perl Conference 2022

memory
PRO

March 04, 2022
Tweet

More Decks by memory

Other Decks in Programming

Transcript

  1. Ί΋Γʔ 1)1Ͱ/'$ϦʔμʔΛ࣮૷͢Δ :"1$+BQBO0OMJOF

  2. @2020 Torana, Inc. @2020 Torana, Inc. Ί΋Γʔ ࣗݾ঺հ 1)1Ͱ+7.Λ࣮૷ͨ͠ΓຊΛॻ͍ͯͨΓͯ͠ ·͢ɻೕ༮ࣇ޲͚஌ҭ؝۩ͷαϒεΫϦϓγϣϯ

    αʔϏεΛఏڙ͢ΔגࣜձࣾτϥʔφͰ$50Λ ͍ͯ͠·͢ɻ !NNS
  3. @2020 Torana, Inc.  1FSMͱ͍͑͹ɺLFOUXFCΛ࢖͍ͬͯ·ͨ͠  ॳΊͯͷεΫϦϓτݴޠɺͦͯ͠࠳ં  1FSMͳΜ΋Θ͔ΒΜ 

    ͦͷޙɺ+BWBɾ+BWB4DSJQUΛܦͯ1)1΁ʜ ࣗݾ঺հ
  4. @2020 Torana, Inc. ΋͘͡ ΍ͬͯΈΑ͏ͱࢥͬͨϞνϕʔγϣϯ /'$Ϧʔμʔͱ͸ ࣮૷ํ๏ ·ͱΊ

  5. ΍ͬͯΈΑ͏ͱࢥͬͨ 
 Ϟνϕʔγϣϯ

  6. ͭ͋Γ·͢

  7. ܹ͕ࢗཉ͔ͬͨ͠ʜ

  8. εΫϦϓτݴޠͰϋʔυʹܨ͙ܥ͸ 1ZUIPO͹͔Γ࢖ΘΕͯͯζϧ͍ʜ

  9. ͦ͏ͩɺݟฦͯ͠΍Ζ͏

  10. /'$Ϧʔμʔͱ͸

  11. @2020 Torana, Inc. /'$Ϧʔμʔͱ͸  'FMJ$B΍3'*%ͳͲΛ͚ۙͮΔͱɺԿ͔͠Βಈ࡞͢Δ΋ͷɻ  4VJDB΍1"4.0 F"NVTFNFOU1BTTͳͲ͸'FMJ$B 

    ϢχΫϩ΍(6ͳͲʹ͍͍ͭͯΔλά͸3'*%  ిࢠ֬ఆਃࠂΛ͍ͯ͠Δํ͸ɺ͓ೃછΈ͔΋͠Ε·ͤΜ  ࠷ۙ4POZ͔Β৽͘͠1B4P3J3$4͕ग़·ͨ͠Ͷ
  12. @2020 Torana, Inc. /'$Ϧʔμʔͱ͸  /'$ʹ͸৭ʑͳن͕֨͋Γ·͢  جຊతͳن֨͸*40*&$ /'$*1 *40*&$

    /'$*1   *40*&$ 'FMJ$B ϚΠφϯόʔΧʔυͳͲ   *40*&$ چF".64&.&/51"44   *40*&$ ΩϟογϡΧʔυɾΫϨδοτΧʔυ ͳͲɻ
  13. @2020 Torana, Inc. /'$Ϧʔμʔͱ͸  /'$ʹ͸৭ʑͳن͕֨͋Γ·͢  ີணܕ ʙNN *40*&$

     ۙ઀ܕ ʙDN *40*&$  ۙ๣ܕ ʙDN *40*&$
  14. @2020 Torana, Inc. /'$Ϧʔμʔͱ͸

  15. @2020 Torana, Inc. /'$Ϧʔμʔͱ͸

  16. @2020 Torana, Inc. /'$Ϧʔμʔͱ͸  "NB[POΛݟΔͱ৭ΜͳछྨͷΧʔυϦʔμʔ͕͋Γ·͢  ͕ɺࠓճ͸4POZ੡ͷ1B4P3JΛϕʔεʹτʔΫ͠·͢  ࢖༻͢Δϋʔυ΢ΣΞσόΠε

     1B4P3J3$4  1B4P3J3$4
  17. ࣮૷ํ๏

  18. @2020 Torana, Inc. ࣮૷ํ๏  ϋʔυ΢ΣΞଆ͸ҎԼΛ༻ҙ  1B4P3J3$4  1B4P3J3$4

     1B4P3J3$4ʹ͍ͭͯ  NBD04্ͰMJCOGD QDTDMJUFͰಈ͘͜ͱ͸֬ೝͰ͖͍ͯΔͷͰ͕͢ɺ ॾ໰୊͕͋ΓࠓճͷτʔΫͰ͸͓ݟૹΓͱ͍͚ͤͯͨͩ͞Ε͹ͱࢥ͍·͢
  19. @2020 Torana, Inc. ࣮૷ํ๏  6CVOUV্Ͱ͸ಈ࡞֬ೝ͞ΕͯΔํ͕͍Βͬ ͠Ό͍·͢  IUUQTRJJUBDPNTOJUFNT DGBDGBEEC

     NBD04.POUFSFZͩͱͳ͔ͥ6*% /'$*%  ͕ೝࣝ͞Εͣʜ  ͦ΋ͦ΋MJCOGDͩͱ'FMJ$B͸ೝࣝ͞Εͳ ͍ʢ*40"ͩͱೝࣝ͞ΕΔ໛༷ʣ  QDTD@TDBOͩͱೝࣝ͞ΕΔ
  20. @2020 Torana, Inc. ࣮૷ํ๏  6CVOUV্Ͱ͸ಈ࡞֬ೝ͞ΕͯΔํ͕͍Βͬ ͠Ό͍·͢  IUUQTRJJUBDPNTOJUFNT DGBDGBEEC

     NBD04.POUFSFZͩͱͳ͔ͥ6*% /'$*%  ͕ೝࣝ͞Εͣʜ  ͦ΋ͦ΋MJCOGDͩͱ'FMJ$B͸ೝࣝ͞Εͳ ͍ʢ*40"ͩͱೝࣝ͞ΕΔ໛༷ʣ  QDTD@TDBOͩͱೝࣝ͞ΕΔ
  21. @2020 Torana, Inc. ࣮૷ํ๏  ιϑτ΢ΣΞଆͷ࣮૷  MJCOGD·ͨ͸MJCVTC͕࢖͑ΔεΫϦϓτݴޠΛ༻ҙ  ͭ·Γɺ''*͕࢖͑Ε͹1)1Ͱ΋(PͰ΋1FSMͰ΋࣮૷Ͱ͖·͢

  22. @2020 Torana, Inc. ࣮૷ํ๏  ιϑτ΢ΣΞଆͷ࣮૷  ͨͩ͠MJCOGD͸1B4P3J3$4Ͱ͸ಈ࡞ͤͣ  ͋ͱ"QQMF8BMMFU΋൓Ԡͤͣ

     ߋʹ1)1''*ʹόά͕͋Γɺ''*ʹΞλον͞ΕΔ΂͖ΦϒδΣΫ τ͕Ξλον͞Εͳ͍
  23. @2020 Torana, Inc. ࣮૷ํ๏  ιϑτ΢ΣΞଆͷ࣮૷  1B4P3J3$4 1B4P3J3$4Ͱಈ࡞ͤ͞Δ৔߹͸ɺMJCVTCΛ࢖ͬͯ ࣗ࡞͢Δඞཁ͕͋Γ·͢

     ͳ͓3$4ͷυΩϡϝϯτ͸ɺ΋͏͢ͰʹखʹೖΒͳ͍໛༷  1ZUIPOͷOGDQZͰલྫ͕͋ΔͷͰ1)1ʹॻ͖௚͠·ͨ͠  IUUQTHJUIVCDPNOGDQZOGDQZCMPCNBTUFSTSDOGDDMGSDTQZ
  24. @2020 Torana, Inc. ࣮૷ํ๏  ιϑτ΢ΣΞଆͷ࣮૷  MJCOGDͰ؆୯ʹ࣮૷͍ͨ͠৔߹͸3$4  رগՁ஋͕ߴ͘஋ஈ͕ΊͬͪΌߴಅ͍ͯ͠·͕͢ʜ

     MJCVTCͰ൚༻తʹ࣮૷͍ͨ͠৔߹͸3$4
  25. IUUQTHJUIVCDPNNNSOGDGPSQIQ

  26. MJCOGDͰͷ࣮૷ํ๏

  27. @2020 Torana, Inc. MJCOGDͰͷ࣮૷ํ๏  MJCOGDΛམͱͯ͘͠Δ  NBDͷ৔߹CSFXJOTUBMMMJCOGD  VTSMPDBM$FMMBSMJCOGD\όʔδϣϯ^MJCMJCOGDEZMJC͕࢖͑ΔΑ͏

    ʹͳΕ͹0,  -JOVYͷ৔߹͸VTSMPDBMMJCMJCOGDTP͋ͨΓʹ 
 Πϯετʔϧ͞Ε·͢
  28. @2020 Torana, Inc. MJCOGDͰͷ࣮૷ํ๏  ''*ʹ࢖༻͢ΔϔομʔϑΝΠϧ  OGDJOUFSOBMI  IUUQTHJUIVCDPNOGDUPPMTMJCOGDCMPC

    CBEDFCFGCDBBCDCFFCGCFMJCOGDOGDJOUFSOBMI  OGDUZQFTI  IUUQTHJUIVCDPNOGDUPPMTMJCOGDCMPC CBEDFCFGCDBBCDCFFCGCFJODMVEFOGDOGDUZQFTI
  29. @2020 Torana, Inc. MJCOGDͰͷ࣮૷ํ๏

  30. @2020 Torana, Inc. MJCOGDͰͷ࣮૷ํ๏  ϔομʔϑΝΠϧͷத਎Λॻ͍͍ͯ͘ͱɺҎԼͷΑ͏ʹΞΫηε͕Ͱ͖ ΔΑ͏ʹͳΓ·͢

  31. @2020 Torana, Inc. MJCOGDͰͷ࣮૷ํ๏  MJCOGDʹ͸αϯϓϧ͕͋ΔͷͰɺݟͳ͕Β''*Ͱ࣮૷͕Ͱ͖·͢  IUUQTHJUIVCDPNOGDUPPMTMJCOGDCMPCNBTUFSFYBNQMFT OGDQPMMD 

    ࣮͸1FSMʹ͸DQBOͰೖΕΒΕΔ3'*%-JCOGD͕͋Γ·͢  গ͠όʔδϣϯݹ͍ͬΆ͍ʁ
  32. MJCTVCͰͷ࣮૷ํ๏

  33. @2020 Torana, Inc. MJCVTCͰͷ࣮૷ํ๏  ൚༻తʹ࣮૷͢ΔͳΒMJCVTC  MJCVTCΛམͱͯ͘͠Δ  NBDͷ৔߹CSFXJOTUBMMMJCVTC

     VTSMPDBM$FMMBSMJCOGD\όʔδϣϯ^MJCMJCVTCEZMJC͕࢖͑ΔΑ͏ʹͳΕ͹0,  -JOVYͷ৔߹͸VTSMPDBMMJCMJCVTCTP͋ͨΓʹ 
 Πϯετʔϧ͞Ε·͢
  34. @2020 Torana, Inc. MJCVTCͰͷ࣮૷ํ๏  ҎԼΛࢀߟʹ࣮૷  IUUQTHJUIVCDPNOGDQZOGDQZCMPCNBTUFSTSDOGDDMG SDTQZ 

    IUUQTHJUIVCDPNZTPNFJUFTU@HFUOGDJECMPCNBTUFS HFUEFWJDFJEDQQ  IUUQTRJJUBDPNTBUVSEBZJUFNTGDEGCCDC
  35. @2020 Torana, Inc. MJCVTCͰͷ࣮૷ํ๏  ''*ʹ࢖༻͢ΔϔομʔϑΝΠϧ  IUUQTHJUIVCDPNMJCVTCMJCVTCCMPCNBTUFSMJCVTCMJCVTCI

  36. IUUQTHJUIVCDPNNNSOGDGPSQIQCMPC NBTUFSTSD%SJWFST3$43$4$PNNBOEQIQ

  37. @2020 Torana, Inc. MJCVTCͰͷ࣮૷ํ๏  ൚༻తʹ࣮૷͢ΔͳΒMJCVTC  MJCVTCΛ࢖͑͹ɺ64#Ͱ઀ଓ͍ͯ͠ΔσόΠεͱ௨৴͕Ͱ͖Δ  ྫ͑͹ɺ/'$Ҏ֎ʹ΋࢖͍ಓ͸ͨ͘͞Μ͋Δ

     ྫ͑͹εϐʔΧʔɾϔουϑΥϯͱ͔ɺ64#Χϝϥɺ64#ϚΠΫɺ 64#ΩʔϘʔυɺ64#ϝϞϦ)%%44%ͳͲͱͷ௨৴
  38. %&.0

  39. ·ͱΊ

  40. @2020 Torana, Inc. ·ͱΊ  ϋʔυ΢ΣΞ͕བྷΜͰ͘Δͱϋʔυϧ͕ΊͬͪΌ্͕Δؾ͕͠·͕͢ɺ ҙ֎ͱ؆୯ʹ࣮૷͕Ͱ͖·͢  ΋ͪΖΜ1FSMͰ΋''*SBXΛ࢖༻͢Ε͹࣮૷Ͱ͖·͢ʂ 

    ࣍͸1)1Ͱ#MVFUPPUI΍Γ͍ͨͳͱࢥͬͯ·͢
  41. @2020 Torana, Inc. ࢀߟ  IUUQTXXXKJQEFDPSKQBSDIJWFTQVCMJDBUJPOT+ 1%'   IUUQTXXXTPOZDPKQ1SPEVDUTGFMJDB/'$