WISE Send Number
Article Metadata
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());
}

