我在做一个项目,是LINUX方面的,我有个现成的程序是当有键盘按下时候采集五张照片,现在改为定时采集五张照片,定时程序如下: t = time (NULL);
memcpy (&tm, localtime (&t), sizeof (struct tm));
senttime = tm.tm_min;
while (1)
{
t = time (NULL);
memcpy (&tm, localtime (&t), sizeof (struct tm));
timer = tm.tm_min - senttime;
if (timer < 0 )
{
timer = timer + 60;
}
printf("timer is %d\n",timer);
if (timer >= timezone)
{
sigalrm_fn();//每隔TIMEZONE时间执行一次sigalrm_fn();
senttime = tm.tm_min;
}
sleep(60);
};
采集照片程序如下int StartCameraCapture(void)
{
int capbuf_phyaddr;
unsigned short *addr;
unsigned char *addr8;
int previewOnce = 1;
int max;
int i=0,j;
int frame=0;
int cnt = 0; //the times count of photo caption
// for(i=0;i<500;i++)
while (1)
{
CaptureFrame(&capbuf_phyaddr);
DoIPIPING(CAP_WIDTH, CAP_HEIGHT, capbuf_phyaddr);
#if 1
//printf("intflag in startCamerCap is %d\n", intflag);
if(intflag!=0)
{
smain((XDAS_Int8 *)ipipebuffer.start);
cnt ++;
if (cnt == CAP_TIMES ) {
intflag=0;//清空标识位
cnt =0;
}
}
#endif
DisplayFrame(ipipebuffer.start,640,480);//设置显示的大小
frame++;
//printf ( "\nhave captured and sent %d frames\n",frame );
}
我想问如何在他们之间建立连接啊,请高手指点一下 |