当前位置:网站首页>Quick realization of Bluetooth ibeacn function
Quick realization of Bluetooth ibeacn function
2022-06-27 06:24:00 【shine_ blink】
Core become iBeacon node
One 、iBeacon brief introduction
iBeacon It's apple 2013 year 9 Mobile devices released in January use OS(iOS7) New features on . The way it works is , Equipped with Low power Bluetooth (BLE) Communication function of the device use BLE Technology sends its own unique ID, Receive the ID Your application software will be based on this ID Take some action . such as , Set up... In the store iBeacon Communication module , Can let iPhone and iPad Run an information notification server on , Or the server sends discount coupons and store entry points to customers . Besides , It can also be used when the home appliance breaks down or stops working iBeacon Send information to the application .
Two 、iBeacon Format
iBeacon It uses BLE technology , To be specific , Use of is BLE Middle name is “ Announcement frame ”(Advertising) The broadcast frame of . An announcement frame is a frame sent periodically , As long as it's support BLE Your device can receive .iBeacon This is achieved by embedding data in Apple's own format in the payload part of this announcement frame .
AD Field Length: Advertisement Data The length of , Indicates the length of useful broadcast information
Type: The radio type
Company ID: The data field is a two byte company ID Code start .SIG Will these ID Code issued to the company , among 0x004C It stands for Apple id( Only this ID, The device will call iBeacon)
iBeacon Type: byte 0x02 This device is Beacon
iBeacon Length: The length of the remaining fields
UUID: It is stipulated that ISO/IEC11578:1996 The standard 128 Bit identifier
Major、Minor: from iBeacon The publisher sets it himself , All are 16 Bit identifier . such as , Chain stores can be in Major Write area information , Can be found in Minor For individual stores ID etc. . in addition , Embed... In appliances iBeacon When the function , It can be used Major Indicates the product model , use Minor Indicates the error code , It is used to notify the outside of the fault
TX Power: APP adopt iBeacon The transmitted signal strength is estimated at 1 When it's rice RSSI Strength
About iBeacon Please refer to Apple's official documentation for details of :
https://developer.apple.com/ibeacon/Getting-Started-with-iBeacon.pdf
3、 ... and 、 Complete code
Realization function : Customize iBeacon The specific content of the broadcast , And update every half a second iBeacon In the broadcast content Major and Minor Value of field .
-- Here for experimental purposes , Arbitrarily defined 16 Data is as uuid
uuid = {
0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF}
-- initialization iBeacon Specific content of broadcast information , And open iBeacon Bluetooth radio , Be careful : This function can only be called once
--CompanyID=0x004C, Major=0x1234, Minor=0x5678, rssi_1m=0xC3(-59db), Broadcast interval =100ms
LIB_NrfBleIbeaconConfig(0x004C,0x1234,0x5678,0x3C,100,uuid)
major = 0
minor = 10000
-- Start the big cycle
while(GC(1) == true)
do
-- every other 500ms(0.5 second ) Updated once iBeacon In Bluetooth broadcast Major and Minor Value
LIB_DelayMs(500)
major = major + 1
minor = minor - 1
LIB_NrfBleIbeaconUpdate(major,minor)
end
Four 、 demonstration
After the above code runs , We install... On Android phones nRF Connect App Bluetooth debugging software , And pass Scan Scanned iBeacon The information is as follows :
Not only can you see iBeacon Node UUID Information , Colleagues can also see in real time Major The value of is constantly increasing ,Minor The value of is constantly decreasing .
For more details, please refer to shineblink.com The website links
边栏推荐
- 【入门】正则表达式基础入门笔记
- Create a basic WDM driver and use MFC to call the driver
- thrift
- Software testing year end summary report template
- Sqlsever 字段相乘后保留2位小数
- Altium designer 19 device silk screen label position shall be placed uniformly in batches
- NoViableAltException([email protected][2389:1: columnNameTypeOrConstraint : ( ( tableConstraint ) | ( columnNameT
- 力扣 179、最大数
- G1和ZGC垃圾收集器
- 卷积神经网络---CNN模型的应用(找矿预测)
猜你喜欢

Altium designer 19 device silk screen label position shall be placed uniformly in batches

Dev++ environment setting C language keyword display color

程序猿学习抖音短视频制作

使用CSDN 开发云搭建导航网站

2018年数学建模竞赛-高温作业专用服装设计

JVM常用指令

Dev++ 环境设置C语言关键字显示颜色

Gaussian distribution, linear regression, logistic regression

多线程带来的的风险——线程安全

使用 WordPress快速个人建站指南
随机推荐
JS to implement bidirectional data binding
JVM object composition and storage
JVM class loading mechanism
What's new in redis4.0 - active memory defragmentation
JVM调优思路
下载cuda和cudnn
426 binary tree (513. find the value in the lower left corner of the tree, 112. sum of paths, 106. construct a binary tree from the middle order and post order traversal sequence, 654. maximum binary
Assembly language - Wang Shuang Chapter 13 int instruction - Notes
线程间等待与唤醒机制、单例模式、阻塞队列、定时器
观测电机转速转矩
Software testing year end summary report template
使用 WordPress快速个人建站指南
thrift
[getting started] regular expression Basics
高斯分布Gaussian distribution、線性回歸、邏輯回歸logistics regression
TiDB 数据库快速上手指南
表单校验 v-model 绑定的变量,校验失效的解决方案
建模竞赛-光传送网建模与价值评估
Unrecognized VM option ‘‘
Multithreading basic part2