Hi, I am configuring Bluetooth profile. BLE device has got data transfer it to app.But same time App is sending various command

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
shdhc_2578096
Level 2
Level 2
First like given

Hi, I am configuring Bluetooth profile. BLE device has got data to transfer it to app.

But same time App is sending various commands and based on those command BLE device should send the data to app.

what type of profile is suitable for Bluetooth? Do I need to go for HCI interface or Profile is okay for the Implementation?

0 Likes
1 Solution
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Use a Custom Profile and then create two characteristics, one for the app to send commands and other for the peripheral to send data. The first characteristic will have Write Property and other characteristic can be Read or Notify.

So when the App sends the commands, the peripheral will prepare the data accordingly and then notify the app when the data is ready. The app should then process the data. I would suggest doing it this way.

You could also make the app to just keep reading intead of waiting for the notify, but will consume more power.

Make use of AsyncTasks in Android SDK to send commands and process the data in the background instead of running it in the main thread.

Regards,

Dheeraj

View solution in original post

0 Likes
3 Replies
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Use a Custom Profile and then create two characteristics, one for the app to send commands and other for the peripheral to send data. The first characteristic will have Write Property and other characteristic can be Read or Notify.

So when the App sends the commands, the peripheral will prepare the data accordingly and then notify the app when the data is ready. The app should then process the data. I would suggest doing it this way.

You could also make the app to just keep reading intead of waiting for the notify, but will consume more power.

Make use of AsyncTasks in Android SDK to send commands and process the data in the background instead of running it in the main thread.

Regards,

Dheeraj

0 Likes