PreviousNext
DpaApiMenu
Help > Custom DPA Handler > DPA API > DpaApiMenu

uns8 DpaApiMenu ( uns8 menu, uns8 flags )

 

Available only at TR-7xG [N]. The function is used when handling Beaming DPA Menu. The function should be periodically called in the beaming function to catch opening Beaming DPA Menu by pressed button. The return value is selected menu&menuItem from the menu. The parameter  menu must be DMENU_Beaming.  The parameter flags is used to customize the menu content by ORing predefined constants:

 

Enabling menu items:

         DMENU_Item_Implemented_User1

         DMENU_Item_Implemented_User2

         DMENU_Item_Implemented_GoBeaming

 

Adding confirmation to menu items:

         DMENU_Item_Confirm_User1

         DMENU_Item_Confirm_User2

 

Disabling menu items:

         DMENU_Item_Unimplemented_GoStandby

         DMENU_Item_Unimplemented_UnbondAndRestart

         DMENU_Item_Unimplemented_UnbondFactorySettingsAndRestart

 

Example

 

case DpaEvent_Idle:

 

  if ( !startBeamingAtIdle )

    break;

 

  startBeamingAtIdle = FALSE;

 

  // Beaming loop

  FirstDpaApiSleep = TRUE;

  for ( ;; )

  {

    DoBeamingOncePerMinute();

 

    DpaApiSleep( WDTCON_1s );

 

    uns8 menuAndItem = DpaApiMenu( DMENU_Beaming, DMENU_Item_Implemented_User1 );

    switch ( menuAndItem )

    {

      case MakeDMenuAndItem( DMENU_Beaming, DMENU_Item_User1 ):

        DpaApiMenuIndicateResult( TRUE );

        ExecuteMyUser1MenuItem();

        break;

 

      case MakeDMenuAndItem( DMENU_Beaming, DMENU_Item_ConnectivityCheck ):

        // Stop beaming sleeps

        DpaApiAfterSleep();

        // Voluntary indication of the connectivity check execution

        pulsingLEDR();

        // Repeaters to test

        clearBufferINFO();

        bufferINFO[ 0 / 8 ] = 0b1111.1110;   // 1...7

        // Do the test and result indication

        DpaApiMenuIndicateResult( DpaApiLocalFrc( FRC_Ping, TX_POWER_MAX ) );

        // Continue regular beaming sleeps

        FirstDpaApiSleep = TRUE;

        break;

 

      default:

        // Stop beaming sleeps

        DpaApiAfterSleep();

        // Execute menu

        DpaApiMenuExecute( menuAndItem );

        // Continue regular beaming sleeps

        FirstDpaApiSleep = TRUE;

        break;

 

      case MakeDMenuAndItem( DMENU_Beaming, DMENU_Item_None ):

        // No menu item was selected

        break;

    }

  }

 

break;

 

See example CustomDpaHandler-DpaMenu for more details.