Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages | Examples

test_refresh.c

Example of select_item() and refresh().
/*
 * Copyright (C) 2003 BLADOX, s.r.o.  All rights reserved.
 * 
 * This file is part of an example program for Turbo. This example
 * program may be used, distributed and modified without limitation.
 *
 */

#include <config.h>
#include <turbo/turbo.h>

u8 PROGMEM t_Refresh_1_en[] = "SIM_INIT_FULL_FILE";
u8 PROGMEM t_Refresh_2_en[] = "FILE_CHANGE";
u8 PROGMEM t_Refresh_3_en[] = "SIM_INIT_FILE_CHANGE";
u8 PROGMEM t_Refresh_4_en[] = "SIM_INIT";
u8 PROGMEM t_Refresh_5_en[] = "SIM_RESET";

const u8 *PROGMEM s_refresh[] = {
  t_Refresh_1_en,
  t_Refresh_2_en,
  t_Refresh_3_en,
  t_Refresh_4_en,
  t_Refresh_5_en
};

lc_char PROGMEM lc_Refresh[] = {
  LC_EN ("Refresh") LC_END
};

void action_menu (void *data)
{
  u8 *res;
  u8 j;
  u8 file_buf[6];

  res =
    select_item (5, s_refresh, locale (lc_Refresh), NULL, 1,
                 Q_SELECT_ITEM_CHOICE);
  j = get_tag (res, T_RESULT);
  if (j != 0)
  {
    j++;                        // tag
    j++;                        //len
    if (res[j] == 0x10)
      return;                   // end
    if (res[j] == 0x11 || res[j] == 0x12)
      return;                   // back
  }
  j = get_tag (res, T_ITEM_ID);
  if (j != 0)
  {
    j++;                        //tag
    j++;                        //len
    j = res[j];
    switch (j)
    {
      case 1:
        refresh (Q_REFRESH_SIM_INIT_FULL_FILE, 0, 0, 0);
        break;
      case 2:
        file_buf[0] = 0x3F;
        file_buf[1] = 0x00;
        file_buf[2] = 0x7F;
        file_buf[3] = 0x10;
        file_buf[4] = 0x6F;
        file_buf[5] = 0x3C;
        refresh (Q_REFRESH_SIM_FILE_CHANGE, 1, 6, file_buf);
        break;
      case 3:
        file_buf[0] = 0x3F;
        file_buf[1] = 0x00;
        file_buf[2] = 0x7F;
        file_buf[3] = 0x10;
        file_buf[4] = 0x6F;
        file_buf[5] = 0x3C;
        refresh (Q_REFRESH_SIM_INIT_FILE_CHANGE, 1, 6, file_buf);
        break;
      case 4:
        refresh (Q_REFRESH_SIM_INIT, 0, 0, 0);
        break;
      case 5:
        refresh (Q_REFRESH_SIM_RESET, 0, 0, 0);
        break;
    }
  }
}

void turbo_handler (u8 action, void *data)
{
  if (action == ACTION_INSERT_MENU)
    insert_menu (locale (lc_Refresh));
  else if (action == ACTION_MENU_SELECTION)
    stk_thread (action_menu, data);
}


Copyright © 2004-2006 BLADOX
Turbo version 1.2