#include "includes.h" SUT_SMS_DEFINE sutSms; SUT_MESSAGE_EDIT sutMEdit; static void SmsScan(unsigned char ret); #ifdef USE_BND_POC void getMyClock(MY_CLOCK*time) { } //unicodeToGbk(tempSMS, ptr, &sutMess.len); #endif void ShowMessageFlag(unsigned char show){ static unsigned char smsUnReadBackup; unsigned char showFlag; showFlag=0; if(show){ if(sutSms.haveUnRead) showFlag=1; }else{ if(smsUnReadBackup == sutSms.haveUnRead) return; smsUnReadBackup = sutSms.haveUnRead; if(sutSms.haveUnRead) showFlag=1; } switch(showFlag) { case 0: guiClearRect(SMS_ICON_X,0,SMS_ICON_X+SMS_ICON_WX,12,COLOR_STATUS_BAR); //guiShowStr(70,1," ",FONT_MODE_12X12, REVERSED_NO, guiGetForeColor(), COLOR_STATUS_BAR); break; case 1:guiShowBmp(SMS_ICON_X,3,"Mail.bmp");break; //case 2:GuiShowStr(60,3," ",0x01,0);break; default:break; } } //读取所有信息的前15字节内容 //返回消息总数目 unsigned char GetPagePreMessage(SUT_LIST_BOX *p,unsigned char firstRead, char up_down){ unsigned char i,*ptr,buf[16],ptrTem[8]; uint32_t readAddr; uint16_t totalnum,retNum; SUT_SMS_INFO_HEADER info; unsigned char downFindFirst;//向下查找时第一次找到消息-此时要记录向上查找记录upToBeRead unsigned char upFindFirst; unsigned char reCtPerTime; int fd; //以下用于交换用 SUT_LIST_BOX_SMS_INFO boxinfo; unsigned char temp,*Cptr1,*Cptr2; fd=LSAPI_FS_Open(SMS_FILE, LSAPI_FS_O_RDONLY,0); if(fd<0){ MSG_ERR(1,"%s GetPagePreMessage open failed", SMS_FILE); return; } //1从最新消息,即sutSms.newestAddr开始读出最多5项 if(sutSms.smsTotalNum >= LIST_ROW) reCtPerTime=LIST_ROW; else reCtPerTime = sutSms.smsTotalNum; downFindFirst=0; upFindFirst=0; totalnum = SMS_TOTAL_NUM; ptr=(unsigned char *)&info; if(firstRead == 1){ //SmsScan(1); sutSms.downToBeRead = sutSms.newestAddr; LSAPI_FS_Seek(fd, sutSms.newestAddr, LSAPI_FS_SEEK_SET); LSAPI_FS_Read(fd, ptr,sizeof( SUT_SMS_INFO_HEADER)); //sFlash_Read(ptr, sutSms.newestAddr, sizeof(struct SUT_SMS_INFO_HEADER)); sutSms.upToBeRead = info.upperAddr; firstRead=0; } i=0; if(up_down == 'd') {//向下读 while(1) { readAddr = sutSms.downToBeRead; //1.1读出年月日(16/06/01 = 8字节)+内容7字节 LSAPI_FS_Seek(fd, readAddr, LSAPI_FS_SEEK_SET); LSAPI_FS_Read(fd, ptr,sizeof( SUT_SMS_INFO_HEADER)); LSAPI_FS_Seek(fd, readAddr+SMS_INFO_DETAIL_OFFSET, LSAPI_FS_SEEK_SET); LSAPI_FS_Read(fd, ptrTem,8); //sFlash_Read(ptr, readAddr, sizeof(struct SUT_SMS_INFO_HEADER)); //sFlash_Read(ptrTem, readAddr+SMS_INFO_DETAIL_OFFSET, 8);//8字节内容 if(1==info.flag) { if(!downFindFirst) { downFindFirst++; sutSms.upToBeRead = info.upperAddr; } sprintf(p->boxinfo[i].item,"%02d/%02d/%02d ", (info.recTime>>26)&0x3F,(info.recTime>>22)&0x0F,(info.recTime>>17)&0x1F); strcat(p->boxinfo[i].item, (char *)ptrTem); if(1==info.read) p->boxinfo[i].features = 0; else p->boxinfo[i].features = 1; sutSms.downToBeRead = info.nextAddr; sutSms.ReadAddr[i] = readAddr; i++; if(i>=reCtPerTime) { retNum=i; break; } }else {//读完了,转到一开始 sutSms.downToBeRead = sutSms.newestAddr; //sutSms.downToBeRead = info.nextAddr; continue; } totalnum--; if(!totalnum) { //error MSG_ERR(1, "[SMS]err1"); retNum=i; break; } } p->handle=0; }else {//向上读 while(1) { readAddr = sutSms.upToBeRead; //1.1读出年月日(16/06/01 = 8字节)+内容7字节 LSAPI_FS_Seek(fd, readAddr, LSAPI_FS_SEEK_SET); LSAPI_FS_Read(fd, ptr,sizeof( SUT_SMS_INFO_HEADER)); LSAPI_FS_Seek(fd, readAddr+SMS_INFO_DETAIL_OFFSET, LSAPI_FS_SEEK_SET); LSAPI_FS_Read(fd, ptrTem,8); //sFlash_Read(ptr, readAddr, sizeof(struct SUT_SMS_INFO_HEADER)); //sFlash_Read(ptrTem, readAddr+SMS_INFO_DETAIL_OFFSET, 8);//8字节内容 if(1==info.flag) { if(!upFindFirst) { upFindFirst++; sutSms.downToBeRead = info.nextAddr; } sprintf(p->boxinfo[i].item,"%d/%d/%d ", (info.recTime>>26)&0x3F,(info.recTime>>22)&0x0F,(info.recTime>>17)&0x1F); strcat(p->boxinfo[i].item, (char *)ptrTem); if(1==info.read) p->boxinfo[i].features = 0; else p->boxinfo[i].features = 1; sutSms.upToBeRead = info.upperAddr; sutSms.ReadAddr[i] = readAddr; i++; if(i>=reCtPerTime) { retNum=i; break; } }else {//读完了,转到最后一条 //sutSms.upToBeRead = sutSms.newestAddr+(sutSms.smsTotalNum-1)*SMS_SIZE_PER; //sutSms.upToBeRead = SMS_START_ADDRESS+(sutSms.smsTotalNum-1)*SMS_SIZE_PER; sutSms.upToBeRead = info.upperAddr; continue; } totalnum--; if(!totalnum) { //error MSG_ERR(1,"[SMS]err2"); retNum=i; break; } } //switch ptr=(unsigned char *)&boxinfo;//copy temp = retNum/2; for(i=0;iboxinfo[i]; Cptr2=(unsigned char *)&p->boxinfo[retNum-1-i]; memcpy(ptr, Cptr1, LIST_ITEM_TEXT_LEN_MAX+1); memcpy(Cptr1, Cptr2, LIST_ITEM_TEXT_LEN_MAX+1); memcpy(Cptr2, ptr, LIST_ITEM_TEXT_LEN_MAX+1); readAddr=sutSms.ReadAddr[i]; sutSms.ReadAddr[i] = sutSms.ReadAddr[retNum-1-i]; sutSms.ReadAddr[retNum-1-i] = readAddr; } p->handle=reCtPerTime-1; } if(fd>0) LSAPI_FS_Close(fd); p->itemnum=retNum; p->pageChange=0; ListBoxItemNumShowSMS(p->notehandle,p->totalnum); ListBoxShowSMS(p); } void SetGotNewMessage(void) { unsigned char type,encode,def1,def2; type = sutMess.GBKMess1[0]; encode=sutMess.GBKMess1[1]; def1 = sutMess.GBKMess1[2]; def2 = sutMess.GBKMess1[3]; //处理分析消息类型 if(type == 0x30 && encode == 0x30 && def1 == 0x32 && def2 == 0x30) {//一键报警 sutMess.len -= 4; sutMess.Update=1;//收到一条消息标记 sutMess.startCntFlag=1; sutMess.skipCnt=0;//从此时开始计数 sutMess.forcePullGroupOn=0; MSG_WARN(1,"AlarmStart"); sutMess.codeType=2;//unicode //sutSms.smsUpdate=1;//need to store }else if(type == 0x01 && encode == 0x02) {//纯TTS播报 sutMess.len -= 4; sutMess.Update=2; sutMess.codeType=2;//unicode sutSms.smsUpdate=1;//need to store MSG_WARN(1,"Pure TTS"); }else if(type == 0x20 && encode == 0x20 && def1 == 0x20 && def2 == 0x20) {//全文本 sutMess.len -= 4; sutMess.Update=0; sutMess.codeType=1;//gb2312 sutSms.smsUpdate=1;//need to store MSG_WARN(1,"Pure TXT"); } // sutFeed.result=0; // sutFeed.feedBackStart=1; } //扫描消息 ret值: //0、重置过的 //1、获得消息总数以及未读数目 //2、往上查找当前最新消息位置上一条空地址 static void SmsScan(unsigned char ret) { unsigned char *ptr; unsigned short i; SUT_SMS_INFO_HEADER smsinfo,*info; unsigned int readAddr; int fd=-1; if(ret > 2) return;//出错不扫描 if(0!=ret){ fd=LSAPI_FS_Open(SMS_FILE, LSAPI_FS_O_RDONLY,0); if(fd<0){ MSG_ERR(1,"%s smsscan but open failed", SMS_FILE); return; } } if(0 == ret) {//已reset过 }else if(1 == ret) {//查找消息总数和未读数 sutSms.smsTotalNum=0; sutSms.smsUnReadNum=0; ptr = (unsigned char *)&smsinfo; readAddr = sutSms.newestAddr; info=&smsinfo; i=SMS_TOTAL_NUM; while(1) { LSAPI_FS_Seek(fd, readAddr, LSAPI_FS_SEEK_SET); LSAPI_FS_Read(fd, ptr, sizeof(SUT_SMS_INFO_HEADER)); //sFlash_Read(ptr, readAddr, sizeof(struct SUT_SMS_INFO_HEADER)); if(1==smsinfo.flag) { sutSms.smsTotalNum ++; if(1==smsinfo.read) { sutSms.smsUnReadNum ++; sutSms.haveUnRead = 1; } } i--; if(!i) break; readAddr = info->nextAddr; } }else if(2 == ret) {//向上查找空地址 ptr = (unsigned char *)&smsinfo; readAddr = sutSms.newestAddr; info=&smsinfo; i=SMS_TOTAL_NUM; while(1) { LSAPI_FS_Seek(fd, readAddr, LSAPI_FS_SEEK_SET); LSAPI_FS_Read(fd, ptr, sizeof(SUT_SMS_INFO_HEADER)); //sFlash_Read(ptr, readAddr, sizeof(struct SUT_SMS_INFO_HEADER)); if(0==smsinfo.flag) {//找到 sutSms.emptyAddr = readAddr; break; } i--; if(!i) { sutSms.poolFull = 1; MSG_WARN(1,"[SMS]Full"); //SpeakerEnable(); ttsPlay(ENCODE_USER_GBK,"CFFBCFA2D2D1C2FA"); break; } readAddr = smsinfo.upperAddr; } } if(fd>0) LSAPI_FS_Close(fd); } /////////////////////////////////////////////////////////// //uint8_t defaultSMS[] = "0我们都是好朋友"; //重置设置 //返回值0到2用实际用处 unsigned char ResetSMSConfi(void){ int endAddress,temp1,i; unsigned char *ptr,process=0; SUT_SMS_INFO_HEADER smsinfo; unsigned short sectorNum,startSector,k,x,y,lx; unsigned int totalBytes; unsigned char tbuf[SMS_SIZE_PER]; long ret; switch(newPara.messageResetFlag){ case 'N'://不用重置 sutSms.smsEnable = 1; //读出最新消息地址 sutSms.newestAddr = newPara.messageNewAddr; MSG_WARN(1,"[SMS]IDLE"); return 1; break; case 'R'://重置 MSG_WARN(1,"[SMS]Reset"); break; default://文件内容错误 MSG_ERR(1,"[SMS]RErr3"); sutSms.smsEnable = 0; return 5; break; } //2,根据短信格式初始化消息内存 y=(GLCD_HEIGHT-24-4)/2; guiShowStr(26,y,"消息内存配置",FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); x=29;y+=(12+4);lx=x; guiDrawRect(x,y,x+100,y+16,1,COLOR_BLACK); //guiDrawRect(29,50+50,128,66+50,1,COLOR_BLACK); //新建文件,如果存在则清空 int fd; fd=LSAPI_FS_Open(SMS_FILE, LSAPI_FS_O_RDWR|LSAPI_FS_O_CREAT,0); if(fd<0){ MSG_ERR(1,"[SMS]%s open err",SMS_FILE); sutSms.smsEnable = 0; return 5; } ptr = (unsigned char *)&smsinfo; for(i=0;i=1){ ListBoxInitSMS(&sutListBox,sutSms.smsTotalNum,accIconFileName,0); uiMenuShowBottomIndacitor("查阅", "[S]选项"); }else{ ListBoxItemNumShowSMS(0,0); uiMenuShowBottomIndacitor(NULL, "[S]选项"); } } if(machine==1){ if(uTimerExpired(&timer)){ machine=0; uISetNextStatus(UIS_MENU_MAIN); } } } void DeleteSpecificSMS(void) { SUT_SMS_INFO_HEADER smsinfo,smsinfoTem,*info; unsigned char *ptr,*ptrTem,temp; unsigned int curAddr; int fd; fd=LSAPI_FS_Open(SMS_FILE, LSAPI_FS_O_RDWR,0); if(fd<0){ MSG_ERR(1,"%s del open but failed", SMS_FILE); return; } ptr=(unsigned char *)&smsinfo; info=&smsinfo; //curAddr=SMS_START_ADDRESS+index*SMS_SIZE_PER;//要删除的消息地址 curAddr=sutSms.ReadAddr[sutListBox.handle]; LSAPI_FS_Seek(fd, curAddr,LSAPI_FS_SEEK_SET); LSAPI_FS_Read(fd, ptr, sizeof( SUT_SMS_INFO_HEADER)); //sFlash_Read(ptr, curAddr, sizeof(struct SUT_SMS_INFO_HEADER)); //0 更新数目 if(1==smsinfo.read) { if(sutSms.smsUnReadNum) { sutSms.smsUnReadNum --; if(0==sutSms.smsUnReadNum) sutSms.haveUnRead =0; } } if(sutSms.smsTotalNum) sutSms.smsTotalNum --; if(sutSms.poolFull) sutSms.poolFull--; if(curAddr != sutSms.newestAddr){ //1将当前要删除的消息的上下消息接连起来 //1.1设置上一条消息的nextAddr ptrTem=(unsigned char *)&smsinfo.nextAddr; LSAPI_FS_Seek(fd,smsinfo.upperAddr+SMS_INFO_REAL_LEN+4,LSAPI_FS_SEEK_SET ); LSAPI_FS_Write(fd, ptrTem, 4); //sFlash_Write(ptrTem, smsinfo.upperAddr+SMS_INFO_REAL_LEN+4, 4); //1.2设置下一条消息的upperAddr ptrTem=(unsigned char *)&smsinfo.upperAddr; LSAPI_FS_Seek(fd,smsinfo.nextAddr+SMS_INFO_REAL_LEN,LSAPI_FS_SEEK_SET ); LSAPI_FS_Write(fd, ptrTem, 4); //sFlash_Write(ptrTem, smsinfo.nextAddr+SMS_INFO_REAL_LEN, 4); } //2设置要删除的消息的标志位 temp=0; LSAPI_FS_Seek(fd,curAddr,LSAPI_FS_SEEK_SET ); LSAPI_FS_Write(fd, &temp, 1); //sFlash_Write(&temp, curAddr, 1); if(curAddr != sutSms.newestAddr) { //3把空的消息插到最新的那条消息的上面去,它的下面都会是连续的新消息,不要往下插 LSAPI_FS_Seek(fd, sutSms.newestAddr, LSAPI_FS_SEEK_SET); LSAPI_FS_Read(fd, ptr, sizeof( SUT_SMS_INFO_HEADER)); //sFlash_Read(ptr, sutSms.newestAddr, sizeof(struct SUT_SMS_INFO_HEADER)); //3.1设置最新的消息的upperAddr LSAPI_FS_Seek(fd, sutSms.newestAddr+SMS_INFO_REAL_LEN, LSAPI_FS_SEEK_SET); LSAPI_FS_Write(fd, (unsigned char *)&curAddr, 4); //sFlash_Write((uint8_t *)&curAddr, sutSms.newestAddr+SMS_INFO_REAL_LEN, 4); //3.2设置最新消息原来的上一条消息的nextAddr LSAPI_FS_Seek(fd, smsinfo.upperAddr+SMS_INFO_REAL_LEN+4, LSAPI_FS_SEEK_SET); LSAPI_FS_Write(fd, (unsigned char *)&curAddr, 4); //sFlash_Write((uint8_t *)&curAddr, smsinfo.upperAddr+SMS_INFO_REAL_LEN+4, 4); //4设置被删除的消息的upperAddr and nextAddr //4.1设置upperAddr LSAPI_FS_Seek(fd, curAddr+SMS_INFO_REAL_LEN, LSAPI_FS_SEEK_SET); LSAPI_FS_Write(fd, (unsigned char *)&smsinfo.upperAddr, 4); //sFlash_Write((uint8_t *)&smsinfo.upperAddr, curAddr+SMS_INFO_REAL_LEN, 4); //4.2设置nextAddr LSAPI_FS_Seek(fd, curAddr+SMS_INFO_REAL_LEN+4, LSAPI_FS_SEEK_SET); LSAPI_FS_Write(fd, (unsigned char *)&sutSms.newestAddr, 4); //sFlash_Write((uint8_t *)&sutSms.newestAddr, curAddr+SMS_INFO_REAL_LEN+4, 4); }else { //如果是删除最新的那条消息,不用更改位置,只要将更改最新消息的地址即可 sutSms.newestAddr = smsinfo.nextAddr; } if(fd>0) LSAPI_FS_Close(fd); } void MessageDeletResponse(void) { unsigned short key=getKeyValue(); if(MKEY_VALUE_MENU==key) { if(sutSms.smsTotalNum>=1) DeleteSpecificSMS(); uISetNextStatus(UIS_MENU_MAIL_SEL); } if(MKEY_VALUE_ESC==key)uISetNextStatus(UIS_MENU_MAIL_SEL); } void FormatSMS(void) { unsigned short i; unsigned char *ptr; SUT_SMS_INFO_HEADER info; unsigned int readAddr; unsigned char process; int fd; fd=LSAPI_FS_Open(SMS_FILE, LSAPI_FS_O_RDWR,0); if(fd<0){ MSG_ERR(1,"%s format but open failed", SMS_FILE); return; } guiClearRect(0,44,GLCD_WIDTH,84,guiGetBackColor()); guiDrawRect(29,50,128,66,1,guiGetForeColor()); process=0; readAddr = sutSms.newestAddr; ptr=(unsigned char *)&info; for(i=0;i0) LSAPI_FS_Close(fd); sutSms.smsTotalNum = 0; sutSms.smsUnReadNum = 0; sutSms.haveUnRead = 0; } void MessageFormatResponse(void) { unsigned short key=getKeyValue(); if(MKEY_VALUE_MENU==key) { FormatSMS(); uISetNextStatus(UIS_MENU_MAIL_SEL); } if(MKEY_VALUE_ESC==key)uISetNextStatus(UIS_MENU_MAIL_SEL); } void MessageOptionResponse(void) { char buf[30]; unsigned short key; key=uiMenuResponse(&sutMenuSysSetup); if(MKEY_VALUE_MENU==key) { switch(sutMenuSysSetup.handle) { case 0:uISetNextStatus(UIS_MENU_MAIL_DEL);break; case 1:uISetNextStatus(UIS_MENU_MAIL_FORMAT);break; } } else if(MKEY_VALUE_ESC==key) uISetNextStatus(sutUIstatus.LastStatus); } void MessageOptionShow(char update) { static const char *apcMenuSysSetup[]= {"删除","格式化",""}; if(update) { guiClearAll(guiGetBackColor()); guiShowCaption(0,"文本选项",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); uiMenuShowBottomLine(); uiMenuInit(&sutMenuSysSetup,apcMenuSysSetup, FONT_MODE_12X12); uiMenuShowBottomIndacitor("确定", "返回"); } } //读取index短信全部内容到bufPt static void ReadSpecificSms(unsigned char *bufPt) { SUT_SMS_INFO_HEADER info; unsigned char *ptr; int fd; fd=LSAPI_FS_Open(SMS_FILE, LSAPI_FS_O_RDWR,0); if(fd<0){ MSG_ERR(1,"%s read sms but open failed", SMS_FILE); return; } ptr=(unsigned char *)&info; LSAPI_FS_Seek(fd, sutSms.ReadAddr[sutListBox.handle]+SMS_INFO_DETAIL_OFFSET, LSAPI_FS_SEEK_SET); LSAPI_FS_Read(fd,bufPt, SMS_SIGNAL_LEN); //sFlash_Read(bufPt, sutSms.ReadAddr[sutListBox.handle]+SMS_INFO_DETAIL_OFFSET, SMS_SIGNAL_LEN); LSAPI_FS_Seek(fd, sutSms.ReadAddr[sutListBox.handle], LSAPI_FS_SEEK_SET); LSAPI_FS_Read(fd,ptr, 2); //sFlash_Read(ptr, sutSms.ReadAddr[sutListBox.handle],2); info.read = 0; LSAPI_FS_Seek(fd, sutSms.ReadAddr[sutListBox.handle], LSAPI_FS_SEEK_SET); LSAPI_FS_Write(fd,ptr, 2); //sFlash_Write(ptr, sutSms.ReadAddr[sutListBox.handle], 2); if(sutSms.smsUnReadNum) { sutSms.smsUnReadNum--; if(sutSms.smsUnReadNum==0) sutSms.haveUnRead = 0; } if(fd>0) LSAPI_FS_Close(fd); } static unsigned short lastShowIndex=0; unsigned char smsDetail[SMS_SIGNAL_LEN]; void MessageReadShow(char update) { if(update) { lastShowIndex=0; memset(smsDetail,0,sizeof(smsDetail)); guiClearAll(guiGetBackColor()); guiShowCaption(0,"消息阅读",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); ReadSpecificSms(smsDetail); MessageEditInit(&sutMEdit,8,UI_CONTENT_SHOW_Y+5, (char *)smsDetail); lastShowIndex=MessageEditShow(&sutMEdit,(char *)smsDetail+lastShowIndex); uiMenuShowBottomLine(); #ifdef REPORT_SMS_VOICE uiMenuShowBottomIndacitor("播放", "返回"); #else uiMenuShowBottomIndacitor(NULL, "返回"); #endif return; } } void MessageReadResponse(void) { unsigned short len; unsigned short key=getKeyValue(); if(MKEY_VALUE_ESC==getKeyValue())uISetNextStatus(UIS_MENU_MAIL_SEL); else if(MKEY_VALUE_MENU == key) { #ifdef REPORT_SMS_VOICE // ReadSpecificSms(smsDetail); // AnsiToStrUnicode(unicodeSms,sizeof(unicodeSms),(char *)smsDetail); // ModemSendAt("AT+ZTTS=1,\""); // ModemSendAt((char *)unicodeSms); // ModemSendAt("\"\r"); #endif }else if(MKEY_VALUE_DOWN==key) { //printf("len:%d,%d\r\n",lastShowIndex,strlen(smsDetail)); if(lastShowIndex= 500){ showCt=0; MSG_ERR(1,"[SMS]Invalid"); } return; } if(0 != sutMess.Update) return;//消息播报处理完毕 if(0 == sutSms.smsUpdate) return;//没有可存储处理 sutSms.smsUpdate = 0; MSG_INFO(1,"[SMS]Store SMS"); SmsScan(2); if(sutSms.poolFull) return; int fd; fd=LSAPI_FS_Open(SMS_FILE, LSAPI_FS_O_RDWR,0); if(fd<0){ MSG_ERR(1,"%s open to save but failed",SMS_FILE); return; } SwitchSMS_ToGB2312(); // SpeakerEnable(); // ModemSendAt("AT+ZTTS=1,\"36653052B065886D6F60\"\r"); //1.1 ptr = (unsigned char*)&infosms; infosms.flag=1; infosms.read=1; tempyear=time.year%2000; infosms.recTime = (unsigned int)tempyear<<26 | (unsigned int)time.month<<22 | (unsigned int)time.day<<17 | (unsigned int)time.hour<<12 | (unsigned int)time.min<<6 | (unsigned int)time.sec<<0; infosms.len = sutMess.len; //保存头信息 LSAPI_FS_Seek(fd, sutSms.emptyAddr, LSAPI_FS_SEEK_SET); LSAPI_FS_Write(fd, ptr, SMS_INFO_REAL_LEN); //保存内容 smsPtr = sutMess.GBKMess1+4; LSAPI_FS_Seek(fd, sutSms.emptyAddr+SMS_INFO_DETAIL_OFFSET,LSAPI_FS_SEEK_SET); LSAPI_FS_Write(fd, smsPtr, SMS_SIGNAL_LEN); LSAPI_FS_Close(fd); sutSms.haveUnRead=1; sutSms.smsTotalNum ++; sutSms.smsUnReadNum ++; sutSms.newestAddr = sutSms.emptyAddr; //保存 newPara.messageNewAddr=sutSms.newestAddr; //save sys sysIniSave(); } void SMSHandle(void) { unsigned char temp1,temp2; unsigned short i; char buf[30]; static unsigned int cnt=0; unsigned char *p; if(sutMess.startCntFlag) { // if(os_time_get() > cnt) // {//秒粗计数器 // cnt=os_time_get()+100; // if(++sutMess.skipCnt>20) // {//时间到了 // sutMess.startCntFlag=0; // SlwTrace(INF,"Timeout",1); // } // } } if(sutMess.Update == 1 || sutMess.Update == 2) { MSG_INFO(1,"TTS_LEN:%d",sutMess.len); p = sutMess.GBKMess1+4; // for(i=0;i