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

📄 misscall.cpp

📁 moto e2键盘软锁第三版
💻 CPP
字号:
////      Missed Calls Alert utility for Motorola ROKR E2//      Copyright (C) 2007 Igor Yudincev;//      All rights reserved.////      This program is free software; you can redistribute it and/or modify//      it under the terms of the GNU General Public License as published by//      the Free Software Foundation; either version 2 of the License, or//      (at your option) any later version.////      This program is distributed in the hope that it will be useful,//      but WITHOUT ANY WARRANTY; without even the implied warranty of//      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the//      GNU General Public License for more details.////      You should have received a copy of the GNU General Public License//      along with this program; if not, write to the Free Software//      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.//// MANIFEST: main program source file//// 2005-10-11 version 0.3// - sound files support// - optionally, user can try to force /dev/dsp stay awake #include <stdio.h>#include <stdint.h>#include <unistd.h>#include <stdlib.h>#include <string.h>	#include "misscall.h"//#include "ezxphoneassist.h"//some missing define's for fseek()#define FILE_SET 0#define FILE_CUR 1#define FILE_END 2//max missed call buffer capacity, in records#define MAX_ENTRIES 128//settingschar    playfile[256] = "ding.wav";int8_t   playvol  = 4;uint32_t dly      = 300;bool     verbose;bool     mis_test;bool     force;   //force /dev/dsp stay awakestruct tag_missed_entry {	char     phone[0x10];	uint8_t  stuff1[0x24];	uint32_t checked;	uint32_t outer_index;	uint32_t n2;	uint32_t n1;	uint32_t inner_index;	uint8_t  stuff2[0x08]; };struct tag_missed_file {  uint32_t                header[2];  struct tag_missed_entry entry[MAX_ENTRIES];} missed_buf;char playcmd[16384];void alert(int type) {	if(type==1)  		system(playcmd);  	else if(type==2)  	system("/usr/SYSqtapp/phone/vibrateprocess"); // 		callviberaor(1);  		}int missalert(int type=0,char * phone_num= NULL , int pv=0 , bool flag_verbose =false){   uint32_t n,i,ix;  FILE *fm;  bool missed;  playvol=pv;//  force=flag_force;  verbose=flag_verbose;  sprintf(playcmd,	"/usr/SYSqtapp/phone/alertprocess -playvol %d -playfile %s >/dev/null", playvol, playfile);/*	else if(type==2)	{		sprintf(playcmd,"/usr/SYSqtapp/phone/vibrateprocess");			}*/  if (verbose) printf("Play command is: %s\n", playcmd);  //main loop      if (!mis_test) {      //clear buffer for missed calls file      for (i=0; i<MAX_ENTRIES; i++)        missed_buf.entry[i].phone[0] = 0;      //open missed calls file      fm = fopen("/ezxlocal/download/appwrite/phone/rc_m","rb");      do { //once	    //check the file	    if(fm==NULL) {	      if (verbose) printf("rc_m read error\n");	      break;	    }	    fseek(fm, 0, FILE_END);	    n = ftell(fm);	    rewind(fm);	    if(n<sizeof(missed_buf.header)) {	      if (verbose) printf("rc_m too small\n");	      break;	    }	    fread(missed_buf.header, 1, sizeof(missed_buf.header), fm);	    if(missed_buf.header[0]!=0xA0B0C0D0U || missed_buf.header[1]!=0x00000005U) {	      if (verbose) printf("rc_m: wrong header\n");	      break;	    }	    //calculate record count	    n = (n-sizeof(missed_buf.header))/sizeof(struct tag_missed_entry);	    if (n>MAX_ENTRIES) {	      n = MAX_ENTRIES;	      if (verbose) printf("rc_m: too long file\n");	    }	    //read missed calls records	    fread(missed_buf.entry, 1, n*sizeof(struct tag_missed_entry), fm);	    if (verbose) printf("rc_m: %d entries read\n", n);	    fclose(fm);	    fm = NULL;	    	    //search for first missed call record	    missed = false;	    ix = 0; 	    for (i=0; i<n; i++) {	      if (!missed_buf.entry[i].phone[0]) break; //конец записей	      if (verbose) printf("%s %d\n", missed_buf.entry[i].phone, missed_buf.entry[i].checked);	      if (missed_buf.entry[i].checked==0) { //непросмотренный пропущенный вызов	        missed = true;	        ix = i;	        break;//for i	      }	    }	    	    if (missed) {	      if (verbose) printf("missed call found: %s\n", missed_buf.entry[ix].phone);	      			strcpy(phone_num,missed_buf.entry[ix].phone);	   	 return 1;	//      alert(type);	    } else {	      if (verbose) printf("no missed calls\n");	    }      } while (false);      if (fm!=NULL) fclose(fm);    }//!mis_test    else { //     alert(type);      		return 1;    }    return 0;}

⌨️ 快捷键说明

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