⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmisounds.c

📁 GSM手机设计软件代码
💻 C
📖 第 1 页 / 共 4 页
字号:

/*******************************************************************************

 $Function:     resource_GetListCount

 $Description:  Returns the number of entries in resource table.

 $Returns:    Number of entries in Melody table.

 $Arguments:  res - Resource Id.

*******************************************************************************/
int resource_GetListCount(res_ResourceID_type res)
  // Returns the number of the resource type available in the phone.
{
  int index=0;
  switch (res)
  {
    case RES_MELODY:
      while(MelodyTable[index] !=0)
        index++;
      return index;
      break;

    case RES_LANGUAGE:

      break;
    case RES_STRING:

      break;
    default:

      break;

  }
  return index;
}

/*******************************************************************************

 $Function:     buildOnOffMenu

 $Description:  builds an on/off menu and associates it with a context

 $Returns:    None

 $Arguments:  count, number of elements in menu
        id3, prompt string
        active, context into which the menu should be associated

*******************************************************************************/

static void buildOnOffMenu( int count, int id3, int active )
{
}

/*******************************************************************************

 $Function:     buildVolumeMenu

 $Description:  builds the volume menu and associates it with the volume
        context

 $Returns:    None

 $Arguments:  volume, the context to be associated with

*******************************************************************************/

static void buildVolumeMenu( VOL_ENUM volume )
{
}

/*******************************************************************************

 $Function:     displayDynaMenu

 $Description:  show one page of the ringer list, determined by item.

 $Returns:    None

 $Arguments:  None

*******************************************************************************/

static void displayDynamenu( void )
{

}

/*******************************************************************************

 $Function:     displayRingerVolume

 $Description:  shows the volume setting determined by cVolume

 $Returns:    None

 $Arguments:  None

*******************************************************************************/

static void displayRingerVolume( void )
{
}

/*******************************************************************************

 $Function:     displayOnOffList

 $Description:  show the On Off (3rd) list, determined by item.

 $Returns:    None

 $Arguments:  None

*******************************************************************************/

static void displayOnOffList( void )
{
}
/*******************************************************************************

 $Function:     buildLanguageMenu

 $Description:  builds the dynamenu for the RES_LANGUAGE resource type

 $Returns:    None

 $Arguments:  None

*******************************************************************************/

static void buildLanguageMenu(void)
{

}

/*******************************************************************************

 $Function:     delayThenPlayMelody

 $Description:  play selected ringer melody after short delay

 $Returns:    None

 $Arguments:  None

*******************************************************************************/

static void delayThenPlayMelody( void )
{

  /* start timer for half a second and on timeout start everlasting play
  */
  timStart( hRingerStartTimer );
}

/*******************************************************************************

 $Function:     playCurrentSound

 $Description:  play tune which is temporarily selected, this event handler
        is invoked when the hRingerStartTimer event completes

 $Returns:    MFW_EVENT_CONSUMED always

 $Arguments:  e, event, tc timer context

*******************************************************************************/

static int playCurrentSound( MfwEvt e, MfwTim *tc )
{
  soundsPlayRinger(current.ringer);

  // stop running timer (One shot mode only)
  if (hRingerStartTimer != NULL ) {
    timStop(hRingerStartTimer);
  }

    return MFW_EVENT_CONSUMED;
}


/*******************************************************************************

 $Function:     setSelection

 $Description:  reactivates calling menu after confirming setting

 $Returns:    MFW_EVENT_PASSED always

 $Arguments:  e, event, m, window handle

*******************************************************************************/

static int setSelection( MfwEvt e, MfwWin *m )
{
  int UpdatePCM = 0;
  int SoundToPlay = -1;

  TRACE_FUNCTION("setSelection");

  /* This implements a state machine, the next setting depends
     on the reason we have been invoked

     Note the following is still pending implementation
     USSD TONE, SVC TONE, MANPLMN TONE
  */
  switch (soundReason)
  {
    case MelodySelect:
    {
    }
    break;

    case SettingVolume:
    {
    }
    break;

    default:
    {
      /* No action required
      */
    }
    break;
  }


  /* redisplay sub menu showing changed position of active marker.
  */
  winShow( win );

  return MFW_EVENT_PASSED;
}







/*******************************************************************************

 $Function:     writeSettingsToPCM

 $Description:  writes contents of global vars of sounds to PCM or
          sets default values

 $Returns:    None

 $Arguments:  flush, dictates whether or not flushing should be
        performed on the write operation

*******************************************************************************/
static void writeSettingsToPCM( U8 flush )
{
}
/*******************************************************************************

 $Function:     readSettingsFromPCM

 $Description:  inits global vars of sounds from PCM or
          sets default values

 $Returns:    None

 $Arguments:  None

*******************************************************************************/

static void readSettingsFromPCM(void)
{
}

/*******************************************************************************

 $Function:     soundsCreate

 $Description:  Create a sounds context, with a window, keyboards, timers
        etc.

 $Returns:    None

 $Arguments:  parent, handle of the parent window

*******************************************************************************/

static void soundsCreate(MfwHnd parent)
{

}


/*******************************************************************************

 $Function:     soundsDestroy

 $Description:  cleans up a context

 $Returns:    None

 $Arguments:  None

*******************************************************************************/

static void soundsDestroy(void)
{

}


/*******************************************************************************

 $Function:     getCallingMenu

 $Description:  handles transition to calling menu
          a) on timeout,
          b) during running timer when Clear, SoftKeyLeft
             or SoftKeyRight is pressed

 $Returns:    MFW_EVENT_PASSED

 $Arguments:  e, event, tc, timer context

*******************************************************************************/

static int getCallingMenu(MfwEvt e, MfwTim *tc)
{
  TRACE_FUNCTION( "BACK to invocating Menu" );

  return 0;
}

/*******************************************************************************

 $Function:     winEvent

 $Description:  window event handler, only deals with the win visible
        event, all others are ignored

 $Returns:    MFW_EVENT_PASSED or MFW_EVENT_CONSUMED depending on the
        event

 $Arguments:  e, event, w, window handle

*******************************************************************************/

static int winEvent (MfwEvt e, MfwWin *w)
{
    return MFW_EVENT_CONSUMED;
}


/*******************************************************************************

 $Function:     keyEventLong

 $Description:  keyboard event handler Long press

 $Returns:    MFW_EVENT_PASSED or MFW_EVENT_CONSUMED depending on the
        event

 $Arguments:  e, event, k, keyboard handle

*******************************************************************************/

static int keyEventLong (MfwEvt e, MfwKbd *k)
{
    PTRACE( sprintf( buf, "keycode in SOUND keyEvtLong %d", (int) k->code ); )
  PTRACE( sprintf( buf, "mfwEvt in SOUND Long 0x%10x", e ); )


  return MFW_EVENT_PASSED; /* give other handlers a chance */
}

/*******************************************************************************

 $Function:     keyEvent

 $Description:  keyboard event handler

 $Returns:    MFW_EVENT_PASSED or MFW_EVENT_CONSUMED depending on the
        event

 $Arguments:  e, event, k, keyboard handle

*******************************************************************************/

static int keyEvent (MfwEvt e, MfwKbd *k)
{

    PTRACE( sprintf( buf, "keycode in SOUND keyEvt %d", (int) k->code ); )
  PTRACE( sprintf( buf, "mfwEvt in SOUND 0x%10x", e ); )

  return MFW_EVENT_CONSUMED;
}

/*******************************************************************************

 $Function:     stepVibrator

 $Description:  Changes the state of the vibrator from vibrating to
                not vibrating and then restarts the vibration timer

 $Returns:    None

 $Arguments:  None

*******************************************************************************/

static void stepVibrator( void )
{
  TRACE_FUNCTION("Vibrator Ringing");

}

/*******************************************************************************

 $Function:     ringVibrator

 $Description:  generates the ringing vibrations as configured

 $Returns:    New setting of the vibrator counter

 $Arguments:  c, pointer to a vibrator counter

*******************************************************************************/

static int ringVibrator( UBYTE *c )
{
  return 0;
}


/*******************************************************************************

 $Function:     VibratorTimerEvent

 $Description:  Vibrator timer event

 $Returns:    Event consumed, always

 $Arguments:  e, event, t, timer

*******************************************************************************/

static int VibratorTimerEvent ( MfwEvt e, MfwTim *t )
{

  return MFW_EVENT_CONSUMED;
}

/*******************************************************************************

 $Function:     volumeSettingTimeOut

 $Description:  The Ringer volume settings time out has occured and used has not selected
        a volume setting.

 $Returns:    MFW_EVENT_CONSUMED always

 $Arguments:  e, event, tc timer context

*******************************************************************************/
static int volumeSettingTimeOut( MfwEvt e, MfwTim *tc )
{
  T_MFW_HND win = mfw_parent(mfw_header());
  T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
  T_idle * idle_data = (T_idle *)win_data->user;

  TRACE_EVENT(">>>> volumeSettingTimeOut(), Vol Setiing Time out. ");

  // stop running timer.
  if (hRingerVolSettingTimeOut != NULL ) {
    timStop(hRingerVolSettingTimeOut);
  }

    if(call_data.win_menu !=NULL && (call_data.call_direction == INCOMING))
  {
    bookMenuDestroy(call_data.win_menu);
    /*
      If volume settings dialog timed out while in the incoming call, allow the
      ringer to continue ringing. MZ 9/4/01
    */
    startPlayingMelody(getCurrentRingerSettings());

  }
  else if (idle_data->info_win != NULL )
  {
    bookMenuDestroy(idle_data->info_win);
  }

    return MFW_EVENT_CONSUMED;
}

/*******************************************************************************

                                Public Methods

*******************************************************************************/
/*******************************************************************************

 $Function:     restartVolSettingInactivityTimer

 $Description:  Restart the Volume settings timer.

 $Returns:    none

 $Arguments:  none

*******************************************************************************/
void restartVolSettingInactivityTimer(void)
{
  if ( hRingerVolSettingTimeOut != NULL )
    timStop( hRingerVolSettingTimeOut );

  timStart(hRingerVolSettingTimeOut);

}
/*******************************************************************************

 $Function:     stopRingerVolTimeOut

 $Description:  Stop the ringer volume settings timer.

 $Returns:    none

 $Arguments:  none

*******************************************************************************/
void stopRingerVolSettingInactivityTimer(void)
{

  if ( hRingerVolSettingTimeOut != NULL )
    timStop( hRingerVolSettingTimeOut );

}
/*******************************************************************************

 $Function:     startRingerVolumeSettingTimer

 $Description:  Create and start the ringer voulme inactivity timer.

 $Returns:    none

 $Arguments:  none

*******************************************************************************/
void startRingerVolSettingInactivityTimer(T_MFW_HND parent_win)
{
  T_MFW_HND win = mfw_parent(mfw_header());
  T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
  T_idle * idle_data = (T_idle *)win_data->user;

  TRACE_FUNCTION(">>>> startRingerVolSettingInactivityTime, Create and Start Vol timer ");
  //Create 4 second ringer delay timer.
  if(hRingerVolSettingTimeOut == NULL )
  {
    if(call_data.call_direction == INCOMING)
    {
      hRingerVolSettingTimeOut = timCreate(call_data.win, TIM4SECOND, (MfwCb)volumeSettingTimeOut);
    }
    else
    {
      hRingerVolSettingTimeOut = timCreate(idle_data->win, TIM4SECOND, (MfwCb)volumeSettingTimeOut);
    }
  }

  if ( hRingerVolSettingTimeOut != NULL )
    timStop( hRingerVolSettingTimeOut );

  timStart(hRingerVolSettingTimeOut);


}
/*******************************************************************************

 $Function:     soundsRinger

 $Description:  prepares Ringer setting screen

 $Returns:    MFW_EVENT_CONSUMED always

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -