×
Namespaces

Variants
Actions

WISE Send Number

From Nokia Developer 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 09:39.
45 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.

×