그럼 이제 정리해보자. (아직 구상중이지만...)
1. PDA battery low
[CODE]/* check whether battery is low or not */ if ((info->dat.ac == AC_OFF_LINE) && (info->dat.level == BATTERY_LEVEL_BAR_0)) { . update battery_status as low_battery if (!(info->stat & BATTERY_SENT_ALARM)) { info->stat |= BATTERY_SENT_ALARM; . send "battery=low" msg } /* add time counter */ b_time_inc(info, BATTERY_LOW_MSG_TIME); /* time to send msg? */ if ( (info->dat.voltage < BATTERY_VOL_LOW) && (info->time[BATTERY_LOW_MSG_TIME] >= BATTERY_MSG_LOW_INTERVAL) ) { if (info->dat.voltage < BATTERY_VOL_PDA_OFF) { /* system off */ if (info->time[BATTERY_OFF_MSG_TIME] >= BATTERY_MSG_PDA_OFF_INTERVAL) . send "battery=off" msg else b_time_inc(info, BATTERY_OFF_MSG_TIME); } else { b_time_clr(info, BATTERY_OFF_MSG_TIME); . send "battery=low" msg b_time_clr(info, BATTERY_LOW_MSG_TIME); } } } else { . it is not low battery. }[/CODE]
[CODE]/* check whether battery is low or not */ if ((info->dat.ac == AC_OFF_LINE) && (info->dat.level == BATTERY_LEVEL_BAR_0)) { . update battery_status as low_battery if (!(info->stat & BATTERY_SENT_ALARM)) { info->stat |= BATTERY_SENT_ALARM; . send "battery=low" msg } /* add time counter */ b_time_inc(info, BATTERY_LOW_MSG_TIME); /* time to send msg? */ if ( (info->dat.voltage < BATTERY_VOL_LOW) && (info->time[BATTERY_LOW_MSG_TIME] >= BATTERY_MSG_LOW_INTERVAL) ) { if (info->dat.voltage < BATTERY_VOL_PDA_OFF) { /* system off */ if (info->time[BATTERY_OFF_MSG_TIME] >= BATTERY_MSG_PDA_OFF_INTERVAL) . send "battery=off" msg else b_time_inc(info, BATTERY_OFF_MSG_TIME); } else { b_time_clr(info, BATTERY_OFF_MSG_TIME); . send "battery=low" msg b_time_clr(info, BATTERY_LOW_MSG_TIME); } } } else { . it is not low battery. }[/CODE]