Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Revision as of 06:39, 30 May 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

WISE Send Number

From Wiki
Jump to: navigation, search
Article Metadata
Article
Created: ebra (17 Jun 2008)
Last edited: hamishwillee (30 May 2013)

Contents

Description

The communication between two WISE devices is divided into two possibilities

When number is send or received the data size is always 5 bytes - the first byte is a control byte (always 'L') and the remaining 4 bytes represents a 32 bit integer is a little endian format.

Maemo Platform

int wise_send_int(int socket,int nbr)
{
/* create number buffer */
char number_buffer[sizeof(int)+1];
int number=nbr,bytes_send=0;
 
memcpy(number_buffer+1,(char*)&number,sizeof(int));
number_buffer[0] = 'L';
 
/* send bumber */
bytes_send = write(socket,number_buffer,sizeof(int)+1);
if ( bytes_send < sizeof(int)+1 ) return WISE_CONNECTION_ERROR;
return WISE_OK;
}

S60 Platform

void CWISEBase::SendIntL(RSocket& aSocket, TInt aInt)
{
TRequestStatus status;
 
TBuf8<5> buffer;
buffer.Append('L');
 
TUint8 buf[4];
LittleEndian::Put32(buf,aInt);
buffer.Append(buf,4);
 
aSocket.Write(buffer,status);
User::WaitForRequest(status);
User::LeaveIfError(status.Int());
}

Links

This page was last modified on 30 May 2013, at 06:39.
52 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×