PreviousNext
DpaApiRfTxDpaPacketCoordinator
Help > Custom DPA Handler > DPA API > DpaApiRfTxDpaPacketCoordinator

uns8 DpaApiRfTxDpaPacketCoordinator()

 

Available at [C] devices only. This function is specially prepared for sending DPA Requests from [C] to the [N] devices in its network. It prepares even more of the requested parameters automatically compared to the DpaApiRfTxDpaPacket function. Last but not least it also takes care of waiting to send another DPA Request until the routing of the previously sent (and received) packet is finished thus minimizing the probability of the network collision. The call initializes NetDepth by value 1.

The function returns the number of hops used to deliver the DPA Request from the addressed device back to the [C]. The number of hops used to deliver the DPA Request to the addressee and slot length is available at IQRF OS variables RTHOPS and RTTSLOT respectively. Thus, the same information (Hops, Timeslot length, Hops Response) as within DPA Confirmation is available to the developer. See also Set Hops.

Calling DpaApiRfTxDpaPacketCoordinator is allowed only at Idle, AfterRouting, and IFaceReceive events.

 

Example

 

case DpaEvent_Idle:

 {

   // The following block of code demonstrates autonomous once per 60 s sending

   // of packets if the [C] is not connected to the interface master

   if ( IFaceMasterNotConnected && DpaTicks.15 != 0 )

   {

     // Setup new timer

     GIE = 0;

     DpaTicks = 60 * 100L;

     GIE = 1;

 

     // DPA Request is broadcasted

     _NADR = BROADCAST_ADDRESS;

     _NADRhigh = 0;

     // Use red LED

     _PNUM = PNUM_LEDR;

     // Make a LED pulse

     _PCMD = CMD_LED_PULSE;

     // HW profile ID

     _HWPID = HWPID_DoNotCheck;

     // This DPA Request has no data

     _DpaDataLength = 0;

     // Send the DPA Request

     DpaApiRfTxDpaPacketCoordinator();

   }

 

   return Carry;

 }

 

See example codes CustomDpaHandler-Coordinator-PulseLEDs.c for more details.