locked
How to connect to a bluetooth device from my Windows Store App?

    Question

  • Hi!

    I'm developing an app that will run on tablets and this app will control a device through bluetooth connection. This app should not be distributed on the store.

    Anyway, I need help understanding how approach the solution. I mean, how do I know which API should I use GATT or RFCOMM? 

    The app will control various devices, it seems that some configuration about one device should be put on the app´s manifest, how can I make this set up? I mean, one day the operator may control one device using the app, and the other day he/she may control another one (or even more than 2 or 3 devices a day). How can I make this information input by the operator?

    Any help to clarify this solution is much appreciated.

    Thanks!

     

    Tuesday, March 11, 2014 10:43 PM

All replies

  • Hi DevDoubts,

    I think you may need some documentations for setting app manifest: How to specify device capabilities for Bluetooth

    And for using API for GATT or RFCOMM, read this: Bluetooth devices

    Hope the documentation helps, and feel free to ask if there is something unclear.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Wednesday, March 12, 2014 2:39 AM
    Moderator
  • You'll know whether you need to use GATT or RFCOMM based entirely on the device you want to control.  Lots of Bluetooth game controllers, for example, use RFCOMM; devices like the TI SensorTag BLE use GATT.

    Network Developer Experience Team (Microsoft)

    Wednesday, March 12, 2014 5:19 PM
  • Thanks for the answer!

    I checked with the company developing the device and they confirmed it uses RFCOMM. Mainly because the conection is kept alive while the device is at range.

    Thanks again!

    Wednesday, March 12, 2014 7:05 PM
  • Thanks for helping!

    I had already seen those resources on MSDN but I still question how am I going to specify the device  bluetooth capabilities when the app can connect to various devices?

    You know, this app will control a device through bluetooth and it will connect to various instances of this device. For example, imagine you have a device that reads weather information autonomously. Then a company places various devices around the city and an operator with a tablet goes around the city to consume the information read on each device. 

    My doubt is how I vary the device Id for each one of those?

    It seems to me that the informations we put on the app´s manifest is for one physical device only. Is that correct? 

    <m2:DeviceCapability Name="bluetooth.rfcomm"> <m2:Device Id="any"> <m2:Function Type="name:AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE" /> </m2:Device> </m2:DeviceCapability>

    Could I provide Id from the database to connect to different devices?

    Thanks.

    Wednesday, March 12, 2014 7:31 PM