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 Reply Children
No Data
Related