Discovering Bluetooth Devices BLE in C# and .Net Core

  Переглядів 60,441

AngelSix

AngelSix

4 роки тому

In the biggest turning point of my life so far, find out why I gave up earning 4 figures a week, to earning nothing at all, because it felt right.
Support me in my journey to giving back to the industry all my knowledge and helping the world with what I do. Spreading knowledge to those who cannot afford an education, and helping those who want to better themselves.
MSDN Doc
docs.microsoft.com/en-us/wind...
Merchandise
teespring.com/stores/angelsix
My Setup & Recommendations
www.amazon.co.uk/shop/angelsix
Live Chat at Discord
discordapp.com/invite/eHr5BMk
Source Code
github.com/angelsix/blueberry
Video Playlist
• The £100,000 Open Sour...
Support what I do and pay for me to survive
www.angelsix.com/donate
Diabetes awareness
www.diabetes.org.uk

КОМЕНТАРІ: 122
@TheMohsell
@TheMohsell 4 роки тому
Definatly we are appreciating what you are doing. Thanks Luke. I ll try to test this on my desktop, which does not have blutooth, to see how it will behave.
@davencharity
@davencharity 4 роки тому
Amazing video, Luke! Sincerely look forward to seeing this series through to the end!
@AngelSix
@AngelSix 4 роки тому
Thanks
@oyoyo2853
@oyoyo2853 11 місяців тому
excellent thanks, name change also worked and was needed for me. Appreciated the tips on technique and best practices i learnt heaps.
@christopherjones1505
@christopherjones1505 4 роки тому
best explanaiton Ive seen so far on how to do BLE on windows.
@roballan7985
@roballan7985 3 роки тому
Thanks for the video - old school coder learnt some new techiques ;) I look forward to running through the dev cycle to see your approach.
@moelmakrani7116
@moelmakrani7116 3 роки тому
Cooooool job man!!! I really like your approach. Keep on doing this... Cheers man!
@RayCarrot
@RayCarrot 4 роки тому
A nice shortcut when creating a constructor for a class with read-only properties is to do CTRL+. on the class name and chose to create a constructor. You can then select which properties to include in the constructor as parameters :)
@gdOnYT
@gdOnYT 2 роки тому
this is great - very informative indeed. thank you so much!
@miroslavivanov9669
@miroslavivanov9669 4 роки тому
Amazing video on real world programming!!! there is nothing else that explains and shows such detail regarding bluetooth connections and interaction!! Thank you for all the hard work Luke. Haters and ungrateful people will always be there, the better you become the more they are! Just ignore them, these are people commenting out of desperation. Thank you again for the brilliant series keep them coming.
@AngelSix
@AngelSix 4 роки тому
Glad you like it
@MrOregonduckman
@MrOregonduckman 2 роки тому
As an experienced BTLE developer I found this coding session very informative, thank you.
@twiggy1771
@twiggy1771 Рік тому
Thanks man for the information; it was quite useful. I come from a physics background so I really appreciate the full breakdown.
@Kardall
@Kardall 4 роки тому
This is amazing. I watched the whole thing. Liked and shared on my socials. 10/10.
@AngelSix
@AngelSix 4 роки тому
Awesome thanks
@ashokvardhanreddy2445
@ashokvardhanreddy2445 4 роки тому
Hi there, where is the video for connecting the blood glucose device to application and reading the data. Can you please share it. It would be of great help!!
@madmaxjunior
@madmaxjunior 4 роки тому
Thanks Luke, been catching up on lots of your videos in the last month (discovered you from some of your WPF MVVM videos) and in response to your comments on the end of this video just wanted to say: - I really love and appreciate your way of explaining everything holistically and not just doing the code, code can be hard sometimes but I agree the important thing is to come at it knowing what you want to achieve and how you are going to do it, you help people understand that and follow your very sensible way of doing things. - Also comments: you could not be more right, going back over code I wrote 6 months ago when I started getting back into development I wish I'd realised it then, so much slower without the comments! Understanding the code of others on Github comments make or break it for me as well, with comments you can jump in and dont need to know their class names (which are often quite obtuse) or what they do to understand the specific piece of code causing you issues. TLDR; thanks, keep up the good work!
@niv9375
@niv9375 3 роки тому
Hey. I run the same program and not able to discover all near by devices.. So is it my laptop issue ??
@AcademyofoneOrg1
@AcademyofoneOrg1 4 роки тому
Amazing Video Man
@VinuP2023
@VinuP2023 4 роки тому
Thank you so much Luke ❤️ These videos are gold 😍
@AngelSix
@AngelSix 4 роки тому
Your welcome
@ashokvardhanreddy2445
@ashokvardhanreddy2445 4 роки тому
Hi there, where is the video for connecting the blood glucose device to application and reading the data. Can you please share it. It would be of great help!!
@kevinfurst8163
@kevinfurst8163 3 роки тому
Very nicely explained, thanks a lot!
@andregroschel9761
@andregroschel9761 4 роки тому
Thanks a lot for the bluetooth videos. Very helpful to understand how it works and I really like your coding style! Learning a lot :)
@AngelSix
@AngelSix 4 роки тому
Thanks
@andregroschel9761
@andregroschel9761 4 роки тому
@@AngelSix btw you can use Microsoft.Windows.SDK.Contracts, Microsoft.Windows.WinMD and System.Runtime.InteropServices.WindowsRuntime nuget packages to access the UWP stuff
@kaustubhapathak4493
@kaustubhapathak4493 4 роки тому
Thanks Luke.., I really enjoyed this video.
@jakobsaxjaxskovsndergard4554
@jakobsaxjaxskovsndergard4554 3 роки тому
This is fantastic, I started at the university to get this kind of knowledge. Please keep up the good work. Apart from all the obvious stuff about BLE, I learned about #region, How to look at Microsoft documentation to see what goes as attributes in a function, How ToString() actually works in a $"{blabla}" . Further more just watching you troubleshoot, going through your code is a joy. How do you plan a video like this?, do you make state charts ,ClassDiagrams or do you just jam away sensing what might come next?
@manjeetnandal1
@manjeetnandal1 4 роки тому
Great sharing! Many thanks!
@AngelSix
@AngelSix 4 роки тому
Your we welcome
@munkh-odganzorigt7497
@munkh-odganzorigt7497 4 роки тому
Damn , lowkey learned a lot from your coding style! please do more
@mihaimyh
@mihaimyh 4 роки тому
Thank you, this was a really helpful video. Is there any chance you can explain a little more about thread locking?
@AngelSix
@AngelSix 4 роки тому
Yes I guess I should do a video on it. Hard to explain well in a comment. Basically stops that same piece of code being run at the same time by multiple threads. The code if not locks and 2 threads tried to run it at the same time is line 1, 2 and 3 could be run inside the function on thread one. Then thread 2 could come in and run lines 1 and 2 again, changing some variables. then thread 1 gets CPU time again and starts running line 4, 5, 6 etc... so basically means its like your function can be jumbled up in a random order and the lines of code can be run in random orders
@krellon
@krellon 4 роки тому
Cracking 👍🏼
@shoukathali1768
@shoukathali1768 4 місяці тому
Could you make a updated version of this video!? because I'm finding a lot of changes to the current and told scenario...
@MyNameIsThoms
@MyNameIsThoms 4 роки тому
Wow, that was an awsome video!!! I like it when you do and explain the things you do before coding. Never took an approach like this. One question though: what does the "Dna" in the bluetooth class name stand for? I have those issues with the auto completion as well - would be great if you could do a video when you know how to fix it. I think it wa caused by the last VS update since it happend in VS2017 as well.
@AngelSix
@AngelSix 4 роки тому
A comment pointed out its top right of VS next to the Live Code button. Or press Ctrl + Alt + Space :) The Dna is just referring to DNA in the blood. My motto for AngelSix is often around code being "in my blood" so I use the Dna for some of my projects
@MyNameIsThoms
@MyNameIsThoms 4 роки тому
@@AngelSix Cool, thanks. By the way, the Bloototh discovery is working great with my Freestyle Libre 2 sensor. It took like 1 Minute to discover but then it shows the name to be ABBOTT (the manufacturer) followed by the serial number of the sensor :)
@bigpego90
@bigpego90 3 роки тому
Hi man, thank you very much for your work, it's great. Does this code work with winform applications? Thank you very much :)
@simon.voggeneder
@simon.voggeneder 4 роки тому
Another fantastic video, Luke. It's enlightening to follow your patterns of thought mapping this application component out. One question though: It is often considered bad practice to use one-line if-statemetns without braces because it can lead to errors when forgetting to insert braces for a possible future second statement below the if. What is your take on this?
@AngelSix
@AngelSix 4 роки тому
I can see the risk sure, but I've never had that issue. VS naturally indents the code correctly too so very hard to make that mistake
@simon.voggeneder
@simon.voggeneder 4 роки тому
@@AngelSix Thank you for your answer. I see the appeal of the braceless if/else, since vertical space is always so limited on screens and it makes the code more readable in my opinion
@durgaprasadreddy5033
@durgaprasadreddy5033 4 роки тому
@@simon.voggeneder For a simple if and else condition it does not really make much difference.However when you have nested if and else statements then braces make all the more sense.
@AngelSix
@AngelSix 4 роки тому
Yes I'd never nest braceless, and I also nest single lines if I split the single line statement over multiple lines too
@w.e.4759
@w.e.4759 2 роки тому
Don't worry what others say. If you like the end product of your video, then leave it at that. Comments about how to make a better video or better ways to tell your knowledge, keep them in mind and disregard others. You are doing good. Keep it coming...
@rishitsingh6621
@rishitsingh6621 4 роки тому
This series is lit
@garthparis6266
@garthparis6266 2 роки тому
Great video
@Exor4155
@Exor4155 4 роки тому
Thank you for sharing. What is the purpose of creating empty getters/setters instead of object/variable or read-only object/variable? At 28:20 & 56:20 are some examples.
@AngelSix
@AngelSix 4 роки тому
When exposing anything I like to stick to Properties and Methods. I don't want to bring fields into it. I don't find a simple library, NuGet package or anything out there that shares code out to consumers and passes their values as fields instead of properties. It's just kind of standard. Hard to think of something that I just do so naturally. You get added benefit of control in the getter/setter to do more things, and easy separation that your class itself is aware properties are typically always public and always for consumers so it can think about them/handle them accordingly
@loam
@loam 4 роки тому
At the beginning I was like why are bluetooth devices sending advertisements all the time, I knew only one meaning of that word - it's the actual Ads or commercials xD
@ICheck1000
@ICheck1000 4 роки тому
Have you found how to toggle the standard completion mode? It's Ctrl + Alt + Space... And your Tab will select the suggested property
@AngelSix
@AngelSix 4 роки тому
Yes thanks :)
@gregcyrus2739
@gregcyrus2739 Рік тому
I would like to it with BLAZOR. But haven't yet found a way to do so.
@NoOne-wf6hm
@NoOne-wf6hm 3 роки тому
Alright this didn't work for me (NetCLR Error on Console; WinForms ther is no Way). But I Loved the few Things I could Learn. I do have a question though: The way you organize the code... Is this a professional way / best practice? I'm sure there is a reason to organize it like that... It just doesn't make sense to me... Couldn't do it but sill thankful.
@Mielesplayz
@Mielesplayz Рік тому
Can you make an updated tutorial on how to do this in .NET MAUI?
@krellon
@krellon 4 роки тому
I'm planning on using the knowledge you impart to develop a similar app but for BT weigh scales, blood pressure monitor and heart rate monitor. Interesting that GettServiceUUids supports the BPM and HRM but not the scales. Presumably as BT scales are a recent introduction on the market. I'm assuming that any device supported by Microsofts namespace will have a common interface making development fairly straight forward but for the scales which are not covered by the namespace, knowing the method call's to get the data out of the device might not be so straight forward? Finding scales with an API that's developer friendly could be an issue? Cheers, great tutorial and great minutiae :=) PS: Does the UWP API work with USB BT dongles or does the BT device have to be integrated into the motherboard? Cheers? I'm asking as some dongles appear as serial ports. (Proof will be in the pudding i guess :)
@AngelSix
@AngelSix 4 роки тому
BT had lots of styles flavours and interfaces. It's like saying a device connected to WiFi could talk in any way it wants to another device. Attempts to standardise the interfaces with GATT is a start but you can just push raw data in any format no problem
@AngelSix
@AngelSix 4 роки тому
For BT motherboard it should work with dongles
@krellon
@krellon 4 роки тому
AngelSix AngelSix Hey Luke, thanks for getting back to me. I don’t have a BT MB. I ordered a BT V4 dongle from Amazon along with a BT HRM strap. I’ll give it a bash and see how I fare. It should work with GATT right if the bat. The scales when i get them will be another story, esp if the manufacturer hasn’t got a documented API. Scales are a tad more pricey than the HRM so i need to do a bit more digging to ensure i get a supported scale. That being said, propriety interfaces do not make for a universal platform n thus not really deployable right?
@krellon
@krellon 4 роки тому
AngelSix I can confirm this to be the case. Your core code worked with both the BT dongle and also detected the BT HRM 👍👍 thanks again 🙏
@vladmartian
@vladmartian 4 роки тому
Found a possible issue with CleanupTimeouts(). If there are no more devices that advertise then the CleanupTimeouts() will not be called anymore.
@bernarddebbasch1106
@bernarddebbasch1106 4 роки тому
Is the window version supposed to do anything? The console works well.
@krishnachaitanya6246
@krishnachaitanya6246 Рік тому
i can't add interops to project can any on help
@administratorilxsystem2245
@administratorilxsystem2245 3 роки тому
Hi. we are trying to build a android app with xamarin to connect to a arduino with hm-10 bluetooth module, to send and receive some simple data, do you have any tips, could you point me in the direction of what I need, because I love this series and you explain it very clearly but at the moment it's only windows app you build and explain, and I need to do it with Android, hope to hear from you.
@urlgreen8699
@urlgreen8699 4 роки тому
for the IntelliSense problem occurs with me sometimes even in older version of visual studio so its not new and it just gets fixed by itself i guess by restarting vs
@juliushuck
@juliushuck 4 роки тому
Same here
@AngelSix
@AngelSix 4 роки тому
Cool I'll see if it's gone for next time
@upperbit5291
@upperbit5291 4 роки тому
@@AngelSix You have "Toggles between suggestion and standard completion modes" toggled - this is the first button to the left of the "Live share" button in the upper right corner of VS (in the video) and it has the blue border. For me, the default keyboard shortcut is CTRL+ALT+SPACE, so i toggle it a lot unintentionally when using ALT+TAB to switch windows i guess, might have happened to you to.
@AngelSix
@AngelSix 4 роки тому
@@upperbit5291 Perfect thanks! Never spotted that
@SinlessDays
@SinlessDays 3 роки тому
The devices found are they mobile devices? Because BLE library only works on Speakers and Headphones I thought?
@Veso266
@Veso266 4 роки тому
how did you make mdn black themed?also the amount of comments makes me happy even if people don't like comments for obvious things its better to have them and ignore them than to not have them and not knowing what to do :)
@thegemgarden2757
@thegemgarden2757 4 роки тому
Not sure how Luke has his setup, but within the msdn link there is a Theme link top right you can change to Dark. As well there are browser extensions available.
@AngelSix
@AngelSix 4 роки тому
chrome.google.com/webstore/detail/dark-background-and-light/cdcoopnlkdlmphjpjggdmhohkiklonkh?hl=en
@camelCased
@camelCased 2 роки тому
Tried the same for WinForms app. Got "Error CS0731 The type forwarder for type 'Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementWatcher' in assembly 'Windows' causes a cycle" after adding that winmd reference. That's so frustrating. How to create a winforms app with BLE?
@patrikbak8161
@patrikbak8161 4 роки тому
The MSDN article is not in the description.
@AngelSix
@AngelSix 4 роки тому
Oh yeah I'll update it
@ashokvardhanreddy2445
@ashokvardhanreddy2445 4 роки тому
Where is the video for connecting to Blood glucose measuring device and reading the data. Would be of great help. Pls send me
@AngelSix
@AngelSix 4 роки тому
I've not done any more on this yet
@comeycallate9959
@comeycallate9959 2 місяці тому
mscorlib.dll could not be loaded
@devaliero-3d597
@devaliero-3d597 3 роки тому
Hi, I am using Visual Studio 2019, when I am adding the ref to windows IneropServices for .Net Core class library I am getting error message "the reference is invalid or unsupported". Does anybody know what maybe the reason?
@devaliero-3d597
@devaliero-3d597 3 роки тому
I was able to install it using NuGet package manager
@mvegeta50
@mvegeta50 3 роки тому
@@devaliero-3d597 Can you pls also tell which nuget this is?
@sunilpaul7525
@sunilpaul7525 4 роки тому
Hi , I have implemented the same application but start listening is not working how can i get resolve it. Could you please help me ? Thanks in advance.
@niv9375
@niv9375 3 роки тому
For me the same issue I faced
@maryamali7928
@maryamali7928 3 роки тому
@@niv9375 @sunil paul have you found any solution?
@michaltomorowicz596
@michaltomorowicz596 3 роки тому
Sweet tutorial, thanks. But man, commenting every single line of code ?
@niv9375
@niv9375 3 роки тому
Using the same code.. The program can not able to find near by device.. Plz help..
@gregcyrus2739
@gregcyrus2739 Рік тому
with another app I had to enable bluetooth privacy settings in WINDOWS. The app had to be called with https (not http). Another WINDOWS setting is to allow apps with unpaired devices. But I cannot grant if it makes this app work 🤔
@VinuP2023
@VinuP2023 4 роки тому
I tried running solution in Windows 7. Does BluetoothLEAdvertisementWatcher not support Windows 7?
@AngelSix
@AngelSix 4 роки тому
Not this one. We can find a way to implement it in windows 7 but I don't think it's worth it. This app is mainly mobile based and the windows version is mostly for convenience of debugging. I hardly see anyone actually using the windows one as actual application.
@VinuP2023
@VinuP2023 4 роки тому
@@AngelSix oh...I got it
@mcborov_
@mcborov_ 4 роки тому
How did your PC connect to Bluetooth?
@AngelSix
@AngelSix 4 роки тому
It has a bluetooth chip on the motherboard
@daniilbaydak991
@daniilbaydak991 3 роки тому
Holy butt cheeks this is incredible! Awesome work!
@jojoduke1702
@jojoduke1702 4 роки тому
Are the book reviews done?
@AngelSix
@AngelSix 4 роки тому
No. Got 6 more already lined up
@deepakbhagat811
@deepakbhagat811 4 роки тому
@@AngelSix hello please tell us the best book on c#☺️ and also you the most innovative c# programmer on youtube..
@AngelSix
@AngelSix 4 роки тому
I have purchased some more books, will read, and as I find good ones they will appear in my recommendations here www.amazon.co.uk/shop/angelsix
@harshkansara7196
@harshkansara7196 4 роки тому
Not able to find Bluetooth "ON" devices using your source code, please help me.
@niv9375
@niv9375 3 роки тому
Same issue with me harsh, do u find any solution??
@mohamedboutakat966
@mohamedboutakat966 3 роки тому
Same to me
@Fuatbolukbas
@Fuatbolukbas 3 роки тому
To make intellisense highlight to default action type Ctrl+Alt+Space on video (ukposts.info/have/v-deo/ioaSp5p7q519rI0.html)
@patrickmaloney1810
@patrickmaloney1810 3 роки тому
You're accessing the dictionary outside the thread lock. Isn't that a no-no even if you're just reading it?
@softwarefacts5801
@softwarefacts5801 3 роки тому
Yeah. VS intellisence is frustrating.
@slipoch6635
@slipoch6635 4 роки тому
This method no longer seems to work in .net core 3+
@caffreychang9495
@caffreychang9495 4 роки тому
You can install Microsoft.Windows.SDK.Contracts, Microsoft.Windows.WinMD and System.Runtime.InteropServices.WindowsRuntime on nuget package. It may solve the issue.
@slipoch6635
@slipoch6635 4 роки тому
@@caffreychang9495 Yes I have discovered that, I am now building a .net standard BT library and will put up my results somewhere.
@AngelSix
@AngelSix 4 роки тому
Good stuff
@zofmod
@zofmod Рік тому
You can connect multiple HC-05s ukposts.info/have/v-deo/oX12oWmIqYZkmIU.html
@goddess_ofchaos
@goddess_ofchaos 3 роки тому
I know this is totally out of context but u look like ed sheeran lol
@Offseasoncornbread
@Offseasoncornbread 4 роки тому
Can you explain why you are commenting everything? Most of these are practically useless, as they add nothing of value to the code and they only repeat what the code already says.
@AngelSix
@AngelSix 4 роки тому
ukposts.info/have/v-deo/bXiDoIOmnIFewmg.html
@thegemgarden2757
@thegemgarden2757 4 роки тому
@@AngelSix Great answer!
@sawomirkrynicki4492
@sawomirkrynicki4492 Рік тому
System.NotImplementedException: „The member DeviceWatcher DeviceInformation.CreateWatcher(string aqsFilter, IEnumerable additionalProperties, DeviceInformationKind kind) is not implemented in Uno. What i doiing wrong?
Reading Bluetooth LE Device Details C# WPF
1:12:08
AngelSix
Переглядів 22 тис.
Master BLE Basics in Just 10 Minutes: The Ultimate Guide!
9:15
Novel Bits
Переглядів 86 тис.
RASPBERRY PI3B- LOAD RASPBIAN DESKTOP PC
3:54
HAMTech RADIO SCANNER M0FXB CB DRONE HOBBY Diary
Переглядів 35
Correcting Common Async/Await Mistakes in .NET - Brandon Minnick
1:00:11
NDC Conferences
Переглядів 165 тис.
Big Tech AI Is A Lie
16:56
Tina Huang
Переглядів 55 тис.
BEST WAY to make Desktop Applications in C++
26:00
The Cherno
Переглядів 862 тис.
Everything you need to know about Bluetooth Low Energy advertising
1:03:22
Nordic Semiconductor
Переглядів 30 тис.
Google Data Center 360° Tour
8:29
Google Cloud Tech
Переглядів 5 млн
Как работает Bluetooth?
21:59
Branch Education На Русском
Переглядів 34 тис.
Building Android Apps to Control Bluetooth LE Devices
38:51
CrossComm, Inc.
Переглядів 34 тис.
Using Web BLE to detect and get GATT information
19:41
Sayanee Basu
Переглядів 27 тис.
GADGETS VS HACKS || Random Useful Tools For your child #hacks #gadgets
0:35
BMW просто издевается над нами! Силы на исходе…
1:34:41
ИЛЬДАР АВТО-ПОДБОР
Переглядів 2,9 млн
Бугатти не продадут Тому Крузу авто 😢
0:51
МУЖИК СТРОИТ ДОМ ИЗ ГРЯЗИ
0:35
Рубить Правду
Переглядів 3,7 млн
Mind blowing bamboo crafts #bamboo
0:12
Bamboo / Shorts
Переглядів 30 млн