📄 global.pas
字号:
unit global;
interface
uses Messages,classes,sysutils,Windows,mmsystem,ComCtrls,Dialogs;
const
//public
MFW_STRING_LEN= 161;
MFW_TAG_LEN= 21;
MFW_SUBADR_LEN= 21;
MAX_LEN= 21;
MAX_CURRENCY= 5;
//电话簿常量
PHB_name_len = 13;
PHB_number_len = 21;
PHB_numberExt_len = 7;
PHB_memo_len = 22;
PHB_MaxUnicode = 11;
PHB_MaxASC = 22;
//SMS const
MAX_SCTP_DIGITS= 2;
MAX_MSG_LEN= 573; //Max size for a SMS
MFW_NUM_LEN= 41;
MAX_MESSAGES = 50;
SMS_MaxUnicode = 70;
SMS_MaxASC = 160;
//Call record const
CR_name_length=24;
SIZE_BUFFER=32000;
// PHB_TYPE_NVM= $01; //手机电话簿
// PHB_TYPE_SIM= $02; //SIM卡电话簿
// PHB_TYPE_PC= $00; //SIM卡电话簿
CR_TYPE_LMN= $01; //未接电话
CR_TYPE_LRN= $04; //已接电话
CR_TYPE_LDN= $08; //已拨电话
PC_AppCID1_File=$11; //file operate
PC_AppCID1_PHB=$12; //Phone Book
PC_AppCID1_SMS=$13; // SMS
PC_AppCID1_CR=$14; //通话记录
PC_AppCID1_MAX=$15;
PC_AppCID2_Read=$11; //read
PC_AppCID2_Write=$12; //write,modify,add
PC_AppCID2_Delete=$13; //delete
PC_AppCID2_Copy=$14; //copy info
PC_AppCID2_Info=$15; //base Infomation
PC_AppCID2_MAX=$16;
PC_IF_FLAGS_DATAUL = $01;
PC_IF_FLAGS_CMD = $02;
PC_IF_FLAGS_DATADL = $10;
PC_FILE_status_init = $01;
PC_FILE_status_getfileinfo = $02;
PC_FILE_status_DLfile = $03;
PC_FILE_status_ULfile = $04;
PC_FILE_status_Delfile=$05;
PC_PHB_status_init = $01;
PC_PHB_status_getPHBcount = $02;
PC_PHB_status_getPHBList = $03;
PC_PHB_status_AddPHB = $04;
PC_PHB_status_DelPHB=$05;
PC_PHB_status_EditPHB=$06;
PC_SMS_status_CopyPHB=$07;
PC_SMS_status_init = $01;
PC_SMS_status_getSMScount = $02;
PC_SMS_status_getFlashSMSList = $03;
PC_SMS_status_getSIMSMSList = $04;
PC_SMS_status_DelSMS=$05;
PC_SMS_status_SendSMS=$06;
PC_SMS_status_SaveSendSMS=$07;
PC_SMS_status_SaveSMS=$08;
PC_SMS_status_CopySMS=$09;
PC_CR_status_init = $01;
PC_CR_status_getCRcount = $02;
PC_CR_status_getCRLMNList = $03;
PC_CR_status_getCRLRNList = $04;
PC_CR_status_getCRLDNList = $05;
PC_CR_status_DelCR=$06;
g_ascii_gsm_table :array[0..255] of byte= (
$20,$20,$20,$20,$20,$20,$20,$20, //000-007
$20,$20, 10,$20,$20, 13,$20,$20, //008-015
$20,$20,$20,$20,$20,$20,$20,$20, //016-023
$20,$20,$20,$20,$20,$20,$20,$20, //024-031
32, 33, 34, 35, 2, 37, 38, 39, //032-039
40, 41, 42, 43, 44, 45, 46, 47, //040-047
48, 49, 50, 51, 52, 53, 54, 55, //048-055
56, 57, 58, 59, 60, 61, 62, 63, //056-063
0, 65, 66, 67, 68, 69, 70, 71, //064-071
72, 73, 74, 75, 76, 77, 78, 79, //072-079
80, 81, 82, 83, 84, 85, 86, 87, //080-087
88, 89, 90,$20,$20,$20,$20,$20, //088-095
$20, 97, 98, 99, 100, 101, 102, 103, //096-103
104, 105, 106, 107, 108, 109, 110, 111, //104-111
112, 113, 114, 115, 116, 117, 118, 119, //112-119
120, 121, 122,$20,$20,$20,$20,$20, //120-127
9, 126, 5,$20, 123, 127, 15,$20, //128-135
$20,$20, 4,$20,$20, 7, 91, 14, //136-143
31, 29, 28,$20, 124, 8,$20, 6, //144-151
$20, 92, 94,$20, 1, 3,$20,$20, //152-159
$20,$20,$20,$20, 125, 93,$20,$20, //160-167
96, 17,$20,$20,$20, 64,$20,$20, //168-175
$20,$20,$20,$20,$20,$20,$20,$20, //176-183
$20,$20,$20,$20,$20,$20,$20,$20, //184-191
$20,$20,$20,$20,$20,$20,$20,$20, //192-199
$20,$20,$20,$20,$20,$20,$20,$20, //200-207
$20,$20,$20,$20,$20,$20,$20,$20, //208-215
$20,$20,$20,$20,$20,$20,$20,$20, //216-223
$20, 30, 19, 22, 24,$20,$20,$20, //224-231
18, 25, 21,$20,$20,$20,$20, 20, //232-239
26,$20,$20,$20,$20,$20,$20,$20, //240-247
$20,$20,$20,$20,$20,$20,$20,$20//248-255
);
g_gsm_ascii_table :array[0..127] of byte= (
64, 156, 36, 157, 138, 130, 151, 141, //6456
149, 128, 10, $20 , 32, 13, 143, 134,
$20, 169, 232, 226, 239, 234, 227, $20,
228, 233, 240, $20, 146, 145, 225, 144,
32, 33, 34, 35, $20, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63,
173, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 142, 153, 165, 154, $20,
168, 97, 98, 99, 100, 101, 102, 103,
104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119,
120, 121, 122, 132, 148, 164, 129, 133
);
type
PC_Error= (
PC_Error_NoError = $00,
PC_Error_CheckSum, //checksumerror
PC_Error_InvalidPktSize = $03,//invalid packed size
PC_Error_InvalidDataSize ,
PC_Error_NoConnect,//NO connect
PC_Error_ConnectExisted,// a connect existed
PC_Error_InvalidFrameType,
PC_Error_InvalidFrameid,
PC_Error_FrameIsReRX = $20, //frame 是被重发的
PC_Error_WaitData,// 用于异步的操作,data不能立即得到
PC_Error_SerialNoResponse = $81,//说明target响应timeout,for example:serial is invalid
App_Error_DefaultError = $82,//默认失败
App_Error_ReadError ,//说明读取失败
App_Error_WriteError ,//说明写失败
App_Error_DeleteError ,//说明删除失败
App_Error_CopyError ,//说明复制失败
App_Error_InfoError ,//说明获取信息失败
App_Error_SendError, //发送短消息失败
App_Error_StoreError, //存储短消息失败
PC_Error_MMINotAllow = $90,//手机不允许pc同步, 要先进入菜单工具箱->pc同步
PC_Error_MMINeedPause,//有电话进来,需要暂停
PC_Error_MemoryAlloc,//内存分配失败,不能操作
App_Error_ModifyError //说明更改电话簿失败
);
TViewState_PHB= (ALL_PHB,V_PHB,S_PHB,P_PHB);//所有电话簿一起显示、手机、SIM卡、PC
TViewState_SMS= (ALL_SMS,V_SMS,S_SMS,P_SMS);//所有短消息一起显示、手机、SIM卡、PC
TViewState_CR = (ALL_CR,M_CR,R_CR,D_CR);//所有来电记录一起显示、只显示未接、只显示已接、只显示已拨
T_MFW_PHB_SELECT=(SIM_BOOK_SEL,NVM_BOOK_SEL,ALL_BOOK_SEL);//电话簿类型
TEditState_SMS= (ReadSMS,ReSMS,ForwardSMS,ModifySMS,NewSMS);//短消息编辑框的四种状态
T_PCSYN_SMS_STAT=(
PCSYN_SMS_UNKNOWN,
PCSYN_SMS_UNREAD, (* received unread message *)
PCSYN_SMS_READ, (* received read message *)
PCSYN_SMS_STOR_UNSENT, (* stored unsent messgae *)
PCSYN_SMS_STOR_SENT, (* stored sent message *)
PCSYN_SMS_ALL,
PCSYN_SMS_NotVOICE,
PCSYN_SMS_FLASH, (*FLASH SMS*)
PCSYN_SMS_FLASH_MO, (*手机信箱发件箱*)
PCSYN_SMS_FLASH_MT, (*手机信箱收件箱*)
PCSYN_SMS_MO, (* SIM MO SMS message *)
PCSYN_SMS_MT, (* SIM MT SMS message *)
PCSYN_SMS_INVALID, (*SPR1830*)
PCSYN_SMS_VOICE (* voice mail message *)
);
{
T_PCSYN_SMS_STAT=(
PCSYN_SMS_NotVOICE,
PCSYN_SMS_FLASH, (*FLASH SMS*)
PCSYN_SMS_FLASH_MO, (*手机信箱发件箱*)
PCSYN_SMS_FLASH_MT, (*手机信箱收件箱*)
PCSYN_SMS_MO, (* SIM MO SMS message *)
PCSYN_SMS_MT, (* SIM MT SMS message *)
PCSYN_SMS_INVALID, (*SPR1830*)
PCSYN_SMS_VOICE, (* voice mail message *)
PCSYN_SMS_UNKNOWN,
PCSYN_SMS_UNREAD, (* received unread message *)
PCSYN_SMS_READ, (* received read message *)
PCSYN_SMS_STOR_UNSENT, (* stored unsent messgae *)
PCSYN_SMS_STOR_SENT, (* stored sent message *)
PCSYN_SMS_ALL
);
}
T_MFW_SMS_MO_TYPE=(
MFW_SMS_SUBMIT,
MFW_SMS_REPLY,
MFW_SMS_SUBMIT_SENT,
MFW_SMS_REPLY_SENT
);
T_ACI_SMS_READ=(SMS_READ_NotPresent=-1,SMS_READ_Normal,SMS_READ_Preview,SMS_READ_StatusChange);
FFS_OBJECT_TYPE=(OT_FILE=1,OT_DIR=2,OT_LINK=3,OT_SEGMENT=4);
FFS_OBJECT_FLAGS=(OF_READONLY= 1 shl 4);
TCharSet=set of char;
PPC_Interface_Info=^TPC_Interface_Info;
TPC_Interface_Info=record
flag:DWord;
pdata_cmd:PChar;
size_cmd:DWord;
pdata_ulbuff:PChar;
size_ulbuff:DWord;
pdata_dlbuff:PChar;
size_dlbuff:DWord;
status:DWord;//返回值
callback:pointer;
end;
PPC_App_Cmd_File=^TPC_App_Cmd_File;
TPC_App_Cmd_File=record
cid1:byte;
cid2:byte;
filename:array[0..49] of char;
end;
PDELRec=^TDelRec;
TDelRec=record
ctype:short;
index:short;
end;
//****phonebook***//
PPC_App_Cmd_PHB=^TPC_App_Cmd_PHB;
TPC_App_Cmd_PHB=record
cid1:byte;
cid2:byte;
ctype:byte;// PHB_TYPE_SIM, PHB_TYPE_NVM
index:byte;//电话簿序号
end;
PPC_PHB_Count=^TPC_PHB_Count;
TPC_PHB_Count=record
NVMTotal:word;
SIMTotal:word;
MaxNVM:word;
MaxSIM:word;
end;
PPhbkDetailItem=^TPhbkDetailItem; // 108 bytes
TPhbkDetailItem=record
name:array[0..PHB_name_len+3-1] of char;//16 bytes
number:array[0..PHB_number_len+1-1] of char; //22 bytes
office:array[0..PHB_number_len+1-1] of char; //22 bytes
home:array[0..PHB_number_len+1-1] of char; //22 bytes
memo:array[0..PHB_memo_len+3-1] of char;// 25 bytes
info:char; //1 byte
end;
PPC_PHB_Content=^TPC_PHB_Content; //112 bytes,传输电话簿记录的数据结构
TPC_PHB_Content=record
phonebook:integer;
id:integer;
phkitem:TPhbkDetailItem;
end;
PPhoneBook=^TPhoneBook; //在内存中存放的电话簿记录结构
TPhoneBook=record
Location:array[0..3] of char; //4bytes
SN:array[0..3] of char; //3bytes
name:array[0..PHB_name_len+3-1] of char;//16 bytes
number:array[0..PHB_number_len+1-1] of char; //22 bytes
office:array[0..PHB_number_len+1-1] of char; //22 bytes
home:array[0..PHB_number_len+1-1] of char; //22 bytes
memo:array[0..PHB_memo_len+3-1] of char; //25 bytes
group:byte; //1 byte
data:TPC_PHB_Content;
serialNo:Longint; //如果是PC数据,则表示在数据库中的索引
end;
//******SMS****//
PPC_App_Cmd_SMS=^TPC_App_Cmd_SMS;
TPC_App_Cmd_SMS=record
cid1:byte;
cid2:byte;
ctype:byte;//
index:byte;//
end;
PPC_SMS_Count=^TPC_PHB_Count;
TPC_SMS_Count=record
FlashMOtotal:byte;
FlashMTtotal:byte;
SIMMOTotal:byte;
SIMMTTotal:byte;
MaxFlashNum:short;
MaxSIMNum:short;
end;
PT_MFW_SMS_SCTP=^T_MFW_SMS_SCTP;
T_MFW_SMS_SCTP=record
year:array[0..MAX_SCTP_DIGITS-1] of byte;
month:array[0..MAX_SCTP_DIGITS-1] of byte;
day:array[0..MAX_SCTP_DIGITS-1] of byte;
hour:array[0..MAX_SCTP_DIGITS-1] of byte;
minute:array[0..MAX_SCTP_DIGITS-1] of byte;
second:array[0..MAX_SCTP_DIGITS-1] of byte;
timezone:short;
end;
{
PFlashSms=^TFlashSms;
TFlashSms=record
id:byte;
addr:array[0..MFW_NUM_LEN-1] of char;
dummy1:array[0..1]of char;
time:T_MFW_SMS_SCTP;
dummy2:array[0..1]of char;
sms_msg:array[0..MAX_MSG_LEN-1] of char;
dummy3:char;
msg_len:Word ;
state:T_PCSYN_SMS_STAT;
dummy4:array[0..2] of char;
dcs:short;
flag: boolean;
dummy5:char;
end;
}
PPC_SMS_Content=^TPC_SMS_Content;
TPC_SMS_Content=record
name:array[0..15] of char;
id:byte;
addr:array[0..39] of char;
dummy1:array[0..2] of char;
time:T_MFW_SMS_SCTP;
dummy2:array[0..1] of char;
dcs:short;
state:T_PCSYN_SMS_STAT;
flag: boolean;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -