void DpaApiLocalRequest()
Performs a local DPA Request at the embedded peripheral, which is even not enabled in the TR Configuration. Of course, the peripheral must be implemented. After the function returns, a corresponding DPA Request is available except when the original DPA Request was a Batch. Calling DpaApiLocalRequest is allowed at Init, Idle, AfterRouting, BeforeSleep, AfterSleep, PeerToPeer, and DisabIeInterrupts events. It can be also called carefully inside the Reset event as during the event the device might not be bonded yet, the interface is not started, etc. When a processed DPA message is not destroyed or used later then the function can be carefully used at ReceiveDpaResponse, IFaceReceive, ReceiveDpaRequest, and BeforeSendingDpaResponse events too. To avoid reentrancy no Custom DPA Handler events (except Interrupt event) are called during local DPA Request processing. This is the reason why performing local DPA Request on custom peripherals do not work. Also, when e.g. Sleep request is executed locally, then events BeforeSleep and AfterSleep are not raised (same applies to e.g. Run RFPGM and Disable Interrupts event). As the DPA Request is executed locally there is no need to fill in _NADR, _NADRhigh, and _HWPID variables, see example below. Please note that this call invalidates the value obtained by GetDpaEvent() macro later in the current event handling.
Example
case DpaEvent_Idle:
if ( IsSleepTime )
{
IsSleepTime = FALSE;
// Prepare OS Sleep DPA Request
_PNUM = PNUM_OS;
_PCMD = CMD_OS_SLEEP;
_DpaMessage.PerOSSleep_Request.Time = 123;
_DpaMessage.PerOSSleep_Request.Control = 0b0010;
_DpaDataLength = sizeof( TPerOSSleep_Request );
// Perform local DPA Request
DpaApiLocalRequest();
// If no error, pulse the LEDR after wake up
if ( _PNUM != PNUM_ERROR_FLAG )
pulseLEDR();
}
return Carry;
☼ See example code CustomDpaHandler-Coordinator-FRCandSleep.c for more details.