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

How to prevent data loss while sending data over bluetooth

Hi

I have created local buffer of 100 bytes.

while device is connected to dongle it is sending all 100 bytes over bluetooth stack .

but once it is disconnected and then again connnected there is data loss.

how can i do whenever device disconnected, i have to send from last 20 bytes which are all already send

while connecting.

i tried fallowing code but not yet worked kindly suggest me.

if((connect==1)&&(disconnect==0)) { flag=1; if(rear>front) { length=rear; d=(length/20); r=(length%20); if(disconnect==1) { front=front-20; exit(0); } for(k=0;k<d;k++) { err_code = ble_hrs_heart_rate_measurement_send(&m_hrs,20, &a[front]);

													if(front==rear)
													{
														front=rear=-1;
													}
													else if((front==SIZE-20)&&(disconnect!=1))
													{
															front=0;
													}
													else if(disconnect==1)
													{
														front=front-20;
														exit(0);
													}
													else if (disconnect!=1)
													{
														front=front+20;
													}
													
												}

}

Parents
  • You must check the error code when trying to send data. If you don't get NRF_SUCCESS back, you need to resend the data from your application if you actually want to transmit it.

    There have been several discussions on this site about how to get high throughput, so I'd recommend you to search around a little if you still have trouble with this. The reply I gave you on this question is still valid, so I'd recommend you to instead implement something like that.

Reply
  • You must check the error code when trying to send data. If you don't get NRF_SUCCESS back, you need to resend the data from your application if you actually want to transmit it.

    There have been several discussions on this site about how to get high throughput, so I'd recommend you to search around a little if you still have trouble with this. The reply I gave you on this question is still valid, so I'd recommend you to instead implement something like that.

Children
No Data
Related