📄 mmismsbroadcast.c
字号:
/*******************************************************************************
CONDAT (UK)
********************************************************************************
This software product is the property of Condat (UK) Ltd and may not be
disclosed to any third party without the express permission of the owner.
********************************************************************************
$Project name: Basic MMI
$Project code: BMI (6349)
$Module: SMS Cell Broadcast
$File: MmiSmsBroadcast.c
$Revision: 1.0
$Author: Condat(UK)
$Date: 22/02/01
********************************************************************************
Description:
Implementation of MMI SMS Cell Broadcast dynamic menu handling
********************************************************************************
$History: MmiSmsBroadcast.c
25/10/00 Original Condat(UK) BMI version.
$End
*******************************************************************************/
/*******************************************************************************
Include Files
*******************************************************************************/
#define ENTITY_MFW
/* includes */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#if defined (NEW_FRAME)
#include "typedefs.h"
#include "vsi.h"
#include "pei.h"
#include "custom.h"
#include "gsm.h"
#else
#include "stddefs.h"
#include "custom.h"
#include "gsm.h"
#include "vsi.h"
#endif
#include "custom.h"
#include "gsm.h"
#include "vsi.h"
#include "p_sim.h"
#include "mfw_sys.h"
#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_kbd.h"
/* SPR#1428 - SH - New Editor changes */
#ifndef NEW_EDITOR
#include "mfw_edt.h"
#endif
#include "mfw_lng.h"
#include "mfw_icn.h"
#include "mfw_phb.h"
#include "mfw_sim.h"
#include "mfw_nm.h"
#include "ksd.h"
#include "psa.h"
#include "mfw_sms.h"
#include "mfw_mnu.h"
#include "mfw_sat.h"
#include "mfw_tim.h"
#include "MmiMmi.h"
#include "MmiDummy.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiMain.h"
#include "MmiStart.h"
#include "MmiPins.h"
#include "MmiMenu.h"
#include "MmiSoftKeys.h"
#include "MmiBookController.h"
#include "mmiSmsBroadcast.h"
#include "mmiSmsIdle.h"
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
#include "ATBCommon.h"
#include "ATBDisplay.h"
#include "ATBEditor.h"
#include "AUIEditor.h"
#else
#include "MmiEditor.h"
#endif
#include "MmiIdle.h"
#include "cus_aci.h"
#include "mmicolours.h"
#define MENU_TEXT_LENGTH 16 /* count of chars to be displayed in one list entry */
/* SH - moved to .h file */
/* storage for Cell Broadcast lists */
typedef struct
{
T_SMSCB_ATT cb_attributes[MAX_MIDS]; /* list of attributes of messages stored in fifo */
CHAR cb_buffer[CB_STORE_LENGTH]; /* fifo buffer for received cell broadcast messages */
ListMenuData *cb_list_attributes; //atttributes for the menu list
T_SMSCB_STATUS current_status; /*read status for all messages */
UBYTE found_mid; //indicate the already existing cb in the fifo
UBYTE clear_mid; //indicate the deleting process
UBYTE result_used; //to update the used-pointer, after deleting the cb message
UBYTE total_number; //this include the total number of messages in the fifo; need for Menu-list
UBYTE multipage_number; //this include the total page of a particular multipage; need for showing msg.
UBYTE *multipage; //pointer to the first page of multipage
UBYTE start_used; //indicate the start point of the multipage, used for the searching
UBYTE end_used; //indicate the end point of the multipage, used for the searching
UBYTE used_pointer; //start point of the free space link list
UBYTE free_pointer; //start point of the data link list
} T_SMSCB_DATA;
T_SMSCB_DATASTORE g_smscb_data; /* storage for Cell Broadcast lists */
T_SMSCB_DATA smscb_data; /* storage for Cell Broadcast lists */
//Attributes of the list menu
static const MfwMnuAttr sms_cb_menuAttrib =
{
&smscb_M_CBArea,
MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
-1, /* use default font */
NULL, /* with these items */
0, /* number of items */
COLOUR_LIST_SMS, TxtNull, NULL, MNUATTRSPARE
};
#define OFFSET(index) (index*CB_PAGE_LENGTH)
//this shows traces of some variable
//#define DEBUG_SMS_CB
#ifdef DEBUG_SMS_CB
UBYTE DEBUG;
#endif
//these prototypes belongs to saving cb_messages in the fifo
UBYTE sms_cb_count_messages ( void );
UBYTE sms_cb_count_unread_messages ( void );
UBYTE sms_cb_delete_message (USHORT mid);
UBYTE sms_cb_find_termination (UBYTE *used);
UBYTE sms_cb_update_free_pointer (UBYTE temp);
UBYTE sms_cb_search_mid (USHORT mid, SHORT sn);
UBYTE sms_cb_store_message (T_MFW_SMS_CB *Message);
UBYTE sms_cb_find_endpoint (USHORT mid, UBYTE end_used);
UBYTE sms_cb_find_startpoint (USHORT mid, UBYTE end_used);
UBYTE sms_cb_give_position_of_msg (UBYTE used, UBYTE positon);
UBYTE sms_cb_overwrite_old_message (T_MFW_SMS_CB *Message);
void sms_cb_show_cb_message(UBYTE link_list_position);
static ListMenuData * sms_cb_create_list (UBYTE number);
static int sms_cb_select_read (MfwMnu* m, MfwMnuItem* i);
static void sms_cb_list_cb(T_MFW_HND win, ListMenuData * ListData);
void sms_cb_store_attributes (UBYTE position, T_MFW_SMS_CB *Message);
static void sms_cb_editor_cb (T_MFW_HND win, USHORT Identifier, SHORT reason);
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
void sms_cb_loadEditDefault (T_AUI_EDITOR_DATA *editor_data);
#else /* NEW_EDITOR */
void sms_cb_loadEditDefault (T_EDITOR_DATA *editor_data);
#endif /* NEW_EDITOR */
/*********************************************************************
**********************************************************************
cell broadcast declaration
*********************************************************************
**********************************************************************/
typedef struct
{
int index; /* index of selected item in list */
} T_CB_index_param;
typedef struct
{
int index; /* index of selected item in list */
char name[CB_TAG_LENGTH]; /* buffer for name to be associated with topic */
char number[CB_MID_LENGTH]; /* buffer for channel number of topic */
} T_CB_EDT_MIDEDT_param;
typedef struct
{
int index; /* index of selected item in list */
char text[CB_TAG_LENGTH]; /* buffer for name to be associated with topic ??? size is dummy */
char number[CB_MID_LENGTH]; /* buffer for channel number of topic ??? size is dummy */
} T_S_param; /* ??? T_S_param not to be defined here, but in "mmiSmsSend.h"! */
/* IDs used for identification of sources of events */
enum {
smscb_M_CB_ID,
smscb_M_CB_ACT_ID,
smscb_M_CB_TOP_ID,
smscb_M_CB_TOP_CONS_ID,
smscb_M_CB_TOP_CONS_SEL_ID,
smscb_CB_ID,
smscb_CB_TEXTEDT_ID,
smscb_CB_OPT_ID,
smscb_CB_OPT_DEL_NOACK_ID,
smscb_CB_EDT_TEXTEDT_ID,
smscb_CB_EDT_MIDEDT_ID
} smscb_ID;
void msgsExtractPhoneNumber(UBYTE *InputString, UBYTE *Buffer);
/* forward declaration of local start routines */
static T_MFW_HND smscb_M_CB_ACT_start(T_MFW_HND parent_window, void *dummy);
static T_MFW_HND smscb_M_CB_TOP_start(T_MFW_HND parent_window, void *dummy);
static T_MFW_HND smscb_M_CB_TOP_CONS_start(T_MFW_HND parent_window, void *dummy);
static T_MFW_HND smscb_M_CB_TOP_CONS_SEL_start(T_MFW_HND parent_window, T_CB_index_param * parameter);
static T_MFW_HND smscb_CB_start(T_MFW_HND parent_window, void *dummy);
static T_MFW_HND smscb_CB_TEXTEDT_start(T_MFW_HND parent_window, T_CB_index_param * parameter);
static T_MFW_HND smscb_CB_OPT_start(T_MFW_HND parent_window, T_CB_index_param * parameter);
static T_MFW_HND smscb_CB_OPT_DEL_NOACK_start(T_MFW_HND parent_window, T_CB_index_param * parameter);
static T_MFW_HND smscb_CB_EDT_TEXTEDT_start(T_MFW_HND parent_window, T_CB_index_param * parameter);
static T_MFW_HND smscb_CB_EDT_MIDEDT_start(T_MFW_HND parent_window, T_CB_EDT_MIDEDT_param * parameter);
void info_screen (T_MFW_HND win, USHORT TextId, USHORT TextId2, T_VOID_FUNC Callback)
/* present info <TextId> for 3 seconds in a simple infoscreen */
{
T_DISPLAY_DATA display_info;
TRACE_FUNCTION ("info_screen()");
dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TextId, TextId2 , COLOUR_STATUS);
dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)Callback, THREE_SECS, 0 );
display_info.Identifier = 0;
info_dialog (win, &display_info);
}
/*********************************************************************
**********************************************************************
cell broadcast routines DECLARATION
*********************************************************************
**********************************************************************/
static T_MFW smscb_delete_topic(UBYTE MidOffset);
/* SH moved prototype to header file */
// c019 rsa
/* this routine is for testing purposes only. It is used to start the submenutree from MmiMenu.c */
int temp_smscb_M_CB_ExeRead (MfwMnu* m, MfwMnuItem* i)
{
T_MFW_HND win = mfwParent((MfwHdr *)mfw_header());
smscb_InitData();
return (int)smscb_M_CB_start (win, NULL);
}
// end c019 rsa
// c020 rsa
static void listCreate(MfwHnd Parent, MfwMnuAttr *a , MfwEvt e, ListCbFunc cbFunc)
{
ListMenuData list_menu_data;
/* initialization of the dialog data */
list_menu_data.Attr = a;
list_menu_data.List = a->items;
list_menu_data.ListLength = a->nItems;/* Number of entries in list menu. */
list_menu_data.ListPosition = 1;/* True cursor position in list menu. */
list_menu_data.CursorPosition = 1;/* Cursor position in list snapshot. */
list_menu_data.SnapshotSize = 4;/* Number of list entries to view. */
list_menu_data.Font = 0;
list_menu_data.LeftSoftKey = TxtSoftSelect;
list_menu_data.RightSoftKey = TxtSoftBack;
/* SPR1428 - SH - Accept menu select key */
list_menu_data.KeyEvents = KEY_CLEAR | KEY_RIGHT | KEY_LEFT | KEY_MNUUP | KEY_MNUDOWN | KEY_MNUSELECT;
list_menu_data.Reason = 0;
list_menu_data.Strings = FALSE;
list_menu_data.autoDestroy = TRUE;
listDisplayListMenu(Parent, &list_menu_data, cbFunc,0);
}
// end c020 rsa
/*********************************************************************
**********************************************************************
M_CB DYNAMIC MENU WINDOW. DECLARATION
*********************************************************************
**********************************************************************/
typedef struct
{
/* administrative data */
T_MMI_CONTROL mmi_control;
T_MFW_HND win;
SHORT id;
T_MFW_HND parent;
/* associated handlers */
T_MFW_HND menu;
/* internal data */
} T_M_CB;
static T_MFW_HND smscb_M_CB_create (T_MFW_HND parent);
static void smscb_M_CB_destroy (T_MFW_HND window);
static void smscb_M_CB_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * dummy);
static void smscb_M_CB_mnu_cb (T_MFW_HND * win, ListMenuData * ListData); // c020 rsa
/*********************************************************************
**********************************************************************
M_CB DYNAMIC MENU WINDOW. CONTENTS DECLARATION
*********************************************************************
**********************************************************************/
static int smscb_M_CB_ExeActivate (MfwMnu* m, MfwMnuItem* i);
static int smscb_M_CB_TOP_ExeConsult(MfwMnu* m, MfwMnuItem* i);
static int smscb_M_CB_TOP_ExeAddNew(MfwMnu* m, MfwMnuItem* i);
static T_MFW_MNU_ITEM smscb_M_CBItems[] =
{
{0,0,0, (char *)TxtActivate, 0, (MenuFunc)smscb_M_CB_ExeActivate, item_flag_none},
{0,0,0, (char *)TxtRead, 0, (MenuFunc)sms_cb_select_read, item_flag_none},
{0,0,0, (char *)TxtNew, 0, (MenuFunc)smscb_M_CB_TOP_ExeAddNew, item_flag_none},
{0,0,0, (char *)TxtList, 0, (MenuFunc)smscb_M_CB_TOP_ExeConsult, item_flag_none}
};
static MfwMnuAttr smscb_M_CBAttrib =
{
&smscb_M_CBArea,
MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
-1, /* use default font */
smscb_M_CBItems, /* with these items */
sizeof(smscb_M_CBItems)/sizeof(MfwMnuItem), /* number of items */
COLOUR_LIST_SMS,TxtNull, NULL, MNUATTRSPARE
};
/*********************************************************************
**********************************************************************
M_CB DYNAMIC MENU WINDOW. CONTENTS BEHAVIOUR
*********************************************************************
**********************************************************************/
static int smscb_M_CB_ExeActivate (MfwMnu* m, MfwMnuItem* i)
{
T_MFW_HND win = mfwParent((MfwHdr *)mfw_header());
// selection "Activate": menucreate M_CB_ACT
return (int)smscb_M_CB_ACT_start (win, NULL);
}
/*********************************************************************
**********************************************************************
M_CB DYNAMIC MENU WINDOW. IMPLEMENTATION
*********************************************************************
**********************************************************************/
/*******************************************************************************
$Function: cellbroadcast_start
$Description: Calls from the MainMenu
$Returns: none.
$Arguments:
*******************************************************************************/
int cellbroadcast_start(MfwMnu* m, MfwMnuItem* i)
{
T_MFW_HND win = mfwParent(mfw_header());
smscb_M_CB_start(win, NULL);
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -