diff options
Diffstat (limited to 'src/org/traccar/events/IgnitionEventHandler.java')
-rw-r--r-- | src/org/traccar/events/IgnitionEventHandler.java | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/org/traccar/events/IgnitionEventHandler.java b/src/org/traccar/events/IgnitionEventHandler.java index e241e450b..3086adb13 100644 --- a/src/org/traccar/events/IgnitionEventHandler.java +++ b/src/org/traccar/events/IgnitionEventHandler.java @@ -1,6 +1,6 @@ /* - * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com) - * Copyright 2016 Andrey Kunitsyn (abyss@fox5.ru) + * Copyright 2016 Anton Tananaev (anton@traccar.org) + * Copyright 2016 Andrey Kunitsyn (andrey@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,20 +39,12 @@ public class IgnitionEventHandler extends BaseEventHandler { Collection<Event> result = null; - boolean ignition = false; - Object ignitionObject = position.getAttributes().get(Position.KEY_IGNITION); - if (ignitionObject != null && ignitionObject instanceof Boolean) { - ignition = (Boolean) ignitionObject; - } + boolean ignition = position.getBoolean(Position.KEY_IGNITION); boolean oldIgnition = false; - Object oldIgnitionObject = null; Position lastPosition = Context.getIdentityManager().getLastPosition(position.getDeviceId()); if (lastPosition != null) { - oldIgnitionObject = lastPosition.getAttributes().get(Position.KEY_IGNITION); - } - if (oldIgnitionObject != null && oldIgnitionObject instanceof Boolean) { - oldIgnition = (Boolean) oldIgnitionObject; + oldIgnition = lastPosition.getBoolean(Position.KEY_IGNITION); } if (ignition && !oldIgnition) { |