Search in sources :

Example 31 with Event

use of org.traccar.model.Event in project traccar by tananaev.

the class OverspeedEventHandler method updateOverspeedState.

public Map<Event, Position> updateOverspeedState(DeviceState deviceState, double speedLimit) {
    Map<Event, Position> result = null;
    if (deviceState.getOverspeedState() != null && !deviceState.getOverspeedState() && deviceState.getOverspeedPosition() != null && speedLimit != 0) {
        long currentTime = System.currentTimeMillis();
        Position overspeedPosition = deviceState.getOverspeedPosition();
        long overspeedTime = overspeedPosition.getFixTime().getTime();
        if (overspeedTime + minimalDuration <= currentTime) {
            result = newEvent(deviceState, speedLimit);
        }
    }
    return result;
}
Also used : Position(org.traccar.model.Position) Event(org.traccar.model.Event)

Aggregations

Event (org.traccar.model.Event)31 Position (org.traccar.model.Position)25 Device (org.traccar.model.Device)9 DeviceState (org.traccar.model.DeviceState)9 Test (org.junit.Test)6 BaseTest (org.traccar.BaseTest)6 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 TripsConfig (org.traccar.reports.model.TripsConfig)3 Date (java.util.Date)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 Path (javax.ws.rs.Path)2 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 SQLException (java.sql.SQLException)1 GET (javax.ws.rs.GET)1 POST (javax.ws.rs.POST)1 Timeout (org.jboss.netty.util.Timeout)1 TimerTask (org.jboss.netty.util.TimerTask)1 MotionEventHandler (org.traccar.events.MotionEventHandler)1