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. | |
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. | |
EXTERNRT int | rtxEncQ825TBCDString (OSCTXT *pctxt, const char *str) |
This function encodes a null-terminated string Q.825 TBCD string. | |
EXTERNRT int | rtxTBCDBinToChar (OSUINT8 bcdDigit, char *pdigit) |
This function converts a TBCD binary character into its ASCII equivalent. | |
EXTERNRT int | rtxTBCDCharToBin (char digit, OSUINT8 *pbyte) |
This function converts a TBCD character ('0'-'9',"*#abc") into its binary equivalent. |
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
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:
-
pctxt Pointer to a context structure block. numocts The number of octets in the BCD value to be read from input stream. buffer The destination buffer. Should not be less than bufsiz argument is. bufsiz The 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
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:
-
pctxt Pointer to a context structure block. str Null-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
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:
-
numocts The number of octets in the BCD value. data The pointer to the BCD value. buffer The destination buffer. Should not be less than bufsiz argument is. bufsiz The 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
EXTERNRT int rtxTBCDBinToChar | ( | OSUINT8 | bcdDigit, | |
char * | pdigit | |||
) |
This function converts a TBCD binary character into its ASCII equivalent.
- Parameters:
-
tbcdDigit TBCD digit pdigit Pointer to character to receive converted character
- Returns:
- 0 if conversion successful, or negative error code
- Since:
- 6.6
EXTERNRT int rtxTBCDCharToBin | ( | char | digit, | |
OSUINT8 * | pbyte | |||
) |
This function converts a TBCD character ('0'-'9',"*#abc") into its binary equivalent.
- Parameters:
-
digit TBCD digit character ('0'-'9',"*#abc") pbyte Pointer to byte to receive binary result.
- Returns:
- 0 if conversion successful, or negative error code
- Since:
- 6.6