Skip to content

Suggestion. Add bluetooth support #20379

Closed

Description

@IngemarSkelander

It would be great to have support for pairing and IO with bluetooth devices for .net core.
It is perhaps a bit of a niche, but since self hosting is so easy in asp.net core I think more people than myself would be interested in communicating with BT devices from our self hosted web api's.

There is the 32feet bluetooth library, but it does not seem to be very active nowadays.

Activity

  1. karelz commented on Mar 2, 2017

    @karelz
    Member

    This is a great idea for independent NuGet package.
    I don't believe it fits the scope of CoreFX repo though - it should not be part of the platform, but rather built on top of the platform.

    Did you consider following up with 32feet authors if they take contributions or plan to move to GitHub?

  2. ianhays commented on Mar 7, 2017

    @ianhays
    Contributor

    I agree with @karelz here. Bluetooth support is really more something that should be a separate package; it doesn't really fit under the "core" libraries. I do think it would be great to have an active, functional package for it on Nuget.

    As it doesn't fit for CoreFX, I'm going to close this issue.

  3. tkp1n commented on Jan 12, 2018

    @tkp1n
    Contributor

    Sorry for posting on a closed issue here, but I think adding the some sort of basic support for the AddressFamily Bluetooth (AF_BTH) and the ProtocolType RFCOMM (BTHPROTO_RFCOMM) in System.Net.Sockets could be considered a corefx concern...

  4. danmoseley commented on Jan 12, 2018

    @danmoseley
    Contributor
  5. transferred this issue fromdotnet/corefxon Jan 31, 2020
  6. added this to the 2.0.0 milestone on Jan 31, 2020
  7. vindicatorr commented on Jun 9, 2020

    @vindicatorr

    I'm also interested in this. I'm on .net-5.0 and am trying to toy around with my bluetooth.

    It looks like my timing is nearly right in that #862 happened recently, but I'm currently presented with the error/stacktrace:

    System.PlatformNotSupportedException: Operation is not supported on this platform.
       at System.Net.SocketAddressPal.ThrowOnFailure(Error err)
       at System.Net.SocketAddressPal.GetAddressFamily(ReadOnlySpan`1 buffer)
       at System.Net.Sockets.Socket..ctor(SafeSocketHandle handle, Boolean loadPropertiesFromHandle)
       at System.Net.Sockets.Socket..ctor(SafeSocketHandle handle)
       at ns.Bluez.Profile1.<>c__DisplayClass19_0.<ns.Bluez.IProfile1.NewConnectionAsync>b__0() in <myProject>
    

    and I'm guessing that's the last thing holding me back, and which led me to this issue that I hope can be brought back to life.

    I used the wonderful world of https://github.com/tmds/Tmds.DBus/ (available on nuget) to get the linux bluez stuff going and as you can see in the stacktrace, the "NewConnection" callback is fired and I'm given a file-descriptor, but when I try to make use of it:

    System.Net.Sockets.SafeSocketHandle lHandle = new System.Net.Sockets.SafeSocketHandle(pFd.DangerousGetHandle(), true);
    System.Net.Sockets.Socket lSocket = new System.Net.Sockets.Socket(lHandle);
    

    ... the "GetAddressFamily" internal stuff doesn't seem to like what it's being told the socket is all about.
    And "lsof" shows me: dotnet 575709 username 85u sock 0,9 0t0 14855571 protocol: RFCOMM which I'm assuming is additional proof that the connection was made.

    I don't know if there's already some existing framework within dotnet that would somewhat reasonably allow me to workaround the problem.
    I know that there also exists the wonderful world of https://github.com/tmds/Tmds.LibC which I haven't toyed with yet, but may fit the bill for now.

    If it's preferred, I could open another issue for this particular error I'm receiving, but I felt it was still applicable to this issue.

  8. tthiery commented on Sep 28, 2020

    @tthiery

    I follow the understanding that this is not a "corefx" thing ... BUT following this logic (rhetorically) ... why is Socket and TCP/IP in general? Bluetooth is the dominant wireless standard which is not TCP/IP in the last 10 years and most likely the next 20 years. Every household has dozen devices. IoT, Desktop Apps, Store Apps, Android and iOS Apps rely on Bluetooth. It is as core as TCP/IP is, just that the average server does not need it.

  9. ghost locked as resolved and limited conversation to collaborators on Dec 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-needs-workarea-System.IO

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions