This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Custom BLE code

I followed the custom BLE tutorial and got the output.



1.  The result increments till 19 , but after that the value 20 is appended with extra character. May i know the reason behind this?


A	09:31:39.095	"(0x) 1D" received
I	09:31:39.885	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 1E
A	09:31:39.885	"(0x) 1E" received
I	09:31:39.885	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 1E
A	09:31:39.885	"(0x) 1E" received
I	09:31:39.886	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 1E
A	09:31:39.886	"(0x) 1E" received
I	09:31:40.879	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 1F
A	09:31:40.879	"(0x) 1F" received
I	09:31:40.879	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 1F
A	09:31:40.879	"(0x) 1F" received
I	09:31:40.879	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 1F
A	09:31:40.879	"(0x) 1F" received
I	09:31:42.072	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 20, " "
A	09:31:42.072	"(0x) 20, " "" received
I	09:31:42.073	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 20, " "
A	09:31:42.073	"(0x) 20, " "" received
I	09:31:42.074	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 20, " "
A	09:31:42.074	"(0x) 20, " "" received
I	09:31:43.069	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 21, "!"
A	09:31:43.069	"(0x) 21, "!"" received
I	09:31:43.070	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 21, "!"
A	09:31:43.070	"(0x) 21, "!"" received
I	09:31:43.265	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 21, "!"
A	09:31:43.265	"(0x) 21, "!"" received
I	09:31:44.456	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 22, """
A	09:31:44.456	"(0x) 22, """" received
I	09:31:44.457	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 22, """
A	09:31:44.457	"(0x) 22, """" received
I	09:31:44.458	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 22, """
A	09:31:44.458	"(0x) 22, """" received
I	09:31:45.052	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 23, "#"
A	09:31:45.052	"(0x) 23, "#"" received
I	09:31:45.053	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 23, "#"
A	09:31:45.053	"(0x) 23, "#"" received
I	09:31:45.053	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 23, "#"
A	09:31:45.053	"(0x) 23, "#"" received
I	09:31:46.047	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 24, "$"
A	09:31:46.047	"(0x) 24, "$"" received
I	09:31:46.048	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 24, "$"
A	09:31:46.048	"(0x) 24, "$"" received
I	09:31:46.049	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 24, "$"
A	09:31:46.049	"(0x) 24, "$"" received
I	09:31:47.045	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 25, "%"
A	09:31:47.045	"(0x) 25, "%"" received
I	09:31:47.243	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 25, "%"
A	09:31:47.243	"(0x) 25, "%"" received
I	09:31:47.244	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 25, "%"
A	09:31:47.244	"(0x) 25, "%"" received
I	09:31:48.034	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 26, "&"
A	09:31:48.035	"(0x) 26, "&"" received
I	09:31:48.035	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 26, "&"
A	09:31:48.035	"(0x) 26, "&"" received
I	09:31:48.042	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 26, "&"
A	09:31:48.042	"(0x) 26, "&"" received
I	09:31:49.028	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 27, "'"
A	09:31:49.028	"(0x) 27, "'"" received
I	09:31:49.028	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 27, "'"
A	09:31:49.028	"(0x) 27, "'"" received
I	09:31:49.028	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 27, "'"
A	09:31:49.028	"(0x) 27, "'"" received
I	09:31:50.022	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 28, "("
A	09:31:50.022	"(0x) 28, "("" received
I	09:31:50.023	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 28, "("
A	09:31:50.023	"(0x) 28, "("" received
I	09:31:50.023	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 28, "("
A	09:31:50.023	"(0x) 28, "("" received
I	09:31:51.218	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 29, ")"
A	09:31:51.218	"(0x) 29, ")"" received
I	09:31:51.414	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 29, ")"

2.  How the change the name of "Unknown Service" and "Unknown characteristics" to a specific names?

3.  I tried to extend the code to add more characteristics to the same service,

      a. when i added the second characteristics, even if i enable the notifications, i cannot see the value on the front page. But i see the notifications.

                                                             

      b.  when i added the third characteristics, i could see the value for two of them and not the third.

                                                                         

4.  Is it possible to have one notification for all 3 characteristics? If so, what needs to be corrected.

5.    Is there any reference that shows how to use the nordic connect app for android? To configure GATT server. 

  • check this http://www.asciitable.com/ . it shows the "char" value

    if you read hex value and you have to convert to the respective integer or your data type or else it will show  char value

  • Hi,

    1.  The result increments till 19 , but after that the value 20 is appended with extra character. May i know the reason behind this?

    As explained by , this is just a matter of how it is displayed in the log. When the value is a valid ASCII value, it is displayed as that as well in the log. There is no additional character.

    2.  How the change the name of "Unknown Service" and "Unknown characteristics" to a specific names?

    There is no way to add a name to a service, so this is just interpreted by the nRF Connect app. Since it does not know which service it is, it shows it like that.

    3.  I tried to extend the code to add more characteristics to the same service,

          a. when i added the second characteristics, even if i enable the notifications, i cannot see the value on the front page. But i see the notifications.

    Where is the value missing? Please elaborate.

    4.  Is it possible to have one notification for all 3 characteristics? If so, what needs to be corrected.

    Yes. I cannot say without knowing more. Can you show you configure the characteristics on the nRF side as well as show it from nRF Connect?

    Is there any reference that shows how to use the nordic connect app for android? To configure GATT server. 

    I do not believe there is any documentation for that.

  • Thank you so much  for your answers. 

          In the Q3.b  image, The VALUE of the first characteristic is 0x0F, and second characteristic is 0x0A. But I cannot view            the third one. 

           Q5. Can you guide me regarding the "configure GATT server", option present?  how to configure it? 

  • Hi,

    Nats said:
          In the Q3.b  image, The VALUE of the first characteristic is 0x0F, and second characteristic is 0x0A. But I cannot view            the third one. 

    Yes, I see that now. It looks a bit odd. Are you sure there is a value? Can you share the code from your nRF implementation so that we can see how this characteristic is configured?

    Nats said:
           Q5. Can you guide me regarding the "configure GATT server", option present?  how to configure it? 

    In the nRF Connect Android app you can ad either a custom service where you specify name and UUID, or a standard service where the UUID is set automatically. And as stated in the app: "With a custom service, you'll be able to manually set characteristic and descriptors data and send notifications.".

Related