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

📄 file.c

📁 本人编写的无线电话程序,给予PIC18C801设计,包括了uCOS的移植以及菜单,自己设计的拼音注入法,完整地一级汉字库,希望对大家有所帮助
💻 C
字号:


/*******************************************************************
 * Here are basic structures used in the file definations followed *
 *******************************************************************/
typedef struct _CALL_RECORD{
	INT8U	head;
	INT8U	len;
	INT8U	num[CALLRECORDNUM][12];
	NM_TIME	time[CALLRECORDNUM];
}CALL_RECORD;
//---------------------------------------
typedef struct _SM_TBLINDEX_ITEM{
	INT8U	peernum[8];
	INT8U	property;
	NM_TIME	time;
	INT8U	previous;
	INT8U	next;
}SM_TBLINDEX_ITEM;

typedef struct _SM_TBLDATA_ITEM{
	INT8U	len;
	INT8U	data[160];
}SM_TBLDATA_ITEM;

#define SMTBLINDEXLEN SMTBLLEN+2
typedef struct _SM_TBL{
	INT8U	head;
	INT8U	tail;
	SM_TBLINDEX_ITEM[SMTBLINDEXLEN];
	SM_TBL_DATA_ITEM[SMTBLLEN];
}SM_TBL;
//--------------------------------------
typedef struct _PHONE_BOOK_ITEM{
	INT8U  	Name[10];	//unicode
	INT8U	Group;
	INT8U	Number[12];	//compressed BCD code
	INT8U	Front;
	INT8U	Next;
}PHONE_BOOK_ITEM;

typedef struct _PHONE_BOOK{
	INT8U	head;
	INT8U	tail;
	PHONE_BOOK_ITEM[PHONEBOOKLEN+2];
}PHONE_BOOK;
//----------------------------------------------------------------//
typedef struct _NCCSM_Info{
	INT8U Typ_Len;
	INT8U data[32];
}
//----------------------------------------------------------------//
typedef union _HCODE_SEC_ITEM{
	INT8U	b[4];
	INT16U	w[2];
}HCODE_SEC_ITEM;

typedef struct _HCODE_ITEM{
	INT8U	subnet;
	INT8U	num;
	HCODE_SEC_ITEM section[20];
}HCODE_ITEM;
//-------------------------------------
typedef struct _RATE_TBL_ITEM{
	INT8U	num[8];
	INT16U  Rate1;
	INT16U  ChgTimUnit1;
	INT16U  Duration1;
	INT16U  Rate2;
	INT16U  ChgTimUnit2;
	INT16U  Duration2;
	INT8U	insertion[6];
	INT16U	option;
	INT8U	optarg[4];
}RATE_TBL_ITEM;

typedef struct _RATE_TBL{
	NM_TIME	starttime;
	RATE_TBL_ITEM	roaming_rate;
	RATE_TBL_ITEM	call_in_rate;
	INT16U			len;
	RATE_TBL_ITEM	item[RATETBLITEM];
}RATE_TBL;
//----------------------------------------------------------------//
typedef struct _FEE_TABLE_ITEM{
	INT8U 	PeerNum[12];                   /*The number of the other side in this session*/
	INT8U 	LocalNum[6];							  /*The number of the local phone(BCD code)*/
	INT8U 	Method;                                                      /*Feature of the call*/
	NM_TIME StartTime;                                               /*The start time of the call*/
	INT16U  Duration;                           /*The duration of the call(Binary,second as unit)*/
	INT16U  Fee;                                        /*The fee of the call(Binary,fen as unit)*/
}FEE_TABLE_ITEM;

/*******************************************************************
 * Here we define some file structure that contains different type *
 * of information used by different functions                      *
 *******************************************************************/
/**********************Start of definations*************************/
//-----------------------------------------------------------------//
// File 1: stores local work parameters, used by both pay-phone and//
//         business phone                                          //
//-----------------------------------------------------------------//
struct _file_localPara{
	INT16U	CtlWord;
	INT8U	PINCode[3];
	INT8U	SelfNum[6];
	INT8U	SpeakerVolume;
	INT8U	LockPassword[4];	//user password, initialized as "0000"
	INT8U	BackLED;
	INT8U	RingType;
	INT8U	ChgStartM;	//How to start charging, according to the signal or delay for a few seconds(ChgArg)
	INT8U	ChgArg;
}
//-----------------------------------------------------------------//
// File 2: stores information of the user, which is applied only on//
//         business phone                                          //
//-----------------------------------------------------------------//
struct _file_UserPrivate{
	CALL_RECORD	UnAcceptCall;
	CALL_RECORD	RecentRxCall;
	CALL_RECORD	RecentTxCall;
	SM_TBL		RxSM;
	SM_TBL		TxSM;
	PHONE_BOOK	PhoneBook;
}

//-----------------------------------------------------------------//
// File 3: stores information of Network Control Center, only app- //
//         lied on payphone (or some specially defined business    //
//         phone                                                   //
//-----------------------------------------------------------------//

struct _file_NCC{
	INT8U		NCCModemNum[6];
	INT8U		NCCID[6];
	NCCSM_INFO	NCCSMInfo;
	INT8U		FeeTblUploadTime[2];
}

//-----------------------------------------------------------------//
// File 4: stores information of call process control, used by any //
//         type of phone                                           //
//-----------------------------------------------------------------//

struct _file_CallCtl{
	HCODE_ITEM	HCodeTbl[10];
	INT8U		CurRateTbl;
	RATE_TBL	RateTbl[2];
}

//-----------------------------------------------------------------//
// File 5: stores information of call record such as number, fee,  //
//         time, duratin and so on. Only applied in payphone	   //
//-----------------------------------------------------------------//

struct _file_FeeRocord{
	INT16U			head;
	INT16U			tail;
	FEE_TBL_ITEM	item[FEETBLLEN];
}

//-----------------------------------------------------------------//
// File 6: stores LAC code information to lock the position of the //
//         phone. Except for special required, this file don't     //
//         used on any type of phone                               //
//-----------------------------------------------------------------//

struct _file_PosLock{
	INT16U LAC_CODE[40];
	INT16U LAC_Limit[16];
}
/**************************End of file definations*******************/

⌨️ 快捷键说明

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