Read-only archive of the All About Symbian forum (2001–2013) · About this archive

Problem extracting string from Bluetooth packet

1 replies · 2,106 views · Started 08 March 2003

Hi,

I am attempting to extract a string from a packet recieved by Bluetooth and display it on the screen using an information note.

For example the client (Nokia 7650) may recieve a packet:

CCCCCCMMMM...MMMM

Where CCCCCC identifies the type of message and M represents a character within the message (of which there are 32). The server process runs on a Windows PC and is written in Perl, I don't think that there is a problem with the generated packet as the command portion of the packet can be successfully decoded using:

if(iPacketBuffer.Left(6) == _L8("ABCDEF"😉)
// do something

where iPacketBuffer is defined as:

TBuf8<1024> iPacketBuffer;

The problem is in trying to extract the message portion, I am using the following code:

TPtrC8 message(iPacketBuffer.Mid(6, 32));

I then pass message onto a function defined as:

void Handler(const TDesC8 &aMessage)
{
TBuf<256> buffer;

buffer.Format(_L("%s"😉, aMessage.Ptr());

CEikonEnv::Static()->InfoWinL(buffer, KNullDesC);
}

The resultant information note simply containes 32 'box' characters.

I hope I have not overlooked something obvious, does anybody have any idea why this is the case?

Andrew