XBinder  Version 2.6.x
Functions
Telephony Binary Coded Decimal (TBCD) Helper Functions

Telephony Binary Coded Decimal (TBCD) helper functions provide assistance in converting TBCD strings to and from binary form as document in standard ITU-T Q.825. More...

Functions

EXTERNRT int rtxQ825TBCDToString (OSSIZE numocts, const OSOCTET *data, char *buffer, OSSIZE bufsiz)
 This function converts a Q.825 TBCD value to a standard null-terminated string. More...
 
EXTERNRT int rtxDecQ825TBCDString (OSCTXT *pctxt, OSSIZE numocts, char *buffer, OSSIZE bufsiz)
 This function decodes a Q.825 TBCD value to a standard null-terminated string. More...
 
EXTERNRT int rtxEncQ825TBCDString (OSCTXT *pctxt, const char *str)
 This function encodes a null-terminated string Q.825 TBCD string. More...
 
EXTERNRT int rtxTBCDBinToChar (OSUINT8 bcdDigit, char *pdigit)
 This function converts a TBCD binary character into its ASCII equivalent. More...
 
EXTERNRT int rtxTBCDCharToBin (char digit, OSUINT8 *pbyte)
 This function converts a TBCD character ('0'-'9',"*#abc") into its binary equivalent. More...
 

Detailed Description

Telephony Binary Coded Decimal (TBCD) helper functions provide assistance in converting TBCD strings to and from binary form as document in standard ITU-T Q.825.

Function Documentation

◆ rtxDecQ825TBCDString()

EXTERNRT int rtxDecQ825TBCDString ( OSCTXT pctxt,
OSSIZE  numocts,
char *  buffer,
OSSIZE  bufsiz 
)

This function decodes a Q.825 TBCD value to a standard null-terminated string.

TBCD digits are read from the decode buffer/stream and converted to their character equivalents. See 'rtQ825TBCDToString' for a description of the Q.825 TBCD format.

Parameters
pctxtPointer to a context structure block.
numoctsThe number of octets in the BCD value to be read from input stream.
bufferThe destination buffer. Should not be less than bufsiz argument is.
bufsizThe size of the destination buffer (in octets). The buffer size should be at least ((numocts * 2) + 1) to hold the BCD to String conversion.
Returns
Status of conversion: 0 = success, negative = error.
Since
6.6

◆ rtxEncQ825TBCDString()

EXTERNRT int rtxEncQ825TBCDString ( OSCTXT pctxt,
const char *  str 
)

This function encodes a null-terminated string Q.825 TBCD string.

TBCD digits are converted and written to the encode buffer/stream. See 'rtQ825TBCDToString' for a description of the Q.825 TBCD format.

Parameters
pctxtPointer to a context structure block.
strNull-terminate string to be encoded. This string may only contain valid Q.825 TBCD characters.
Returns
Status of operation: 0 = success, negative = error.
Since
6.6

◆ rtxQ825TBCDToString()

EXTERNRT int rtxQ825TBCDToString ( OSSIZE  numocts,
const OSOCTET *  data,
char *  buffer,
OSSIZE  bufsiz 
)

This function converts a Q.825 TBCD value to a standard null-terminated string.

Octet values can contain the filler digit to represent the odd number of BCD digits.

The encoding is as follows per Q.825:

This type (Telephony Binary Coded Decimal String) is used to represent digits from 0 through 9, *, #, a, b, c, two digits per octet, each digit encoded 0000 to 1001 (0 to 9), 1010 (*) 1011(#), 1100 (a), 1101 (b) or 1110 (c); 1111 (end of pulsing signal-ST); 0000 is used as a filler when there is an odd number of digits.

Parameters
numoctsThe number of octets in the BCD value.
dataThe pointer to the BCD value.
bufferThe destination buffer. Should not be less than bufsiz argument is.
bufsizThe size of the destination buffer (in octets). The buffer size should be at least ((numocts * 2) + 1) to hold the BCD to String conversion.
Returns
Status of conversion: 0 = success, negative = error.
Since
6.6

◆ rtxTBCDBinToChar()

EXTERNRT int rtxTBCDBinToChar ( OSUINT8  bcdDigit,
char *  pdigit 
)

This function converts a TBCD binary character into its ASCII equivalent.

Parameters
tbcdDigitTBCD digit
pdigitPointer to character to receive converted character
Returns
0 if conversion successful, or negative error code
Since
6.6

◆ rtxTBCDCharToBin()

EXTERNRT int rtxTBCDCharToBin ( char  digit,
OSUINT8 *  pbyte 
)

This function converts a TBCD character ('0'-'9',"*#abc") into its binary equivalent.

Parameters
digitTBCD digit character ('0'-'9',"*#abc")
pbytePointer to byte to receive binary result.
Returns
0 if conversion successful, or negative error code
Since
6.6