PreviousNext
Reset
Help > Custom DPA Handler > Events > Reset

The event is called just after the module was reset. It can be used to handle bonding/unbonding of the  [N] devices. In this case, the code must return TRUE. If the [N] is not bonded the handler routine must not finish until the [N] is bonded. The code should also handle the setting of NodeWasBonded. See also Init event concerning the initialization options. An interrupt is enabled so the Interrupt event can be already called. [N] devices are set to the Node mode by calling setNodeMode IQRF OS function before this event is raised.

 

The Reset event is also once raised at the [C] device for the sake of same behavior of all device types. In this case, it is not used to do bonding or unbonding of course. The [C] devices are at non‑network mode because of the previous call of setNonetMode IQRF OS function.

 

Example

 

 case DpaEvent_Reset:

        if (!doCustomBonding)

             return FALSE;

 

        if ( amIBonded() )

        {

              if ( unBondCondition )

              {

                    removeBond();

                    setLEDR();

                    waitDelay( 100 );

                    stopLEDR();

              }

        }

        else

        {

        while ( !amIBonded() )

        {

              if ( bondRequestCondition )

             {

                            bondRequestAdvanced();

                    setWDToff();

             }

        }

 

        NodeWasBonded = TRUE;

        }

 

       return TRUE;

 

☼ See example code CustomDpaHandler-Bonding.c for more details.