Download BL620 smartBASIC extensions v12.4.10.0

Transcript
smart BASIC – BL620
Extension Functionality User Manual
advert.
nRssi
Interactive
Command
byREF nRssi AS INTEGER
On return this parameter is updated with the RSSI as reported by the stack for that advert.
Note: This is NOT a value that is sent by the peripheral but a value that is calculated by
the receiver in this module.
No
//Example :: BleScanGetPagerAddr.sb (See in BL620CodeSnippets.zip)
DIM rc
'//Scan for 20 seconds with no filtering
rc = BleScanStart(10000, 0)
IF rc==0 THEN
PRINT "\nScanning"
ELSE
PRINT "\nError: "; INTEGER.H'rc
ENDIF
'//This handler will be called when scanning times out
FUNCTION HndlrScanTO()
PRINT "\nScan timeout"
ENDFUNC 0
'//This handler will be called when an advert is received requesting a connection to
this module
FUNCTION HndlrFastPaged()
DIM periphAddr$, nRssi
rc = BleScanGetPagerAddr(periphAddr$, nRssi)
PRINT "\nAdvert received from peripheral "; StrHexize$(periphAddr$); " with RSSI
";nRssi
PRINT "\nrequesting a connection to this module"
rc = BleScanStop()
ENDFUNC 0
ONEVENT EVBLE_SCAN_TIMEOUT CALL HndlrScanTO
ONEVENT EVBLE_FAST_PAGED
CALL HndlrFastPaged
WAITEVENT
Expected Output:
Scanning
Advert received from peripheral 01D8CFCF14498D with RSSI -96
requesting a connection to this module
BLESCANGETPAGERADDR is an extension function.
Embedded Wireless Solutions Support Center:
http://ews-support.lairdtech.com
www.lairdtech.com/wireless
69
Laird Technologies
Americas: +1-800-492-2320
Europe: +44-1628-858-940
Hong Kong: +852-2268-6567 x026