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

About Service and characteristic using method?

Hi

I am currently working on a BLE based hardware but I am a little confused about the terms such as service, characteristics... etc.

Let's say, I would like to control 2 different IO, an LED or a buzzer, based on received data and this data should include 3 different parameters: pulse_count, pulse_length (milliseconds) and pulse_interval (milliseconds).

For example, I should be able to say "Blink the LED 3 times with 50ms pulse length and 150ms pulse interval" as following:

image description

or "Trigger the buzzer 2 times with 100ms pulse length and 100ms interval" as following:

image description

For the above example, should I create 2 services, one for LED and one for buzzer, with 3 characteristics (pulse_count, pulse_length, pulse interval) ?

or 1 service, 1 characteristic(has string value contians pulse_count, pulse_length, pulse interval data)? Is it advantage or disadvantage about using less or more service??

What is the best approach for handling such a case?

Regards

Parents
  • Hi Eyup,

    If you are new to BLE it might be worth your time to follow along with this Nordic Tutorial. It should clarify the differences between a service and characteristic.

    For some more detail I would check out this Intro To BLE. There you will find more information about your question for best practices. I would recommend against using one string because of the extra overhead in parsing it, and that it would take up a lot of your space in the characteristic. Using an int masked for three sections would be more efficient.

    I hope the guides are helpful.

Reply
  • Hi Eyup,

    If you are new to BLE it might be worth your time to follow along with this Nordic Tutorial. It should clarify the differences between a service and characteristic.

    For some more detail I would check out this Intro To BLE. There you will find more information about your question for best practices. I would recommend against using one string because of the extra overhead in parsing it, and that it would take up a lot of your space in the characteristic. Using an int masked for three sections would be more efficient.

    I hope the guides are helpful.

Children
No Data
Related