void Smokesensor_alarm(int sig)
{ char *psmoke;
int ret,i; int j = 0;
#if !USE_ALM
intflag=get_alarm_io();
#else if
intflag = (1<<6); //set intflag use alarm happen
printf("intflag in smokesensor_alarm is %d\n", intflag);
alarm(10);
#endif
}
void sig_init()
sensor // signal(SIGPIPE, alarm_handler);
// signal(SIGINT, exit_app);
sigact_smokesensor.sa_handler = Smokesensor_alarm;
sigemptyset(&sigact_smokesensor.sa_mask);
sigaddset(&sigact_smokesensor.sa_mask,SIGUSR2);
sigact_smokesensor.sa_flags=0;
if(sigaction(SIGUSR2,&sigact_smokesensor,NULL)<0)
printf("Install smokesensor_alarm Signal Action Error");
#if USE_ALM
signal (SIGALRM, Smokesensor_alarm);
alarm (5);
#endif
} |