Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
hishamBakr
Posts: 45
Registered: ‎04-11-2012
My Device: Z10 Limited Edition

How to disable buffer while writing to Bluetooth ? to send a

Hi All, I am trying to send a batch of messages to PC from BB10 through Bluetooth

 

I use:

write( sppDataThread.getFD( ), msg1.toAscii( ), msg.size( ) );
write( sppDataThread.getFD( ), msg2.toAscii( ), msg.size( ) );
write( sppDataThread.getFD( ), msg3.toAscii( ), msg.size( ) );

 

I face a strange behaviour when i recieve these messages on PC.

 

I expect to recieve

msg1

msg2

msg3

 

but I recieve:

msg1

msg1msg2

msg1msg2msg3

 

I fixed this issue by using:

 

write( sppDataThread.getFD( ), msg1.toAscii( ), msg.size( ) );
sppDataThread.wait( 200  )
write( sppDataThread.getFD( ), msg2.toAscii( ), msg.size( ) );
sppDataThread.wait( 200  )
write( sppDataThread.getFD( ), msg3.toAscii( ), msg.size( ) );

 

But I dont want my thread to sleep . It seems that it is a caching issue. How to send messages immediattely correctly?

When you are young, work to learn. Not to earn !
Please use plain text.
Contributor
hishamBakr
Posts: 45
Registered: ‎04-11-2012
My Device: Z10 Limited Edition

Re: How to disable buffer while writing to Bluetooth ? to send a

any help
When you are young, work to learn. Not to earn !
Please use plain text.
Contributor
hishamBakr
Posts: 45
Registered: ‎04-11-2012
My Device: Z10 Limited Edition

Re: How to disable buffer while writing to Bluetooth ? to send a

any reply :smileysad:
When you are young, work to learn. Not to earn !
Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: How to disable buffer while writing to Bluetooth ? to send a

I can provide 'any' but not sure it will help you.

What is sppDataThread?

How do you declare msg, msg1, msg2 and msg3?

How do you initialize msg, msg1, msg2 and msg3? 

Please use plain text.
Contributor
hishamBakr
Posts: 45
Registered: ‎04-11-2012
My Device: Z10 Limited Edition

Re: How to disable buffer while writing to Bluetooth ? to send a

sppDataThread is a thread used to handle bluetooth connection

QString msg1="msg1";
When you are young, work to learn. Not to earn !
Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: How to disable buffer while writing to Bluetooth ? to send a

I am not young so probably that's why I'll ask you to give all of them  as well:

>How do you declare msg, msg1, msg2 and msg3?

>How do you initialize msg, msg1, msg2 and msg3?

Please use plain text.
Contributor
hishamBakr
Posts: 45
Registered: ‎04-11-2012
My Device: Z10 Limited Edition

Re: How to disable buffer while writing to Bluetooth ? to send a

I am sorry I didnt get your point. I answered your questions

the issue is. bluetooth buffer a block then flush it. I want to disable that flush by block and I want it to be flush by line
When you are young, work to learn. Not to earn !
Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: How to disable buffer while writing to Bluetooth ? to send a

I don't think it is 'block' issue.

What bothers me is in every wirte you use different variables to push into the socket but you have the same lengh of msg variable that is why I asked you to provide *all 4 variables declarations/initializations.

msg1.toAscii( ), msg.size( )
Please use plain text.
Contributor
hishamBakr
Posts: 45
Registered: ‎04-11-2012
My Device: Z10 Limited Edition

Re: How to disable buffer while writing to Bluetooth ? to send a

:smileyhappy:
No that is not the issue

actually the original code is :a method that is called when user presses on a button

when user clicks the button and waits for 400 millisecond between clicks--> no issue happens

when user clicks the button and waits less than 400 millisecond between clicks--> the issue happens


I just wrote msg1,msg2,msg3 to describe my issue

When you are young, work to learn. Not to earn !
Please use plain text.
BlackBerry Development Advisor
idruker
Posts: 4
Registered: ‎12-07-2012
My Device: BB10

Re: How to disable buffer while writing to Bluetooth ? to send a

To hishamBakr

 

 

Could you show the code of all the functions where msg, msg1,msg2,msg3 are involved?

 

Ilya

 

 

Please use plain text.