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
テストコードのガイドライン 〜作成から運用まで〜
riku929hr
3
390
創造的活動から切り拓く新たなキャリア 好きから始めてみる夜勤オペレーターからSREへの転身
yjszk
1
130
フロントエンドのディレクトリ構成どうしてる? Feature-Sliced Design 導入体験談
osakatechlab
8
4.1k
Recoilを剥がしている話
kirik
5
6.7k
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
130
Zoneless Testing
rainerhahnekamp
0
120
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
130
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
360
Keeping it Ruby: Why Your Product Needs a Ruby SDK - RubyWorld 2024
envek
0
190
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
760
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
770
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Why Our Code Smells
bkeepers
PRO
335
57k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
RailsConf 2023
tenderlove
29
940
Building Your Own Lightsaber
phodgson
103
6.1k
Designing for Performance
lara
604
68k
Scaling GitHub
holman
458
140k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
The Language of Interfaces
destraynor
154
24k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
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