RFduino Development => Software => Topic started by: Ali250 on November 22, 2014, 07:06:31 AM
I'm trying to establish communication between an rfduino and a Windows Phone app I'm designing (I need to transmit arrays from the RFduino and receive them on my phone). On the phone end, I'm having trouble configuring the rfduino. From what I've read, every task in BLE is performed by some service(?). So I ran the BulkDataTransfer example on the rfduino and ran the code here: http://www.apeoholic.se/post/2014/05/04/Windows-phone-81-and-Bluetooth-LE-Getting-started (http://www.apeoholic.se/post/2014/05/04/Windows-phone-81-and-Bluetooth-LE-Getting-started) on my phone to figure out what was going on
The code showed me that the rfduino was using the GenericAccess and GenericAttirbute services. Once I knew that, it seemed pretty straight forward; all I had to do was write an event handler for when these services changed and I'd be able to receive the packets the rfduino was sending out. But the problem is that I also need to know the "characteristic" UUID that is being used by the BulkDataTransfer code example.
Below is the list of characteristic UUIDs that I can use:
The RFDuino has 3 characteristics you can see ONLY.... 1 service UUID broadcast (which you can modify)
Service UUID: "2220"
Characteristic UUID: "2221 - Read, 2222 - Write, 2223 - no idea" it says disconnect but not sure....
In order to connect to a bluetooth ble device you need to follow some rules, and althought they may vary from host to host (apple/microsoft) they have to follow bluetooth's guideliness for connection....
so in general I would suggest trying to find a function for windows phone apps that discovers all available services from all peripherals... that way you can see which services are available...
otherwise do a scan for a specific service uuid: 2220... this one for sure will find the rfduino... after that you have to do a scan for characteristics... again do a full search to see available ones... but if you're reading a value then just simply use characteristic uuid: 2221... that's when you'd have to read the documentation by windows to obtain the value from characteristic.value or something similar....
I'm not going to try and fully explain it, as I'm not 100% clear myself, but for your purposes:
A characteristic represents a particular value. It can be readable (on demand), writable, or it can notify you when it changes.
Characteristics are grouped together in a Service.
Services and characteristics are identified by UUIDs, which can be either 16bit (e.g. "2221") or 128bit (e.g. "abece8fd-afde-40b4-b1b1-632adfb84d5e"). The 16bit UUIDs are reserved for registered official uses, which is probably what that documentation page is referring to. The 128bit UUIDs are supposed to be random enough not to overlap, so there's no need for central registration.
Typically there is one "main" Service that a BLE peripheral advertises, in RFduino it is 2220. You would ask Windows phone to find BLE peripherals advertising the Service "2220" and then pick one to connect to. Once the Windows phone connects it must scan to discover all the Services; it should find 2220. Now it must scan that service for Characteristics; it should find 2221, 2222, and 2223. One of those Characteristics will be marked as capable of being transmitted to, another will be marked as capable of sending notifications. You need to ask Windows phone to enable notification for that characteristic, that will be how you RX data from RFduino whenever it is sent. The third is unimportant.
May I ask where did you find out that 2220, 2221, 2222 and 2223 are the given characteristics for the RFDuino? I just need it for the documentation of my university assignment.
I used gattool on Linux.
Somewhere early in this forum there is are RFduino threads of users figuring out stuff. Perhaps check that out. You will have to go back and read through history.