AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | List of all members
alexaClientSDK::mediaPlayer::android::test::MockAttachmentReader Class Reference

This class mocks an attachment reader that reads from the INPUT_CSTR. More...

Inheritance diagram for alexaClientSDK::mediaPlayer::android::test::MockAttachmentReader:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::mediaPlayer::android::test::MockAttachmentReader:
Collaboration graph
[legend]

Public Member Functions

 MOCK_METHOD1 (seek, bool(uint64_t offset))
 
 MOCK_CONST_METHOD0 (tell, uint64_t())
 
 MOCK_METHOD0 (getNumUnreadBytes, uint64_t())
 
 MOCK_METHOD1 (close, void(ClosePoint closePoint))
 
size_t read (void *buf, std::size_t numBytes, AttachmentReader::ReadStatus *readStatus, std::chrono::milliseconds timeoutMs)
 
 MockAttachmentReader (const unsigned char *input, size_t length, ssize_t timeoutIteration=-1)
 
 MOCK_METHOD1 (seek, bool(uint64_t offset))
 
 MOCK_CONST_METHOD0 (tell, uint64_t())
 
 MOCK_METHOD0 (getNumUnreadBytes, uint64_t())
 
 MOCK_METHOD1 (close, void(ClosePoint closePoint))
 
size_t read (void *buf, std::size_t numBytes, AttachmentReader::ReadStatus *readStatus, std::chrono::milliseconds timeoutMs)
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::avs::attachment::AttachmentReader
virtual ~AttachmentReader ()=default
 
virtual bool seek (uint64_t offset)=0
 
virtual uint64_t getNumUnreadBytes ()=0
 
virtual void close (ClosePoint closePoint=ClosePoint::AFTER_DRAINING_CURRENT_BUFFER)=0
 

Additional Inherited Members

- Public Types inherited from alexaClientSDK::avsCommon::avs::attachment::AttachmentReader
enum  ReadStatus {
  ReadStatus::OK, ReadStatus::OK_WOULDBLOCK, ReadStatus::OK_TIMEDOUT, ReadStatus::OK_OVERRUN_RESET,
  ReadStatus::CLOSED, ReadStatus::ERROR_OVERRUN, ReadStatus::ERROR_BYTES_LESS_THAN_WORD_SIZE, ReadStatus::ERROR_INTERNAL
}
 
enum  ClosePoint { ClosePoint::IMMEDIATELY, ClosePoint::AFTER_DRAINING_CURRENT_BUFFER }
 An enum class to indicate when the read() function should stop returning data after a call to close(). More...
 

Detailed Description

This class mocks an attachment reader that reads from the INPUT_CSTR.

Constructor & Destructor Documentation

◆ MockAttachmentReader()

alexaClientSDK::mediaPlayer::android::test::MockAttachmentReader::MockAttachmentReader ( const unsigned char *  input,
size_t  length,
ssize_t  timeoutIteration = -1 
)

MockAttachmentReader constructor.

Parameters
inputThe buffer that holds the input data.
lengthThe input buffer length.
timeoutIterationOptional iteration that should trigger a timeout response.

Member Function Documentation

◆ MOCK_CONST_METHOD0() [1/2]

alexaClientSDK::mediaPlayer::android::test::MockAttachmentReader::MOCK_CONST_METHOD0 ( tell  ,
uint64_t()   
)

◆ MOCK_CONST_METHOD0() [2/2]

alexaClientSDK::mediaPlayer::android::test::MockAttachmentReader::MOCK_CONST_METHOD0 ( tell  ,
uint64_t()   
)

◆ MOCK_METHOD0() [1/2]

alexaClientSDK::mediaPlayer::android::test::MockAttachmentReader::MOCK_METHOD0 ( getNumUnreadBytes  ,
uint64_t()   
)

◆ MOCK_METHOD0() [2/2]

alexaClientSDK::mediaPlayer::android::test::MockAttachmentReader::MOCK_METHOD0 ( getNumUnreadBytes  ,
uint64_t()   
)

◆ MOCK_METHOD1() [1/4]

alexaClientSDK::mediaPlayer::android::test::MockAttachmentReader::MOCK_METHOD1 ( seek  ,
bool(uint64_t offset)   
)

◆ MOCK_METHOD1() [2/4]

alexaClientSDK::mediaPlayer::android::test::MockAttachmentReader::MOCK_METHOD1 ( close  ,
void(ClosePoint closePoint)   
)

◆ MOCK_METHOD1() [3/4]

alexaClientSDK::mediaPlayer::android::test::MockAttachmentReader::MOCK_METHOD1 ( seek  ,
bool(uint64_t offset)   
)

◆ MOCK_METHOD1() [4/4]

alexaClientSDK::mediaPlayer::android::test::MockAttachmentReader::MOCK_METHOD1 ( close  ,
void(ClosePoint closePoint)   
)

◆ read() [1/2]

size_t alexaClientSDK::mediaPlayer::android::test::MockAttachmentReader::read ( void *  buf,
std::size_t  numBytes,
AttachmentReader::ReadStatus readStatus,
std::chrono::milliseconds  timeoutMs 
)
virtual

The read function.

Parameters
bufThe buffer where data should be copied to.
numBytesThe size of the buffer in bytes.
[out]readStatusThe out-parameter where the resulting state of the read will be expressed.
timeoutMsThe timeout for this read call in milliseconds. This value is only used for the BLOCKING reader policy. If this parameter is zero, there is no timeout and blocking reads will wait forever.
Returns
The number of bytes read as a result of this call.

Implements alexaClientSDK::avsCommon::avs::attachment::AttachmentReader.

◆ read() [2/2]

size_t alexaClientSDK::mediaPlayer::android::test::MockAttachmentReader::read ( void *  buf,
std::size_t  numBytes,
AttachmentReader::ReadStatus readStatus,
std::chrono::milliseconds  timeoutMs 
)
virtual

Method that simulates files reading.

Parameters
bufThe buffer to read into.
numBytesThe number of bytes to read.
readStatus[out]The status from the last read.
timeoutMsThe timeout used for the read operation.
Returns
The number of bytes read.

Implements alexaClientSDK::avsCommon::avs::attachment::AttachmentReader.


The documentation for this class was generated from the following files:

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0