当前位置:网站首页>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
边栏推荐
- KubeSphere 集群配置 NFS 存储解决方案-收藏版
- 论文阅读技巧
- Functional continuous
- Small program of C language practice (consolidate and deepen the understanding of knowledge points)
- Configuring the help class iconfiguration in C # NETCORE
- [cultivation system] common regular expressions
- Force buckle 179, max
- JVM object composition and storage
- ORA-00909: 参数个数无效,concat引起
- Information System Project Manager - Chapter VII project cost management
猜你喜欢

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

G1 and ZGC garbage collector

卷积神经网络---CNN模型的应用(找矿预测)

Program ape learning Tiktok short video production

Altium Designer 19 器件丝印标号位置批量统一摆放

427- binary tree (617. merge binary tree, 700. search in binary search tree, 98. verify binary search tree, 530. minimum absolute difference of binary search tree)

机 器 学 习

Kubesphere cluster configuration NFS storage solution - favorite

Convolution neural network -- Application of CNN model (ore prospecting prediction)

JVM common instructions
随机推荐
Small program of C language practice (consolidate and deepen the understanding of knowledge points)
机 器 学 习
【养成系】常用正则表达式
飞行器翼尖加速度和控制面的MPC控制
js实现双向数据绑定
Program ape learning Tiktok short video production
How to check the frequency of memory and the number of memory slots in CPU-Z?
Run opcua protocol demo on raspberry pie 4B to access kubeedge
ORA-00909: 参数个数无效,concat引起
[QT notes] basic use of qregularexpression in QT
Configuring the help class iconfiguration in C # NETCORE
The form verifies the variables bound to the V-model, and the solution to invalid verification
427- binary tree (617. merge binary tree, 700. search in binary search tree, 98. verify binary search tree, 530. minimum absolute difference of binary search tree)
JVM overall structure analysis
Contents in qlistwidget are not displayed
Us camera cloud service scheme: designed for lightweight video production scenes
Spark's projection
Code is data
Altium designer 19 device silk screen label position shall be placed uniformly in batches
TiDB 基本功能