当前位置:网站首页>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
边栏推荐
- 浅谈GPU:历史发展,架构
- 多线程基础部分Part3
- My opinion on test team construction
- 观测电机转速转矩
- C Primer Plus Chapter 11_ Strings and string functions_ Codes and exercises
- Assembly language - Wang Shuang Chapter 13 int instruction - Notes
- Information System Project Manager - Chapter VII project cost management
- [collection] Introduction to basic knowledge of point cloud and functions of point cloud catalyst software
- Inter thread wait and wake-up mechanism, singleton mode, blocking queue, timer
- 快速实现蓝牙iBeacn功能详解
猜你喜欢

Us camera cloud service scheme: designed for lightweight video production scenes

第 299 场周赛 第四题 6103. 从树中删除边的最小分数

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

研究生数学建模竞赛-无人机在抢险救灾中的优化应用

Inter thread wait and wake-up mechanism, singleton mode, blocking queue, timer

JVM overall structure analysis

0.0.0.0:x的含义

Cloud-Native Database Systems at Alibaba: Opportunities and Challenges

我对于测试团队建设的意见

快速实现蓝牙iBeacn功能详解
随机推荐
汇编语言-王爽 第11章 标志寄存器-笔记
多线程基础部分Part2
快速实现Thread Mesh组网详解
线程间等待与唤醒机制、单例模式、阻塞队列、定时器
The risk of multithreading -- thread safety
Code is data
【QT小点】实现看门狗功能,检测外部程序是否在运行
TiDB的使用限制
Thinking technology: how to solve the dilemma in work and life?
thrift
Inter thread wait and wake-up mechanism, singleton mode, blocking queue, timer
Change the status to the corresponding text during MySQL query
Scala函数柯里化(Currying)
HTAP 快速上手指南
JVM常用指令
openresty使用文档
Assembly language - Wang Shuang Chapter 8 two basic problems in data processing - Notes
Instance Tunnel 使用
Kubesphere cluster configuration NFS storage solution - favorite
yaml文件加密