Hi Guys,
Me again. I was thinking someone could provide some suggestions on my understanding of the BLE connection ( porfile, GATT, characteristic,value, etc...)
I finished reading all the BLE tutorials and would like to re-write my understanding about the tutorials and some other questions about where should I go next.
With my understanding by now, in order to transfer the data between server and client, first the server need to declare profiles depending on what kind of data it will send and how to send out to the client. The GATT profile is used for this purpose. The GATT profile will be used to define what and how to transfer the data. The GATT consists with a service or many services, each services is used for one purpose. For example, a heart rate device can have 2 service, one is used to transfer heart data, another one is used to transfer battery data.
Within a service, there are many characteristics, declarations and values which are used to either indicating what service it is or holding the actually sensor value. And at the client side, for example a phone app, the app should also be able to set up a similar profile which pairs to the device so that the phone app can quickly connect with the server and read or write data.
And in order to send data out, I need to do the things below: make a GATT profile -> add service to the GATT profile based on what function I need for my device -> add declaration into service, so that when the client scan, it can know the device quickly and easily and know how to read data -> add data into the characteristic value declaration, this should be the data I want to send out -> set up other parameters, security, notification, etc...-> set up trigger event, timer or button press.
Above is my understanding from the tutorial. I have also go through the code example and successfully run through with my nRF51 DK. Here are some questions which I'm not sure about:
-
How to define the GATT itself ? As mentioned, the GATT is holding all the services and characteristics , etc... How can I declare a specific GATT in advance ? Say I'm using the heart rate GATT profile, is there a need to declare a heart rate GATT profile ? Or the GATT is defined with the service declaration ? Like in here in Table 1 first row, the attribute value 0X180D si the GATT declaration, which is the value from BL SIG
-
Is the data in the characteristic declaration value is the raw value when transmit to phone app? I have used some BLE module before where I don't really care about the pair or what kind of the data I need to transfer. For example, when I did my embedded design, I just add a BLE module and use RX/TX line on the BLE module to send and read data with between core chip and BLE, byte by byte, not really care about set service or profile or others. So, for now, say if I also need to develop an iphone app along with my project, when the phone connect with my device, the value I put into the characteristic value declaration is the value I want to transfer. Is that right?
-
The third question is about the phone app. I have all the time developing circuit and system but never did a app design. So, if I want to also have a app working with the nrf chip, where should I start? I have go through some android examples and have a draft app, it can scan my nrf51822 device, but cannot connect to it. So, is this because I didn't have a profile in the app?
-
What about multiple data sending out? I think with my understanding, if I want to send multiple data our, either enclose them into one service but at different index in the value bytes and send all the phone and de-format them later, or make multiple service and send them out together. But how should I design at the phone app side ?
Thanks for taking a read for my long post. If you have any feedback or suggestion please let me know.