Go to the source code of this file.
|
int32_t | le_hex_StringToBinary (const char *stringPtr, uint32_t stringLength, uint8_t *binaryPtr, uint32_t binarySize) |
|
int32_t | le_hex_BinaryToString (const uint8_t *binaryPtr, uint32_t binarySize, char *stringPtr, uint32_t stringSize) |
|
void | le_hex_Dump (char *asciiBufferPtr, size_t asciiBufferSize, char *binaryDataPtr, size_t binaryDataLen) |
|
int | le_hex_HexaToInteger (const char *stringPtr) |
|
Legato Hex string API include file.
Copyright (C) Sierra Wireless Inc.
◆ le_hex_StringToBinary()
int32_t le_hex_StringToBinary |
( |
const char * |
stringPtr, |
|
|
uint32_t |
stringLength, |
|
|
uint8_t * |
binaryPtr, |
|
|
uint32_t |
binarySize |
|
) |
| |
Convert a string of valid hexadecimal characters [0-9a-fA-F] into a byte array where each element of the byte array holds the value corresponding to a pair of hexadecimal characters.
- Returns
- number of bytes written into binaryPtr
- -1 if the binarySize is too small or stringLength is odd or stringPtr contains an invalid character
- Note
- The input string is not required to be NULL terminated.
- Parameters
-
[in] | stringPtr | string to convert |
[in] | stringLength | string length |
[out] | binaryPtr | binary result |
[in] | binarySize | size of the binary table. Must be >= stringLength / 2 |
◆ le_hex_BinaryToString()
int32_t le_hex_BinaryToString |
( |
const uint8_t * |
binaryPtr, |
|
|
uint32_t |
binarySize, |
|
|
char * |
stringPtr, |
|
|
uint32_t |
stringSize |
|
) |
| |
Convert a byte array into a string of uppercase hexadecimal characters.
- Returns
- number of characters written to stringPtr or -1 if stringSize is too small for binarySize
- Note
- the string written to stringPtr will be NULL terminated.
- Parameters
-
[in] | binaryPtr | binary array to convert |
[in] | binarySize | size of binary array |
[out] | stringPtr | hex string array, terminated with '\0'. |
[in] | stringSize | size of string array. Must be >= (2 * binarySize) + 1 |
◆ le_hex_Dump()
void le_hex_Dump |
( |
char * |
asciiBufferPtr, |
|
|
size_t |
asciiBufferSize, |
|
|
char * |
binaryDataPtr, |
|
|
size_t |
binaryDataLen |
|
) |
| |
Function that takes binary data and creates 'hex dump' that is stored into user provided ASCII buffer and is null terminated Total length of one line will be 74 characters: 9 + (16 * 3) + 17 0x000000: 2e 2f 68 65 78 64 75 6d 0 00 53 53 48 5f 41 47 ./hexdump.SSH_AG
◆ le_hex_HexaToInteger()
int le_hex_HexaToInteger |
( |
const char * |
stringPtr | ) |
|
Convert a NULL terminated string of valid hexadecimal characters [0-9a-fA-F] into an integer.
- Returns
- Positive integer corresponding to the hexadecimal input string
- -1 if the input contains an invalid character or the value will not fit in an integer
- Parameters
-
[in] | stringPtr | string of hex chars to convert into an int |