Is it possible to send data with BLE broadcast mode?












3














I would like to kindly ask you if it's possible to send data (a string) in broadcast mode from a BLE device (like a Raspberry Pi, Onion or Arduino with a bluetooth dongle) to another device (like a Phone or another Raspberry Pi), which will show the data on screen.



To be honest it's not necessary to show the data on screen, but the other device must be able to elaborate the received data with a C program I will create.



I made a lot of researches on this topic but I could only find answers about Beacons, these objects can't send useful data for my project(like strings), or BLE devices which have to connect each other to send/receive data.



I would like to create a program in C, in order to achieve this result.
I searched something useful in the BlueZ library but I couldn't find anything because they don't explain the meaning of their functions.
If it's possible I don't want to creat an android/iOS app.










share|improve this question






















  • BLE devices can broadcast data, and any nearby device can receive these, but the amount of data is very limited. It's plenty for, say, a BLE thermometer to broadcast its temperature reading, but for any larger amount of data you'll have to connect one-to-one.
    – Lee Daniel Crocker
    Nov 16 '18 at 17:07












  • how can I extrapolate the broadcast data? Can I use this data in a C program?
    – Enrico Gerussi
    Nov 16 '18 at 17:15










  • Bytes are bytes. Data is data. Use them any way you like. I can't write your program for you.
    – Lee Daniel Crocker
    Nov 16 '18 at 17:27










  • Of course, I didn't mean to ask for a complete program. I just wanted to know if there are some references to any usable function in BlueZ ( I mentioned this one because is the only one I've found). Thank you very much for your answer
    – Enrico Gerussi
    Nov 18 '18 at 10:12


















3














I would like to kindly ask you if it's possible to send data (a string) in broadcast mode from a BLE device (like a Raspberry Pi, Onion or Arduino with a bluetooth dongle) to another device (like a Phone or another Raspberry Pi), which will show the data on screen.



To be honest it's not necessary to show the data on screen, but the other device must be able to elaborate the received data with a C program I will create.



I made a lot of researches on this topic but I could only find answers about Beacons, these objects can't send useful data for my project(like strings), or BLE devices which have to connect each other to send/receive data.



I would like to create a program in C, in order to achieve this result.
I searched something useful in the BlueZ library but I couldn't find anything because they don't explain the meaning of their functions.
If it's possible I don't want to creat an android/iOS app.










share|improve this question






















  • BLE devices can broadcast data, and any nearby device can receive these, but the amount of data is very limited. It's plenty for, say, a BLE thermometer to broadcast its temperature reading, but for any larger amount of data you'll have to connect one-to-one.
    – Lee Daniel Crocker
    Nov 16 '18 at 17:07












  • how can I extrapolate the broadcast data? Can I use this data in a C program?
    – Enrico Gerussi
    Nov 16 '18 at 17:15










  • Bytes are bytes. Data is data. Use them any way you like. I can't write your program for you.
    – Lee Daniel Crocker
    Nov 16 '18 at 17:27










  • Of course, I didn't mean to ask for a complete program. I just wanted to know if there are some references to any usable function in BlueZ ( I mentioned this one because is the only one I've found). Thank you very much for your answer
    – Enrico Gerussi
    Nov 18 '18 at 10:12
















3












3








3







I would like to kindly ask you if it's possible to send data (a string) in broadcast mode from a BLE device (like a Raspberry Pi, Onion or Arduino with a bluetooth dongle) to another device (like a Phone or another Raspberry Pi), which will show the data on screen.



To be honest it's not necessary to show the data on screen, but the other device must be able to elaborate the received data with a C program I will create.



I made a lot of researches on this topic but I could only find answers about Beacons, these objects can't send useful data for my project(like strings), or BLE devices which have to connect each other to send/receive data.



I would like to create a program in C, in order to achieve this result.
I searched something useful in the BlueZ library but I couldn't find anything because they don't explain the meaning of their functions.
If it's possible I don't want to creat an android/iOS app.










share|improve this question













I would like to kindly ask you if it's possible to send data (a string) in broadcast mode from a BLE device (like a Raspberry Pi, Onion or Arduino with a bluetooth dongle) to another device (like a Phone or another Raspberry Pi), which will show the data on screen.



To be honest it's not necessary to show the data on screen, but the other device must be able to elaborate the received data with a C program I will create.



I made a lot of researches on this topic but I could only find answers about Beacons, these objects can't send useful data for my project(like strings), or BLE devices which have to connect each other to send/receive data.



I would like to create a program in C, in order to achieve this result.
I searched something useful in the BlueZ library but I couldn't find anything because they don't explain the meaning of their functions.
If it's possible I don't want to creat an android/iOS app.







c bluetooth-lowenergy broadcast






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 16 '18 at 16:45









Enrico Gerussi

183




183












  • BLE devices can broadcast data, and any nearby device can receive these, but the amount of data is very limited. It's plenty for, say, a BLE thermometer to broadcast its temperature reading, but for any larger amount of data you'll have to connect one-to-one.
    – Lee Daniel Crocker
    Nov 16 '18 at 17:07












  • how can I extrapolate the broadcast data? Can I use this data in a C program?
    – Enrico Gerussi
    Nov 16 '18 at 17:15










  • Bytes are bytes. Data is data. Use them any way you like. I can't write your program for you.
    – Lee Daniel Crocker
    Nov 16 '18 at 17:27










  • Of course, I didn't mean to ask for a complete program. I just wanted to know if there are some references to any usable function in BlueZ ( I mentioned this one because is the only one I've found). Thank you very much for your answer
    – Enrico Gerussi
    Nov 18 '18 at 10:12




















  • BLE devices can broadcast data, and any nearby device can receive these, but the amount of data is very limited. It's plenty for, say, a BLE thermometer to broadcast its temperature reading, but for any larger amount of data you'll have to connect one-to-one.
    – Lee Daniel Crocker
    Nov 16 '18 at 17:07












  • how can I extrapolate the broadcast data? Can I use this data in a C program?
    – Enrico Gerussi
    Nov 16 '18 at 17:15










  • Bytes are bytes. Data is data. Use them any way you like. I can't write your program for you.
    – Lee Daniel Crocker
    Nov 16 '18 at 17:27










  • Of course, I didn't mean to ask for a complete program. I just wanted to know if there are some references to any usable function in BlueZ ( I mentioned this one because is the only one I've found). Thank you very much for your answer
    – Enrico Gerussi
    Nov 18 '18 at 10:12


















BLE devices can broadcast data, and any nearby device can receive these, but the amount of data is very limited. It's plenty for, say, a BLE thermometer to broadcast its temperature reading, but for any larger amount of data you'll have to connect one-to-one.
– Lee Daniel Crocker
Nov 16 '18 at 17:07






BLE devices can broadcast data, and any nearby device can receive these, but the amount of data is very limited. It's plenty for, say, a BLE thermometer to broadcast its temperature reading, but for any larger amount of data you'll have to connect one-to-one.
– Lee Daniel Crocker
Nov 16 '18 at 17:07














how can I extrapolate the broadcast data? Can I use this data in a C program?
– Enrico Gerussi
Nov 16 '18 at 17:15




how can I extrapolate the broadcast data? Can I use this data in a C program?
– Enrico Gerussi
Nov 16 '18 at 17:15












Bytes are bytes. Data is data. Use them any way you like. I can't write your program for you.
– Lee Daniel Crocker
Nov 16 '18 at 17:27




Bytes are bytes. Data is data. Use them any way you like. I can't write your program for you.
– Lee Daniel Crocker
Nov 16 '18 at 17:27












Of course, I didn't mean to ask for a complete program. I just wanted to know if there are some references to any usable function in BlueZ ( I mentioned this one because is the only one I've found). Thank you very much for your answer
– Enrico Gerussi
Nov 18 '18 at 10:12






Of course, I didn't mean to ask for a complete program. I just wanted to know if there are some references to any usable function in BlueZ ( I mentioned this one because is the only one I've found). Thank you very much for your answer
– Enrico Gerussi
Nov 18 '18 at 10:12














1 Answer
1






active

oldest

votes


















2














Yes this is possible. As you may already know, there are four roles in Bluetooth Low Energy (BLE):-




  • Broadcaster - A devices that just advertises data.

  • Peripheral - A device that advertises data but can be connected to by remote devices as well.

  • Observer - A device that just scans for data.

  • Central - A device that can scan for data as well as connect to them.


When BLE was first introduced, beacons/sensors (e.g. Heart Rate, Thermometer) occupied the first two categories and phones/computers occupied the other two. However, BLE has since evolved and a lot of devices now support all four roles and a device can operate in one or more roles at the same time.



Regarding your question, as Lee Daniel Crocker mentioned, data is data and what you put in adverts is just going to be bytes that the other end has to understand. You can only put 31 bytes of data in an advert report*, which is why connection-oriented data transfer is more efficient.



Regarding the programmability, I would recommend starting with BlueZ commands on both, the device that will advertise and the device that will read the data. You can do this with the Bluetoothctl command as follows:-



On the broadcaster/peripheral



#bluetoothctl
[bluetooth]menu advertise
[bluetooth]advertise data 00 00 00 00
[bluetooth]back
[bluetooth]advertise on


On the observer/central



#bluetoothctl
[bluetooth]scan on


I am using BlueZ version 5.50 and I recommend that you do the same.



Once you can advertise the data and read it from the other end correctly, you can go through the source code and see what you can leverage to your C application. For bluetoothctl functions you want to start with the following two files:-




  • bluez-5.50/client/main.c

  • bluez-5.50/client/advertising.c


I hope this helps.



(*) As of Bluetooth 5 you can add a lot more data to advert reports, however this a very recent feature and as of this writing very few stacks support it.






share|improve this answer





















  • Thank you very much! I'll certainly try this functions and I'll write an update if it works. I have another question, I hope this doesn't bother you. Where you can find manuals/links on how to use BlueZ? Because I search on the web but I didn't find anything for the students. Thank you again for your help.
    – Enrico Gerussi
    Nov 18 '18 at 10:27






  • 1




    Unfortunately, I don't think there is one documentation with all the details; instead you have to read through tutorials and questions on the usage. Have a look at this answer as it contains a few links to tutorials and questions:- stackoverflow.com/questions/35389894/…
    – Youssif Saeed
    Nov 19 '18 at 8:25











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53342122%2fis-it-possible-to-send-data-with-ble-broadcast-mode%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














Yes this is possible. As you may already know, there are four roles in Bluetooth Low Energy (BLE):-




  • Broadcaster - A devices that just advertises data.

  • Peripheral - A device that advertises data but can be connected to by remote devices as well.

  • Observer - A device that just scans for data.

  • Central - A device that can scan for data as well as connect to them.


When BLE was first introduced, beacons/sensors (e.g. Heart Rate, Thermometer) occupied the first two categories and phones/computers occupied the other two. However, BLE has since evolved and a lot of devices now support all four roles and a device can operate in one or more roles at the same time.



Regarding your question, as Lee Daniel Crocker mentioned, data is data and what you put in adverts is just going to be bytes that the other end has to understand. You can only put 31 bytes of data in an advert report*, which is why connection-oriented data transfer is more efficient.



Regarding the programmability, I would recommend starting with BlueZ commands on both, the device that will advertise and the device that will read the data. You can do this with the Bluetoothctl command as follows:-



On the broadcaster/peripheral



#bluetoothctl
[bluetooth]menu advertise
[bluetooth]advertise data 00 00 00 00
[bluetooth]back
[bluetooth]advertise on


On the observer/central



#bluetoothctl
[bluetooth]scan on


I am using BlueZ version 5.50 and I recommend that you do the same.



Once you can advertise the data and read it from the other end correctly, you can go through the source code and see what you can leverage to your C application. For bluetoothctl functions you want to start with the following two files:-




  • bluez-5.50/client/main.c

  • bluez-5.50/client/advertising.c


I hope this helps.



(*) As of Bluetooth 5 you can add a lot more data to advert reports, however this a very recent feature and as of this writing very few stacks support it.






share|improve this answer





















  • Thank you very much! I'll certainly try this functions and I'll write an update if it works. I have another question, I hope this doesn't bother you. Where you can find manuals/links on how to use BlueZ? Because I search on the web but I didn't find anything for the students. Thank you again for your help.
    – Enrico Gerussi
    Nov 18 '18 at 10:27






  • 1




    Unfortunately, I don't think there is one documentation with all the details; instead you have to read through tutorials and questions on the usage. Have a look at this answer as it contains a few links to tutorials and questions:- stackoverflow.com/questions/35389894/…
    – Youssif Saeed
    Nov 19 '18 at 8:25
















2














Yes this is possible. As you may already know, there are four roles in Bluetooth Low Energy (BLE):-




  • Broadcaster - A devices that just advertises data.

  • Peripheral - A device that advertises data but can be connected to by remote devices as well.

  • Observer - A device that just scans for data.

  • Central - A device that can scan for data as well as connect to them.


When BLE was first introduced, beacons/sensors (e.g. Heart Rate, Thermometer) occupied the first two categories and phones/computers occupied the other two. However, BLE has since evolved and a lot of devices now support all four roles and a device can operate in one or more roles at the same time.



Regarding your question, as Lee Daniel Crocker mentioned, data is data and what you put in adverts is just going to be bytes that the other end has to understand. You can only put 31 bytes of data in an advert report*, which is why connection-oriented data transfer is more efficient.



Regarding the programmability, I would recommend starting with BlueZ commands on both, the device that will advertise and the device that will read the data. You can do this with the Bluetoothctl command as follows:-



On the broadcaster/peripheral



#bluetoothctl
[bluetooth]menu advertise
[bluetooth]advertise data 00 00 00 00
[bluetooth]back
[bluetooth]advertise on


On the observer/central



#bluetoothctl
[bluetooth]scan on


I am using BlueZ version 5.50 and I recommend that you do the same.



Once you can advertise the data and read it from the other end correctly, you can go through the source code and see what you can leverage to your C application. For bluetoothctl functions you want to start with the following two files:-




  • bluez-5.50/client/main.c

  • bluez-5.50/client/advertising.c


I hope this helps.



(*) As of Bluetooth 5 you can add a lot more data to advert reports, however this a very recent feature and as of this writing very few stacks support it.






share|improve this answer





















  • Thank you very much! I'll certainly try this functions and I'll write an update if it works. I have another question, I hope this doesn't bother you. Where you can find manuals/links on how to use BlueZ? Because I search on the web but I didn't find anything for the students. Thank you again for your help.
    – Enrico Gerussi
    Nov 18 '18 at 10:27






  • 1




    Unfortunately, I don't think there is one documentation with all the details; instead you have to read through tutorials and questions on the usage. Have a look at this answer as it contains a few links to tutorials and questions:- stackoverflow.com/questions/35389894/…
    – Youssif Saeed
    Nov 19 '18 at 8:25














2












2








2






Yes this is possible. As you may already know, there are four roles in Bluetooth Low Energy (BLE):-




  • Broadcaster - A devices that just advertises data.

  • Peripheral - A device that advertises data but can be connected to by remote devices as well.

  • Observer - A device that just scans for data.

  • Central - A device that can scan for data as well as connect to them.


When BLE was first introduced, beacons/sensors (e.g. Heart Rate, Thermometer) occupied the first two categories and phones/computers occupied the other two. However, BLE has since evolved and a lot of devices now support all four roles and a device can operate in one or more roles at the same time.



Regarding your question, as Lee Daniel Crocker mentioned, data is data and what you put in adverts is just going to be bytes that the other end has to understand. You can only put 31 bytes of data in an advert report*, which is why connection-oriented data transfer is more efficient.



Regarding the programmability, I would recommend starting with BlueZ commands on both, the device that will advertise and the device that will read the data. You can do this with the Bluetoothctl command as follows:-



On the broadcaster/peripheral



#bluetoothctl
[bluetooth]menu advertise
[bluetooth]advertise data 00 00 00 00
[bluetooth]back
[bluetooth]advertise on


On the observer/central



#bluetoothctl
[bluetooth]scan on


I am using BlueZ version 5.50 and I recommend that you do the same.



Once you can advertise the data and read it from the other end correctly, you can go through the source code and see what you can leverage to your C application. For bluetoothctl functions you want to start with the following two files:-




  • bluez-5.50/client/main.c

  • bluez-5.50/client/advertising.c


I hope this helps.



(*) As of Bluetooth 5 you can add a lot more data to advert reports, however this a very recent feature and as of this writing very few stacks support it.






share|improve this answer












Yes this is possible. As you may already know, there are four roles in Bluetooth Low Energy (BLE):-




  • Broadcaster - A devices that just advertises data.

  • Peripheral - A device that advertises data but can be connected to by remote devices as well.

  • Observer - A device that just scans for data.

  • Central - A device that can scan for data as well as connect to them.


When BLE was first introduced, beacons/sensors (e.g. Heart Rate, Thermometer) occupied the first two categories and phones/computers occupied the other two. However, BLE has since evolved and a lot of devices now support all four roles and a device can operate in one or more roles at the same time.



Regarding your question, as Lee Daniel Crocker mentioned, data is data and what you put in adverts is just going to be bytes that the other end has to understand. You can only put 31 bytes of data in an advert report*, which is why connection-oriented data transfer is more efficient.



Regarding the programmability, I would recommend starting with BlueZ commands on both, the device that will advertise and the device that will read the data. You can do this with the Bluetoothctl command as follows:-



On the broadcaster/peripheral



#bluetoothctl
[bluetooth]menu advertise
[bluetooth]advertise data 00 00 00 00
[bluetooth]back
[bluetooth]advertise on


On the observer/central



#bluetoothctl
[bluetooth]scan on


I am using BlueZ version 5.50 and I recommend that you do the same.



Once you can advertise the data and read it from the other end correctly, you can go through the source code and see what you can leverage to your C application. For bluetoothctl functions you want to start with the following two files:-




  • bluez-5.50/client/main.c

  • bluez-5.50/client/advertising.c


I hope this helps.



(*) As of Bluetooth 5 you can add a lot more data to advert reports, however this a very recent feature and as of this writing very few stacks support it.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 17 '18 at 11:26









Youssif Saeed

3,80122247




3,80122247












  • Thank you very much! I'll certainly try this functions and I'll write an update if it works. I have another question, I hope this doesn't bother you. Where you can find manuals/links on how to use BlueZ? Because I search on the web but I didn't find anything for the students. Thank you again for your help.
    – Enrico Gerussi
    Nov 18 '18 at 10:27






  • 1




    Unfortunately, I don't think there is one documentation with all the details; instead you have to read through tutorials and questions on the usage. Have a look at this answer as it contains a few links to tutorials and questions:- stackoverflow.com/questions/35389894/…
    – Youssif Saeed
    Nov 19 '18 at 8:25


















  • Thank you very much! I'll certainly try this functions and I'll write an update if it works. I have another question, I hope this doesn't bother you. Where you can find manuals/links on how to use BlueZ? Because I search on the web but I didn't find anything for the students. Thank you again for your help.
    – Enrico Gerussi
    Nov 18 '18 at 10:27






  • 1




    Unfortunately, I don't think there is one documentation with all the details; instead you have to read through tutorials and questions on the usage. Have a look at this answer as it contains a few links to tutorials and questions:- stackoverflow.com/questions/35389894/…
    – Youssif Saeed
    Nov 19 '18 at 8:25
















Thank you very much! I'll certainly try this functions and I'll write an update if it works. I have another question, I hope this doesn't bother you. Where you can find manuals/links on how to use BlueZ? Because I search on the web but I didn't find anything for the students. Thank you again for your help.
– Enrico Gerussi
Nov 18 '18 at 10:27




Thank you very much! I'll certainly try this functions and I'll write an update if it works. I have another question, I hope this doesn't bother you. Where you can find manuals/links on how to use BlueZ? Because I search on the web but I didn't find anything for the students. Thank you again for your help.
– Enrico Gerussi
Nov 18 '18 at 10:27




1




1




Unfortunately, I don't think there is one documentation with all the details; instead you have to read through tutorials and questions on the usage. Have a look at this answer as it contains a few links to tutorials and questions:- stackoverflow.com/questions/35389894/…
– Youssif Saeed
Nov 19 '18 at 8:25




Unfortunately, I don't think there is one documentation with all the details; instead you have to read through tutorials and questions on the usage. Have a look at this answer as it contains a few links to tutorials and questions:- stackoverflow.com/questions/35389894/…
– Youssif Saeed
Nov 19 '18 at 8:25


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53342122%2fis-it-possible-to-send-data-with-ble-broadcast-mode%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents