AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
Classes | |
struct | AudioFormat |
class | DeviceInfo |
struct | Dummy |
class | EndianTest |
class | GuardedValue |
class | HTTPContent |
class | MacAddressString |
class | Metrics |
class | Optional |
class | PromiseFuturePair |
class | PromiseFuturePair< void > |
struct | ReferenceCounter |
class | RequiresShutdown |
class | RetryTimer |
struct | StructWithoutDefaultConstructor |
class | TestableAttachmentManager |
class | TestableAttachmentWriter |
class | TestableMessageObserver |
class | TestMimeAttachmentPart |
class | TestMimeJsonPart |
class | TestMimePart |
struct | TypeIndex |
class | WaitEvent |
struct | WavHeader |
Typedefs | |
using | ByteVector = std::vector< unsigned char > |
using | SDSType = avsCommon::utils::sds::InProcessSDS |
using | SDSBufferType = avsCommon::utils::sds::InProcessSDSTraits::Buffer |
Enumerations | |
enum | MediaType { MediaType::MPEG, MediaType::WAV, MediaType::UNKNOWN } |
Functions | |
std::ostream & | operator<< (std::ostream &stream, const AudioFormat::Encoding &encoding) |
std::ostream & | operator<< (std::ostream &stream, const AudioFormat::Endianness &endianness) |
static std::shared_ptr< std::mutex > | getCoutMutex () |
bool | littleEndianMachine () |
Function used to check the machine endianness. More... | |
uint16_t | swapEndian (uint16_t input) |
uint32_t | swapEndian (uint32_t input) |
MediaType | MimeTypeToMediaType (const std::string &mimetype) |
std::ostream & | operator<< (std::ostream &stream, const MediaType &mediatype) |
template<typename Type > | |
TypeIndex | getTypeIndex () |
template<typename Type > | |
void | logTypeIndex (const std::string &name) |
ByteVector | generateWavHeader (unsigned int bytesPerSample, unsigned int channels, unsigned int rate, std::chrono::milliseconds totalDuration, bool isPCM=true) |
bool | readWAVFile (const std::string &absoluteFilePath, std::vector< uint16_t > *audioBuffer, WavHeader &wavHeader, bool isPCM=true) |
std::string | createRandomAlphabetString (int stringSize) |
int | generateRandomNumber (int min, int max) |
std::string | constructTestMimeString (const std::vector< std::shared_ptr< TestMimePart >> &mimeParts, const std::string &boundaryString, bool addPrependedNewline=true) |
TEST (OptionalTest, test_createEmptyOptional) | |
TEST (OptionalTest, test_createOptionalWithValue) | |
TEST (OptionalTest, test_getValueOfOptionalWithValue) | |
TEST (OptionalTest, test_getValueOfEmptyOptional) | |
TEST (OptionalTest, test_functionWithEmptyOptionalReturn) | |
TEST (OptionalTest, test_functionWithNonEmptyOptionalReturn) | |
TEST (OptionalTest, test_copyOptionalWithValue) | |
TEST (OptionalTest, test_copyEmptyOptional) | |
TEST (OptionalTest, test_setNewValueForEmptyOptional) | |
TEST (OptionalTest, test_setNewValueForNonEmptyOptional) | |
TEST (OptionalTest, test_resetEmptyOptional) | |
TEST (OptionalTest, test_resetNonEmptyOptional) | |
TEST (OptionalTest, test_optionalObjectWithoutDefaultConstructor) | |
TEST (OptionalTest, test_constructorCallsMatchDestructorCalls) | |
TEST (OptionalTest, test_equalityOperator) | |
TEST (OptionalTest, test_inequalityOperator) | |
TEST_F (EndianTest, test_SwapEndian16) | |
TEST_F (EndianTest, test_SwapEndian32) | |
Variables | |
const std::string | METRICS_TAG = ":METRICS:" |
constexpr const char * | ID_RIFF = "RIFF" |
constexpr const char * | ID_WAVE = "WAVE" |
constexpr const char * | ID_FMT = "fmt " |
constexpr const char * | ID_DATA = "data" |
constexpr uint32_t | PCM_SUBCHUNK_SZ = 16 |
constexpr uint16_t | FORMAT_PCM = 1 |
constexpr uint16_t | BITS_PER_BYTE = 8 |
constexpr uint16_t | PLAY_BITS_PER_SAMPLE = 16 |
constexpr uint16_t | FORMAT_IEEE_FLOAT = 3 |
constexpr uint32_t | FLOAT_SUBCHUNK_SZ = 18 |
constexpr uint32_t | FACT_CHUNK_SZ = 4 |
constexpr const char * | ID_FACT = "fact" |
constexpr unsigned int | PCM_HEADER_SIZE = 44 |
constexpr unsigned int | NON_PCM_HEADER_SIZE = 58 |
constexpr unsigned int | RIFF_ID_OFFSET = 0 |
constexpr unsigned int | RIFF_SZ_OFFSET = 4 |
constexpr unsigned int | RIFF_FMT_OFFSET = 8 |
constexpr unsigned int | FMT_ID_OFFSET = 12 |
constexpr unsigned int | FMT_SZ_OFFSET = 16 |
constexpr unsigned int | AUDIO_FORMAT_OFFSET = 20 |
constexpr unsigned int | NUM_CHANNELS_OFFSET = 22 |
constexpr unsigned int | SAMPLE_RATE_OFFSET = 24 |
constexpr unsigned int | BYTE_RATE_OFFSET = 28 |
constexpr unsigned int | BLOCK_ALIGN_OFFSET = 32 |
constexpr unsigned int | BITS_PER_SAMPLE_OFFSET = 34 |
constexpr unsigned int | DATA_ID_OFFSET = 36 |
constexpr unsigned int | DATA_SZ_OFFSET = 40 |
constexpr unsigned int | CB_SZ_OFFSET = 36 |
constexpr unsigned int | FACT_ID_OFFSET = 38 |
constexpr unsigned int | FACT_SZ_OFFSET = 42 |
constexpr unsigned int | FACT_SAMPLE_LEN_OFFSET = 46 |
constexpr unsigned int | NON_PCM_OFFSET = 14 |
static const std::string | MIME_NEWLINE = "\r\n" |
The newline characters that MIME parsers expect. More... | |
static const std::string | MIME_BOUNDARY_DASHES = "--" |
The double dashes which may occur before and after a boundary string. More... | |
static const std::string | MIME_JSON_PREFIX_STRING = "Content-Type: application/json; charset=UTF-8" |
The MIME text expected before a JSON part. More... | |
static const std::string | MIME_ATTACHMENT_PREFIX_STRING = "Content-Type: application/octet-stream" |
The MIME text expected before a binary data part. More... | |
static const std::string | MIME_CONTENT_ID_PREFIX_STRING = "Content-ID: " |
The MIME prefix for a content id header. More... | |
static const std::chrono::seconds | WAIT_FOR_DIRECTIVE_TIMEOUT_IN_SECONDS = std::chrono::seconds(1) |
Our default timeout when validating if a MIME part was received by another object. More... | |
static const int | DUMMY_SDS_BUFFER_SIZE = 100 |
A small value so we can create objects with a valid SDS (even if unused). More... | |
using alexaClientSDK::avsCommon::utils::ByteVector = typedef std::vector<unsigned char> |
using alexaClientSDK::avsCommon::utils::SDSBufferType = typedef avsCommon::utils::sds::InProcessSDSTraits::Buffer |
|
strong |
std::string alexaClientSDK::avsCommon::utils::constructTestMimeString | ( | const std::vector< std::shared_ptr< TestMimePart >> & | mimeParts, |
const std::string & | boundaryString, | ||
bool | addPrependedNewline = true |
||
) |
A utility function to generate a MIME string.
mimeParts | A vector of TestMimePart objects, which through polymorphism know how to generate their own substrings. |
boundaryString | The boundary string to be used when generating the MIME string. |
addPrependedNewline | true if a trailing newline (CRLF) sequence is required, false otherwise. |
std::string alexaClientSDK::avsCommon::utils::createRandomAlphabetString | ( | int | stringSize | ) |
Utility function to generate a random string of characters between 'a' - 'z'.
stringSize | The length of the string we will create. |
Convert the data into a std::string.
Convert the data into a std::string.
int alexaClientSDK::avsCommon::utils::generateRandomNumber | ( | int | min, |
int | max | ||
) |
Utility function to generate a random number. This function does not require seeding before use.
min | The minimum value in the desired distribution. |
max | The maximum value in the desired distribution. |
Identifier to tell if the random number generated has been initialized
Identifier to tell if the random number generated has been initialized
ByteVector alexaClientSDK::avsCommon::utils::generateWavHeader | ( | unsigned int | bytesPerSample, |
unsigned int | channels, | ||
unsigned int | rate, | ||
std::chrono::milliseconds | totalDuration, | ||
bool | isPCM = true |
||
) |
Generates a WAVE header.
bytesPerSample | The number of bytes per sample. |
channels | The number of channels in the audio data. |
rate | The sample rate of the audio data, in blocks per second. |
totalDuration | The total duration of the audio data. |
isPCM | Bool indicating if header to generate is PCM format or Non-PCM. |
|
inlinestatic |
Get the mutex used to serialize writing to cout
.
cout
.
|
inline |
|
inline |
Function used to check the machine endianness.
|
inline |
Utility function to log a name for a given type. This can be useful when TypeIndex<Type>::getName() does not return a string that is easy to correlate with C++ type names.
Type | The type to log |
name | The name ot log for the type. |
|
inline |
Convert a string file type to MediaType
value.
mimetype | The string representation of a file's mimetype. |
MediaType
value of file
|
inline |
Write an MediaType
value to an ostream
as a string.
stream | The stream to write the value to. |
mediatype | The MediaType value to write to the ostream as a string. |
ostream
that was passed in and written to.
|
inline |
Write an Encoding
value to an ostream
as a string.
stream | The stream to write the value to. |
encoding | The encoding value to write to the ostream as a string. |
ostream
that was passed in and written to.
|
inline |
Write an Endianness
value to an ostream
as a string.
stream | The stream to write the value to. |
endianness | The endianness value to write to the ostream as a string. |
ostream
that was passed in and written to. bool alexaClientSDK::avsCommon::utils::readWAVFile | ( | const std::string & | absoluteFilePath, |
std::vector< uint16_t > * | audioBuffer, | ||
WavHeader & | wavHeader, | ||
bool | isPCM = true |
||
) |
Reads a .wav file and seperates the audio data from the header data.
absoluteFilePath | The path to a file to retrieve the WAVE header from. |
audioBuffer | The pointer to the audioBuffer vector. |
wavHeader | The WavHeader. |
isPCM | Bool indicating if header to generate is PCM format or Non-PCM. |
|
inline |
|
inline |
alexaClientSDK::avsCommon::utils::TEST | ( | OptionalTest | , |
test_createEmptyOptional | |||
) |
alexaClientSDK::avsCommon::utils::TEST | ( | OptionalTest | , |
test_createOptionalWithValue | |||
) |
alexaClientSDK::avsCommon::utils::TEST | ( | OptionalTest | , |
test_getValueOfOptionalWithValue | |||
) |
alexaClientSDK::avsCommon::utils::TEST | ( | OptionalTest | , |
test_getValueOfEmptyOptional | |||
) |
alexaClientSDK::avsCommon::utils::TEST | ( | OptionalTest | , |
test_functionWithEmptyOptionalReturn | |||
) |
alexaClientSDK::avsCommon::utils::TEST | ( | OptionalTest | , |
test_functionWithNonEmptyOptionalReturn | |||
) |
alexaClientSDK::avsCommon::utils::TEST | ( | OptionalTest | , |
test_copyOptionalWithValue | |||
) |
alexaClientSDK::avsCommon::utils::TEST | ( | OptionalTest | , |
test_copyEmptyOptional | |||
) |
alexaClientSDK::avsCommon::utils::TEST | ( | OptionalTest | , |
test_setNewValueForEmptyOptional | |||
) |
alexaClientSDK::avsCommon::utils::TEST | ( | OptionalTest | , |
test_setNewValueForNonEmptyOptional | |||
) |
alexaClientSDK::avsCommon::utils::TEST | ( | OptionalTest | , |
test_resetEmptyOptional | |||
) |
alexaClientSDK::avsCommon::utils::TEST | ( | OptionalTest | , |
test_resetNonEmptyOptional | |||
) |
alexaClientSDK::avsCommon::utils::TEST | ( | OptionalTest | , |
test_optionalObjectWithoutDefaultConstructor | |||
) |
alexaClientSDK::avsCommon::utils::TEST | ( | OptionalTest | , |
test_constructorCallsMatchDestructorCalls | |||
) |
alexaClientSDK::avsCommon::utils::TEST | ( | OptionalTest | , |
test_equalityOperator | |||
) |
alexaClientSDK::avsCommon::utils::TEST | ( | OptionalTest | , |
test_inequalityOperator | |||
) |
alexaClientSDK::avsCommon::utils::TEST_F | ( | EndianTest | , |
test_SwapEndian16 | |||
) |
alexaClientSDK::avsCommon::utils::TEST_F | ( | EndianTest | , |
test_SwapEndian32 | |||
) |
constexpr unsigned int alexaClientSDK::avsCommon::utils::AUDIO_FORMAT_OFFSET = 20 |
constexpr uint16_t alexaClientSDK::avsCommon::utils::BITS_PER_BYTE = 8 |
constexpr unsigned int alexaClientSDK::avsCommon::utils::BITS_PER_SAMPLE_OFFSET = 34 |
constexpr unsigned int alexaClientSDK::avsCommon::utils::BLOCK_ALIGN_OFFSET = 32 |
constexpr unsigned int alexaClientSDK::avsCommon::utils::BYTE_RATE_OFFSET = 28 |
constexpr unsigned int alexaClientSDK::avsCommon::utils::CB_SZ_OFFSET = 36 |
constexpr unsigned int alexaClientSDK::avsCommon::utils::DATA_ID_OFFSET = 36 |
constexpr unsigned int alexaClientSDK::avsCommon::utils::DATA_SZ_OFFSET = 40 |
|
static |
A small value so we can create objects with a valid SDS (even if unused).
constexpr uint32_t alexaClientSDK::avsCommon::utils::FACT_CHUNK_SZ = 4 |
constexpr unsigned int alexaClientSDK::avsCommon::utils::FACT_ID_OFFSET = 38 |
constexpr unsigned int alexaClientSDK::avsCommon::utils::FACT_SAMPLE_LEN_OFFSET = 46 |
constexpr unsigned int alexaClientSDK::avsCommon::utils::FACT_SZ_OFFSET = 42 |
constexpr uint32_t alexaClientSDK::avsCommon::utils::FLOAT_SUBCHUNK_SZ = 18 |
constexpr unsigned int alexaClientSDK::avsCommon::utils::FMT_ID_OFFSET = 12 |
constexpr unsigned int alexaClientSDK::avsCommon::utils::FMT_SZ_OFFSET = 16 |
constexpr uint16_t alexaClientSDK::avsCommon::utils::FORMAT_IEEE_FLOAT = 3 |
constexpr uint16_t alexaClientSDK::avsCommon::utils::FORMAT_PCM = 1 |
constexpr const char* alexaClientSDK::avsCommon::utils::ID_DATA = "data" |
constexpr const char* alexaClientSDK::avsCommon::utils::ID_FACT = "fact" |
constexpr const char* alexaClientSDK::avsCommon::utils::ID_FMT = "fmt " |
constexpr const char* alexaClientSDK::avsCommon::utils::ID_RIFF = "RIFF" |
constexpr const char* alexaClientSDK::avsCommon::utils::ID_WAVE = "WAVE" |
const std::string alexaClientSDK::avsCommon::utils::METRICS_TAG = ":METRICS:" |
|
static |
The MIME text expected before a binary data part.
|
static |
The double dashes which may occur before and after a boundary string.
|
static |
The MIME prefix for a content id header.
|
static |
The MIME text expected before a JSON part.
|
static |
The newline characters that MIME parsers expect.
constexpr unsigned int alexaClientSDK::avsCommon::utils::NON_PCM_HEADER_SIZE = 58 |
constexpr unsigned int alexaClientSDK::avsCommon::utils::NON_PCM_OFFSET = 14 |
constexpr unsigned int alexaClientSDK::avsCommon::utils::NUM_CHANNELS_OFFSET = 22 |
constexpr unsigned int alexaClientSDK::avsCommon::utils::PCM_HEADER_SIZE = 44 |
constexpr uint32_t alexaClientSDK::avsCommon::utils::PCM_SUBCHUNK_SZ = 16 |
constexpr uint16_t alexaClientSDK::avsCommon::utils::PLAY_BITS_PER_SAMPLE = 16 |
constexpr unsigned int alexaClientSDK::avsCommon::utils::RIFF_FMT_OFFSET = 8 |
constexpr unsigned int alexaClientSDK::avsCommon::utils::RIFF_ID_OFFSET = 0 |
constexpr unsigned int alexaClientSDK::avsCommon::utils::RIFF_SZ_OFFSET = 4 |
constexpr unsigned int alexaClientSDK::avsCommon::utils::SAMPLE_RATE_OFFSET = 24 |
|
static |
Our default timeout when validating if a MIME part was received by another object.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0