-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDDIR_Handler_Pace_V.java
More file actions
44 lines (35 loc) · 1.36 KB
/
DDIR_Handler_Pace_V.java
File metadata and controls
44 lines (35 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import javax.safetycritical.PriorityScheduler;
import javax.realtime.*;
import javax.safetycritical.*;
// Implementaion of a periodic event handler
public class DDIR_Handler_Pace_V extends AperiodicEventHandler {
Actuator_V pm_V= new Actuator_V();
long interval ;
DDIR_ModeChange fmc = new DDIR_ModeChange();
public DDIR_Handler_Pace_V() {
super(new PriorityParameters(PriorityScheduler.instance().getMaxPriority()),
null,
new StorageConfigurationParameters(32768, 4096, 4096),
32768,
"DDIR_Handler_Pace_V"); //when sensor event is fire
}
public void handleEvent() {
AbsoluteTime now = Clock.getRealtimeClock().getTime();
//interval = now.subtract(DDIR_PMMission.lastAtriumActivityTime).getMilliseconds();
//if(interval > DDIR_PMMission.AVI){
interval = now.subtract(DDIR_PMMission.lastVentricleActivityTime).getMilliseconds();
if(interval > (DDIR_PMMission.PVARP + DDIR_PMMission.AVI)){
pm_V.Pace_ON_V();
try{
RealtimeThread.sleep(new RelativeTime(DDIR_PMMission.PacingLength,0)); //sleep
}catch (InterruptedException ie){
System.out.println(ie.getMessage());
}
pm_V.Pace_OFF_V();
//Reset Atrium activity flag
DDIR_PMMission.Activity_A_Occured = false;
//Save pacing Time of Ventricle
DDIR_PMMission.lastVentricleActivityTime.set(now.getMilliseconds(),now.getNanoseconds());
}
}
}//end class