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
BLE on React Native
Search
januswel
February 08, 2018
Programming
2
1.3k
BLE on React Native
some tips to use BLE on React Native
januswel
February 08, 2018
Tweet
Share
More Decks by januswel
See All by januswel
今日からできる環境カイゼン
januswel
0
720
読みやすいコード クラスメソッド 2022 年度新卒研修
januswel
2
8.9k
Accelerate your business with React Native
januswel
0
2.2k
猫の手も借りたい引っ張りだこ企業による LINE API活用事例発表会! クラスメソッド編
januswel
0
140
現状確認
januswel
0
870
polyglot になろう !!
januswel
1
5.8k
React Native & monorepo
januswel
0
1k
What is React Native?
januswel
1
1.1k
discussion about the bridge
januswel
1
4k
Other Decks in Programming
See All in Programming
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
CSC509 Lecture 12
javiergs
PRO
0
160
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
280
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
Jakarta EE meets AI
ivargrimstad
0
120
Remix on Hono on Cloudflare Workers
yusukebe
1
280
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
190
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
6
1.1k
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.1k
OSSで起業してもうすぐ10年 / Open Source Conference 2024 Shimane
furukawayasuto
0
100
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
330
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
88
5.7k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
A Modern Web Designer's Workflow
chriscoyier
693
190k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Transcript
BLE ON REACT NATIVE REACT NATIVE MEETUP #7 2018/01/22 BY
JANUSWEL
About speaker KBOVTXFM TPGUXBSFFOHJOFFS !$VSF"QQ
CO checker
What is CO checker? "EFWJDFUPNFBTVSFDPODFOUSBUJPOTPG$0JOUIF CSFBUI 5IFNFBTVSFEWBMVFTBSFJNQPSUBOUJOEFYUPDVSF OJDPUJOFBEEJDUJPO #VUFYJTUJOHQSPEVDUTBSFWFSZFYQFOTJWF TPEFWJDFT
BSFFRVJQQFEJOPOMZIPTQJUBMTDMJOJDT 8FEFDJEFEUPQSPEVDFBOEEJTUSJCVUFEFWJDFTUP QBUJFOUT
Layout 3FBE8SJUF $0WBMVFT 4VCNJU $0WBMVFT
Layout 3FBE8SJUF $0WBMVFT 4VCNJU $0WBMVFT 5PEBZ`TUPQJD
In CureApp… 8FXPSLFEXJUIIBSEXBSFWFOEPS IBSEXBSFEFTJHO pSNXBSFEFWFMPQNFOU $VSF"QQJTSFTQPOTJCMFGPSUIFTPGUXBSFPG TNBSUQIPOFEFWFMPQNFOU
BLE chips $IPPTFPOFGSPNGPMMPXJOHDBUBMPH IUUQTGBCLVSBHJUCPPLTJPCMFEPDT DPOUFOUNPEVMFIUNM 6TFDIJQTIBWFDFSUJpDBUJPOPGDPNQMJBODF XJUIUFDIOJDBMTUBOEBSET l&WBMVBUJPOCPBSEzTBSFUIFCFTUDIPJDFUPHFU TUBSUFE
BLE scanners "OESPJE#-&4DBOOFS IUUQTQMBZHPPHMFDPNTUPSFBQQTEFUBJMT JEDPNNBDEPNCMFCMFTDBOOFSIMKB J04#-&YQMS IUUQTJUVOFTBQQMFDPNKQBQQCMFYQMS JE NU
Module to use BLE SFBDUOBUJWFCMFNBOBHFS IUUQTHJUIVCDPNJOOPWFJUSFBDUOBUJWF CMFNBOBHFS SFBDUOBUJWFCMFJTOPUNBJOUBJOFEOPMPOHFS
Words $FOUSBM %FWJDFTUPVTFTFSWJDFT 4FFBTDMJFOUTJODMJFOUTFSWFSNPEFM 1FSJQIFSBM %FWJDFTUPQSPWJEFTFSWJDFT 4FFBTTFSWFSTJODMJFOUTFSWFSNPEFM
Words $IBSBDUFSJTUJD 4UPSFUP3FBE8SJUFWBMVFT #POEJOH 'FBUVSFTGPSTFDVSJUZ "WBJMBCMF&ODSZQUJPO"VUIFOUJDBUJPO "MTPDBMMFEBTl1BJSJOHz
Read Peripheral Central
Write Peripheral Central
Notify Peripheral Central
Indicate Peripheral Central
Steps to communicate 4FFEPDVNFOUTPGSFBDUOBUJWFCMFNBOBHFS 4DBOQFSJQIFSBM T $POOFDUUPBEJTDPWFSFEQFSJQIFSBM 3FBE8SJUF/PUJGZ*OEJDBUF
CureApp Use Case 3FBE $0DIBSBDUFSJTUJD XJUIFODSZQUJPO Peripheral Central
React Integration 8FVTF&WFOU&NJUUFS IUUQTHJUIVCDPNBTZODMZ&WFOU&NJUUFS &NJUUJOHFWFOUTXIFO 4DBOOJOHQFSJQIFSBMTJTEPOF 3FBEJTEPOFGSPNQFSJQIFSBMT FUDʜ
React Integration 4FUFWFOUIBOEMFSTJO3FBDUDPNQPOFOU DPNQPOFOU%JE.PVOU $POTVNFFWFOUTXJUITFU4UBUF3FEVYBDUJPOT JOFWFOUIBOEMFST
1 class BleManager extends EventEmitter2 { 2 startScanning() { /*
snip */ } 3 connectToPeripheral() { /* snip */ } 4 async readCharacteristic() { /* snip */ } 5 async startMeasuring() { 6 const value = await this.readCharacteristic() 7 this.emit('READ', value) 8 } 9 } 1 class SomeComponent extends React.Component { 2 handleRead(value) { 3 this.props.actions.storeValues(value) 4 } 5 componentDidMount() { 6 this.props.bleManager.on( 7 'READ', 8 this.handleRead.bind(this) 9 ) 10 } 11 render() { 12 /* render buttons to 13 * - startScanning 14 * - connectToPeripheral, 15 * - startMeasuring */ 16 } 17 }
Problems 4PNF"OESPJEEFWJDFTBSFUPPTMPXUP DPOTVNFFWFOUT "EEXBJUT +VTUBGUFSEFWJDFTBSFCPPUFE DIBSBDUFSJTUJD WBMVFTBSFOPUJOJUJBMJ[FEZFU 8SJUFJOJUJBMWBMVFTUPFBDIDIBSBDUFSJTUJDT CFGPSF3FBE
Problems %POPUGPSHFUlEJTDPOOFDUzGPSFSSPSGSFF EFWFMPQNFOU 5IFSFBSFGFXEFTDSJQUJPOTBCPVUCPOEJOH 5SZBOEFSSPS IUUQXXXTJMFYKQCMPHXJSFMFTT CMVFUPPUIIUNM
Summary 6TJOH#-&JTFBTZPO3FBDU/BUJWF 8FDBOVTFJ04"OESPJEBTQFSJQIFSBMT OPCMFJTBWBJMBCMFUPP IUUQTHJUIVCDPNTBOEFFQNJTUSZOPCMF -FU`THFUTUBSUFE
References IUUQTGBCLVSBHJUCPPLTJPCMFEPDTDPOUFOU NPEVMFIUNM IUUQTHJUIVCDPNJOOPWFJUSFBDUOBUJWFCMF NBOBHFS IUUQXXXTJMFYKQCMPHXJSFMFTT CMVFUPPUIIUNM