Data types

<< Click to Display Table of Contents >>

Navigation:  Devices > UDP data exchange > Protocol >

Data types

Previous pageReturn to chapter overviewNext page

Type

Width in bytes

Description

UINT16

2

Byte0: low

Byte1: high

On a little endian system a UINT16 data value can be copied directly into the payload.

Example:

//encoding

uint16 value = 9873;

char payload[2];

uint16* p = reinterpret_cast<uint16*>( payload );

*p = value;

 

//decoding

value = *( reinterpret_cast<const uint16*>( payload ) );

INT32

4

Byte0: low

Byte3: high

On a little endian system a INT32 data value can be copied directly into the payload.

Example:

//encoding

int32 value = -3459873;

char payload[4];

int32* p = reinterpret_cast<int32*>( payload );

*p = value;

 

//decoding

value = *( reinterpret_cast<const int32*>( payload ) );

UINT32

4

Byte0: low

Byte3: high

On a little endian system a UINT32 data value can be copied directly into the payload.

Example:

//encoding

uint32 value = 3459873;

char payload[4];

uint32* p = reinterpret_cast<uint32*>( payload );

*p = value;

 

//decoding

value = *( reinterpret_cast<const uint32*>( payload ) );