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

📄 smi_ui.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 5 页
字号:
        ui_data->timerMod = TIMER_MOD_NIBT;
        ui_data->nibtOn   = TRUE;
        break;

      case (NIBT_BUSY):
        wm_areaWrite (areaCaller, 0, 0, "NIBT_BUSY");
#if defined (NEW_FRAME)
        TIMERSTART (TNIBT_VALUE, SMI_TUNIVERSAL);
        t_universal_running = TRUE;
#else
        TIMERSTART (TNIBT_VALUE, t_universal_handle);
#endif
        ui_data->timerMod = TIMER_MOD_NIBT;
        ui_data->nibtOn   = TRUE;
        break;
   }

    wm_showArea  (areaCaller);
  }
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_UI                   |
| STATE   : code                  ROUTINE : ui_backlight             |
+--------------------------------------------------------------------+

  PURPOSE : This function switches the backlight on/off.
*/
LOCAL void ui_backlight (BOOL on)
{
#if defined (NEW_FRAME)
  if (t_backlight_running NEQ FALSE)
  {
    TIMERSTOP (SMI_TBACKLIGHT)
    t_backlight_running = FALSE;
  }
#else
  if (t_backlight_handle NEQ (T_VSI_THANDLE) VSI_ERROR)
  {
    TIMERSTOP (t_backlight_handle)
  }
#endif

  if (on)
  {
#if !defined (NEW_FRAME)
#if defined WIN32
      char buf[30];
      sprintf (buf, "BACKLIGHT %4x", t_backlight_handle);
      TRACE_FUNCTION (buf);
#endif
#endif
#if defined (NEW_FRAME)
    TIMERSTART (TBACKLIGHT_VALUE, SMI_TBACKLIGHT);
    t_backlight_running = TRUE;
#else
    TIMERSTART (TBACKLIGHT_VALUE, t_backlight_handle);
#endif
  }
  if (ui_data->backlightOn NEQ on)
  {
    light_SetStatus (LIGHT_DEVICE_BACKLIGHT,
                     (UBYTE)((on ? LIGHT_STATUS_ON : LIGHT_STATUS_OFF)));
    TRACE_EVENT ((on ? "backlight on" : "backlight off"));
    ui_data->backlightOn = on;
  }
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_UI                   |
| STATE   : code                  ROUTINE : ui_shift                 |
+--------------------------------------------------------------------+

  PURPOSE : This function switches the shiftkey state on/off and
            indicates the state at the LCD.
*/
LOCAL void ui_shift (BOOL on)
{
#if defined (NEW_FRAME)
  if (t_shiftkey_running NEQ FALSE)
  {
    TIMERSTOP (SMI_TSHIFTKEY)
    t_shiftkey_running = FALSE;
  }
#else
  if (t_shiftkey_handle NEQ (T_VSI_THANDLE) VSI_ERROR)
  {
    TIMERSTOP (t_shiftkey_handle)
  }
  if (on)
#endif

  {
#if defined (NEW_FRAME)
    TIMERSTART (TSHIFTKEY_VALUE, SMI_TSHIFTKEY);
    t_shiftkey_running = TRUE;
#else
    TIMERSTART (TSHIFTKEY_VALUE, t_shiftkey_handle);
#endif
  }

  if (ui_data->shiftOn NEQ on)
  {
    TRACE_EVENT ((on ? "shift on" : "shift off"));

    if (on)
    {
      ui_data->keypadMode = 1; /* select the shifted keypad   */
      wm_areaWrite (areaShift, 0, 0, "S");
    }
    else
    {
      ui_data->keypadMode = 0; /* shifted keypad not selected */
      wm_areaWrite (areaShift, 0, 0, " ");

      ui_processDefaultKey (ui_data->lastShiftedKey, KEY_STAT_PRS);
    }

    ui_data->shiftOn = on;
  }
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_UI                   |
| STATE   : code                  ROUTINE : ui_updateKeystate        |
+--------------------------------------------------------------------+

  PURPOSE : This function manages states for each key.
*/
LOCAL UBYTE ui_updateKeystate (UBYTE key, BOOL pressed)
{
  USHORT      i;
  const CHAR *keyString;

  i = 0;

  while (keyTable[i].keypadCode NEQ NULL_TERM AND
         keyTable[i].keypadCode NEQ key)
    i++;

  if (keyTable[i].keypadCode NEQ NULL_TERM)
  {
    keyTable[i].pressed = pressed;
    if (keyTable[i].pressed)
    {
      if (ui_data->keypadMode < MAX_KEYPAD_MODE)
      {
        keyString = keyTable[i].keyCode[ui_data->keypadMode];

        if (keyString EQ NULL)
        {
          /*
           *---------------------------------------------------------
           * if no keycode defined for this key in the actual
           * keypad mode, use the keycode of the normal mode.
           *---------------------------------------------------------
           */
          keyString = keyTable[i].keyCode[0];

        }
      }
      else
        return 0;

      if (ui_data->lastKeyIdx EQ i)
      {
        ui_data->lastKeyRep++;
        ui_data->lastKeyRep %= strlen (keyString);
      }
      else
      {
        ui_data->lastKeyRep = 0;
        ui_data->lastKeyIdx = i;
      }

      if (keyString[ui_data->lastKeyRep] NEQ POWER_KEY)
      {
        if (ui_data->keyBeep)
          cal_sendAudioToneReq (0x26,
                                csf_getVolume (VT_KEY_BEEP),
                                TONE_SWT_ON_SINGLE);

        ui_backlight (TRUE);
      }
      return keyString[ui_data->lastKeyRep];
    }
    else
    {
      UBYTE dtmfKey;

      if (ui_data->sendDTMF)
      {
        keyString = keyTable[i].keyCode[ui_data->keypadMode];

        dtmfKey = keyString[ui_data->lastKeyRep];

        if ((dtmfKey >= '0' AND dtmfKey <= '9') OR
            (dtmfKey >= 'A' AND dtmfKey <= 'D') OR
            (dtmfKey >= 'a' AND dtmfKey <= 'd') OR
             dtmfKey EQ '#' OR  dtmfKey EQ '*')

           return dtmfKey;
      }
    }
  }
  return 0;
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_UI                   |
| STATE   : code                  ROUTINE : ui_getCauseName          |
+--------------------------------------------------------------------+

  PURPOSE : This function returns the text for a cause value.
*/
#if defined (NEW_FRAME)
LOCAL char *ui_getCauseName (char * source, USHORT cause)
{
  static char buffer [40];

  sprintf (buffer, "%s%4x", source, cause);

  return buffer;
}
#else
LOCAL CHAR *ui_getCauseName (BYTE * source, USHORT cause)
{
  static CHAR buffer [40];

  sprintf (buffer, "%s%4x", source, cause);

  return buffer;
}
#endif
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_UI                   |
| STATE   : code                  ROUTINE : ui_startFSDisplay        |
+--------------------------------------------------------------------+

  PURPOSE : This function starts the level display of fieldstrength.
*/

LOCAL void ui_startFSDisplay (void)
{
  rx_DCB_Type rx_DCB;
  /*
   *-----------------------------------------------------------------
   * request from the PS an indication on change of the
   * rx level with 10 intervalls
   *-----------------------------------------------------------------
   */
  rx_DCB.Steps    = 10;

  rx_SetConfig (&rx_DCB);
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_UI                   |
| STATE   : code                  ROUTINE : ui_startBATDisplay       |
+--------------------------------------------------------------------+

  PURPOSE : This function starts the level display of the battery
            charge.
*/
LOCAL void ui_startBATDisplay (void)
{
  pwr_DCB_Type pwr_DCB;
  /*
   *-----------------------------------------------------------------
   * request from the driver indication of the battery level
   * with 10 intervalls
   *-----------------------------------------------------------------
   */
  pwr_DCB.RangeMin = 10;
  pwr_DCB.RangeMax = 100;
  pwr_DCB.Steps    = 10;

  pwr_SetConfig (&pwr_DCB);
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_UI                   |
| STATE   : code                  ROUTINE : ui_handlePinAndPuk       |
+--------------------------------------------------------------------+

  PURPOSE : This function manages the input of the PIN or PUK and
            initiates further steps.
*/
LOCAL void ui_handlePinAndPuk (void)
{
  CHAR *input;

  switch (ui_data->inputMode)
  {
    case (INP_MOD_PIN):
      /*
       *-------------------------------------------------------------
       * PIN was entered, PIN evaluation process starts
       *-------------------------------------------------------------
       */
      input = inp_getInput (areaUser);
      inp_stopInput (areaUser);

      ui_data->state     = UI_IDLE;
      ui_data->inputMode = INP_MOD_NONE;

      aca_signal (ACA_SIG_PININPUT, input);
      break;

    case (INP_MOD_PUK):
      /*
       *-------------------------------------------------------------
       * PUK was entered, now new PIN is requested
       *-------------------------------------------------------------
       */
      input = inp_getInput (areaUser);
      inp_stopInput (areaUser);

      strcpy (puk, input);

      ui_startNewInput (areaUser,
                        0,
                        0,
                        "PIN: ",
                        MAX_PIN_LEN,
                        IT_NUMERIC | IT_ECHO | IT_HIDDEN,
                        INP_MOD_NPIN,
                        NULL,
                        TRUE);
      break;

    case (INP_MOD_NPIN):
      /*
       *-------------------------------------------------------------
       * new PIN is entered, now new PIN is requested again
       *-------------------------------------------------------------
       */
      input = inp_getInput (areaUser);
      inp_stopInput (areaUser);

      strcpy (pin, input);

      ui_startNewInput (areaUser,
                        0,
                        0,
                        "PIN: ",
                        MAX_PIN_LEN,
                        IT_NUMERIC | IT_ECHO | IT_HIDDEN,
                        INP_MOD_NPIN_TWICE,
                        NULL,
                        TRUE);
      break;

    case (INP_MOD_NPIN_TWICE):
      /*
       *-------------------------------------------------------------
       * new PIN is entered the second time, now PUK evaluation
       * process starts
       *-------------------------------------------------------------
       */
      input = inp_getInput (areaUser);
      inp_stopInput (areaUser);
      ui_data->state     = UI_IDLE;
      ui_data->inputMode = INP_MOD_NONE;
      aca_signal (ACA_SIG_PUKINPUT, puk, pin, input);

      /*
       *-------------------------------------------------------------
       * forget all about PIN and PUK
       *-------------------------------------------------------------
       */
      memset (puk, NULL_TERM, MAX_PUK_LEN + 1);
      memset (pin, NULL_TERM, MAX_PIN_LEN + 1);
      break;
    }
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_UI                   |
| STATE   : code                  ROUTINE : ui_startBooting          |
+--------------------------------------------------------------------+

  PURPOSE : This function prepares for booting.
*/
LOCAL void ui_startBooting (void)
{
  cal_sendAudioToneReq (CT_RING,
                        csf_getVolume (VT_RINGER),
                        TONE_SWT_ON_SINGLE);

#if defined (NEW_FRAME)
  TIMERSTART (TBOOTING_VALUE, SMI_TUNIVERSAL);
  t_universal_running = TRUE;
#else
  TIMERSTART (TBOOTING_VALUE, t_universal_handle);
#endif
  ui_data->timerMod = TIMER_MOD_BOOTING;
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_UI                   |
| STATE   : code                  ROUTINE : ui_init                  |
+--------------------------------------------------------------------+

  PURPOSE : Initialize the user interface module.
*/
GLOBAL void ui_init (void)
{
  USHORT i;

  csf_getPanelInfo (&screensize_x,
                    &screensize_y,

⌨️ 快捷键说明

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