1
0
mirror of https://github.com/cathery/sys-con.git synced 2024-07-01 01:38:44 +00:00

IUSBEndpoint::Write() now takes a const buffer

This commit is contained in:
cathery 2019-11-08 11:59:57 +03:00
parent 3509f2c223
commit 586f1b0914
3 changed files with 4 additions and 4 deletions

View File

@ -28,7 +28,7 @@ public:
virtual void Close() = 0;
//This will read from the inBuffer pointer for the specified size and write it to the endpoint.
virtual Status Write(void *inBuffer, size_t bufferSize) = 0;
virtual Status Write(const void *inBuffer, size_t bufferSize) = 0;
//This will read from the endpoint and put the data in the outBuffer pointer for the specified size.
virtual Status Read(void *outBuffer, size_t bufferSize) = 0;

View File

@ -22,7 +22,7 @@ public:
virtual void Close();
//buffer should point to the data array, and only the specified size will be read.
virtual Result Write(void *inBuffer, size_t bufferSize);
virtual Result Write(const void *inBuffer, size_t bufferSize);
//The data received will be put in the outBuffer array for the length of the specified size.
virtual Result Read(void *outBuffer, size_t bufferSize);

View File

@ -28,7 +28,7 @@ void SwitchUSBEndpoint::Close()
usbHsEpClose(&m_epSession);
}
Result SwitchUSBEndpoint::Write(void *inBuffer, size_t bufferSize)
Result SwitchUSBEndpoint::Write(const void *inBuffer, size_t bufferSize)
{
Result rc = -1;
if (m_buffer != nullptr)
@ -38,7 +38,7 @@ Result SwitchUSBEndpoint::Write(void *inBuffer, size_t bufferSize)
for (size_t byte = 0; byte != bufferSize; ++byte)
{
static_cast<uint8_t *>(m_buffer)[byte] = static_cast<uint8_t *>(inBuffer)[byte];
static_cast<uint8_t *>(m_buffer)[byte] = static_cast<const uint8_t *>(inBuffer)[byte];
}
rc = usbHsEpPostBuffer(&m_epSession, m_buffer, bufferSize, &transferredSize);