Receive

nn::ir::CTR::Communicator::Receive Member Function

Syntax

static Result Receive(
     void * pDst,
     size_t size,
     size_t * pReceiveSize,
     s32 * pRemainCount
);

Parameters

Name Description
out pDst Specifies the address of the receive buffer to which to copy the data. Must be aligned on a 4-byte boundary.
in size Specifies the receive buffer size.
Note: This buffer must be larger than the size of data actually being received.
out pReceiveSize Stores the size of the receive data.
out pRemainCount Stores the remaining number of receive packets.

Return Values

Returns the function's result. Returns one of the Result values listed below.

Value Description
Result::IsSuccess Process was successful.
ResultNotConnected Not in the connected state.
ResultCannotConfirm ID has not been confirmed.
ResultNoData There are no receive packets.
ResultBufferInsufficient The size of the buffer where data are being copied is not large enough.
ResultInvalidData Received invalid data.
ResultMachineSleep Sleeping because the system is in Sleep Mode.
ResultFatalError The IR module may be malfunctioning.

Description

Receives data.

Copies the user data portion of a received packet to the specified buffer. Data are copied in units of packets, so if multiple packets have been received you will need to make repeated calls to this function.

Since security information is appended to data before it is sent, the receiving process requires a buffer that is 48 to 53 bytes larger than the data size. The size of buffer required depends on the size of data sent. Calculate the value using the CalculateBufferSizeToCommunicate function. (Note that you do not use the GetPacketSize function.)
The receive buffer also must be aligned on a 4-byte boundary.

If the connection is dropped while there is still receive data to be processed, the remaining data can be received up until the start of the next connection process.

In order for this function to succeed, you must first confirm the ID using the RequireToConfirmId function or the WaitToConfirmId function.

Also note that if the passphrase specified by these functions differs from the passphrase configured by the communication partner, the two parties will not be able to establish communication. Data sending will succeed, but the receiving party will treat the received data as invalid data.

Even if you have received invalid data, until you execute this function you cannot run the process to determine that the data are invalid. If you have received any data, you must either run this function to conduct the receiving process, or run the DropNextReceiveData function to destroy the data.

Revision History

2011/08/30
Initial version.

CONFIDENTIAL