rtxBitDecode.h File Reference

Bit decode functions. More...

#include "rtxsrc/rtxContext.h"

Go to the source code of this file.

Functions

EXTERNRT int rtxDecBit (OSCTXT *pctxt, OSBOOL *pvalue)
 This function will decode a single bit and return the result in an OSBOOL value.
EXTERNRT int rtxDecBits (OSCTXT *pctxt, OSUINT32 *pvalue, OSSIZE nbits)
 This function decodes up to sizeof(unsigned) bits and returns the result in an unsigned integer value.
EXTERNRT int rtxDecBitsToByte (OSCTXT *pctxt, OSUINT8 *pvalue, OSUINT8 nbits)
 This function decodes bits and returns the result in a byte (octet) value.
EXTERNRT int rtxDecBitsToUInt16 (OSCTXT *pctxt, OSUINT16 *pvalue, OSUINT8 nbits)
 This function decodes bits and returns the result in an unsigned 16-bit (short) value.
EXTERNRT int rtxDecBitsToByteArray (OSCTXT *pctxt, OSOCTET *pbuffer, OSSIZE bufsiz, OSSIZE nbits)
 This function decodes bits and returns the result in an octet array.
EXTERNRT int rtxPeekBit (OSCTXT *pctxt, OSBOOL *pvalue)
 This function decodes the bit at the current position and the resets the bit cursor back to the original position.
EXTERNRT int rtxSkipBits (OSCTXT *pctxt, OSSIZE nbits)
 This function skips the given number of bits.

Detailed Description

Bit decode functions.

Definition in file rtxBitDecode.h.


Function Documentation

EXTERNRT int rtxDecBit ( OSCTXT pctxt,
OSBOOL *  pvalue 
)

This function will decode a single bit and return the result in an OSBOOL value.

Parameters:
pctxt A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pvalue A pointer to the BOOLEAN value to receive the decoded result. A null pointer value may be passed to skip the bit.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
EXTERNRT int rtxDecBits ( OSCTXT pctxt,
OSUINT32 *  pvalue,
OSSIZE  nbits 
)

This function decodes up to sizeof(unsigned) bits and returns the result in an unsigned integer value.

Parameters:
pctxt Pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pvalue Pointer to value to be receive decoded result.
nbits Number of bits to read from decode buffer.
Returns:
Status of the operation. Zero if successful; a negative status code if failed.
EXTERNRT int rtxDecBitsToByte ( OSCTXT pctxt,
OSUINT8 *  pvalue,
OSUINT8  nbits 
)

This function decodes bits and returns the result in a byte (octet) value.

Bits are shifted to the right in the decode byte to remove unused bits. For example, if a single bit is decoded from octet 0x80, the decoded byte value will be 1.

Parameters:
pctxt Pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pvalue Pointer to byte value to receive decoded data.
nbits Number of bits to read from decode buffer. The maximum that can be read is eight.
Returns:
Status of the operation. Zero if successful; a negative status code if failed.
EXTERNRT int rtxDecBitsToByteArray ( OSCTXT pctxt,
OSOCTET *  pbuffer,
OSSIZE  bufsiz,
OSSIZE  nbits 
)

This function decodes bits and returns the result in an octet array.

Parameters:
pctxt Pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pbuffer Address of buffer to receive decoded binary data.
bufsiz Size of output buffer.
nbits Number of bits to read from decode buffer.
Returns:
Status of the operation. Zero if successful; a negative status code if failed.
EXTERNRT int rtxDecBitsToUInt16 ( OSCTXT pctxt,
OSUINT16 *  pvalue,
OSUINT8  nbits 
)

This function decodes bits and returns the result in an unsigned 16-bit (short) value.

Bits are shifted to the right in the decode byte to remove unused bits. For example, if a single bit is decoded from octet 0x80, the decoded byte value will be 1.

Parameters:
pctxt Pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pvalue Pointer to byte value to receive decoded data.
nbits Number of bits to read from decode buffer. The maximum that can be read is sixteen.
Returns:
Status of the operation. Zero if successful; a negative status code if failed.
EXTERNRT int rtxPeekBit ( OSCTXT pctxt,
OSBOOL *  pvalue 
)

This function decodes the bit at the current position and the resets the bit cursor back to the original position.

Parameters:
pctxt A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pvalue A pointer to the BOOLEAN value to receive the decoded result. A null pointer value may be passed to skip the bit.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
EXTERNRT int rtxSkipBits ( OSCTXT pctxt,
OSSIZE  nbits 
)

This function skips the given number of bits.

Parameters:
pctxt Pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
nbits Number of bits to skip.
Returns:
Status of the operation. Zero if successful; a negative status code if failed.