nkim-bitzap / bluetooth Goto Github PK
View Code? Open in Web Editor NEWCollection of C programming examples dealing with Bluetooth using BlueZ/GDBus
Collection of C programming examples dealing with Bluetooth using BlueZ/GDBus
I've tried to run the code in my raspberry Pi, but unfortunately it doesn't work properly. It's the same file as the one in github, and I'm afraid it's something related to directories or the bluetoothd version. I copy here the log obtained. (Ignore some " I had to write in order to keep the code integrity)
pi@FrambuesaPi:~ $ sudo btmon
Bluetooth monitor ver 5.50
= Note: Linux version 5.10.103-v7+ (armv7l) 0.972811
= Note: Bluetooth subsystem version 2.22 0.972824
= New Index: B8:27:EB:F3:EB:C5 (Primary,UART,hci0) [hci0] 0.972829
= Open Index: B8:27:EB:F3:EB:C5 [hci0] 0.972835
= Index Info: B8:27:EB:F.. (Cypress Semiconductor Corporation) [hci0] 0.972839
@ MGMT Open: bluetoothd (privileged) version 1.18 {0x0001} 0.972843
@ MGMT Open: btmon (privileged) version 1.18 {0x0002} 0.973232
@ MGMT Command: Add Advertising (0x003e) plen 27 {0x0001} [hci0] 4.271771
Instance: 1
Flags: 0x00000000
Duration: 0
Timeout: 0
Advertising data length: 16
16-bit Service UUIDs (complete): 3 entries
First Name (0x2a8a)
Last Name (0x2a90)
Email Address (0x2a87)
Service Data (UUID 0x2a8a): 5374616e
Scan response length: 0
@ MGMT Event: Advertising Added (0x0023) plen 1 {0x0002} [hci0] 4.271803
Instance: 1
< HCI Command: LE Set Random Address (0x08|0x0005) plen 6 #"1 [hci0] 4.271890
Address: 07:5B:83:7E:02:D3 (Non-Resolvable)
"> HCI Event: Command Complete (0x0e) plen 4 #"2 [hci0] 4.272221
LE Set Random Address (0x08|0x0005) ncmd 1
Status: Success (0x00)
< HCI Command: LE Set Advertising P.. (0x08|0x0006) plen 15 #"3 [hci0] 4.272268
Min advertising interval: 62.500 msec (0x0064)
Max advertising interval: 93.750 msec (0x0096)
Type: Non connectable undirected - ADV_NONCONN_IND (0x03)
Own address type: Random (0x01)
Direct address type: Public (0x00)
Direct address: 00:00:00:00:00:00 (OUI 00-00-00)
Channel map: 37, 38, 39 (0x07)
Filter policy: Allow Scan Request from Any, Allow Connect Request from Any (0x00)
"> HCI Event: Command Complete (0x0e) plen 4 #"4 [hci0] 4.275317
LE Set Advertising Parameters (0x08|0x0006) ncmd 1
Status: Invalid HCI Command Parameters (0x12)
@ MGMT Event: Advertising Removed (0x0024) plen 1 {0x0002} [hci0] 4.275367
Instance: 1
@ MGMT Event: Command Status (0x0002) plen 3 {0x0001} [hci0] 4.275380
Add Advertising (0x003e)
Status: Invalid Parameters (0x0d)
= bluetoothd: Failed to add advertisement: Invalid Parameters (0x0d) 4.276024
By the way, I would also like to ask how or where in the code do we have to set the data we want to advertise and it's format. I'm starting with this type of project in the raspberryPi and it's not being very easy to handle the c programming...
Thanks a lot in advance
Firstly, I would like to say a big thank you. I have found your example code very useful where there is not much information regarding Bluez on the Internet.
However, I'm not sure how to communicate with a UART bluetooth module, e.g. HM-10.
Do you think you could show some sample code to achieve this? Currently I only know how to pair with a device, not actually communicate with it and send data.
Thanks again.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.