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
740
読みやすいコード クラスメソッド 2022 年度新卒研修
januswel
2
9k
Accelerate your business with React Native
januswel
0
2.2k
猫の手も借りたい引っ張りだこ企業による LINE API活用事例発表会! クラスメソッド編
januswel
0
140
現状確認
januswel
0
890
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
複雑な仕様に立ち向かうアーキテクチャ
myohei
0
170
急成長期の品質とスピードを両立するフロントエンド技術基盤
soarteclab
0
920
良いユニットテストを書こう
mototakatsu
5
1.9k
バグを見つけた?それAppleに直してもらおう!
uetyo
0
170
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
talk-with-local-llm-with-web-streams-api
kbaba1001
0
170
return文におけるstd::moveについて
onihusube
1
860
As an Engineers, let's build the CRM system via LINE Official Account 2.0
clonn
1
670
事業成長を爆速で進めてきたプロダクトエンジニアたちの成功談・失敗談
nealle
3
1.4k
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
240
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
73
9.1k
The Invisible Side of Design
smashingmag
298
50k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
Building a Scalable Design System with Sketch
lauravandoore
460
33k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
290
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
How to Ace a Technical Interview
jacobian
276
23k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
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