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

📄 engine.h

📁 vt6528芯片交换机API函数和文档运行程序
💻 H
字号:
/*
 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
 * All rights reserved.
 *
 * This software is copyrighted by and is the sole property of
 * VIA Networking Technologies, Inc. This software may only be used
 * in accordance with the corresponding license agreement. Any unauthorized
 * use, duplication, transmission, distribution, or disclosure of this
 * software is expressly forbidden.
 *
 * This software is provided by VIA Networking Technologies, Inc. "as is"
 * and any express or implied warranties, including, but not limited to, the
 * implied warranties of merchantability and fitness for a particular purpose
 * are disclaimed. In no event shall VIA Networking Technologies, Inc.
 * be liable for any direct, indirect, incidental, special, exemplary, or
 * consequential damages.
 *
 *
 * File:    engine.h
 *
 * Purpose: UI engine main body
 *
 * Author:  Jenda Jao
 *
 * Date:    Jan 08, 2002
 *
 */


#ifndef __ENGINE_H__
#define __ENGINE_H__

#if !defined(__TTYPE_H__)
#include "ttype.h"
#endif




/*---------------------  Export Definitions  ------------------------*/
//// define all items
#define NULL_ITEM_ID        0xFF
#define NULL_LINE_ID        0xFF
#define MAX_ITEM_STR_LEN    18          // for mac address max str = 17, max str len+1

#define MAX_ITEM_DEC_LEN    4
#define ITEM_INTERVAL       1

/*---------------------  Export Types  ------------------------------*/
//// define position
typedef struct tagPosition {
    UINT8        byRow;
    UINT8        byCol;
} SPosition;

// define fix label
typedef struct tagFixLabel {
    SPosition   SPos;
    char*       strLabel;
    UINT8        byDrawLineLen;
} SFixLabel;


enum EItemDataType {
    ITEM_DECNUM,
    ITEM_HEXNUM,
    //ITEM_BYTEARRAY,     // for sram, use SItemNum, only hex, byMaxLen = byte array size, not support input yet
    ITEM_STRING,
    ITEM_PASSWORD,
    ITEM_LISTBOX,
    ITEM_VAR_LISTBOX,   // the list number is assigned by a variable and a byte array is specified for mapping value to string index
    ITEM_MENU_PAGESEL,  // the item in a menu page
    ITEM_ACTION
};

enum EItemHyperLinkType {
    LINK_TYPE_NONE,
    LINK_TYPE_EDITPAGE,     // list in edit page and link to other page when selected. Attention: this item can be any data type but will not be edit (change value).
    LINK_TYPE_LISTBOX       // jump to different page when selected different value in listbox item
};

enum EItemRepeatType {
    REPEAT_TYPE_NONE,
    REPEAT_TYPE_RECT_SINGLE,      // repeat item in rectangle, and rank items in column
    REPEAT_TYPE_RECT_MULTI        // repeat item in rectangle, and intersect repeat items
};

typedef struct tagItem {
    SPosition   SPos;
    void*       pvItem;

    char*       strDescription;

    // item info
    BITS8       f4DataType:     4;      // definition list in EItemDataType
    BITS8       f2RepeatType:   2;      // definition list in EItemRepeatType
    BITS8       f2LinkType:     2;      // definition list in EItemHyperLinkType

    UINT8        byLineNumPerColumn;
    UINT8        byPosColOffset;         // position offset of X coord. for REPEAT_TYPE_RECT_SINGLE only
} SItem, SVarLabel;


typedef struct tagItemPageSel {
    char*       strPageSel;
    UINT8        byPageID;
} SItemPageSel;

typedef struct tagItemNum {
    UINT8*       pbyNum;

    UINT8        f3ByteNum;
    UINT8        f5MaxLen;

    UINT8        byVarByteOffset;    // for repeat item. if not roll-page, don't care this value
} SItemNum;

typedef struct tagItemString {
    char*       strString;          
    UINT8        byMaxLen;
} SItemString;

typedef struct tagItemPasswd {
    char*       strPassword;
    UINT8        byMaxLen;
} SItemPasswd;

typedef struct tagItemListbox {
    UINT8*       pbyIndex;           // the max size of value is 1 byte(8 bits),

    UINT8        byStartBit;         // (byEndBit - byStartBit +1) must <= 8
    UINT8        byEndBit;
    UINT8        byVarBitOffset;     // for repeat item

    char**      astrListbox;        // string array of listbox
    UINT8        byListNum;          // number of items in this listbox for var_item only
} SItemListbox;

// for variable list number of listbox
typedef struct tagSStringTableMap { // this should allocate in RAM
    UINT8        byListNum;          // number of string in this listbox
    UINT8*       abyListIndex;       // mapping value to string index
} SStringTableMap;

typedef struct tagSItemVarListbox {
    UINT8*       pbyIndex;           // the max size of value is 1 byte(8 bits),

    UINT8        byStartBit;         // (byEndBit - byStartBit +1) must <= 8
    UINT8        byEndBit;
    UINT8        byVarBitOffset;     // for repeat item (not support in engine now, for reducing code size)

    char**      astrListbox;        // string array of listbox
    SStringTableMap* pSStrTblMap;
} SItemVarListbox;


// action item
typedef struct tagActionItem {
    SPosition   SPos;
    char*       strLabel;                               // the display string
    //char        cHotKey;                                // hot key support

    BOOL        (*bActFunc)(void); // action function pointer, return TRUE if change page
} SActItem;


//// define whole page, if any object not needed, assign NULL value
typedef struct tagPage {
    SFixLabel*  aSFixLabel;     // constant label
    UINT8        byFixLabelNum;

    SVarLabel*  aSVarLabel;     // variable label, i.e., the value can be changed, but can not be edited(highlight)
    UINT8        byVarLabelNum;

    SItem*      aSVarItem;      // the item can be edited and highlight
    UINT16      wVarItemNum;

    SActItem*   aSActItem;      // action items
    UINT8        byActItemNum;

    BOOL        (*bLoadPage)(void);
} SPage;


/*---------------------  Export Macros  -----------------------------*/

/*---------------------  Export Classes  ----------------------------*/

/*---------------------  Export Variables  --------------------------*/
// Default is 0, and the action may specify them ...
// repeated times for repeat-item; pass to
extern UINT16 g_wTotalLineNum;  // load_config function may specify
extern BOOL g_bDataDirty;       // save_config function may specify
extern UINT8 g_byRootPageID;     // the root page after login, it should be modified in write_default action function
extern UINT8 g_byCurPageID;      // It may change in action function to change page
extern UINT8 g_byCurKey;         // used to distinguish between ENTER and ESC key and pass to eng_io

extern UINT8 g_byMultiPageNo;


// pass to action functions of add/edit page
// DON'T change except UI engine
extern UINT16 g_wCurLineID;
extern UINT16 g_wCurItemID;

#define g_pSCurPage         g_apSPage[g_byCurPageID]
#define g_aSCurItemList     g_apSPage[g_byCurPageID]->aSVarItem
#define g_SCurItem          g_apSPage[g_byCurPageID]->aSVarItem[g_wCurItemID]
#define g_aSCurActionList   g_apSPage[g_byCurPageID]->aSActItem

extern volatile BOOL    g_bSemaphoreTtyLogout;

/*---------------------  Export Functions  --------------------------*/
// starting entry of menuline engine
void ENGvEnterPage(void);
// select a var item, return the array index of aSVarItem
void ENGvItemSelect(void);




#endif


⌨️ 快捷键说明

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