aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/Context.java3
-rw-r--r--src/main/java/org/traccar/MainModule.java8
-rw-r--r--src/main/java/org/traccar/api/AsyncSocketServlet.java17
-rw-r--r--src/main/java/org/traccar/api/resource/PasswordResource.java81
-rw-r--r--src/main/java/org/traccar/config/Keys.java31
-rw-r--r--src/main/java/org/traccar/database/DataManager.java6
-rw-r--r--src/main/java/org/traccar/database/MailManager.java6
-rw-r--r--src/main/java/org/traccar/database/NotificationManager.java18
-rw-r--r--src/main/java/org/traccar/geocoder/JsonGeocoder.java4
-rw-r--r--src/main/java/org/traccar/geocoder/MapboxGeocoder.java90
-rw-r--r--src/main/java/org/traccar/handler/CopyAttributesHandler.java5
-rw-r--r--src/main/java/org/traccar/handler/GeocoderHandler.java11
-rw-r--r--src/main/java/org/traccar/handler/events/AlertEventHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/events/CommandResultEventHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/events/DriverEventHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/events/FuelDropEventHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/events/GeofenceEventHandler.java4
-rw-r--r--src/main/java/org/traccar/handler/events/IgnitionEventHandler.java4
-rw-r--r--src/main/java/org/traccar/handler/events/MaintenanceEventHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/events/MotionEventHandler.java2
-rw-r--r--src/main/java/org/traccar/handler/events/OverspeedEventHandler.java2
-rw-r--r--src/main/java/org/traccar/model/Calendar.java25
-rw-r--r--src/main/java/org/traccar/model/Command.java2
-rw-r--r--src/main/java/org/traccar/model/Event.java20
-rw-r--r--src/main/java/org/traccar/model/Server.java8
-rw-r--r--src/main/java/org/traccar/notification/NotificationFormatter.java61
-rw-r--r--src/main/java/org/traccar/notification/TextTemplateFormatter.java91
-rw-r--r--src/main/java/org/traccar/notificators/NotificatorFirebase.java3
-rw-r--r--src/main/java/org/traccar/notificators/NotificatorTelegram.java52
-rw-r--r--src/main/java/org/traccar/protocol/AdmProtocolDecoder.java4
-rw-r--r--src/main/java/org/traccar/protocol/AtrackProtocolDecoder.java94
-rw-r--r--src/main/java/org/traccar/protocol/DmtProtocolDecoder.java7
-rw-r--r--src/main/java/org/traccar/protocol/DolphinProtocolDecoder.java24
-rw-r--r--src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java56
-rw-r--r--src/main/java/org/traccar/protocol/FlexibleReportProtocol.java33
-rw-r--r--src/main/java/org/traccar/protocol/FlexibleReportProtocolDecoder.java169
-rw-r--r--src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java177
-rw-r--r--src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java40
-rw-r--r--src/main/java/org/traccar/protocol/Gs100Protocol.java33
-rw-r--r--src/main/java/org/traccar/protocol/Gs100ProtocolDecoder.java138
-rw-r--r--src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java25
-rw-r--r--src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java12
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java53
-rw-r--r--src/main/java/org/traccar/protocol/IotmProtocolDecoder.java207
-rw-r--r--src/main/java/org/traccar/protocol/ItsProtocolDecoder.java35
-rw-r--r--src/main/java/org/traccar/protocol/KhdProtocol.java10
-rw-r--r--src/main/java/org/traccar/protocol/KhdProtocolDecoder.java61
-rw-r--r--src/main/java/org/traccar/protocol/KhdProtocolEncoder.java36
-rw-r--r--src/main/java/org/traccar/protocol/Mavlink2Protocol.java36
-rw-r--r--src/main/java/org/traccar/protocol/Mavlink2ProtocolDecoder.java85
-rw-r--r--src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java33
-rw-r--r--src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java45
-rw-r--r--src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java6
-rw-r--r--src/main/java/org/traccar/protocol/NavtelecomProtocol.java35
-rw-r--r--src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java72
-rw-r--r--src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java25
-rw-r--r--src/main/java/org/traccar/protocol/PluginProtocolDecoder.java9
-rw-r--r--src/main/java/org/traccar/protocol/R12wProtocol.java39
-rw-r--r--src/main/java/org/traccar/protocol/R12wProtocolDecoder.java62
-rw-r--r--src/main/java/org/traccar/protocol/RstProtocolDecoder.java78
-rw-r--r--src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java12
-rw-r--r--src/main/java/org/traccar/protocol/SiwiProtocolDecoder.java35
-rw-r--r--src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java8
-rw-r--r--src/main/java/org/traccar/protocol/StartekProtocol.java46
-rw-r--r--src/main/java/org/traccar/protocol/StartekProtocolDecoder.java171
-rw-r--r--src/main/java/org/traccar/protocol/StartekProtocolEncoder.java56
-rw-r--r--src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java2
-rw-r--r--src/main/java/org/traccar/protocol/TaipPrefixEncoder.java47
-rw-r--r--src/main/java/org/traccar/protocol/TaipProtocol.java4
-rw-r--r--src/main/java/org/traccar/protocol/TaipProtocolDecoder.java2
-rw-r--r--src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java19
-rw-r--r--src/main/java/org/traccar/protocol/ThinkPowerProtocol.java35
-rw-r--r--src/main/java/org/traccar/protocol/ThinkPowerProtocolDecoder.java182
-rw-r--r--src/main/java/org/traccar/protocol/Tk103ProtocolDecoder.java4
-rw-r--r--src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java101
-rw-r--r--src/main/java/org/traccar/protocol/TopinProtocolDecoder.java29
-rw-r--r--src/main/java/org/traccar/protocol/Tr20Protocol.java10
-rw-r--r--src/main/java/org/traccar/protocol/Tr20ProtocolDecoder.java4
-rw-r--r--src/main/java/org/traccar/protocol/UlbotechProtocol.java6
-rw-r--r--src/main/java/org/traccar/protocol/UlbotechProtocolEncoder.java42
-rw-r--r--src/main/java/org/traccar/protocol/UuxProtocol.java35
-rw-r--r--src/main/java/org/traccar/protocol/UuxProtocolDecoder.java95
-rw-r--r--src/main/java/org/traccar/protocol/WialonProtocolDecoder.java26
-rw-r--r--src/main/java/org/traccar/sms/SnsSmsClient.java82
-rw-r--r--src/main/java/org/traccar/web/WebServer.java2
-rw-r--r--src/main/resources/ical4j.properties1
-rw-r--r--src/test/java/org/traccar/geocoder/GeocoderTest.java8
-rw-r--r--src/test/java/org/traccar/protocol/AdmFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/AdmProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/AisProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/AlematicsProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/AnytrekProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/ApelProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/AplicomFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/AplicomProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/AppelloProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/AppletProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/AquilaProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Ardi01ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/ArknavProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/ArknavX8ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/ArnaviFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/ArnaviTextProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/AstraProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/At2000FrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/AtrackFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/AtrackProtocolDecoderTest.java7
-rw-r--r--src/test/java/org/traccar/protocol/AuroProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/AustinNbProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/AutoFonProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/AutoGradeProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/AutoTrackProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/AvemaProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Avl301ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/BceProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/BlackKiteProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/BlueProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/BoxProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/C2stekProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/CalAmpProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/CarTrackProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/CarscopProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/CastelProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/CautelaProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/CellocatorFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/CellocatorProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/CguardProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/CityeasyProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/ContinentalProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/CradlepointProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/DingtekFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/DingtekProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/DishaProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/DmtHttpProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/DmtProtocolDecoderTest.java5
-rw-r--r--src/test/java/org/traccar/protocol/DolphinProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/DwayProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/EasyTrackProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/EasyTrackProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/EelinkProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/EgtsFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/EgtsProtocolDecoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/EnforaProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/EnnfuProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/EsealProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/EskyFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/EskyProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/ExtremTracProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/FifotrackFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java6
-rw-r--r--src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/FlespiProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/FlexCommProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/FlexibleReportProtocolDecoderTest.java21
-rw-r--r--src/test/java/org/traccar/protocol/FlextrackProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/FoxProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/FreedomProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java11
-rw-r--r--src/test/java/org/traccar/protocol/FutureWayFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/FutureWayProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/GalileoFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/GalileoProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/GatorProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/GenxProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Gl100ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Gl200BinaryProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Gl200FrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java8
-rw-r--r--src/test/java/org/traccar/protocol/GlobalSatProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/GlobalSatProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/GlobalstarProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/GnxProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/GoSafeProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Gps056FrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Gps056ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Gps103ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/GpsGateProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/GpsMarkerProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/GpsmtaProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/GranitFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/GranitProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Gs100ProtocolDecoderTest.java24
-rw-r--r--src/test/java/org/traccar/protocol/Gt02ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Gt06FrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java10
-rw-r--r--src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Gt30ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/H02FrameDecoderTest.java6
-rw-r--r--src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java10
-rw-r--r--src/test/java/org/traccar/protocol/HaicomProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/HomtecsProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/HuaShengFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/HuaShengProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/HuabaoFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java8
-rw-r--r--src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/HunterProProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/IdplProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/IntellitracProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/IotmProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/ItsFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java8
-rw-r--r--src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Ivt401ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/JpKorjarProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Jt600FrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java8
-rwxr-xr-xsrc/test/java/org/traccar/protocol/KenjiProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/KhdProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java7
-rw-r--r--src/test/java/org/traccar/protocol/L100FrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/L100ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/LaipacProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/LeafSpyProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/M2cProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/M2mProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/MaestroProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/ManPowerProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Mavlink2ProtocolDecoderTest.java21
-rw-r--r--src/test/java/org/traccar/protocol/MegastekFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/MegastekProtocolDecoderTest.java18
-rw-r--r--src/test/java/org/traccar/protocol/MeiligaoFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/MeiligaoProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/MeitrackFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/MeitrackProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java14
-rw-r--r--src/test/java/org/traccar/protocol/MilesmateProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/MiniFinderProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/MobilogixProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/MoovboxProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/MotorProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/MtxProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/MxtProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/NavigilProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/NavisProtocolDecoderTest.java6
-rw-r--r--src/test/java/org/traccar/protocol/NavisetFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/NavisetProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/NavtelecomProtocolDecoderTest.java18
-rw-r--r--src/test/java/org/traccar/protocol/NeosProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/NetProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/NiotProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/NoranProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/NvsFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/NvsProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/NyitechProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/ObdDongleProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/OigoProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/OkoProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/OmnicommFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/OmnicommProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/OpenGtsProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/OrionProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/OsmAndProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/OutsafeProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/OwnTracksProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/PathAwayProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/PiligrimProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java5
-rw-r--r--src/test/java/org/traccar/protocol/PolteProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/PortmanProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/PortmanProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/PretraceProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/PricolProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/ProgressProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/PstFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/PstProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/PstProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/Pt215ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Pt3000ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Pt502FrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Pt502ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java8
-rw-r--r--src/test/java/org/traccar/protocol/Pt60ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/R12wProtocolDecoderTest.java18
-rw-r--r--src/test/java/org/traccar/protocol/RaceDynamicsProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/RadarProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/RaveonProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/RecodaProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/RetranslatorProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/RitiProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/RoboTrackFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/RoboTrackProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/RstProtocolDecoderTest.java5
-rw-r--r--src/test/java/org/traccar/protocol/RuptelaProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/S168ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/SabertekFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/SabertekProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/SanavProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/SanulProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/SatsolProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/SiwiProtocolDecoderTest.java11
-rw-r--r--src/test/java/org/traccar/protocol/SkypatrolProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/SmartSoleProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/SmokeyProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/SolarPoweredProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/SpotProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java8
-rw-r--r--src/test/java/org/traccar/protocol/StarcomProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/StartekProtocolDecoderTest.java29
-rw-r--r--src/test/java/org/traccar/protocol/StartekProtocolEncoderTest.java24
-rw-r--r--src/test/java/org/traccar/protocol/Stl060ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/SuntechFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java14
-rwxr-xr-xsrc/test/java/org/traccar/protocol/SupermateProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/SviasProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/SwiftechProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/T55ProtocolDecoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/T57FrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/T57ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TechTltProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TekFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TekProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TelemaxProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TelicFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TelicProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TeltonikaFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java12
-rw-r--r--src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/ThinkPowerProtocolDecoderTest.java27
-rw-r--r--src/test/java/org/traccar/protocol/ThinkRaceProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Tk102ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Tk103FrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Tk103ProtocolDecoderTest.java5
-rw-r--r--src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java40
-rw-r--r--src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java14
-rw-r--r--src/test/java/org/traccar/protocol/TlvProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TmgFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TmgProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TopflytechProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java8
-rw-r--r--src/test/java/org/traccar/protocol/TotemFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TotemProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Tr20ProtocolDecoderTest.java5
-rw-r--r--src/test/java/org/traccar/protocol/Tr900ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TrackboxProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TrakMateProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TramigoFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TramigoProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Tt8850ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TytanProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/TzoneProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/UlbotechFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/UlbotechProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/UlbotechProtocolEncoderTest.java23
-rw-r--r--src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/UuxProtocolDecoderTest.java18
-rw-r--r--src/test/java/org/traccar/protocol/V680ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/VisiontekProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/VnetProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Vt200FrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Vt200ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/VtfmsFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/VtfmsProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/WatchFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/WialonProtocolDecoderTest.java5
-rw-r--r--src/test/java/org/traccar/protocol/WliFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/WliProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/WondexFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/WondexProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/WristbandProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/XexunFrameDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/XexunProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/XirgoProtocolDecoderTest.java6
-rw-r--r--src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Xrb28ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/Xt013ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Xt2400ProtocolDecoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/YwtProtocolDecoderTest.java2
397 files changed, 3634 insertions, 798 deletions
diff --git a/src/main/java/org/traccar/Context.java b/src/main/java/org/traccar/Context.java
index 3ba8843f0..fe494dabf 100644
--- a/src/main/java/org/traccar/Context.java
+++ b/src/main/java/org/traccar/Context.java
@@ -60,6 +60,7 @@ import org.traccar.reports.model.TripsConfig;
import org.traccar.schedule.ScheduleManager;
import org.traccar.sms.HttpSmsClient;
import org.traccar.sms.SmsManager;
+import org.traccar.sms.SnsSmsClient;
import org.traccar.web.WebServer;
import javax.ws.rs.client.Client;
@@ -317,6 +318,8 @@ public final class Context {
if (config.hasKey(Keys.SMS_HTTP_URL)) {
smsManager = new HttpSmsClient();
+ } else if (config.hasKey(Keys.SMS_AWS_REGION)) {
+ smsManager = new SnsSmsClient();
}
initEventsModule();
diff --git a/src/main/java/org/traccar/MainModule.java b/src/main/java/org/traccar/MainModule.java
index 77f0c89d1..350af6bd7 100644
--- a/src/main/java/org/traccar/MainModule.java
+++ b/src/main/java/org/traccar/MainModule.java
@@ -45,6 +45,7 @@ import org.traccar.geocoder.NominatimGeocoder;
import org.traccar.geocoder.OpenCageGeocoder;
import org.traccar.geocoder.PositionStackGeocoder;
import org.traccar.geocoder.TomTomGeocoder;
+import org.traccar.geocoder.MapboxGeocoder;
import org.traccar.geolocation.GeolocationProvider;
import org.traccar.geolocation.GoogleGeolocationProvider;
import org.traccar.geolocation.MozillaGeolocationProvider;
@@ -184,6 +185,8 @@ public class MainModule extends AbstractModule {
return new TomTomGeocoder(url, key, cacheSize, addressFormat);
case "positionstack":
return new PositionStackGeocoder(key, cacheSize, addressFormat);
+ case "mapbox":
+ return new MapboxGeocoder(key, cacheSize, addressFormat);
default:
return new GoogleGeocoder(key, language, cacheSize, addressFormat);
}
@@ -283,10 +286,9 @@ public class MainModule extends AbstractModule {
@Singleton
@Provides
public static GeocoderHandler provideGeocoderHandler(
- Config config, @Nullable Geocoder geocoder, IdentityManager identityManager,
- StatisticsManager statisticsManager) {
+ Config config, @Nullable Geocoder geocoder, IdentityManager identityManager) {
if (geocoder != null) {
- return new GeocoderHandler(config, geocoder, identityManager, statisticsManager);
+ return new GeocoderHandler(config, geocoder, identityManager);
}
return null;
}
diff --git a/src/main/java/org/traccar/api/AsyncSocketServlet.java b/src/main/java/org/traccar/api/AsyncSocketServlet.java
index 490fc89fc..a964ead10 100644
--- a/src/main/java/org/traccar/api/AsyncSocketServlet.java
+++ b/src/main/java/org/traccar/api/AsyncSocketServlet.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,20 +15,23 @@
*/
package org.traccar.api;
-import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
-import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
+import org.eclipse.jetty.websocket.server.JettyWebSocketServlet;
+import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory;
import org.traccar.Context;
import org.traccar.api.resource.SessionResource;
import org.traccar.config.Keys;
-public class AsyncSocketServlet extends WebSocketServlet {
+import javax.servlet.http.HttpSession;
+import java.time.Duration;
+
+public class AsyncSocketServlet extends JettyWebSocketServlet {
@Override
- public void configure(WebSocketServletFactory factory) {
- factory.getPolicy().setIdleTimeout(Context.getConfig().getLong(Keys.WEB_TIMEOUT));
+ public void configure(JettyWebSocketServletFactory factory) {
+ factory.setIdleTimeout(Duration.ofMillis(Context.getConfig().getLong(Keys.WEB_TIMEOUT)));
factory.setCreator((req, resp) -> {
if (req.getSession() != null) {
- long userId = (Long) req.getSession().getAttribute(SessionResource.USER_ID_KEY);
+ long userId = (Long) ((HttpSession) req.getSession()).getAttribute(SessionResource.USER_ID_KEY);
return new AsyncSocket(userId);
} else {
return null;
diff --git a/src/main/java/org/traccar/api/resource/PasswordResource.java b/src/main/java/org/traccar/api/resource/PasswordResource.java
new file mode 100644
index 000000000..20e8d768d
--- /dev/null
+++ b/src/main/java/org/traccar/api/resource/PasswordResource.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.api.resource;
+
+import org.apache.velocity.VelocityContext;
+import org.traccar.Context;
+import org.traccar.api.BaseResource;
+import org.traccar.model.User;
+import org.traccar.notification.FullMessage;
+import org.traccar.notification.TextTemplateFormatter;
+
+import javax.annotation.security.PermitAll;
+import javax.mail.MessagingException;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.sql.SQLException;
+import java.util.UUID;
+
+@Path("password")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
+public class PasswordResource extends BaseResource {
+
+ private static final String PASSWORD_RESET_TOKEN = "passwordToken";
+
+ @Path("reset")
+ @PermitAll
+ @POST
+ public Response reset(@FormParam("email") String email) throws SQLException, MessagingException {
+ for (long userId : Context.getUsersManager().getAllItems()) {
+ User user = Context.getUsersManager().getById(userId);
+ if (email.equals(user.getEmail())) {
+ String token = UUID.randomUUID().toString().replaceAll("-", "");
+ user.set(PASSWORD_RESET_TOKEN, token);
+ Context.getUsersManager().updateItem(user);
+ VelocityContext velocityContext = TextTemplateFormatter.prepareContext(null);
+ velocityContext.put("token", token);
+ FullMessage message = TextTemplateFormatter.formatFullMessage(velocityContext, "passwordReset");
+ Context.getMailManager().sendMessage(userId, message.getSubject(), message.getBody());
+ break;
+ }
+ }
+ return Response.ok().build();
+ }
+
+ @Path("update")
+ @PermitAll
+ @POST
+ public Response update(
+ @FormParam("token") String token, @FormParam("password") String password) throws SQLException {
+ for (long userId : Context.getUsersManager().getAllItems()) {
+ User user = Context.getUsersManager().getById(userId);
+ if (token.equals(user.getString(PASSWORD_RESET_TOKEN))) {
+ user.getAttributes().remove(PASSWORD_RESET_TOKEN);
+ user.setPassword(password);
+ Context.getUsersManager().updateItem(user);
+ return Response.ok().build();
+ }
+ }
+ return Response.status(Response.Status.NOT_FOUND).build();
+ }
+
+}
diff --git a/src/main/java/org/traccar/config/Keys.java b/src/main/java/org/traccar/config/Keys.java
index 5f8b36c6d..6d2296fb1 100644
--- a/src/main/java/org/traccar/config/Keys.java
+++ b/src/main/java/org/traccar/config/Keys.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2019 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -155,6 +155,13 @@ public final class Keys {
Collections.singletonList(KeyType.GLOBAL));
/**
+ * Indicates whether TAIP protocol should have prefixes for messages.
+ */
+ public static final ConfigSuffix<Boolean> PROTOCOL_PREFIX = new ConfigSuffix<>(
+ ".prefix",
+ Collections.singletonList(KeyType.GLOBAL));
+
+ /**
* Some devices require server address confirmation. Use this parameter to configure correct public address.
*/
public static final ConfigSuffix<String> PROTOCOL_SERVER = new ConfigSuffix<>(
@@ -688,6 +695,28 @@ public final class Keys {
Collections.singletonList(KeyType.GLOBAL));
/**
+ * AWS Access Key with SNS permission.
+ */
+ public static final ConfigKey<String> SMS_AWS_ACCESS = new ConfigKey<>(
+ "sms.aws.access",
+ Collections.singletonList(KeyType.GLOBAL));
+
+ /**
+ * AWS Secret Access Key with SNS permission.
+ */
+ public static final ConfigKey<String> SMS_AWS_SECRET = new ConfigKey<>(
+ "sms.aws.secret",
+ Collections.singletonList(KeyType.GLOBAL));
+
+ /**
+ * AWS Region for SNS service.
+ * Make sure to use regions that are supported for messaging.
+ */
+ public static final ConfigKey<String> SMS_AWS_REGION = new ConfigKey<>(
+ "sms.aws.region",
+ Collections.singletonList(KeyType.GLOBAL));
+
+ /**
* Traccar notification API key.
*/
public static final ConfigKey<String> NOTIFICATOR_TRACCAR_KEY = new ConfigKey<>(
diff --git a/src/main/java/org/traccar/database/DataManager.java b/src/main/java/org/traccar/database/DataManager.java
index a3b31350f..15137ad91 100644
--- a/src/main/java/org/traccar/database/DataManager.java
+++ b/src/main/java/org/traccar/database/DataManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -272,11 +272,11 @@ public class DataManager {
return result;
}
- private void initDatabaseSchema() throws SQLException, LiquibaseException {
+ private void initDatabaseSchema() throws LiquibaseException {
if (config.hasKey(Keys.DATABASE_CHANGELOG)) {
- ResourceAccessor resourceAccessor = new FileSystemResourceAccessor();
+ ResourceAccessor resourceAccessor = new FileSystemResourceAccessor(new File("."));
Database database = DatabaseFactory.getInstance().openDatabase(
config.getString(Keys.DATABASE_URL),
diff --git a/src/main/java/org/traccar/database/MailManager.java b/src/main/java/org/traccar/database/MailManager.java
index 8a2f002cd..d94f55cda 100644
--- a/src/main/java/org/traccar/database/MailManager.java
+++ b/src/main/java/org/traccar/database/MailManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2021 Anton Tananaev (anton@traccar.org)
* Copyright 2017 - 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -87,6 +87,10 @@ public final class MailManager {
return properties;
}
+ public boolean getEmailEnabled() {
+ return Context.getConfig().hasKey("mail.smtp.host");
+ }
+
public void sendMessage(
long userId, String subject, String body) throws MessagingException {
sendMessage(userId, subject, body, null);
diff --git a/src/main/java/org/traccar/database/NotificationManager.java b/src/main/java/org/traccar/database/NotificationManager.java
index ccad192f6..9f9a83cd2 100644
--- a/src/main/java/org/traccar/database/NotificationManager.java
+++ b/src/main/java/org/traccar/database/NotificationManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2021 Anton Tananaev (anton@traccar.org)
* Copyright 2016 - 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -41,7 +41,7 @@ public class NotificationManager extends ExtendedObjectManager<Notification> {
private static final Logger LOGGER = LoggerFactory.getLogger(NotificationManager.class);
- private boolean geocodeOnRequest;
+ private final boolean geocodeOnRequest;
public NotificationManager(DataManager dataManager) {
super(dataManager, Notification.class);
@@ -70,11 +70,6 @@ public class NotificationManager extends ExtendedObjectManager<Notification> {
LOGGER.warn("Event save error", error);
}
- if (position != null && geocodeOnRequest && Context.getGeocoder() != null && position.getAddress() == null) {
- position.setAddress(Context.getGeocoder()
- .getAddress(position.getLatitude(), position.getLongitude(), null));
- }
-
long deviceId = event.getDeviceId();
Set<Long> users = Context.getPermissionsManager().getDeviceUsers(deviceId);
Set<Long> usersToForward = null;
@@ -90,7 +85,7 @@ public class NotificationManager extends ExtendedObjectManager<Notification> {
usersToForward.add(userId);
}
final Set<String> notificators = new HashSet<>();
- for (long notificationId : getEffectiveNotifications(userId, deviceId, event.getServerTime())) {
+ for (long notificationId : getEffectiveNotifications(userId, deviceId, event.getEventTime())) {
Notification notification = getById(notificationId);
if (getById(notificationId).getType().equals(event.getType())) {
boolean filter = false;
@@ -108,6 +103,13 @@ public class NotificationManager extends ExtendedObjectManager<Notification> {
}
}
}
+
+ if (position != null && position.getAddress() == null
+ && geocodeOnRequest && Context.getGeocoder() != null) {
+ position.setAddress(Context.getGeocoder()
+ .getAddress(position.getLatitude(), position.getLongitude(), null));
+ }
+
for (String notificator : notificators) {
Context.getNotificatorManager().getNotificator(notificator).sendAsync(userId, event, position);
}
diff --git a/src/main/java/org/traccar/geocoder/JsonGeocoder.java b/src/main/java/org/traccar/geocoder/JsonGeocoder.java
index 8c442def3..4f34fb973 100644
--- a/src/main/java/org/traccar/geocoder/JsonGeocoder.java
+++ b/src/main/java/org/traccar/geocoder/JsonGeocoder.java
@@ -18,6 +18,8 @@ package org.traccar.geocoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.traccar.Context;
+import org.traccar.Main;
+import org.traccar.database.StatisticsManager;
import javax.json.JsonObject;
import javax.ws.rs.ClientErrorException;
@@ -95,6 +97,8 @@ public abstract class JsonGeocoder implements Geocoder {
}
}
+ Main.getInjector().getInstance(StatisticsManager.class).registerGeocoderRequest();
+
Invocation.Builder request = Context.getClient().target(String.format(url, latitude, longitude)).request();
if (callback != null) {
diff --git a/src/main/java/org/traccar/geocoder/MapboxGeocoder.java b/src/main/java/org/traccar/geocoder/MapboxGeocoder.java
new file mode 100644
index 000000000..9b987c9d8
--- /dev/null
+++ b/src/main/java/org/traccar/geocoder/MapboxGeocoder.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2021 Rafael Miquelino (rafaelmiquelino@gmail.com)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.geocoder;
+
+import javax.json.JsonArray;
+import javax.json.JsonObject;
+import javax.json.JsonString;
+
+public class MapboxGeocoder extends JsonGeocoder {
+
+ private static String formatUrl(String key) {
+ return "https://api.mapbox.com/geocoding/v5/mapbox.places/%2$f,%1$f.json?access_token=" + key;
+ }
+
+ public MapboxGeocoder(String key, int cacheSize, AddressFormat addressFormat) {
+ super(formatUrl(key), cacheSize, addressFormat);
+ }
+
+ @Override
+ public Address parseAddress(JsonObject json) {
+ JsonArray features = json.getJsonArray("features");
+
+ if (!features.isEmpty()) {
+ Address address = new Address();
+
+ JsonObject mostSpecificFeature = (JsonObject) features.get(0);
+
+ if (mostSpecificFeature.containsKey("place_name")) {
+ address.setFormattedAddress(mostSpecificFeature.getString("place_name"));
+ }
+
+ if (mostSpecificFeature.containsKey("address")) {
+ address.setHouse(mostSpecificFeature.getString("address"));
+ }
+
+ for (JsonObject feature : features.getValuesAs(JsonObject.class)) {
+
+ String value = feature.getString("text");
+
+ typesLoop:
+ for (JsonString type : feature.getJsonArray("place_type").getValuesAs(JsonString.class)) {
+
+ switch (type.getString()) {
+ case "address":
+ address.setStreet(value);
+ break typesLoop;
+ case "neighborhood":
+ address.setSuburb(value);
+ break typesLoop;
+ case "postcode":
+ address.setPostcode(value);
+ break typesLoop;
+ case "locality":
+ address.setSettlement(value);
+ break typesLoop;
+ case "district":
+ case "place":
+ address.setDistrict(value);
+ break typesLoop;
+ case "region":
+ address.setState(value);
+ break typesLoop;
+ case "country":
+ address.setCountry(value);
+ break typesLoop;
+ default:
+ break;
+ }
+ }
+ }
+
+ return address;
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/org/traccar/handler/CopyAttributesHandler.java b/src/main/java/org/traccar/handler/CopyAttributesHandler.java
index 3cd7d144d..f386116b0 100644
--- a/src/main/java/org/traccar/handler/CopyAttributesHandler.java
+++ b/src/main/java/org/traccar/handler/CopyAttributesHandler.java
@@ -34,11 +34,6 @@ public class CopyAttributesHandler extends BaseDataHandler {
protected Position handlePosition(Position position) {
String attributesString = identityManager.lookupAttributeString(
position.getDeviceId(), "processing.copyAttributes", "", false, true);
- if (attributesString.isEmpty()) {
- attributesString = Position.KEY_DRIVER_UNIQUE_ID;
- } else {
- attributesString += "," + Position.KEY_DRIVER_UNIQUE_ID;
- }
Position last = identityManager.getLastPosition(position.getDeviceId());
if (last != null) {
for (String attribute : attributesString.split("[ ,]")) {
diff --git a/src/main/java/org/traccar/handler/GeocoderHandler.java b/src/main/java/org/traccar/handler/GeocoderHandler.java
index b96f01b3a..614cf97d6 100644
--- a/src/main/java/org/traccar/handler/GeocoderHandler.java
+++ b/src/main/java/org/traccar/handler/GeocoderHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,6 @@ import org.traccar.Context;
import org.traccar.config.Config;
import org.traccar.config.Keys;
import org.traccar.database.IdentityManager;
-import org.traccar.database.StatisticsManager;
import org.traccar.geocoder.Geocoder;
import org.traccar.model.Position;
@@ -35,16 +34,14 @@ public class GeocoderHandler extends ChannelInboundHandlerAdapter {
private final Geocoder geocoder;
private final IdentityManager identityManager;
- private final StatisticsManager statisticsManager;
private final boolean ignorePositions;
private final boolean processInvalidPositions;
private final int geocoderReuseDistance;
public GeocoderHandler(
- Config config, Geocoder geocoder, IdentityManager identityManager, StatisticsManager statisticsManager) {
+ Config config, Geocoder geocoder, IdentityManager identityManager) {
this.geocoder = geocoder;
this.identityManager = identityManager;
- this.statisticsManager = statisticsManager;
ignorePositions = Context.getConfig().getBoolean(Keys.GEOCODER_IGNORE_POSITIONS);
processInvalidPositions = config.getBoolean(Keys.GEOCODER_PROCESS_INVALID_POSITIONS);
geocoderReuseDistance = config.getInteger(Keys.GEOCODER_REUSE_DISTANCE, 0);
@@ -65,10 +62,6 @@ public class GeocoderHandler extends ChannelInboundHandlerAdapter {
}
}
- if (statisticsManager != null) {
- statisticsManager.registerGeocoderRequest();
- }
-
geocoder.getAddress(position.getLatitude(), position.getLongitude(),
new Geocoder.ReverseGeocoderCallback() {
@Override
diff --git a/src/main/java/org/traccar/handler/events/AlertEventHandler.java b/src/main/java/org/traccar/handler/events/AlertEventHandler.java
index 0b7c8d23e..05dbc516e 100644
--- a/src/main/java/org/traccar/handler/events/AlertEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/AlertEventHandler.java
@@ -48,7 +48,7 @@ public class AlertEventHandler extends BaseEventHandler {
}
}
if (!ignoreAlert) {
- Event event = new Event(Event.TYPE_ALARM, position.getDeviceId(), position.getId());
+ Event event = new Event(Event.TYPE_ALARM, position);
event.set(Position.KEY_ALARM, (String) alarm);
return Collections.singletonMap(event, position);
}
diff --git a/src/main/java/org/traccar/handler/events/CommandResultEventHandler.java b/src/main/java/org/traccar/handler/events/CommandResultEventHandler.java
index cfe676653..9b7ff554e 100644
--- a/src/main/java/org/traccar/handler/events/CommandResultEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/CommandResultEventHandler.java
@@ -29,7 +29,7 @@ public class CommandResultEventHandler extends BaseEventHandler {
protected Map<Event, Position> analyzePosition(Position position) {
Object commandResult = position.getAttributes().get(Position.KEY_RESULT);
if (commandResult != null) {
- Event event = new Event(Event.TYPE_COMMAND_RESULT, position.getDeviceId(), position.getId());
+ Event event = new Event(Event.TYPE_COMMAND_RESULT, position);
event.set(Position.KEY_RESULT, (String) commandResult);
return Collections.singletonMap(event, position);
}
diff --git a/src/main/java/org/traccar/handler/events/DriverEventHandler.java b/src/main/java/org/traccar/handler/events/DriverEventHandler.java
index 994df93fa..6fdf4246b 100644
--- a/src/main/java/org/traccar/handler/events/DriverEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/DriverEventHandler.java
@@ -46,7 +46,7 @@ public class DriverEventHandler extends BaseEventHandler {
oldDriverUniqueId = lastPosition.getString(Position.KEY_DRIVER_UNIQUE_ID);
}
if (!driverUniqueId.equals(oldDriverUniqueId)) {
- Event event = new Event(Event.TYPE_DRIVER_CHANGED, position.getDeviceId(), position.getId());
+ Event event = new Event(Event.TYPE_DRIVER_CHANGED, position);
event.set(Position.KEY_DRIVER_UNIQUE_ID, driverUniqueId);
return Collections.singletonMap(event, position);
}
diff --git a/src/main/java/org/traccar/handler/events/FuelDropEventHandler.java b/src/main/java/org/traccar/handler/events/FuelDropEventHandler.java
index bc1426b86..343a17311 100644
--- a/src/main/java/org/traccar/handler/events/FuelDropEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/FuelDropEventHandler.java
@@ -57,7 +57,7 @@ public class FuelDropEventHandler extends BaseEventHandler {
double drop = lastPosition.getDouble(Position.KEY_FUEL_LEVEL)
- position.getDouble(Position.KEY_FUEL_LEVEL);
if (drop >= fuelDropThreshold) {
- Event event = new Event(Event.TYPE_DEVICE_FUEL_DROP, position.getDeviceId(), position.getId());
+ Event event = new Event(Event.TYPE_DEVICE_FUEL_DROP, position);
event.set(ATTRIBUTE_FUEL_DROP_THRESHOLD, fuelDropThreshold);
return Collections.singletonMap(event, position);
}
diff --git a/src/main/java/org/traccar/handler/events/GeofenceEventHandler.java b/src/main/java/org/traccar/handler/events/GeofenceEventHandler.java
index 067c97957..f4807e56b 100644
--- a/src/main/java/org/traccar/handler/events/GeofenceEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/GeofenceEventHandler.java
@@ -69,7 +69,7 @@ public class GeofenceEventHandler extends BaseEventHandler {
long calendarId = geofenceManager.getById(geofenceId).getCalendarId();
Calendar calendar = calendarId != 0 ? calendarManager.getById(calendarId) : null;
if (calendar == null || calendar.checkMoment(position.getFixTime())) {
- Event event = new Event(Event.TYPE_GEOFENCE_EXIT, position.getDeviceId(), position.getId());
+ Event event = new Event(Event.TYPE_GEOFENCE_EXIT, position);
event.setGeofenceId(geofenceId);
events.put(event, position);
}
@@ -78,7 +78,7 @@ public class GeofenceEventHandler extends BaseEventHandler {
long calendarId = geofenceManager.getById(geofenceId).getCalendarId();
Calendar calendar = calendarId != 0 ? calendarManager.getById(calendarId) : null;
if (calendar == null || calendar.checkMoment(position.getFixTime())) {
- Event event = new Event(Event.TYPE_GEOFENCE_ENTER, position.getDeviceId(), position.getId());
+ Event event = new Event(Event.TYPE_GEOFENCE_ENTER, position);
event.setGeofenceId(geofenceId);
events.put(event, position);
}
diff --git a/src/main/java/org/traccar/handler/events/IgnitionEventHandler.java b/src/main/java/org/traccar/handler/events/IgnitionEventHandler.java
index ec133bafc..69df9a46b 100644
--- a/src/main/java/org/traccar/handler/events/IgnitionEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/IgnitionEventHandler.java
@@ -52,10 +52,10 @@ public class IgnitionEventHandler extends BaseEventHandler {
if (ignition && !oldIgnition) {
result = Collections.singletonMap(
- new Event(Event.TYPE_IGNITION_ON, position.getDeviceId(), position.getId()), position);
+ new Event(Event.TYPE_IGNITION_ON, position), position);
} else if (!ignition && oldIgnition) {
result = Collections.singletonMap(
- new Event(Event.TYPE_IGNITION_OFF, position.getDeviceId(), position.getId()), position);
+ new Event(Event.TYPE_IGNITION_OFF, position), position);
}
}
}
diff --git a/src/main/java/org/traccar/handler/events/MaintenanceEventHandler.java b/src/main/java/org/traccar/handler/events/MaintenanceEventHandler.java
index 93ae74142..0f960ad1f 100644
--- a/src/main/java/org/traccar/handler/events/MaintenanceEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/MaintenanceEventHandler.java
@@ -58,7 +58,7 @@ public class MaintenanceEventHandler extends BaseEventHandler {
if (oldValue != 0.0 && newValue != 0.0
&& (long) ((oldValue - maintenance.getStart()) / maintenance.getPeriod())
< (long) ((newValue - maintenance.getStart()) / maintenance.getPeriod())) {
- Event event = new Event(Event.TYPE_MAINTENANCE, position.getDeviceId(), position.getId());
+ Event event = new Event(Event.TYPE_MAINTENANCE, position);
event.setMaintenanceId(maintenanceId);
event.set(maintenance.getType(), newValue);
events.put(event, position);
diff --git a/src/main/java/org/traccar/handler/events/MotionEventHandler.java b/src/main/java/org/traccar/handler/events/MotionEventHandler.java
index 9ec02ccfb..db276f32b 100644
--- a/src/main/java/org/traccar/handler/events/MotionEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/MotionEventHandler.java
@@ -45,7 +45,7 @@ public class MotionEventHandler extends BaseEventHandler {
private Map<Event, Position> newEvent(DeviceState deviceState, boolean newMotion) {
String eventType = newMotion ? Event.TYPE_DEVICE_MOVING : Event.TYPE_DEVICE_STOPPED;
Position position = deviceState.getMotionPosition();
- Event event = new Event(eventType, position.getDeviceId(), position.getId());
+ Event event = new Event(eventType, position);
deviceState.setMotionState(newMotion);
deviceState.setMotionPosition(null);
return Collections.singletonMap(event, position);
diff --git a/src/main/java/org/traccar/handler/events/OverspeedEventHandler.java b/src/main/java/org/traccar/handler/events/OverspeedEventHandler.java
index c396b28e9..347ad9005 100644
--- a/src/main/java/org/traccar/handler/events/OverspeedEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/OverspeedEventHandler.java
@@ -53,7 +53,7 @@ public class OverspeedEventHandler extends BaseEventHandler {
private Map<Event, Position> newEvent(DeviceState deviceState, double speedLimit) {
Position position = deviceState.getOverspeedPosition();
- Event event = new Event(Event.TYPE_DEVICE_OVERSPEED, position.getDeviceId(), position.getId());
+ Event event = new Event(Event.TYPE_DEVICE_OVERSPEED, position);
event.set(ATTRIBUTE_SPEED, deviceState.getOverspeedPosition().getSpeed());
event.set(ATTRIBUTE_SPEED_LIMIT, speedLimit);
event.setGeofenceId(deviceState.getOverspeedGeofenceId());
diff --git a/src/main/java/org/traccar/model/Calendar.java b/src/main/java/org/traccar/model/Calendar.java
index 56d3eb74c..1010325b6 100644
--- a/src/main/java/org/traccar/model/Calendar.java
+++ b/src/main/java/org/traccar/model/Calendar.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2021 Anton Tananaev (anton@traccar.org)
* Copyright 2016 Andrey Kunitsyn (andrey@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,24 +16,22 @@
*/
package org.traccar.model;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Date;
-
import com.fasterxml.jackson.annotation.JsonIgnore;
-
import net.fortuna.ical4j.data.CalendarBuilder;
import net.fortuna.ical4j.data.ParserException;
import net.fortuna.ical4j.filter.Filter;
import net.fortuna.ical4j.filter.PeriodRule;
import net.fortuna.ical4j.model.DateTime;
-import net.fortuna.ical4j.model.Dur;
import net.fortuna.ical4j.model.Period;
import net.fortuna.ical4j.model.component.CalendarComponent;
-import org.apache.commons.collections4.Predicate;
import org.traccar.database.QueryIgnore;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.time.Duration;
+import java.util.Collection;
+import java.util.Date;
+
public class Calendar extends ExtendedModel {
private String name;
@@ -68,13 +66,10 @@ public class Calendar extends ExtendedModel {
public boolean checkMoment(Date date) {
if (calendar != null) {
- Period period = new Period(new DateTime(date), new Dur(0, 0, 0, 0));
- Predicate<CalendarComponent> periodRule = new PeriodRule<>(period);
- Filter<CalendarComponent> filter = new Filter<>(new Predicate[] {periodRule}, Filter.MATCH_ANY);
+ Period period = new Period(new DateTime(date), Duration.ZERO);
+ Filter<CalendarComponent> filter = new Filter<>(new PeriodRule<>(period));
Collection<CalendarComponent> events = filter.filter(calendar.getComponents(CalendarComponent.VEVENT));
- if (events != null && !events.isEmpty()) {
- return true;
- }
+ return events != null && !events.isEmpty();
}
return false;
}
diff --git a/src/main/java/org/traccar/model/Command.java b/src/main/java/org/traccar/model/Command.java
index 099fb152d..99930d1e6 100644
--- a/src/main/java/org/traccar/model/Command.java
+++ b/src/main/java/org/traccar/model/Command.java
@@ -36,6 +36,7 @@ public class Command extends Message implements Cloneable {
public static final String TYPE_REQUEST_PHOTO = "requestPhoto";
public static final String TYPE_POWER_OFF = "powerOff";
public static final String TYPE_REBOOT_DEVICE = "rebootDevice";
+ public static final String TYPE_FACTORY_RESET = "factoryReset";
public static final String TYPE_SEND_SMS = "sendSms";
public static final String TYPE_SEND_USSD = "sendUssd";
public static final String TYPE_SOS_NUMBER = "sosNumber";
@@ -54,6 +55,7 @@ public class Command extends Message implements Cloneable {
public static final String TYPE_SET_ODOMETER = "setOdometer";
public static final String TYPE_GET_MODEM_STATUS = "getModemStatus";
public static final String TYPE_GET_DEVICE_STATUS = "getDeviceStatus";
+ public static final String TYPE_SET_SPEED_LIMIT = "setSpeedLimit";
public static final String TYPE_MODE_POWER_SAVING = "modePowerSaving";
public static final String TYPE_MODE_DEEP_SLEEP = "modeDeepSleep";
diff --git a/src/main/java/org/traccar/model/Event.java b/src/main/java/org/traccar/model/Event.java
index 5eee2a0a0..a7a134ecf 100644
--- a/src/main/java/org/traccar/model/Event.java
+++ b/src/main/java/org/traccar/model/Event.java
@@ -19,15 +19,17 @@ import java.util.Date;
public class Event extends Message {
- public Event(String type, long deviceId, long positionId) {
- this(type, deviceId);
- setPositionId(positionId);
+ public Event(String type, Position position) {
+ setType(type);
+ setPositionId(position.getId());
+ setDeviceId(position.getDeviceId());
+ eventTime = position.getDeviceTime();
}
public Event(String type, long deviceId) {
setType(type);
setDeviceId(deviceId);
- this.serverTime = new Date();
+ eventTime = new Date();
}
public Event() {
@@ -62,14 +64,14 @@ public class Event extends Message {
public static final String TYPE_DRIVER_CHANGED = "driverChanged";
- private Date serverTime;
+ private Date eventTime;
- public Date getServerTime() {
- return serverTime;
+ public Date getEventTime() {
+ return eventTime;
}
- public void setServerTime(Date serverTime) {
- this.serverTime = serverTime;
+ public void setEventTime(Date eventTime) {
+ this.eventTime = eventTime;
}
private long positionId;
diff --git a/src/main/java/org/traccar/model/Server.java b/src/main/java/org/traccar/model/Server.java
index e84943efc..7bdb53b22 100644
--- a/src/main/java/org/traccar/model/Server.java
+++ b/src/main/java/org/traccar/model/Server.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
package org.traccar.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import org.traccar.Context;
import org.traccar.database.QueryIgnore;
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -176,4 +177,9 @@ public class Server extends ExtendedModel {
return getClass().getPackage().getImplementationVersion();
}
+ @QueryIgnore
+ public Boolean getEmailEnabled() {
+ return Context.getMailManager().getEmailEnabled();
+ }
+
}
diff --git a/src/main/java/org/traccar/notification/NotificationFormatter.java b/src/main/java/org/traccar/notification/NotificationFormatter.java
index 2f8100226..dabc75b8b 100644
--- a/src/main/java/org/traccar/notification/NotificationFormatter.java
+++ b/src/main/java/org/traccar/notification/NotificationFormatter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2021 Anton Tananaev (anton@traccar.org)
* Copyright 2017 - 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,18 +16,7 @@
*/
package org.traccar.notification;
-import java.io.StringWriter;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Paths;
-import java.util.Locale;
-
-import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
-import org.apache.velocity.exception.ResourceNotFoundException;
-import org.apache.velocity.tools.generic.DateTool;
-import org.apache.velocity.tools.generic.NumberTool;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.traccar.Context;
import org.traccar.model.Device;
import org.traccar.model.Event;
@@ -37,8 +26,6 @@ import org.traccar.reports.ReportUtils;
public final class NotificationFormatter {
- private static final Logger LOGGER = LoggerFactory.getLogger(NotificationFormatter.class);
-
private NotificationFormatter() {
}
@@ -47,8 +34,8 @@ public final class NotificationFormatter {
User user = Context.getPermissionsManager().getUser(userId);
Device device = Context.getIdentityManager().getById(event.getDeviceId());
- VelocityContext velocityContext = new VelocityContext();
- velocityContext.put("user", user);
+ VelocityContext velocityContext = TextTemplateFormatter.prepareContext(user);
+
velocityContext.put("device", device);
velocityContext.put("event", event);
if (position != null) {
@@ -67,52 +54,18 @@ public final class NotificationFormatter {
if (driverUniqueId != null) {
velocityContext.put("driver", Context.getDriversManager().getDriverByUniqueId(driverUniqueId));
}
- velocityContext.put("webUrl", Context.getVelocityEngine().getProperty("web.url"));
- velocityContext.put("dateTool", new DateTool());
- velocityContext.put("numberTool", new NumberTool());
- velocityContext.put("timezone", ReportUtils.getTimezone(userId));
- velocityContext.put("locale", Locale.getDefault());
- return velocityContext;
- }
-
- public static Template getTemplate(Event event, String path) {
- String templateFilePath;
- Template template;
-
- try {
- templateFilePath = Paths.get(path, event.getType() + ".vm").toString();
- template = Context.getVelocityEngine().getTemplate(templateFilePath, StandardCharsets.UTF_8.name());
- } catch (ResourceNotFoundException error) {
- LOGGER.warn("Notification template error", error);
- templateFilePath = Paths.get(path, "unknown.vm").toString();
- template = Context.getVelocityEngine().getTemplate(templateFilePath, StandardCharsets.UTF_8.name());
- }
- return template;
+ return velocityContext;
}
public static FullMessage formatFullMessage(long userId, Event event, Position position) {
VelocityContext velocityContext = prepareContext(userId, event, position);
- String formattedMessage = formatMessage(velocityContext, userId, event, position, "full");
-
- return new FullMessage((String) velocityContext.get("subject"), formattedMessage);
+ return TextTemplateFormatter.formatFullMessage(velocityContext, event.getType());
}
public static String formatShortMessage(long userId, Event event, Position position) {
- return formatMessage(null, userId, event, position, "short");
- }
-
- private static String formatMessage(VelocityContext vc, Long userId, Event event, Position position,
- String templatePath) {
-
- VelocityContext velocityContext = vc;
- if (velocityContext == null) {
- velocityContext = prepareContext(userId, event, position);
- }
- StringWriter writer = new StringWriter();
- getTemplate(event, templatePath).merge(velocityContext, writer);
-
- return writer.toString();
+ VelocityContext velocityContext = prepareContext(userId, event, position);
+ return TextTemplateFormatter.formatShortMessage(velocityContext, event.getType());
}
}
diff --git a/src/main/java/org/traccar/notification/TextTemplateFormatter.java b/src/main/java/org/traccar/notification/TextTemplateFormatter.java
new file mode 100644
index 000000000..c7cac2d4d
--- /dev/null
+++ b/src/main/java/org/traccar/notification/TextTemplateFormatter.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.notification;
+
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.exception.ResourceNotFoundException;
+import org.apache.velocity.tools.generic.DateTool;
+import org.apache.velocity.tools.generic.NumberTool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.traccar.Context;
+import org.traccar.model.User;
+import org.traccar.reports.ReportUtils;
+
+import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Paths;
+import java.util.Locale;
+
+public final class TextTemplateFormatter {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(TextTemplateFormatter.class);
+
+ private TextTemplateFormatter() {
+ }
+
+ public static VelocityContext prepareContext(User user) {
+
+ VelocityContext velocityContext = new VelocityContext();
+
+ if (user != null) {
+ velocityContext.put("user", user);
+ velocityContext.put("timezone", ReportUtils.getTimezone(user.getId()));
+ }
+
+ velocityContext.put("webUrl", Context.getVelocityEngine().getProperty("web.url"));
+ velocityContext.put("dateTool", new DateTool());
+ velocityContext.put("numberTool", new NumberTool());
+ velocityContext.put("locale", Locale.getDefault());
+
+ return velocityContext;
+ }
+
+ public static Template getTemplate(String name, String path) {
+
+ String templateFilePath;
+ Template template;
+
+ try {
+ templateFilePath = Paths.get(path, name + ".vm").toString();
+ template = Context.getVelocityEngine().getTemplate(templateFilePath, StandardCharsets.UTF_8.name());
+ } catch (ResourceNotFoundException error) {
+ LOGGER.warn("Notification template error", error);
+ templateFilePath = Paths.get(path, "unknown.vm").toString();
+ template = Context.getVelocityEngine().getTemplate(templateFilePath, StandardCharsets.UTF_8.name());
+ }
+ return template;
+ }
+
+ public static FullMessage formatFullMessage(VelocityContext velocityContext, String name) {
+ String formattedMessage = formatMessage(velocityContext, name, "full");
+ return new FullMessage((String) velocityContext.get("subject"), formattedMessage);
+ }
+
+ public static String formatShortMessage(VelocityContext velocityContext, String name) {
+ return formatMessage(velocityContext, name, "short");
+ }
+
+ private static String formatMessage(
+ VelocityContext velocityContext, String name, String templatePath) {
+
+ StringWriter writer = new StringWriter();
+ getTemplate(name, templatePath).merge(velocityContext, writer);
+ return writer.toString();
+ }
+
+}
diff --git a/src/main/java/org/traccar/notificators/NotificatorFirebase.java b/src/main/java/org/traccar/notificators/NotificatorFirebase.java
index 89cdbcb14..78d5da1e2 100644
--- a/src/main/java/org/traccar/notificators/NotificatorFirebase.java
+++ b/src/main/java/org/traccar/notificators/NotificatorFirebase.java
@@ -39,6 +39,8 @@ public class NotificatorFirebase extends Notificator {
public static class Notification {
@JsonProperty("body")
private String body;
+ @JsonProperty("sound")
+ private String sound;
}
public static class Message {
@@ -66,6 +68,7 @@ public class NotificatorFirebase extends Notificator {
Notification notification = new Notification();
notification.body = NotificationFormatter.formatShortMessage(userId, event, position).trim();
+ notification.sound = "default";
Message message = new Message();
message.tokens = user.getString("notificationTokens").split("[, ]");
diff --git a/src/main/java/org/traccar/notificators/NotificatorTelegram.java b/src/main/java/org/traccar/notificators/NotificatorTelegram.java
index 6b8bc426d..963bdb091 100644
--- a/src/main/java/org/traccar/notificators/NotificatorTelegram.java
+++ b/src/main/java/org/traccar/notificators/NotificatorTelegram.java
@@ -31,10 +31,11 @@ public class NotificatorTelegram extends Notificator {
private static final Logger LOGGER = LoggerFactory.getLogger(NotificatorTelegram.class);
- private final String url;
+ private final String urlSendText;
+ private final String urlSendLocation;
private final String chatId;
- public static class Message {
+ public static class TextMessage {
@JsonProperty("chat_id")
private String chatId;
@JsonProperty("text")
@@ -43,20 +44,30 @@ public class NotificatorTelegram extends Notificator {
private String parseMode = "html";
}
+ public static class LocationMessage {
+ @JsonProperty("chat_id")
+ private String chatId;
+ @JsonProperty("latitude")
+ private double latitude;
+ @JsonProperty("longitude")
+ private double longitude;
+ @JsonProperty("horizontal_accuracy")
+ private double accuracy;
+ @JsonProperty("bearing")
+ private int bearing;
+ }
+
public NotificatorTelegram() {
- url = String.format(
+ urlSendText = String.format(
"https://api.telegram.org/bot%s/sendMessage",
Context.getConfig().getString(Keys.NOTIFICATOR_TELEGRAM_KEY));
+ urlSendLocation = String.format(
+ "https://api.telegram.org/bot%s/sendLocation",
+ Context.getConfig().getString(Keys.NOTIFICATOR_TELEGRAM_KEY));
chatId = Context.getConfig().getString(Keys.NOTIFICATOR_TELEGRAM_CHAT_ID);
}
- @Override
- public void sendSync(long userId, Event event, Position position) {
-
- Message message = new Message();
- message.chatId = chatId;
- message.text = NotificationFormatter.formatShortMessage(userId, event, position);
-
+ private void executeRequest(String url, Object message) {
Context.getClient().target(url).request()
.async().post(Entity.json(message), new InvocationCallback<Object>() {
@Override
@@ -70,6 +81,27 @@ public class NotificatorTelegram extends Notificator {
});
}
+ private LocationMessage createLocationMessage(Position position) {
+ LocationMessage locationMessage = new LocationMessage();
+ locationMessage.chatId = chatId;
+ locationMessage.latitude = position.getLatitude();
+ locationMessage.longitude = position.getLongitude();
+ locationMessage.bearing = (int) Math.ceil(position.getCourse());
+ locationMessage.accuracy = position.getAccuracy();
+ return locationMessage;
+ }
+
+ @Override
+ public void sendSync(long userId, Event event, Position position) {
+ if (position != null) {
+ executeRequest(urlSendLocation, createLocationMessage(position));
+ }
+ TextMessage message = new TextMessage();
+ message.chatId = chatId;
+ message.text = NotificationFormatter.formatFullMessage(userId, event, position).getBody();
+ executeRequest(urlSendText, message);
+ }
+
@Override
public void sendAsync(long userId, Event event, Position position) {
sendSync(userId, event, position);
diff --git a/src/main/java/org/traccar/protocol/AdmProtocolDecoder.java b/src/main/java/org/traccar/protocol/AdmProtocolDecoder.java
index 31064286e..7e3478704 100644
--- a/src/main/java/org/traccar/protocol/AdmProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/AdmProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -97,7 +97,7 @@ public class AdmProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(type, 5)) {
for (int i = 1; i <= 3; i++) {
- buf.readUnsignedShortLE(); // fuel level
+ position.set("fuel" + i, buf.readUnsignedShortLE());
}
for (int i = 1; i <= 3; i++) {
position.set(Position.PREFIX_TEMP + i, buf.readUnsignedByte());
diff --git a/src/main/java/org/traccar/protocol/AtrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/AtrackProtocolDecoder.java
index ff7ef6c4a..186b81470 100644
--- a/src/main/java/org/traccar/protocol/AtrackProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/AtrackProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2013 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
package org.traccar.protocol;
import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
@@ -24,6 +25,8 @@ import org.traccar.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
import org.traccar.config.Keys;
+import org.traccar.helper.BitUtil;
+import org.traccar.helper.DataConverter;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
@@ -115,6 +118,89 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
return result;
}
+ private void decodeBeaconData(Position position, int mode, int mask, ByteBuf data) {
+ int i = 1;
+ while (data.isReadable()) {
+ if (BitUtil.check(mask, 7)) {
+ position.set("tag" + i + "Id", ByteBufUtil.hexDump(data.readSlice(6)));
+ }
+ switch (mode) {
+ case 1:
+ if (BitUtil.check(mask, 6)) {
+ data.readUnsignedShort(); // major
+ }
+ if (BitUtil.check(mask, 5)) {
+ data.readUnsignedShort(); // minor
+ }
+ if (BitUtil.check(mask, 4)) {
+ data.readUnsignedByte(); // tx power
+ }
+ if (BitUtil.check(mask, 3)) {
+ position.set("tag" + i + "Rssi", data.readUnsignedByte());
+ }
+ break;
+ case 2:
+ if (BitUtil.check(mask, 6)) {
+ data.readUnsignedShort(); // battery voltage
+ }
+ if (BitUtil.check(mask, 5)) {
+ position.set("tag" + i + "Temp", data.readUnsignedShort());
+ }
+ if (BitUtil.check(mask, 4)) {
+ data.readUnsignedByte(); // tx power
+ }
+ if (BitUtil.check(mask, 3)) {
+ position.set("tag" + i + "Rssi", data.readUnsignedByte());
+ }
+ break;
+ case 3:
+ if (BitUtil.check(mask, 6)) {
+ position.set("tag" + i + "Humidity", data.readUnsignedShort());
+ }
+ if (BitUtil.check(mask, 5)) {
+ position.set("tag" + i + "Temp", data.readUnsignedShort());
+ }
+ if (BitUtil.check(mask, 3)) {
+ position.set("tag" + i + "Rssi", data.readUnsignedByte());
+ }
+ if (BitUtil.check(mask, 2)) {
+ data.readUnsignedShort();
+ }
+ break;
+ case 4:
+ if (BitUtil.check(mask, 6)) {
+ int hardwareId = data.readUnsignedByte();
+ if (BitUtil.check(mask, 5)) {
+ switch (hardwareId) {
+ case 1:
+ case 4:
+ data.skipBytes(11); // fuel
+ break;
+ case 2:
+ data.skipBytes(2); // temperature
+ break;
+ case 3:
+ data.skipBytes(6); // temperature and luminosity
+ break;
+ case 5:
+ data.skipBytes(10); // temperature, humidity, luminosity and pressure
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ if (BitUtil.check(mask, 4)) {
+ data.skipBytes(9); // name
+ }
+ break;
+ default:
+ break;
+ }
+ i += 1;
+ }
+ }
+
private void readTextCustomData(Position position, String data, String form) {
CellTower cellTower = new CellTower();
String[] keys = form.substring(1).split("%");
@@ -208,6 +294,12 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
case "MT":
position.set(Position.KEY_MOTION, Integer.parseInt(values[i]) > 0);
break;
+ case "BC":
+ String[] beaconValues = values[i].split(":");
+ decodeBeaconData(
+ position, Integer.parseInt(beaconValues[0]), Integer.parseInt(beaconValues[1]),
+ Unpooled.wrappedBuffer(DataConverter.parseHex(beaconValues[2])));
+ break;
default:
break;
}
diff --git a/src/main/java/org/traccar/protocol/DmtProtocolDecoder.java b/src/main/java/org/traccar/protocol/DmtProtocolDecoder.java
index 75fdc3253..96b06557a 100644
--- a/src/main/java/org/traccar/protocol/DmtProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/DmtProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 - 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -197,7 +197,8 @@ public class DmtProtocolDecoder extends BaseProtocolDecoder {
} else if (fieldId == 6) {
while (buf.readerIndex() < fieldEnd) {
- switch (buf.readUnsignedByte()) {
+ int number = buf.readUnsignedByte();
+ switch (number) {
case 1:
position.set(Position.KEY_BATTERY, buf.readUnsignedShortLE() * 0.001);
break;
@@ -214,7 +215,7 @@ public class DmtProtocolDecoder extends BaseProtocolDecoder {
position.set("solarPower", buf.readUnsignedShortLE() * 0.001);
break;
default:
- buf.readUnsignedShortLE(); // other
+ position.set(Position.PREFIX_IO + number, buf.readUnsignedShortLE());
break;
}
}
diff --git a/src/main/java/org/traccar/protocol/DolphinProtocolDecoder.java b/src/main/java/org/traccar/protocol/DolphinProtocolDecoder.java
index 56d9314b2..e882c2378 100644
--- a/src/main/java/org/traccar/protocol/DolphinProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/DolphinProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2020 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +17,11 @@ package org.traccar.protocol;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
+import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
+import org.traccar.NetworkMessage;
import org.traccar.Protocol;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.Position;
@@ -43,7 +45,7 @@ public class DolphinProtocolDecoder extends BaseProtocolDecoder {
ByteBuf buf = (ByteBuf) msg;
buf.readUnsignedShort(); // header
- buf.readUnsignedIntLE(); // index
+ int index = (int) buf.readUnsignedIntLE();
buf.readUnsignedShort(); // version
buf.readUnsignedShort(); // flags
int type = buf.readUnsignedShortLE();
@@ -61,6 +63,24 @@ public class DolphinProtocolDecoder extends BaseProtocolDecoder {
DolphinMessages.DataPackRequest message = DolphinMessages.DataPackRequest.parseFrom(
ByteBufUtil.getBytes(buf, buf.readerIndex(), length, false));
+ if (channel != null) {
+ byte[] responseData = DolphinMessages.DataPackResponse.newBuilder()
+ .setResponse(DolphinMessages.DataPackResponseCode.DataPack_OK)
+ .build()
+ .toByteArray();
+
+ ByteBuf response = Unpooled.buffer();
+ response.writeShort(0xABAB); // header
+ response.writeIntLE(index);
+ response.writeShort(0); // flags
+ response.writeShortLE(DolphinMessages.MessageType.DataPack_Response.getNumber());
+ response.writeIntLE(responseData.length);
+ response.writeIntLE(0); // reserved
+ response.writeBytes(responseData);
+
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
+ }
+
List<Position> positions = new LinkedList<>();
for (int i = 0; i < message.getPointsCount(); i++) {
diff --git a/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java
index fe42a44d7..70972f847 100644
--- a/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import org.traccar.Context;
import org.traccar.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
+import org.traccar.helper.BitUtil;
import org.traccar.helper.Checksum;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
@@ -95,6 +96,16 @@ public class FifotrackProtocolDecoder extends BaseProtocolDecoder {
.number("(d+),") // size
.compile();
+ private static final Pattern PATTERN_RESULT = new PatternBuilder()
+ .text("$$")
+ .number("d+,") // length
+ .number("(d+),") // imei
+ .any()
+ .expression(",([A-Z]+)") // result
+ .text("*")
+ .number("xx")
+ .compile();
+
private void requestPhoto(Channel channel, SocketAddress socketAddress, String imei, String file) {
if (channel != null) {
String content = "1,D06," + file + "," + photo.writerIndex() + "," + Math.min(1024, photo.writableBytes());
@@ -177,7 +188,12 @@ public class FifotrackProtocolDecoder extends BaseProtocolDecoder {
position.setAltitude(parser.nextInt());
position.set(Position.KEY_ODOMETER, parser.nextLong());
- position.set(Position.KEY_STATUS, parser.nextHexLong());
+
+ long status = parser.nextHexLong();
+ position.set(Position.KEY_RSSI, BitUtil.between(status, 3, 8));
+ position.set(Position.KEY_SATELLITES, BitUtil.from(status, 28));
+ position.set(Position.KEY_STATUS, status);
+
position.set(Position.KEY_INPUT, parser.nextHexInt());
position.set(Position.KEY_OUTPUT, parser.nextHexInt());
@@ -203,6 +219,27 @@ public class FifotrackProtocolDecoder extends BaseProtocolDecoder {
return position;
}
+ private Object decodeResult(
+ Channel channel, SocketAddress remoteAddress, String sentence) {
+
+ Parser parser = new Parser(PATTERN_RESULT, sentence);
+ if (!parser.matches()) {
+ return null;
+ }
+
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());
+ if (deviceSession == null) {
+ return null;
+ }
+
+ Position position = new Position(getProtocolName());
+ position.setDeviceId(deviceSession.getDeviceId());
+
+ position.set(Position.KEY_RESULT, parser.next());
+
+ return position;
+ }
+
@Override
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
@@ -213,7 +250,12 @@ public class FifotrackProtocolDecoder extends BaseProtocolDecoder {
typeIndex = buf.indexOf(typeIndex, buf.writerIndex(), (byte) ',') + 1;
String type = buf.toString(typeIndex, 3, StandardCharsets.US_ASCII);
- if (type.equals("D05")) {
+ if (type.startsWith("B")) {
+
+ return decodeResult(channel, remoteAddress, buf.toString(StandardCharsets.US_ASCII));
+
+ } else if (type.equals("D05")) {
+
String sentence = buf.toString(StandardCharsets.US_ASCII);
Parser parser = new Parser(PATTERN_PHOTO, sentence);
if (parser.matches()) {
@@ -223,7 +265,9 @@ public class FifotrackProtocolDecoder extends BaseProtocolDecoder {
photo = Unpooled.buffer(length);
requestPhoto(channel, remoteAddress, imei, photoId);
}
+
} else if (type.equals("D06")) {
+
if (photo == null) {
return null;
}
@@ -251,9 +295,11 @@ public class FifotrackProtocolDecoder extends BaseProtocolDecoder {
return position;
}
}
+
} else {
- String sentence = buf.toString(StandardCharsets.US_ASCII);
- return decodeLocation(channel, remoteAddress, sentence);
+
+ return decodeLocation(channel, remoteAddress, buf.toString(StandardCharsets.US_ASCII));
+
}
return null;
diff --git a/src/main/java/org/traccar/protocol/FlexibleReportProtocol.java b/src/main/java/org/traccar/protocol/FlexibleReportProtocol.java
new file mode 100644
index 000000000..0cd55343a
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/FlexibleReportProtocol.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import org.traccar.BaseProtocol;
+import org.traccar.PipelineBuilder;
+import org.traccar.TrackerServer;
+
+public class FlexibleReportProtocol extends BaseProtocol {
+
+ public FlexibleReportProtocol() {
+ addServer(new TrackerServer(true, getName()) {
+ @Override
+ protected void addProtocolHandlers(PipelineBuilder pipeline) {
+ pipeline.addLast(new FlexibleReportProtocolDecoder(FlexibleReportProtocol.this));
+ }
+ });
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/FlexibleReportProtocolDecoder.java b/src/main/java/org/traccar/protocol/FlexibleReportProtocolDecoder.java
new file mode 100644
index 000000000..759f2cd6f
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/FlexibleReportProtocolDecoder.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufUtil;
+import io.netty.buffer.Unpooled;
+import io.netty.channel.Channel;
+import org.traccar.BaseProtocolDecoder;
+import org.traccar.DeviceSession;
+import org.traccar.NetworkMessage;
+import org.traccar.Protocol;
+import org.traccar.helper.BitUtil;
+import org.traccar.helper.DateBuilder;
+import org.traccar.helper.UnitsConverter;
+import org.traccar.model.Position;
+
+import java.net.SocketAddress;
+import java.util.Date;
+
+public class FlexibleReportProtocolDecoder extends BaseProtocolDecoder {
+
+ public FlexibleReportProtocolDecoder(Protocol protocol) {
+ super(protocol);
+ }
+
+ public static final int MSG_GENERAL = 0x00;
+
+ private void sendResponse(Channel channel, SocketAddress remoteAddress, int index) {
+ if (channel != null) {
+ ByteBuf response = Unpooled.buffer();
+ response.writeByte(0x7E); // header
+ response.writeShort(2); // length
+ response.writeByte(0xE0);
+ response.writeByte(BitUtil.check(index, 0) ? 0x4F : 0x0F);
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
+ }
+ }
+
+ private Date decodeTime(ByteBuf buf) {
+ int timestamp = buf.readInt();
+ return new DateBuilder()
+ .setSecond(timestamp % 60)
+ .setMinute((timestamp / 60) % 60)
+ .setHour((timestamp / (60 * 60)) % 24)
+ .setDay(1 + timestamp / (60 * 60 * 24) % 31)
+ .setMonth(1 + timestamp / (60 * 60 * 24 * 31) % 12)
+ .setYear(2000 + timestamp / (60 * 60 * 24 * 31 * 12))
+ .getDate();
+ }
+
+ @Override
+ protected Object decode(
+ Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
+
+ ByteBuf buf = (ByteBuf) msg;
+
+ buf.readUnsignedByte(); // header
+ int flags = buf.readUnsignedByte();
+
+ String imei = ByteBufUtil.hexDump(buf.readSlice(8)).substring(1);
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, imei);
+ if (deviceSession == null) {
+ return null;
+ }
+
+ int index = buf.readUnsignedShort();
+
+ if (BitUtil.to(flags, 2) > 0) {
+ sendResponse(channel, remoteAddress, index);
+ }
+
+ Date time = decodeTime(buf);
+ int event = buf.readUnsignedByte();
+
+ buf.readUnsignedByte(); // length
+
+ int type = buf.readUnsignedByte();
+
+ if (type == MSG_GENERAL) {
+
+ Position position = new Position(getProtocolName());
+ position.setDeviceId(deviceSession.getDeviceId());
+
+ position.setDeviceTime(time);
+
+ position.set(Position.KEY_EVENT, event);
+
+ buf.readUnsignedByte(); // length
+ long mask = buf.readUnsignedInt();
+
+ if (BitUtil.check(mask, 0)) {
+ buf.readUnsignedByte(); // product id
+ }
+ if (BitUtil.check(mask, 1)) {
+ position.setFixTime(decodeTime(buf));
+ }
+ if (BitUtil.check(mask, 2)) {
+ position.setValid(true);
+ position.setLatitude(buf.readUnsignedInt() / 1000000.0 - 90);
+ position.setLongitude(buf.readUnsignedInt() / 1000000.0 - 180);
+ }
+ if (BitUtil.check(mask, 3)) {
+ position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte()));
+ position.setCourse(buf.readUnsignedShort());
+ }
+ if (BitUtil.check(mask, 4)) {
+ position.setAltitude(buf.readShort());
+ }
+ if (BitUtil.check(mask, 5)) {
+ buf.readUnsignedShort(); // gps accuracy
+ }
+ if (BitUtil.check(mask, 6)) {
+ position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.001);
+ }
+ if (BitUtil.check(mask, 7)) {
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
+ }
+ if (BitUtil.check(mask, 8)) {
+ position.set("auxPower", buf.readUnsignedShort() * 0.001);
+ }
+ if (BitUtil.check(mask, 9)) {
+ position.set("solarPower", buf.readUnsignedShort() * 0.001);
+ }
+ if (BitUtil.check(mask, 10)) {
+ int cellService = buf.readUnsignedByte();
+ position.set(Position.KEY_ROAMING, BitUtil.check(cellService, 7));
+ position.set("service", BitUtil.to(cellService, 7));
+ buf.skipBytes(4); // cell info
+ }
+ if (BitUtil.check(mask, 11)) {
+ buf.readUnsignedByte(); // rssi
+ }
+ if (BitUtil.check(mask, 12)) {
+ int inputs = buf.readUnsignedByte();
+ position.set(Position.KEY_IGNITION, BitUtil.check(inputs, 0));
+ position.set(Position.PREFIX_IO + 1, inputs);
+ }
+ if (BitUtil.check(mask, 13)) {
+ position.set(Position.PREFIX_IO + 2, buf.readUnsignedByte());
+ }
+ if (BitUtil.check(mask, 14)) {
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 1000);
+ }
+ if (BitUtil.check(mask, 15)) {
+ position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedShort() * 0.01);
+ }
+
+ return position;
+
+ }
+
+ return null;
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java b/src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java
index b6d7f4e45..aded35823 100644
--- a/src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2018 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -75,9 +75,9 @@ public class FreematicsProtocolDecoder extends BaseProtocolDecoder {
}
private Object decodePosition(
- Channel channel, SocketAddress remoteAddress, String sentence) throws Exception {
+ Channel channel, SocketAddress remoteAddress, String sentence, String id) {
- DeviceSession deviceSession = getDeviceSession(channel, remoteAddress);
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, id);
if (deviceSession == null) {
return null;
}
@@ -88,94 +88,104 @@ public class FreematicsProtocolDecoder extends BaseProtocolDecoder {
for (String pair : sentence.split(",")) {
String[] data = pair.split("[=:]");
- int key = Integer.parseInt(data[0], 16);
+ int key;
+ try {
+ key = Integer.parseInt(data[0], 16);
+ } catch (NumberFormatException e) {
+ continue;
+ }
String value = data[1];
- switch (key) {
- case 0x0:
- if (position != null) {
- position.setTime(dateBuilder.getDate());
- positions.add(position);
- }
- position = new Position(getProtocolName());
- position.setDeviceId(deviceSession.getDeviceId());
- position.setValid(true);
- dateBuilder = new DateBuilder(new Date());
- break;
- case 0x11:
- value = ("000000" + value).substring(value.length());
- dateBuilder.setDateReverse(
- Integer.parseInt(value.substring(0, 2)),
- Integer.parseInt(value.substring(2, 4)),
- Integer.parseInt(value.substring(4)));
- break;
- case 0x10:
- value = ("00000000" + value).substring(value.length());
- dateBuilder.setTime(
- Integer.parseInt(value.substring(0, 2)),
- Integer.parseInt(value.substring(2, 4)),
- Integer.parseInt(value.substring(4, 6)),
- Integer.parseInt(value.substring(6)) * 10);
- break;
- case 0xA:
- position.setLatitude(Double.parseDouble(value));
- break;
- case 0xB:
- position.setLongitude(Double.parseDouble(value));
- break;
- case 0xC:
- position.setAltitude(Double.parseDouble(value));
- break;
- case 0xD:
- position.setSpeed(UnitsConverter.knotsFromKph(Double.parseDouble(value)));
- break;
- case 0xE:
- position.setCourse(Integer.parseInt(value));
- break;
- case 0xF:
- position.set(Position.KEY_SATELLITES, Integer.parseInt(value));
- break;
- case 0x12:
- position.set(Position.KEY_HDOP, Integer.parseInt(value));
- break;
- case 0x20:
- position.set(Position.KEY_ACCELERATION, value);
- break;
- case 0x24:
- position.set(Position.KEY_BATTERY, Integer.parseInt(value) * 0.01);
- break;
- case 0x81:
- position.set(Position.KEY_RSSI, Integer.parseInt(value));
- break;
- case 0x82:
- position.set(Position.KEY_DEVICE_TEMP, Integer.parseInt(value) * 0.1);
- break;
- case 0x104:
- position.set(Position.KEY_ENGINE_LOAD, Integer.parseInt(value));
- break;
- case 0x105:
- position.set(Position.KEY_COOLANT_TEMP, Integer.parseInt(value));
- break;
- case 0x10c:
- position.set(Position.KEY_RPM, Integer.parseInt(value));
- break;
- case 0x10d:
- position.set(Position.KEY_OBD_SPEED, UnitsConverter.knotsFromKph(Integer.parseInt(value)));
- break;
- case 0x111:
- position.set(Position.KEY_THROTTLE, Integer.parseInt(value));
- break;
- default:
- position.set(Position.PREFIX_IO + key, value);
- break;
+ if (key == 0x0) {
+ if (position != null) {
+ position.setTime(dateBuilder.getDate());
+ positions.add(position);
+ }
+ position = new Position(getProtocolName());
+ position.setDeviceId(deviceSession.getDeviceId());
+ dateBuilder = new DateBuilder(new Date());
+ } else if (position != null) {
+ switch (key) {
+ case 0x11:
+ value = ("000000" + value).substring(value.length());
+ dateBuilder.setDateReverse(
+ Integer.parseInt(value.substring(0, 2)),
+ Integer.parseInt(value.substring(2, 4)),
+ Integer.parseInt(value.substring(4)));
+ break;
+ case 0x10:
+ value = ("00000000" + value).substring(value.length());
+ dateBuilder.setTime(
+ Integer.parseInt(value.substring(0, 2)),
+ Integer.parseInt(value.substring(2, 4)),
+ Integer.parseInt(value.substring(4, 6)),
+ Integer.parseInt(value.substring(6)) * 10);
+ break;
+ case 0xA:
+ position.setValid(true);
+ position.setLatitude(Double.parseDouble(value));
+ break;
+ case 0xB:
+ position.setValid(true);
+ position.setLongitude(Double.parseDouble(value));
+ break;
+ case 0xC:
+ position.setAltitude(Double.parseDouble(value));
+ break;
+ case 0xD:
+ position.setSpeed(UnitsConverter.knotsFromKph(Double.parseDouble(value)));
+ break;
+ case 0xE:
+ position.setCourse(Integer.parseInt(value));
+ break;
+ case 0xF:
+ position.set(Position.KEY_SATELLITES, Integer.parseInt(value));
+ break;
+ case 0x12:
+ position.set(Position.KEY_HDOP, Integer.parseInt(value));
+ break;
+ case 0x20:
+ position.set(Position.KEY_ACCELERATION, value);
+ break;
+ case 0x24:
+ position.set(Position.KEY_BATTERY, Integer.parseInt(value) * 0.01);
+ break;
+ case 0x81:
+ position.set(Position.KEY_RSSI, Integer.parseInt(value));
+ break;
+ case 0x82:
+ position.set(Position.KEY_DEVICE_TEMP, Integer.parseInt(value) * 0.1);
+ break;
+ case 0x104:
+ position.set(Position.KEY_ENGINE_LOAD, Integer.parseInt(value));
+ break;
+ case 0x105:
+ position.set(Position.KEY_COOLANT_TEMP, Integer.parseInt(value));
+ break;
+ case 0x10c:
+ position.set(Position.KEY_RPM, Integer.parseInt(value));
+ break;
+ case 0x10d:
+ position.set(Position.KEY_OBD_SPEED, UnitsConverter.knotsFromKph(Integer.parseInt(value)));
+ break;
+ case 0x111:
+ position.set(Position.KEY_THROTTLE, Integer.parseInt(value));
+ break;
+ default:
+ position.set(Position.PREFIX_IO + key, value);
+ break;
+ }
}
}
if (position != null) {
+ if (!position.getValid()) {
+ getLastLocation(position, null);
+ }
position.setTime(dateBuilder.getDate());
positions.add(position);
}
- return positions;
+ return positions.isEmpty() ? null : positions;
}
@Override
@@ -187,12 +197,13 @@ public class FreematicsProtocolDecoder extends BaseProtocolDecoder {
int endIndex = sentence.indexOf('*');
if (startIndex > 0 && endIndex > 0) {
+ String id = sentence.substring(0, startIndex);
sentence = sentence.substring(startIndex + 1, endIndex);
if (sentence.startsWith("EV")) {
return decodeEvent(channel, remoteAddress, sentence);
} else {
- return decodePosition(channel, remoteAddress, sentence);
+ return decodePosition(channel, remoteAddress, sentence, id);
}
}
diff --git a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
index d438aa33d..683ba476e 100644
--- a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -75,7 +75,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
.expression("(?:[0-9Ff]{20})?,") // iccid
.number("(d{1,2}),") // rssi
.number("d{1,2},")
- .expression("[01],") // external power
+ .expression("[01]{1,2},") // external power
.number("([d.]+)?,") // odometer or external power
.number("d*,") // backup battery or lightness
.number("(d+.d+),") // battery
@@ -97,6 +97,8 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
.number("(xx)?,") // digital output
.number("[-+]dddd,") // timezone
.expression("[01],") // daylight saving
+ .or()
+ .any()
.groupEnd()
.number("(dddd)(dd)(dd)") // date (yyyymmdd)
.number("(dd)(dd)(dd),") // time (hhmmss)
@@ -237,8 +239,14 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
.number("(d{5}:dd:dd)?,") // hour meter
.number("(x+)?,") // adc 1
.number("(x+)?,").optional() // adc 2
+ .groupBegin()
+ .number("(x+)?,") // adc 3
+ .number("(xx),") // inputs
+ .number("(xx),") // outputs
+ .or()
.number("(d{1,3})?,") // battery
.number("(?:(xx)(xx)(xx))?,") // device status
+ .groupEnd()
.expression("(.*)") // additional data
.or()
.number("d*,,")
@@ -920,15 +928,21 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_POWER, power * 0.001);
}
- if (parser.hasNext(9)) {
+ if (parser.hasNext(12)) {
position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000);
position.set(Position.KEY_HOURS, parseHours(parser.next()));
position.set(Position.PREFIX_ADC + 1, parser.next());
position.set(Position.PREFIX_ADC + 2, parser.next());
- position.set(Position.KEY_BATTERY_LEVEL, parser.nextInt());
-
- decodeStatus(position, parser);
+ position.set(Position.PREFIX_ADC + 3, parser.next());
+ if (parser.hasNext(2)) {
+ position.set(Position.KEY_INPUT, parser.nextHexInt());
+ position.set(Position.KEY_OUTPUT, parser.nextHexInt());
+ }
+ if (parser.hasNext(4)) {
+ position.set(Position.KEY_BATTERY_LEVEL, parser.nextInt());
+ decodeStatus(position, parser);
+ }
int index = 0;
String[] data = parser.next().split(",");
@@ -1147,10 +1161,6 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
decodeDeviceTime(position, parser);
- if (channel != null && Context.getConfig().getBoolean(Keys.PROTOCOL_ACK.withPrefix(getProtocolName()))) {
- channel.writeAndFlush(new NetworkMessage("+SACK:" + parser.next() + "$", remoteAddress));
- }
-
return position;
}
@@ -1315,6 +1325,16 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
}
}
+ if (channel != null && Context.getConfig().getBoolean(Keys.PROTOCOL_ACK.withPrefix(getProtocolName()))) {
+ String checksum;
+ if (sentence.endsWith("$")) {
+ checksum = sentence.substring(sentence.length() - 1 - 4, sentence.length() - 1);
+ } else {
+ checksum = sentence.substring(sentence.length() - 4);
+ }
+ channel.writeAndFlush(new NetworkMessage("+SACK:" + checksum + "$", remoteAddress));
+ }
+
return result;
}
diff --git a/src/main/java/org/traccar/protocol/Gs100Protocol.java b/src/main/java/org/traccar/protocol/Gs100Protocol.java
new file mode 100644
index 000000000..a701815d0
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/Gs100Protocol.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import org.traccar.BaseProtocol;
+import org.traccar.PipelineBuilder;
+import org.traccar.TrackerServer;
+
+public class Gs100Protocol extends BaseProtocol {
+
+ public Gs100Protocol() {
+ addServer(new TrackerServer(false, getName()) {
+ @Override
+ protected void addProtocolHandlers(PipelineBuilder pipeline) {
+ pipeline.addLast(new Gs100ProtocolDecoder(Gs100Protocol.this));
+ }
+ });
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/Gs100ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gs100ProtocolDecoder.java
new file mode 100644
index 000000000..2496aad48
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/Gs100ProtocolDecoder.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufUtil;
+import io.netty.buffer.Unpooled;
+import io.netty.channel.Channel;
+import org.traccar.BaseProtocolDecoder;
+import org.traccar.DeviceSession;
+import org.traccar.NetworkMessage;
+import org.traccar.Protocol;
+import org.traccar.helper.BcdUtil;
+import org.traccar.helper.BitUtil;
+import org.traccar.helper.DateBuilder;
+import org.traccar.helper.UnitsConverter;
+import org.traccar.model.Position;
+
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.util.LinkedList;
+import java.util.List;
+
+public class Gs100ProtocolDecoder extends BaseProtocolDecoder {
+
+ public Gs100ProtocolDecoder(Protocol protocol) {
+ super(protocol);
+ }
+
+ @Override
+ protected Object decode(
+ Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
+
+ ByteBuf buf = (ByteBuf) msg;
+
+ String header = buf.readCharSequence(2, StandardCharsets.US_ASCII).toString();
+
+ if (header.equals("GL")) {
+
+ buf.skipBytes(1);
+ String imei = buf.readCharSequence(buf.readUnsignedByte(), StandardCharsets.US_ASCII).toString();
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, imei);
+
+ if (channel != null && deviceSession != null) {
+ ByteBuf response = Unpooled.copiedBuffer("GS100", StandardCharsets.US_ASCII);
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
+ }
+
+ return null;
+
+ } else {
+
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress);
+ if (deviceSession == null) {
+ return null;
+ }
+
+ List<Position> positions = new LinkedList<>();
+
+ int count = buf.readUnsignedByte();
+ for (int i = 0; i < count; i++) {
+
+ int endIndex = buf.readUnsignedByte() + buf.readerIndex();
+
+ Position position = new Position(getProtocolName());
+ position.setDeviceId(deviceSession.getDeviceId());
+
+ int status = buf.readUnsignedMedium();
+ position.set(Position.KEY_STATUS, status);
+
+ if (BitUtil.check(status, 8 + 8 + 7)) {
+
+ DateBuilder dateBuilder = new DateBuilder()
+ .setHour(BcdUtil.readInteger(buf, 2))
+ .setMinute(BcdUtil.readInteger(buf, 2))
+ .setSecond(BcdUtil.readInteger(buf, 2))
+ .setDay(BcdUtil.readInteger(buf, 2))
+ .setMonth(BcdUtil.readInteger(buf, 2))
+ .setYear(BcdUtil.readInteger(buf, 2));
+ position.setTime(dateBuilder.getDate());
+
+ position.setValid(true);
+
+ String coordinates = ByteBufUtil.hexDump(buf.readSlice(9));
+ position.setLongitude(Integer.parseInt(coordinates.substring(0, 3))
+ + Integer.parseInt(coordinates.substring(3, 9)) * 0.0001 / 60);
+ position.setLatitude(Integer.parseInt(coordinates.substring(10, 12))
+ + Integer.parseInt(coordinates.substring(12, 18)) * 0.0001 / 60);
+ int flags = Integer.parseInt(coordinates.substring(9, 10), 16);
+ if (!BitUtil.check(flags, 3)) {
+ position.setLongitude(-position.getLongitude());
+ }
+ if (!BitUtil.check(flags, 2)) {
+ position.setLatitude(-position.getLatitude());
+ }
+
+ String other = ByteBufUtil.hexDump(buf.readSlice(4));
+ position.setSpeed(UnitsConverter.knotsFromKph(Integer.parseInt(other.substring(0, 5)) * 0.01));
+ position.setCourse(Integer.parseInt(other.substring(5, 8)));
+
+ } else {
+
+ getLastLocation(position, null);
+
+ }
+
+ positions.add(position);
+
+ buf.readerIndex(endIndex);
+
+ }
+
+ if (channel != null) {
+ ByteBuf response = Unpooled.buffer();
+ response.writeCharSequence("GS100", StandardCharsets.US_ASCII);
+ response.writeByte(count);
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
+ }
+
+ return positions.isEmpty() ? null : positions;
+
+ }
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
index c5e8809e3..6d49be0ce 100644
--- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -295,7 +295,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
return true;
}
- private boolean decodeStatus(Position position, ByteBuf buf) {
+ private boolean decodeStatus(Position position, ByteBuf buf, boolean batteryLevel) {
int status = buf.readUnsignedByte();
@@ -324,7 +324,11 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
break;
}
- position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte() * 100 / 6);
+ if (batteryLevel) {
+ position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte() * 100 / 6);
+ } else {
+ position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
+ }
position.set(Position.KEY_RSSI, buf.readUnsignedByte());
position.set(Position.KEY_ALARM, decodeAlarm(buf.readUnsignedByte()));
@@ -838,7 +842,9 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort(); // satellites
buf.readUnsignedByte(); // alarm
buf.readUnsignedByte(); // language
- buf.readUnsignedByte(); // battery
+
+ position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte());
+
buf.readUnsignedByte(); // working mode
buf.readUnsignedShort(); // working voltage
buf.readUnsignedByte(); // reserved
@@ -864,7 +870,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
}
if (hasStatus(type)) {
- decodeStatus(position, buf);
+ decodeStatus(position, buf, true);
}
if (type == MSG_GPS_LBS_1 && buf.readableBytes() > 75 + 6) {
@@ -875,6 +881,17 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
position.set("driverLicense", data.trim());
}
+ if (type == MSG_GPS_LBS_1 && buf.readableBytes() == 18) {
+ decodeStatus(position, buf, false);
+ position.set("oil", buf.readUnsignedShort());
+ int temperature = buf.readUnsignedByte();
+ if (BitUtil.check(temperature, 7)) {
+ temperature = -BitUtil.to(temperature, 7);
+ }
+ position.set(Position.PREFIX_TEMP + 1, temperature);
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 10);
+ }
+
if (type == MSG_GPS_LBS_1 && buf.readableBytes() == 2 + 6) {
int mask = buf.readUnsignedShort();
position.set(Position.KEY_IGNITION, BitUtil.check(mask, 8 + 7));
diff --git a/src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java
index 3ad70bdca..2e1ddf5f2 100644
--- a/src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -234,8 +234,14 @@ public class HuaShengProtocolDecoder extends BaseProtocolDecoder {
int length = buf.readUnsignedShort() - 4;
switch (subtype) {
case 0x0001:
- position.set(Position.KEY_COOLANT_TEMP, buf.readUnsignedByte() - 40);
- position.set(Position.KEY_RPM, buf.readUnsignedShort());
+ int coolantTemperature = buf.readUnsignedByte() - 40;
+ if (coolantTemperature <= 215) {
+ position.set(Position.KEY_COOLANT_TEMP, coolantTemperature);
+ }
+ int rpm = buf.readUnsignedShort();
+ if (rpm <= 65535) {
+ position.set(Position.KEY_RPM, rpm);
+ }
position.set("averageSpeed", buf.readUnsignedByte());
buf.readUnsignedShort(); // interval fuel consumption
position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedShort() * 0.01);
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
index a3d16cb62..675a08aef 100644
--- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,6 +45,7 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_GENERAL_RESPONSE = 0x8001;
public static final int MSG_GENERAL_RESPONSE_2 = 0x4401;
+ public static final int MSG_HEARTBEAT = 0x0002;
public static final int MSG_TERMINAL_REGISTER = 0x0100;
public static final int MSG_TERMINAL_REGISTER_RESPONSE = 0x8100;
public static final int MSG_TERMINAL_CONTROL = 0x8105;
@@ -171,7 +172,7 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
formatMessage(MSG_TERMINAL_REGISTER_RESPONSE, id, false, response), remoteAddress));
}
- } else if (type == MSG_TERMINAL_AUTH) {
+ } else if (type == MSG_TERMINAL_AUTH || type == MSG_HEARTBEAT) {
sendGeneralResponse(channel, remoteAddress, id, type, index);
@@ -334,24 +335,36 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
position.set("cover", BitUtil.check(deviceStatus, 3));
break;
case 0xEB:
- while (buf.readerIndex() < endIndex) {
- int extendedLength = buf.readUnsignedShort();
- int extendedType = buf.readUnsignedShort();
- switch (extendedType) {
- case 0x0001:
- position.set("fuel1", buf.readUnsignedShort() * 0.1);
- buf.readUnsignedByte(); // unused
- break;
- case 0x0023:
- position.set("fuel2", Double.parseDouble(
- buf.readCharSequence(6, StandardCharsets.US_ASCII).toString()));
- break;
- case 0x00CE:
- position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
- break;
- default:
- buf.skipBytes(extendedLength - 2);
- break;
+ if (buf.getUnsignedShort(buf.readerIndex()) > 200) {
+ Network network = new Network();
+ int mcc = buf.readUnsignedShort();
+ int mnc = buf.readUnsignedByte();
+ while (buf.readerIndex() < endIndex) {
+ network.addCellTower(CellTower.from(
+ mcc, mnc, buf.readUnsignedShort(), buf.readUnsignedShort(),
+ buf.readUnsignedByte()));
+ }
+ position.setNetwork(network);
+ } else {
+ while (buf.readerIndex() < endIndex) {
+ int extendedLength = buf.readUnsignedShort();
+ int extendedType = buf.readUnsignedShort();
+ switch (extendedType) {
+ case 0x0001:
+ position.set("fuel1", buf.readUnsignedShort() * 0.1);
+ buf.readUnsignedByte(); // unused
+ break;
+ case 0x0023:
+ position.set("fuel2", Double.parseDouble(
+ buf.readCharSequence(6, StandardCharsets.US_ASCII).toString()));
+ break;
+ case 0x00CE:
+ position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
+ break;
+ default:
+ buf.skipBytes(extendedLength - 2);
+ break;
+ }
}
}
break;
diff --git a/src/main/java/org/traccar/protocol/IotmProtocolDecoder.java b/src/main/java/org/traccar/protocol/IotmProtocolDecoder.java
index bbb63fb65..9c94ffd4b 100644
--- a/src/main/java/org/traccar/protocol/IotmProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/IotmProtocolDecoder.java
@@ -84,6 +84,156 @@ public class IotmProtocolDecoder extends BaseProtocolDecoder {
}
}
+ private void decodeSensor(Position position, ByteBuf record, int sensorType, int sensorId) {
+ String key;
+ switch (sensorId) {
+ case 0x0002:
+ position.set(Position.KEY_MOTION, sensorType > 0);
+ break;
+ case 0x0008:
+ case 0x009B:
+ if (sensorType > 0) {
+ position.set(Position.KEY_ALARM, Position.ALARM_JAMMING);
+ }
+ break;
+ case 0x0010:
+ case 0x0011:
+ case 0x0012:
+ case 0x0013:
+ case 0x0014:
+ case 0x0015:
+ key = Position.PREFIX_IN + (sensorId - 0x0010 + 2);
+ position.set(key, sensorType > 0);
+ break;
+ case 0x0062:
+ position.set("doorFL", sensorType > 0);
+ break;
+ case 0x0063:
+ position.set("doorFR", sensorType > 0);
+ break;
+ case 0x0064:
+ position.set("doorRL", sensorType > 0);
+ break;
+ case 0x0065:
+ position.set("doorRR", sensorType > 0);
+ break;
+ case 0x001E:
+ position.set("buttonPresent", sensorType > 0);
+ break;
+ case 0x006D:
+ position.set(Position.KEY_IGNITION, sensorType > 0);
+ break;
+ case 0x008B:
+ position.set("handBrake", sensorType > 0);
+ break;
+ case 0x008C:
+ position.set("footBrake", sensorType > 0);
+ break;
+ case 0x0094:
+ case 0x0095:
+ case 0x0096:
+ key = Position.PREFIX_OUT + (sensorId - 0x0094 + 1);
+ position.set(key, sensorType > 0);
+ break;
+ case 0x009A:
+ position.set(Position.PREFIX_OUT + 4, sensorType > 0);
+ break;
+ case 0x2000:
+ position.set(Position.KEY_OBD_SPEED, record.readUnsignedByte());
+ break;
+ case 0x2001:
+ position.set(Position.KEY_SATELLITES, record.readUnsignedByte());
+ break;
+ case 0x2006:
+ position.set(Position.KEY_THROTTLE, record.readUnsignedByte());
+ break;
+ case 0x2007:
+ position.set(Position.KEY_FUEL_LEVEL, record.readUnsignedByte());
+ break;
+ case 0x2008:
+ position.set(Position.KEY_COOLANT_TEMP, record.readUnsignedByte());
+ break;
+ case 0x2009:
+ position.set("fuel2", record.readUnsignedByte());
+ break;
+ case 0x200A:
+ position.set(Position.KEY_ENGINE_LOAD, record.readUnsignedByte());
+ break;
+ case 0x2041:
+ position.set(Position.KEY_BATTERY_LEVEL, record.readUnsignedByte());
+ break;
+ case 0x3000:
+ position.set(Position.KEY_POWER, record.readUnsignedShortLE() * 0.001);
+ break;
+ case 0x3001:
+ case 0x3002:
+ case 0x3003:
+ key = Position.PREFIX_ADC + (0x3003 - sensorId + 3);
+ position.set(key, record.readUnsignedShortLE() * 0.001);
+ break;
+ case 0x3004:
+ position.set(Position.KEY_BATTERY, record.readUnsignedShortLE() * 0.001);
+ break;
+ case 0x300C:
+ position.set(Position.KEY_RPM, record.readUnsignedShortLE());
+ break;
+ case 0x3021:
+ position.set(Position.KEY_FUEL_CONSUMPTION, record.readUnsignedShortLE() * 0.05);
+ break;
+ case 0x3037:
+ position.set("cargoWeight", record.readUnsignedShortLE() * 2);
+ break;
+ case 0x4001:
+ position.set(Position.KEY_FUEL_USED, record.readUnsignedIntLE());
+ break;
+ case 0x4002:
+ position.set(Position.KEY_HOURS, record.readUnsignedIntLE());
+ break;
+ case 0x4003:
+ position.set(Position.KEY_ODOMETER, record.readUnsignedIntLE() * 5);
+ break;
+ case 0x4063:
+ position.set(Position.KEY_AXLE_WEIGHT, record.readUnsignedIntLE());
+ break;
+ case 0x5000:
+ position.set(Position.KEY_DRIVER_UNIQUE_ID, String.valueOf(record.readLongLE()));
+ break;
+ case 0x5004:
+ case 0x5005:
+ case 0x5006:
+ case 0x5007:
+ key = Position.PREFIX_TEMP + (sensorId - 0x5004 + 1);
+ position.set(key, record.readLongLE());
+ break;
+ case 0x500D:
+ position.set("trailerId", String.valueOf(record.readLongLE()));
+ break;
+ case 0xA000:
+ position.set(Position.KEY_DEVICE_TEMP, record.readFloatLE());
+ break;
+ case 0xA001:
+ position.set(Position.KEY_ACCELERATION, record.readFloatLE());
+ break;
+ case 0xA002:
+ position.set("cornering", record.readFloatLE());
+ break;
+ case 0xA017:
+ case 0xA018:
+ case 0xA019:
+ case 0xA01A:
+ key = Position.PREFIX_TEMP + (sensorId - 0xA017 + 1);
+ position.set(key, record.readFloatLE());
+ break;
+ case 0xB002:
+ position.set(Position.KEY_OBD_ODOMETER, record.readDoubleLE());
+ break;
+ default:
+ key = Position.PREFIX_IO + sensorId;
+ position.getAttributes().put(key, readValue(record, sensorType));
+ break;
+ }
+ }
+
@Override
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
@@ -163,62 +313,7 @@ public class IotmProtocolDecoder extends BaseProtocolDecoder {
continue;
}
- String key;
- switch (sensorId) {
- case 0x0008:
- if (sensorType > 0) {
- position.set(Position.KEY_ALARM, Position.ALARM_JAMMING);
- }
- break;
- case 0x0010:
- case 0x0011:
- case 0x0012:
- case 0x0013:
- key = Position.PREFIX_IN + (sensorId - 0x0010 + 2);
- position.set(key, sensorType > 0);
- break;
- case 0x001E:
- position.set("buttonPresent", sensorType > 0);
- break;
- case 0x006D:
- position.set(Position.KEY_IGNITION, sensorType > 0);
- break;
- case 0x3000:
- position.set(Position.KEY_POWER, record.readUnsignedShortLE() * 0.001);
- break;
- case 0x3001:
- case 0x3002:
- case 0x3003:
- key = Position.PREFIX_ADC + (0x3003 - sensorId + 3);
- position.set(key, record.readUnsignedShortLE() * 0.001);
- break;
- case 0x3004:
- position.set(Position.KEY_BATTERY, record.readUnsignedShortLE() * 0.001);
- break;
- case 0x300C:
- position.set(Position.KEY_RPM, record.readUnsignedShortLE());
- break;
- case 0x4003:
- position.set(Position.KEY_ODOMETER, record.readUnsignedIntLE() * 5);
- break;
- case 0x5000:
- position.set(Position.KEY_DRIVER_UNIQUE_ID, String.valueOf(record.readLongLE()));
- break;
- case 0xA001:
- position.set(Position.KEY_ACCELERATION, record.readFloatLE());
- break;
- case 0xA002:
- position.set("cornering", record.readFloatLE());
- break;
- case 0xA017:
- key = Position.PREFIX_TEMP + (sensorId - 0xA017 + 1);
- position.set(key, record.readFloatLE());
- break;
- default:
- key = Position.PREFIX_IO + sensorId;
- position.getAttributes().put(key, readValue(record, sensorType));
- break;
- }
+ decodeSensor(position, record, sensorType, sensorId);
}
}
diff --git a/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java b/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java
index 94c9a3038..9eed58347 100644
--- a/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/ItsProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2018 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +28,10 @@ import org.traccar.model.Network;
import org.traccar.model.Position;
import java.net.SocketAddress;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
import java.util.regex.Pattern;
public class ItsProtocolDecoder extends BaseProtocolDecoder {
@@ -75,7 +79,7 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
.number("(d+.?d*),") // power
.number("(d+.?d*),") // battery
.number("([01]),") // emergency
- .expression("[CO]?,") // tamper
+ .expression("[COYN]?,") // tamper
.expression("(.*),") // cells
.number("([012]{4}),") // inputs
.number("([01]{2}),") // outputs
@@ -96,6 +100,12 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
.number("d+,") // index
.number("(d+.?d*),") // adc1
.number("(d+.?d*),") // adc2
+ .or()
+ .number("(d+.d+),") // adc1
+ .number("(d+),") // odometer
+ .number("(d{6}),") // index
+ .expression("([^,]+),") // response format
+ .expression("([^,]+),") // response
.groupEnd("?")
.groupEnd("?")
.or()
@@ -137,8 +147,17 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
- if (channel != null && sentence.startsWith("$,01,")) {
- channel.writeAndFlush(new NetworkMessage("$,1,*", remoteAddress));
+ if (channel != null) {
+ if (sentence.startsWith("$,01,")) {
+ channel.writeAndFlush(new NetworkMessage("$,1,*", remoteAddress));
+ } else if (sentence.startsWith("$,LGN,")) {
+ DateFormat dateFormat = new SimpleDateFormat("ddMMyyyyHHmmss");
+ dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
+ String time = dateFormat.format(new Date());
+ channel.writeAndFlush(new NetworkMessage("$LGN" + time + "*", remoteAddress));
+ } else if (sentence.startsWith("$,HBT,")) {
+ channel.writeAndFlush(new NetworkMessage("$HBT*", remoteAddress));
+ }
}
Parser parser = new Parser(PATTERN, sentence);
@@ -257,6 +276,14 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.PREFIX_ADC + 2, parser.nextDouble());
}
+ if (parser.hasNext(5)) {
+ position.set(Position.PREFIX_ADC + 1, parser.nextDouble());
+ position.set(Position.KEY_ODOMETER, parser.nextInt());
+ position.set(Position.KEY_INDEX, parser.nextInt());
+ position.set("responseFormat", parser.next());
+ position.set("response", parser.next());
+ }
+
if (parser.hasNext(2)) {
position.setAltitude(parser.nextDouble());
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
diff --git a/src/main/java/org/traccar/protocol/KhdProtocol.java b/src/main/java/org/traccar/protocol/KhdProtocol.java
index f77f4c311..60a2aea7f 100644
--- a/src/main/java/org/traccar/protocol/KhdProtocol.java
+++ b/src/main/java/org/traccar/protocol/KhdProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,13 @@ public class KhdProtocol extends BaseProtocol {
public KhdProtocol() {
setSupportedDataCommands(
Command.TYPE_ENGINE_STOP,
- Command.TYPE_ENGINE_RESUME);
+ Command.TYPE_ENGINE_RESUME,
+ Command.TYPE_GET_VERSION,
+ Command.TYPE_FACTORY_RESET,
+ Command.TYPE_SET_SPEED_LIMIT,
+ Command.TYPE_SET_ODOMETER,
+ Command.TYPE_POSITION_SINGLE);
+
addServer(new TrackerServer(false, getName()) {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
diff --git a/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java b/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java
index 16ad616ed..251351a74 100644
--- a/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java
@@ -24,6 +24,7 @@ import org.traccar.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
import org.traccar.helper.BcdUtil;
+import org.traccar.helper.BitUtil;
import org.traccar.helper.Checksum;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
@@ -65,6 +66,44 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_SMS_ALARM_SWITCH = 0x86;
public static final int MSG_PERIPHERAL = 0xA3;
+ private void decodeAlarmStatus(Position position, byte[] status) {
+ if (BitUtil.check(status[0], 4)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_LOW_POWER);
+ } else if (BitUtil.check(status[0], 6)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_GEOFENCE_EXIT);
+ } else if (BitUtil.check(status[0], 7)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_GEOFENCE_ENTER);
+ } else if (BitUtil.check(status[1], 0)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_SOS);
+ } else if (BitUtil.check(status[1], 1)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED);
+ } else if (BitUtil.check(status[1], 3)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_POWER_CUT);
+ } else if (BitUtil.check(status[1], 6)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_TOW);
+ } else if (BitUtil.check(status[1], 7)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_DOOR);
+ } else if (BitUtil.check(status[2], 2)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_TEMPERATURE);
+ } else if (BitUtil.check(status[2], 4)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_TAMPERING);
+ } else if (BitUtil.check(status[2], 6)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_FATIGUE_DRIVING);
+ } else if (BitUtil.check(status[2], 7)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_IDLE);
+ } else if (BitUtil.check(status[6], 3)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_VIBRATION);
+ } else if (BitUtil.check(status[6], 4)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_BRAKING);
+ } else if (BitUtil.check(status[6], 5)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_ACCELERATION);
+ } else if (BitUtil.check(status[6], 6)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_CORNERING);
+ } else if (BitUtil.check(status[6], 7)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_ACCIDENT);
+ }
+ }
+
@Override
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
@@ -125,11 +164,15 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_ODOMETER, buf.readUnsignedMedium());
position.set(Position.KEY_STATUS, buf.readUnsignedInt());
- position.set(Position.KEY_HDOP, buf.readUnsignedByte());
- position.set(Position.KEY_VDOP, buf.readUnsignedByte());
- position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
- buf.skipBytes(5); // other location data
+ buf.readUnsignedShort();
+ buf.readUnsignedByte();
+ buf.readUnsignedByte();
+ buf.readUnsignedByte();
+ buf.readUnsignedByte();
+ buf.readUnsignedByte();
+
+ position.set(Position.KEY_RESULT, buf.readUnsignedByte());
if (type == MSG_PERIPHERAL) {
@@ -174,6 +217,16 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder {
}
+ } else {
+
+ buf.readUnsignedByte(); // overloaded state
+ buf.readUnsignedByte(); // logging status
+
+ byte[] alarmStatus = new byte[8];
+ buf.readBytes(alarmStatus);
+
+ decodeAlarmStatus(position, alarmStatus);
+
}
return position;
diff --git a/src/main/java/org/traccar/protocol/KhdProtocolEncoder.java b/src/main/java/org/traccar/protocol/KhdProtocolEncoder.java
index 4a8df26c8..8aeb9660d 100644
--- a/src/main/java/org/traccar/protocol/KhdProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/KhdProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,14 +24,19 @@ import org.traccar.Protocol;
public class KhdProtocolEncoder extends BaseProtocolEncoder {
+ public static final int MSG_ON_DEMAND_TRACK = 0x30;
public static final int MSG_CUT_OIL = 0x39;
public static final int MSG_RESUME_OIL = 0x38;
+ public static final int MSG_CHECK_VERSION = 0x3D;
+ public static final int MSG_FACTORY_RESET = 0xC3;
+ public static final int MSG_SET_OVERSPEED = 0x3F;
+ public static final int MSG_DELETE_MILEAGE = 0x66;
public KhdProtocolEncoder(Protocol protocol) {
super(protocol);
}
- private ByteBuf encodeCommand(int command, String uniqueId) {
+ private ByteBuf encodeCommand(int command, String uniqueId, ByteBuf content) {
ByteBuf buf = Unpooled.buffer();
@@ -39,7 +44,12 @@ public class KhdProtocolEncoder extends BaseProtocolEncoder {
buf.writeByte(0x29);
buf.writeByte(command);
- buf.writeShort(6); // size
+
+ int length = 6;
+ if (content != null) {
+ length += content.readableBytes();
+ }
+ buf.writeShort(length);
uniqueId = "00000000".concat(uniqueId);
uniqueId = uniqueId.substring(uniqueId.length() - 8);
@@ -48,6 +58,10 @@ public class KhdProtocolEncoder extends BaseProtocolEncoder {
buf.writeByte(Integer.parseInt(uniqueId.substring(4, 6)) + 0x80);
buf.writeByte(Integer.parseInt(uniqueId.substring(6, 8)));
+ if (content != null) {
+ buf.writeBytes(content);
+ }
+
buf.writeByte(Checksum.xor(buf.nioBuffer()));
buf.writeByte(0x0D); // ending
@@ -61,9 +75,21 @@ public class KhdProtocolEncoder extends BaseProtocolEncoder {
switch (command.getType()) {
case Command.TYPE_ENGINE_STOP:
- return encodeCommand(MSG_CUT_OIL, uniqueId);
+ return encodeCommand(MSG_CUT_OIL, uniqueId, null);
case Command.TYPE_ENGINE_RESUME:
- return encodeCommand(MSG_RESUME_OIL, uniqueId);
+ return encodeCommand(MSG_RESUME_OIL, uniqueId, null);
+ case Command.TYPE_GET_VERSION:
+ return encodeCommand(MSG_CHECK_VERSION, uniqueId, null);
+ case Command.TYPE_FACTORY_RESET:
+ return encodeCommand(MSG_FACTORY_RESET, uniqueId, null);
+ case Command.TYPE_SET_SPEED_LIMIT:
+ ByteBuf content = Unpooled.buffer();
+ content.writeByte(Integer.parseInt(command.getString(Command.KEY_DATA)));
+ return encodeCommand(MSG_RESUME_OIL, uniqueId, content);
+ case Command.TYPE_SET_ODOMETER:
+ return encodeCommand(MSG_DELETE_MILEAGE, uniqueId, null);
+ case Command.TYPE_POSITION_SINGLE:
+ return encodeCommand(MSG_ON_DEMAND_TRACK, uniqueId, null);
default:
return null;
}
diff --git a/src/main/java/org/traccar/protocol/Mavlink2Protocol.java b/src/main/java/org/traccar/protocol/Mavlink2Protocol.java
new file mode 100644
index 000000000..d779648e4
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/Mavlink2Protocol.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2021 Chipeng Li (chplee@gmail.com)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import org.traccar.BaseProtocol;
+import org.traccar.PipelineBuilder;
+import org.traccar.TrackerServer;
+
+import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
+
+public class Mavlink2Protocol extends BaseProtocol {
+
+ public Mavlink2Protocol() {
+ addServer(new TrackerServer(true, getName()) {
+ @Override
+ protected void addProtocolHandlers(PipelineBuilder pipeline) {
+ pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 1, 1, 10, 0));
+ pipeline.addLast(new Mavlink2ProtocolDecoder(Mavlink2Protocol.this));
+ }
+ });
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/Mavlink2ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Mavlink2ProtocolDecoder.java
new file mode 100644
index 000000000..431258388
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/Mavlink2ProtocolDecoder.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2021 Chipeng Li (chplee@gmail.com)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.Channel;
+import org.traccar.BaseProtocolDecoder;
+import org.traccar.DeviceSession;
+import org.traccar.Protocol;
+import org.traccar.helper.UnitsConverter;
+import org.traccar.model.Position;
+
+import java.net.SocketAddress;
+import java.util.Date;
+
+public class Mavlink2ProtocolDecoder extends BaseProtocolDecoder {
+
+ public Mavlink2ProtocolDecoder(Protocol protocol) {
+ super(protocol);
+ }
+
+ @Override
+ protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
+
+ ByteBuf buf = (ByteBuf) msg;
+ if (buf.readUnsignedByte() != 0xFD) {
+ return null;
+ }
+
+ buf.readUnsignedByte(); // length
+ buf.readUnsignedByte(); // incompatibility flags
+ buf.readUnsignedByte(); // compatibility flags
+ buf.readUnsignedByte(); // index
+
+ int senderSystemId = buf.readUnsignedByte();
+ buf.readUnsignedByte(); // component id
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, Integer.toString(senderSystemId));
+ if (deviceSession == null) {
+ return null;
+ }
+
+ int type = buf.readUnsignedMediumLE();
+ if (type == 33) {
+
+ Position position = new Position(getProtocolName());
+ position.setDeviceId(deviceSession.getDeviceId());
+
+ position.set("timeBoot", buf.readUnsignedIntLE()); // time since system boot
+
+ position.setValid(true);
+ position.setTime(new Date());
+ position.setLatitude(buf.readIntLE() / 10000000.0);
+ position.setLongitude(buf.readIntLE() / 10000000.0);
+ position.setAltitude(buf.readIntLE() / 1000.0);
+ position.set("relativeAltitude", buf.readIntLE() / 1000.0);
+
+ int groundSpeedX = buf.readShortLE();
+ int groundSpeedY = buf.readShortLE();
+ buf.readShortLE(); // ground speed z
+ double speed = Math.sqrt(Math.pow(groundSpeedX, 2) + Math.pow(groundSpeedY, 2));
+ position.setSpeed(UnitsConverter.knotsFromCps(speed));
+
+ position.setCourse(buf.readUnsignedShortLE() / 100.0);
+
+ return position;
+
+ }
+
+ return null;
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java b/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java
index d81cc0eda..fae73d931 100644
--- a/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java
@@ -275,9 +275,10 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
.or().text(" ")
.groupEnd("?").text(",")
.number("(d+)?,") // rfid
+ .number("([01])(d)?").optional() // charge and belt status
.expression("[^,]*,")
.number("(d+)?,") // battery
- .expression("([^,]*)") // alert
+ .expression("([^,]*)[,;]") // alert
.any()
.compile();
@@ -355,6 +356,13 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_DRIVER_UNIQUE_ID, parser.next());
+ if (parser.hasNext()) {
+ position.set(Position.KEY_CHARGE, parser.nextInt() > 0);
+ }
+ if (parser.hasNext()) {
+ position.set("belt", parser.nextInt());
+ }
+
String battery = parser.next();
if (battery != null) {
position.set(Position.KEY_BATTERY, Integer.parseInt(battery));
@@ -375,10 +383,11 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
}
}
switch (value) {
+ case "pw on":
case "poweron":
return Position.ALARM_POWER_ON;
case "poweroff":
- return Position.ALARM_POWER_ON;
+ return Position.ALARM_POWER_OFF;
case "sos":
case "help":
return Position.ALARM_SOS;
@@ -390,12 +399,32 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
case "low battery":
case "lowbattery":
return Position.ALARM_LOW_BATTERY;
+ case "low extern voltage":
+ return Position.ALARM_LOW_POWER;
+ case "gps cut":
+ return Position.ALARM_GPS_ANTENNA_CUT;
case "vib":
return Position.ALARM_VIBRATION;
case "move in":
return Position.ALARM_GEOFENCE_ENTER;
case "move out":
return Position.ALARM_GEOFENCE_EXIT;
+ case "corner":
+ return Position.ALARM_CORNERING;
+ case "fatigue":
+ return Position.ALARM_FATIGUE_DRIVING;
+ case "psd":
+ return Position.ALARM_POWER_CUT;
+ case "psr":
+ return Position.ALARM_POWER_RESTORED;
+ case "hit":
+ return Position.ALARM_SHOCK;
+ case "belt on":
+ case "belton":
+ return Position.ALARM_LOCK;
+ case "belt off":
+ case "beltoff":
+ return Position.ALARM_UNLOCK;
case "error":
return Position.ALARM_FAULT;
default:
diff --git a/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java
index 5ea9f148c..992b5c43a 100644
--- a/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2019 - 2021 Anton Tananaev (anton@traccar.org)
* Copyright 2020 Roeland Boeters (roeland@geodelta.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -168,8 +168,48 @@ public class MictrackProtocolDecoder extends BaseProtocolDecoder {
if (sentence.startsWith("MT")) {
return decodeStandard(channel, remoteAddress, sentence);
- } else {
+ } else if (sentence.contains("$")) {
return decodeLowAltitude(channel, remoteAddress, sentence);
+ } else {
+ return decodeResult(channel, remoteAddress, sentence);
+ }
+ }
+
+ private Object decodeResult(
+ Channel channel, SocketAddress remoteAddress, String sentence) {
+
+ if (sentence.matches("\\d{15} .+")) {
+
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, sentence.substring(0, 15));
+ if (deviceSession == null) {
+ return null;
+ }
+
+ Position position = new Position(getProtocolName());
+ position.setDeviceId(deviceSession.getDeviceId());
+
+ getLastLocation(position, null);
+
+ position.set(Position.KEY_RESULT, sentence.substring(16, sentence.length() - 1));
+
+ return position;
+
+ } else {
+
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress);
+ if (deviceSession == null) {
+ return null;
+ }
+
+ Position position = new Position(getProtocolName());
+ position.setDeviceId(deviceSession.getDeviceId());
+
+ getLastLocation(position, null);
+
+ position.set(Position.KEY_RESULT, sentence.substring(0, sentence.length() - 1));
+
+ return position;
+
}
}
@@ -184,6 +224,7 @@ public class MictrackProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
+ position.set(Position.KEY_TYPE, Integer.parseInt(fragments[1]));
switch (fragments[3]) {
case "R0":
diff --git a/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java
index 89217a39b..68e9e8dd5 100644
--- a/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java
@@ -189,13 +189,17 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder {
case 0x28:
int beaconFlags = buf.readUnsignedByte();
position.set("tagId", ByteBufUtil.hexDump(buf.readSlice(6)));
- buf.readUnsignedByte(); // rssi
+ position.set("tagRssi", buf.readUnsignedByte());
buf.readUnsignedByte(); // 1m rssi
if (BitUtil.check(beaconFlags, 7)) {
position.setLatitude(buf.readIntLE() * 0.0000001);
position.setLongitude(buf.readIntLE() * 0.0000001);
hasLocation = true;
}
+ if (BitUtil.check(beaconFlags, 6)) {
+ position.set("description", buf.readCharSequence(
+ endIndex - buf.readerIndex(), StandardCharsets.US_ASCII).toString());
+ }
break;
case 0x30:
buf.readUnsignedInt(); // timestamp
diff --git a/src/main/java/org/traccar/protocol/NavtelecomProtocol.java b/src/main/java/org/traccar/protocol/NavtelecomProtocol.java
new file mode 100644
index 000000000..c76b42768
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/NavtelecomProtocol.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
+import org.traccar.BaseProtocol;
+import org.traccar.PipelineBuilder;
+import org.traccar.TrackerServer;
+
+public class NavtelecomProtocol extends BaseProtocol {
+
+ public NavtelecomProtocol() {
+ addServer(new TrackerServer(false, getName()) {
+ @Override
+ protected void addProtocolHandlers(PipelineBuilder pipeline) {
+ pipeline.addLast(new LengthFieldBasedFrameDecoder(256, 2, 1, 2, 0));
+ pipeline.addLast(new Gt02ProtocolDecoder(NavtelecomProtocol.this));
+ }
+ });
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java b/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java
new file mode 100644
index 000000000..2362b1870
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import io.netty.channel.Channel;
+import org.traccar.BaseProtocolDecoder;
+import org.traccar.NetworkMessage;
+import org.traccar.Protocol;
+import org.traccar.helper.Checksum;
+
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+
+public class NavtelecomProtocolDecoder extends BaseProtocolDecoder {
+
+ public NavtelecomProtocolDecoder(Protocol protocol) {
+ super(protocol);
+ }
+
+ @Override
+ protected Object decode(
+ Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
+
+ ByteBuf buf = (ByteBuf) msg;
+
+ buf.skipBytes(4); // preamble
+ int receiver = buf.readIntLE();
+ int sender = buf.readIntLE();
+ int length = buf.readUnsignedShortLE();
+ buf.readUnsignedByte(); // data checksum
+ buf.readUnsignedByte(); // header checksum
+
+ String sentence = buf.readCharSequence(length, StandardCharsets.US_ASCII).toString();
+
+ if (sentence.startsWith("*>S")) {
+
+ String data = "*<S";
+
+ ByteBuf response = Unpooled.buffer();
+ response.writeCharSequence("@NTC", StandardCharsets.US_ASCII);
+ response.writeIntLE(sender);
+ response.writeIntLE(receiver);
+ response.writeShortLE(data.length());
+ response.writeByte(Checksum.xor(data));
+ response.writeByte(Checksum.xor(response.nioBuffer()));
+ response.writeCharSequence(data, StandardCharsets.US_ASCII);
+
+ if (channel != null) {
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
+ }
+
+ }
+
+ return null;
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java
index ea0966a5d..c9044fa2b 100644
--- a/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/PacificTrackProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2019 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -83,6 +83,11 @@ public class PacificTrackProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(UnitsConverter.knotsFromKph(BitUtil.to(speedAndCourse, 12) * 0.1));
position.set(Position.KEY_INDEX, buf.readUnsignedShort());
break;
+ case 0x20:
+ int voltage = buf.readUnsignedMedium();
+ position.set(Position.KEY_BATTERY, BitUtil.between(voltage, 0, 12) * 0.01);
+ position.set(Position.KEY_POWER, BitUtil.between(voltage, 12, 24) * 0.01);
+ break;
case 0x92:
while (buf.readerIndex() < segmentEnd) {
int field = buf.readUnsignedByte();
@@ -106,6 +111,24 @@ public class PacificTrackProtocolDecoder extends BaseProtocolDecoder {
case 0b00001:
position.set(Position.KEY_RPM, buf.readUnsignedByte() * 32);
break;
+ case 0b00011:
+ position.set("oilPressure", buf.readUnsignedByte() * 4);
+ break;
+ case 0b00100:
+ position.set("oilLevel", buf.readUnsignedByte() * 0.4);
+ break;
+ case 0b00101:
+ position.set("oilTemp", buf.readUnsignedByte() - 40);
+ break;
+ case 0b00110:
+ position.set("coolantLevel", buf.readUnsignedByte() * 0.4);
+ break;
+ case 0b00111:
+ position.set(Position.KEY_COOLANT_TEMP, buf.readUnsignedByte() - 40);
+ break;
+ case 0b01000:
+ position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedByte() * 0.4);
+ break;
case 0b01001:
position.set("defLevel", buf.readUnsignedByte() * 0.4);
break;
diff --git a/src/main/java/org/traccar/protocol/PluginProtocolDecoder.java b/src/main/java/org/traccar/protocol/PluginProtocolDecoder.java
index 949c994ee..65de211ac 100644
--- a/src/main/java/org/traccar/protocol/PluginProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/PluginProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2019 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.traccar.protocol;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
+import org.traccar.NetworkMessage;
import org.traccar.Protocol;
import org.traccar.helper.BitUtil;
import org.traccar.helper.Parser;
@@ -75,6 +76,10 @@ public class PluginProtocolDecoder extends BaseProtocolDecoder {
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
+ if (channel != null) {
+ channel.writeAndFlush(new NetworkMessage("$$hb,1#", remoteAddress));
+ }
+
Parser parser = new Parser(PATTERN, (String) msg);
if (!parser.matches()) {
return null;
@@ -98,7 +103,7 @@ public class PluginProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_SATELLITES, parser.nextInt());
position.set(Position.KEY_ODOMETER, (long) (parser.nextDouble() * 1000));
- int status = parser.nextInt();
+ long status = parser.nextLong();
position.setValid(BitUtil.check(status, 0));
position.set(Position.KEY_IGNITION, BitUtil.check(status, 1));
for (int i = 0; i < 4; i++) {
diff --git a/src/main/java/org/traccar/protocol/R12wProtocol.java b/src/main/java/org/traccar/protocol/R12wProtocol.java
new file mode 100644
index 000000000..3726233b4
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/R12wProtocol.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import io.netty.handler.codec.LineBasedFrameDecoder;
+import io.netty.handler.codec.string.StringDecoder;
+import io.netty.handler.codec.string.StringEncoder;
+import org.traccar.BaseProtocol;
+import org.traccar.PipelineBuilder;
+import org.traccar.TrackerServer;
+
+public class R12wProtocol extends BaseProtocol {
+
+ public R12wProtocol() {
+ addServer(new TrackerServer(false, getName()) {
+ @Override
+ protected void addProtocolHandlers(PipelineBuilder pipeline) {
+ pipeline.addLast(new LineBasedFrameDecoder(1024));
+ pipeline.addLast(new StringEncoder());
+ pipeline.addLast(new StringDecoder());
+ pipeline.addLast(new R12wProtocolDecoder(R12wProtocol.this));
+ }
+ });
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/R12wProtocolDecoder.java b/src/main/java/org/traccar/protocol/R12wProtocolDecoder.java
new file mode 100644
index 000000000..d60318447
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/R12wProtocolDecoder.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import io.netty.channel.Channel;
+import org.traccar.BaseProtocolDecoder;
+import org.traccar.DeviceSession;
+import org.traccar.NetworkMessage;
+import org.traccar.Protocol;
+import org.traccar.helper.Checksum;
+
+import java.net.SocketAddress;
+
+public class R12wProtocolDecoder extends BaseProtocolDecoder {
+
+ public R12wProtocolDecoder(Protocol protocol) {
+ super(protocol);
+ }
+
+ private void sendResponse(Channel channel, String type, String id, String data) {
+ if (channel != null) {
+ String sentence = String.format("$HX,%s,%s,%s,#", type, id, data);
+ sentence += String.format(",%02x,\r\n", Checksum.xor(sentence));
+ channel.writeAndFlush(new NetworkMessage(sentence, channel.remoteAddress()));
+ }
+ }
+
+ @Override
+ protected Object decode(
+ Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
+
+ String sentence = (String) msg;
+ String[] values = sentence.split(",");
+ String type = values[1];
+ String id = values[2];
+
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, id);
+ if (deviceSession == null) {
+ return null;
+ }
+
+ if (type.equals("0001")) {
+ sendResponse(channel, "1001", id, values[3] + ",OK");
+ }
+
+ return null;
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/RstProtocolDecoder.java b/src/main/java/org/traccar/protocol/RstProtocolDecoder.java
index 05601ed51..9e3261a04 100644
--- a/src/main/java/org/traccar/protocol/RstProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/RstProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2019 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,6 +43,7 @@ public class RstProtocolDecoder extends BaseProtocolDecoder {
.number("(d{9});") // serial number
.number("(d+);") // index
.number("(d+);") // type
+ .groupBegin()
.number("(dd)-(dd)-(dddd) ") // event date
.number("(dd):(dd):(dd);") // event time
.number("(dd)-(dd)-(dddd) ") // fix date
@@ -68,6 +69,7 @@ public class RstProtocolDecoder extends BaseProtocolDecoder {
.number("x{4};") // sensors
.number("(xx);") // status 1
.number("(xx);") // status 2
+ .groupEnd("?")
.any()
.compile();
@@ -80,14 +82,14 @@ public class RstProtocolDecoder extends BaseProtocolDecoder {
return null;
}
- String archive = parser.next();
+ parser.next(); // archive
String model = parser.next();
String firmware = parser.next();
String serial = parser.next();
int index = parser.nextInt();
- parser.nextInt(); // type
+ int type = parser.nextInt();
- if (channel != null && archive.equals("A")) {
+ if (channel != null) {
String response = "RST;A;" + model + ";" + firmware + ";" + serial + ";" + index + ";6;FIM;";
channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
}
@@ -97,36 +99,44 @@ public class RstProtocolDecoder extends BaseProtocolDecoder {
return null;
}
- Position position = new Position(getProtocolName());
- position.setDeviceId(deviceSession.getDeviceId());
-
- position.setDeviceTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS));
- position.setFixTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS));
- position.setLatitude(parser.nextDouble());
- position.setLongitude(parser.nextDouble());
- position.setSpeed(UnitsConverter.knotsFromKph(parser.nextInt()));
- position.setCourse(parser.nextInt());
- position.setAltitude(parser.nextInt());
- position.setValid(parser.nextInt() > 0);
-
- position.set(Position.KEY_SATELLITES, parser.nextInt());
- position.set(Position.KEY_HDOP, parser.nextInt());
- position.set(Position.PREFIX_IN + 1, parser.nextHexInt());
- position.set(Position.PREFIX_IN + 2, parser.nextHexInt());
- position.set(Position.PREFIX_IN + 3, parser.nextHexInt());
- position.set(Position.PREFIX_OUT + 1, parser.nextHexInt());
- position.set(Position.PREFIX_OUT + 2, parser.nextHexInt());
- position.set(Position.KEY_POWER, parser.nextDouble());
- position.set(Position.KEY_BATTERY, parser.nextDouble());
- position.set(Position.KEY_ODOMETER, parser.nextInt());
- position.set(Position.KEY_RSSI, parser.nextInt());
- position.set(Position.PREFIX_TEMP + 1, (int) parser.nextHexInt().byteValue());
-
- int status = (parser.nextHexInt() << 8) + parser.nextHexInt();
- position.set(Position.KEY_IGNITION, BitUtil.check(status, 7));
- position.set(Position.KEY_STATUS, status);
-
- return position;
+ if (parser.hasNext()) {
+
+ Position position = new Position(getProtocolName());
+ position.setDeviceId(deviceSession.getDeviceId());
+
+ position.setDeviceTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS));
+ position.setFixTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS));
+ position.setLatitude(parser.nextDouble());
+ position.setLongitude(parser.nextDouble());
+ position.setSpeed(UnitsConverter.knotsFromKph(parser.nextInt()));
+ position.setCourse(parser.nextInt());
+ position.setAltitude(parser.nextInt());
+ position.setValid(parser.nextInt() > 0);
+
+ position.set(Position.KEY_SATELLITES, parser.nextInt());
+ position.set(Position.KEY_HDOP, parser.nextInt());
+ position.set(Position.PREFIX_IN + 1, parser.nextHexInt());
+ position.set(Position.PREFIX_IN + 2, parser.nextHexInt());
+ position.set(Position.PREFIX_IN + 3, parser.nextHexInt());
+ position.set(Position.PREFIX_OUT + 1, parser.nextHexInt());
+ position.set(Position.PREFIX_OUT + 2, parser.nextHexInt());
+ position.set(Position.KEY_POWER, parser.nextDouble());
+ position.set(Position.KEY_BATTERY, parser.nextDouble());
+ position.set(Position.KEY_ODOMETER, parser.nextInt());
+ position.set(Position.KEY_RSSI, parser.nextInt());
+ position.set(Position.PREFIX_TEMP + 1, (int) parser.nextHexInt().byteValue());
+
+ int status = (parser.nextHexInt() << 8) + parser.nextHexInt();
+ position.set(Position.KEY_IGNITION, BitUtil.check(status, 7));
+ position.set(Position.KEY_STATUS, status);
+
+ return position;
+
+ } else {
+
+ return null;
+
+ }
}
}
diff --git a/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java
index 227a9ac91..b6378f416 100644
--- a/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 - 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2013 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -110,6 +110,16 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
case 80:
position.set(Position.PREFIX_TEMP + (id - 78), readValue(buf, length, true) * 0.1);
break;
+ case 198:
+ position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED);
+ break;
+ case 199:
+ case 200:
+ position.set(Position.KEY_ALARM, Position.ALARM_BRAKING);
+ break;
+ case 201:
+ position.set(Position.KEY_ALARM, Position.ALARM_ACCELERATION);
+ break;
default:
position.set(Position.PREFIX_IO + id, readValue(buf, length, false));
break;
diff --git a/src/main/java/org/traccar/protocol/SiwiProtocolDecoder.java b/src/main/java/org/traccar/protocol/SiwiProtocolDecoder.java
index 6b97f5fe0..bf8bfab77 100644
--- a/src/main/java/org/traccar/protocol/SiwiProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/SiwiProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,12 +38,12 @@ public class SiwiProtocolDecoder extends BaseProtocolDecoder {
.number("(d+),") // device id
.number("d+,") // unit no
.expression("([A-Z]),") // reason
- .number("d+,") // command code
+ .number("d*,") // command code
.number("[^,]*,") // command value
.expression("([01]),") // ignition
.expression("[01],") // power cut
- .expression("[01],") // box open
- .number("d+,") // message key
+ .number("d+,") // flags
+ .number("[^,]+,")
.number("(d+),") // odometer
.number("(d+),") // speed
.number("(d+),") // satellites
@@ -54,6 +54,19 @@ public class SiwiProtocolDecoder extends BaseProtocolDecoder {
.number("(d+),") // course
.number("(dd)(dd)(dd),") // time (hhmmss)
.number("(dd)(dd)(dd),") // date (ddmmyy)
+ .number("d+,") // signal strength
+ .number("d+,") // gsm status
+ .number("d+,") // error code
+ .number("d+,") // internal status
+ .number("(d+),") // battery
+ .number("(d+),") // adc
+ .number("(d+),") // digital inputs
+ .number("(d+),") // sensor 1
+ .number("(d+),") // sensor 2
+ .number("(d+),") // sensor 3
+ .number("(d+),") // sensor 4
+ .expression("([^,]+),") // hw version
+ .expression("([^,]+),") // sw version
.any()
.compile();
@@ -90,6 +103,20 @@ public class SiwiProtocolDecoder extends BaseProtocolDecoder {
position.setTime(parser.nextDateTime(Parser.DateTimeFormat.HMS_DMY, "IST"));
+ position.set(Position.KEY_BATTERY, parser.nextInt() * 0.001);
+ position.set(Position.PREFIX_ADC + 1, parser.nextInt() * 0.01);
+ position.set(Position.KEY_INPUT, parser.nextInt());
+
+ for (int i = 1; i <= 4; i++) {
+ int value = parser.nextInt();
+ if (value != 0) {
+ position.set(Position.PREFIX_IO + i, value);
+ }
+ }
+
+ position.set(Position.KEY_VERSION_HW, parser.next());
+ position.set(Position.KEY_VERSION_FW, parser.next());
+
return position;
}
diff --git a/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java b/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java
index 882bed81b..82f0e4061 100644
--- a/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -193,6 +193,12 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder {
case "#TVI#":
position.set(Position.KEY_DEVICE_TEMP, Double.parseDouble(data[i]));
break;
+ case "#CFL#":
+ position.set(Position.KEY_FUEL_LEVEL, Integer.parseInt(data[i]));
+ break;
+ case "#CFL2#":
+ position.set("fuel2", Integer.parseInt(data[i]));
+ break;
case "#IN1#":
case "#IN2#":
case "#IN3#":
diff --git a/src/main/java/org/traccar/protocol/StartekProtocol.java b/src/main/java/org/traccar/protocol/StartekProtocol.java
new file mode 100644
index 000000000..32f1c5a29
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/StartekProtocol.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import io.netty.handler.codec.LineBasedFrameDecoder;
+import io.netty.handler.codec.string.StringDecoder;
+import io.netty.handler.codec.string.StringEncoder;
+import org.traccar.BaseProtocol;
+import org.traccar.PipelineBuilder;
+import org.traccar.TrackerServer;
+import org.traccar.model.Command;
+
+public class StartekProtocol extends BaseProtocol {
+
+ public StartekProtocol() {
+ setSupportedDataCommands(
+ Command.TYPE_CUSTOM,
+ Command.TYPE_OUTPUT_CONTROL,
+ Command.TYPE_ENGINE_STOP,
+ Command.TYPE_ENGINE_RESUME);
+ addServer(new TrackerServer(false, getName()) {
+ @Override
+ protected void addProtocolHandlers(PipelineBuilder pipeline) {
+ pipeline.addLast(new LineBasedFrameDecoder(1024));
+ pipeline.addLast(new StringEncoder());
+ pipeline.addLast(new StringDecoder());
+ pipeline.addLast(new StartekProtocolEncoder(StartekProtocol.this));
+ pipeline.addLast(new StartekProtocolDecoder(StartekProtocol.this));
+ }
+ });
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/StartekProtocolDecoder.java b/src/main/java/org/traccar/protocol/StartekProtocolDecoder.java
new file mode 100644
index 000000000..1cc69c6e6
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/StartekProtocolDecoder.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import io.netty.channel.Channel;
+import org.traccar.BaseProtocolDecoder;
+import org.traccar.DeviceSession;
+import org.traccar.Protocol;
+import org.traccar.helper.BitUtil;
+import org.traccar.helper.Parser;
+import org.traccar.helper.PatternBuilder;
+import org.traccar.helper.UnitsConverter;
+import org.traccar.model.CellTower;
+import org.traccar.model.Network;
+import org.traccar.model.Position;
+
+import java.net.SocketAddress;
+import java.util.regex.Pattern;
+
+public class StartekProtocolDecoder extends BaseProtocolDecoder {
+
+ public StartekProtocolDecoder(Protocol protocol) {
+ super(protocol);
+ }
+
+ private static final Pattern PATTERN = new PatternBuilder()
+ .text("&&")
+ .expression(".") // index
+ .number("d+,") // length
+ .number("(d+),") // imei
+ .number("xxx,") // command
+ .number("(d+),") // event
+ .expression("([^,]+)?,") // event data
+ .number("(dd)(dd)(dd)") // date (yyymmdd)
+ .number("(dd)(dd)(dd),") // time (hhmmss)
+ .expression("([AV]),") // valid
+ .number("(-?d+.d+),") // longitude
+ .number("(-?d+.d+),") // latitude
+ .number("(d+),") // satellites
+ .number("(d+.d+),") // hdop
+ .number("(d+),") // speed
+ .number("(d+),") // course
+ .number("(-?d+),") // altitude
+ .number("(d+),") // odometer
+ .number("(d+)|") // mcc
+ .number("(d+)|") // mnc
+ .number("(x+)|") // lac
+ .number("(x+),") // cid
+ .number("(d+),") // rssi
+ .number("(x+),") // status
+ .number("(x+),") // inputs
+ .number("(x+),") // outputs
+ .number("(x+)|") // power
+ .number("(x+)|") // battery
+ .expression("([^,]+),") // adc
+ .number("d,") // extended
+ .expression("([^,]+)?,") // fuel
+ .expression("([^,]+)?") // temperature
+ .number("xx") // checksum
+ .compile();
+
+ private String decodeAlarm(int value) {
+ switch (value) {
+ case 5:
+ case 6:
+ return Position.ALARM_DOOR;
+ case 39:
+ return Position.ALARM_ACCELERATION;
+ case 40:
+ return Position.ALARM_BRAKING;
+ case 41:
+ return Position.ALARM_CORNERING;
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ protected Object decode(
+ Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
+
+ Parser parser = new Parser(PATTERN, (String) msg);
+ if (!parser.matches()) {
+ return null;
+ }
+
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());
+ if (deviceSession == null) {
+ return null;
+ }
+
+ Position position = new Position(getProtocolName());
+ position.setDeviceId(deviceSession.getDeviceId());
+
+ int event = parser.nextInt();
+ String eventData = parser.next();
+ position.set(Position.KEY_EVENT, event);
+ if (event == 53) {
+ position.set(Position.KEY_DRIVER_UNIQUE_ID, eventData);
+ } else {
+ position.set(Position.KEY_ALARM, decodeAlarm(event));
+ }
+
+ position.setTime(parser.nextDateTime());
+ position.setValid(parser.next().equals("A"));
+ position.setLatitude(parser.nextDouble());
+ position.setLongitude(parser.nextDouble());
+
+ position.set(Position.KEY_SATELLITES, parser.nextInt());
+ position.set(Position.KEY_HDOP, parser.nextDouble());
+
+ position.setSpeed(UnitsConverter.knotsFromKph(parser.nextInt()));
+ position.setCourse(parser.nextInt());
+ position.setAltitude(parser.nextInt());
+
+ position.set(Position.KEY_ODOMETER, parser.nextInt());
+
+ position.setNetwork(new Network(CellTower.from(
+ parser.nextInt(), parser.nextInt(), parser.nextHexInt(), parser.nextHexInt(), parser.nextInt())));
+
+ position.set(Position.KEY_STATUS, parser.nextHexInt());
+ position.set(Position.KEY_INPUT, parser.nextHexInt());
+ position.set(Position.KEY_OUTPUT, parser.nextHexInt());
+
+ position.set(Position.KEY_POWER, parser.nextHexInt() * 0.01);
+ position.set(Position.KEY_BATTERY, parser.nextHexInt() * 0.01);
+
+ String[] adc = parser.next().split("\\|");
+ for (int i = 0; i < adc.length; i++) {
+ position.set(Position.PREFIX_ADC + (i + 1), Integer.parseInt(adc[i], 16) * 0.01);
+ }
+
+ if (parser.hasNext()) {
+ String[] fuels = parser.next().split("\\|");
+ for (String fuel : fuels) {
+ int index = Integer.parseInt(fuel.substring(0, 2));
+ int value = Integer.parseInt(fuel.substring(2), 16);
+ position.set("fuel" + index, value * 0.1);
+ }
+ }
+
+ if (parser.hasNext()) {
+ String[] temperatures = parser.next().split("\\|");
+ for (String temperature : temperatures) {
+ int index = Integer.parseInt(temperature.substring(0, 2));
+ int value = Integer.parseInt(temperature.substring(2), 16);
+ double convertedValue = BitUtil.to(value, 15);
+ if (BitUtil.check(value, 15)) {
+ convertedValue = -convertedValue;
+ }
+ position.set(Position.PREFIX_TEMP + index, convertedValue * 0.1);
+ }
+ }
+
+ return position;
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/StartekProtocolEncoder.java b/src/main/java/org/traccar/protocol/StartekProtocolEncoder.java
new file mode 100644
index 000000000..011a8dfae
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/StartekProtocolEncoder.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import io.netty.channel.Channel;
+import org.traccar.Protocol;
+import org.traccar.StringProtocolEncoder;
+import org.traccar.helper.Checksum;
+import org.traccar.model.Command;
+
+public class StartekProtocolEncoder extends StringProtocolEncoder {
+
+ public StartekProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
+ @Override
+ protected String formatCommand(Command command, String format, String... keys) {
+ String uniqueId = getUniqueId(command.getDeviceId());
+ String payload = super.formatCommand(command, format, keys);
+ int length = 1 + uniqueId.length() + 1 + payload.length();
+ String sentence = "$$:" + length + "," + uniqueId + "," + payload;
+ return sentence + Checksum.sum(sentence) + "\r\n";
+ }
+
+ @Override
+ protected Object encodeCommand(Channel channel, Command command) {
+
+ switch (command.getType()) {
+ case Command.TYPE_CUSTOM:
+ return formatCommand(command, "%s", Command.KEY_DATA);
+ case Command.TYPE_OUTPUT_CONTROL:
+ return formatCommand(command, "900,%s,%s", Command.KEY_INDEX, Command.KEY_DATA);
+ case Command.TYPE_ENGINE_STOP:
+ return formatCommand(command, "900,1,1");
+ case Command.TYPE_ENGINE_RESUME:
+ return formatCommand(command, "900,1,0");
+ default:
+ return null;
+ }
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
index 76e3e6ecc..d8710a899 100644
--- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -356,6 +356,8 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
totalFuel += fuel2;
position.set("fuel2", fuel2);
}
+ } else if (attribute.startsWith("GTSL")) {
+ position.set(Position.KEY_DRIVER_UNIQUE_ID, attribute.split("\\|")[4]);
} else {
String[] pair = attribute.split("=");
if (pair.length >= 2) {
diff --git a/src/main/java/org/traccar/protocol/TaipPrefixEncoder.java b/src/main/java/org/traccar/protocol/TaipPrefixEncoder.java
new file mode 100644
index 000000000..02c111b01
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/TaipPrefixEncoder.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import io.netty.channel.ChannelHandler;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.MessageToMessageEncoder;
+import org.traccar.Context;
+import org.traccar.Protocol;
+import org.traccar.config.Keys;
+
+import java.util.List;
+
+@ChannelHandler.Sharable
+public class TaipPrefixEncoder extends MessageToMessageEncoder<ByteBuf> {
+
+ private final Protocol protocol;
+
+ public TaipPrefixEncoder(Protocol protocol) {
+ this.protocol = protocol;
+ }
+
+ @Override
+ protected void encode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
+ if (Context.getConfig().getBoolean(Keys.PROTOCOL_PREFIX.withPrefix(protocol.getName()))) {
+ out.add(Unpooled.wrappedBuffer(Unpooled.wrappedBuffer(new byte[] {0x20, 0x20, 0x06, 0x00}), msg.retain()));
+ } else {
+ out.add(msg.retain());
+ }
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/TaipProtocol.java b/src/main/java/org/traccar/protocol/TaipProtocol.java
index b8f40a183..0966cfd7c 100644
--- a/src/main/java/org/traccar/protocol/TaipProtocol.java
+++ b/src/main/java/org/traccar/protocol/TaipProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@ public class TaipProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '<'));
+ pipeline.addLast(new TaipPrefixEncoder(TaipProtocol.this));
pipeline.addLast(new StringDecoder());
pipeline.addLast(new StringEncoder());
pipeline.addLast(new TaipProtocolDecoder(TaipProtocol.this));
@@ -37,6 +38,7 @@ public class TaipProtocol extends BaseProtocol {
addServer(new TrackerServer(true, getName()) {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
+ pipeline.addLast(new TaipPrefixEncoder(TaipProtocol.this));
pipeline.addLast(new StringDecoder());
pipeline.addLast(new StringEncoder());
pipeline.addLast(new TaipProtocolDecoder(TaipProtocol.this));
diff --git a/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java b/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java
index 6f71b6c08..ec0ce1931 100644
--- a/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java
@@ -313,7 +313,7 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
if (messageIndex != null) {
String response;
if (messageIndex.startsWith("#IP")) {
- response = "\u0020\u0020\u0006\u0000>SAK;ID=" + uniqueId + ";" + messageIndex + "<";
+ response = ">SAK;ID=" + uniqueId + ";" + messageIndex + "<";
} else {
response = ">ACK;ID=" + uniqueId + ";" + messageIndex + ";*";
response += String.format("%02X", Checksum.xor(response)) + "<";
diff --git a/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
index 716589e00..6ba183f9b 100644
--- a/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2013 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -312,6 +312,11 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
break;
}
break;
+ case 389:
+ if (BitUtil.between(readValue(buf, length, false), 4, 8) == 1) {
+ position.set(Position.KEY_ALARM, Position.ALARM_SOS);
+ }
+ break;
default:
position.set(Position.PREFIX_IO + id, readValue(buf, length, false));
break;
@@ -537,7 +542,11 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
int id = buf.readUnsignedShort();
int length = buf.readUnsignedShort();
if (id == 256) {
- position.set(Position.KEY_VIN, buf.readSlice(length).toString(StandardCharsets.US_ASCII));
+ position.set(Position.KEY_VIN,
+ buf.readSlice(length).toString(StandardCharsets.US_ASCII));
+ } else if (id == 281) {
+ position.set(Position.KEY_DTCS,
+ buf.readSlice(length).toString(StandardCharsets.US_ASCII).replace(',', ' '));
} else if (id == 385) {
ByteBuf data = buf.readSlice(length);
data.readUnsignedByte(); // data part
@@ -617,19 +626,17 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
}
if (channel != null && codec != CODEC_12 && codec != CODEC_13) {
+ ByteBuf response = Unpooled.buffer();
if (connectionless) {
- ByteBuf response = Unpooled.buffer();
response.writeShort(5);
response.writeShort(0);
response.writeByte(0x01);
response.writeByte(locationPacketId);
response.writeByte(count);
- channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
} else {
- ByteBuf response = Unpooled.buffer();
response.writeInt(count);
- channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
}
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
}
return positions.isEmpty() ? null : positions;
diff --git a/src/main/java/org/traccar/protocol/ThinkPowerProtocol.java b/src/main/java/org/traccar/protocol/ThinkPowerProtocol.java
new file mode 100644
index 000000000..ece1b0544
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/ThinkPowerProtocol.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
+import org.traccar.BaseProtocol;
+import org.traccar.PipelineBuilder;
+import org.traccar.TrackerServer;
+
+public class ThinkPowerProtocol extends BaseProtocol {
+
+ public ThinkPowerProtocol() {
+ addServer(new TrackerServer(false, getName()) {
+ @Override
+ protected void addProtocolHandlers(PipelineBuilder pipeline) {
+ pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 2, 2, 2, 0));
+ pipeline.addLast(new ThinkPowerProtocolDecoder(ThinkPowerProtocol.this));
+ }
+ });
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/ThinkPowerProtocolDecoder.java b/src/main/java/org/traccar/protocol/ThinkPowerProtocolDecoder.java
new file mode 100644
index 000000000..b3f943078
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/ThinkPowerProtocolDecoder.java
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import io.netty.channel.Channel;
+import org.traccar.BaseProtocolDecoder;
+import org.traccar.DeviceSession;
+import org.traccar.NetworkMessage;
+import org.traccar.Protocol;
+import org.traccar.helper.Checksum;
+import org.traccar.helper.UnitsConverter;
+import org.traccar.model.Position;
+
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.util.Date;
+
+public class ThinkPowerProtocolDecoder extends BaseProtocolDecoder {
+
+ public ThinkPowerProtocolDecoder(Protocol protocol) {
+ super(protocol);
+ }
+
+ public static final int MSG_LOGIN_REQUEST = 0x01;
+ public static final int MSG_LOGIN_RESPONSE = 0x02;
+ public static final int MSG_HEARTBEAT_REQUEST = 0x03;
+ public static final int MSG_HEARTBEAT_RESPONSE = 0x04;
+ public static final int MSG_RECORD_REPORT = 0x05;
+ public static final int MSG_RECORD_RESPONSE = 0x06;
+
+ private void sendResponse(Channel channel, int type, int index, ByteBuf content) {
+ if (channel != null) {
+ ByteBuf response = Unpooled.buffer();
+ response.writeByte(type);
+ response.writeByte(index);
+ if (content != null) {
+ response.writeShort(content.readableBytes());
+ response.writeBytes(content);
+ content.release();
+ } else {
+ response.writeShort(0);
+ }
+ response.writeShort(Checksum.crc16(Checksum.CRC16_CCITT_FALSE, response.nioBuffer()));
+ channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));
+ }
+ }
+
+ private void decodeValue(Position position, int type, ByteBuf buf) {
+ switch (type) {
+ case 0x01:
+ position.setValid(true);
+ position.setLatitude(buf.readInt() * 0.0000001);
+ position.setLongitude(buf.readInt() * 0.0000001);
+ position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort() * 0.1));
+ position.setCourse(buf.readUnsignedShort() * 0.01);
+ break;
+ case 0x02:
+ position.setValid(buf.readUnsignedByte() > 0);
+ break;
+ case 0x03:
+ buf.skipBytes(3); // geofence
+ break;
+ case 0x06:
+ case 0x07:
+ case 0x08:
+ buf.skipBytes(2); // g-sensor x/y/z
+ break;
+ case 0x09:
+ buf.readUnsignedByte(); // collision alarm
+ break;
+ case 0x0A:
+ buf.readUnsignedByte(); // drop alarm
+ break;
+ case 0x10:
+ if (buf.readUnsignedByte() > 0) {
+ position.set(Position.KEY_ALARM, Position.ALARM_SOS);
+ }
+ break;
+ case 0x12:
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.1);
+ break;
+ case 0x13:
+ if (buf.readUnsignedByte() > 0) {
+ position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY);
+ }
+ break;
+ case 0x16:
+ buf.readUnsignedShort(); // temperature
+ break;
+ case 0x17:
+ buf.readUnsignedByte(); // humidity
+ break;
+ case 0x18:
+ buf.readUnsignedShort(); // high temperature
+ break;
+ case 0x19:
+ buf.readUnsignedByte(); // high humidity
+ break;
+ case 0x50:
+ if (buf.readUnsignedByte() > 0) {
+ position.set(Position.KEY_ALARM, Position.ALARM_REMOVING);
+ }
+ break;
+ case 0x51:
+ if (buf.readUnsignedByte() > 0) {
+ position.set(Position.KEY_ALARM, Position.ALARM_TAMPERING);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ @Override
+ protected Object decode(
+ Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
+
+ ByteBuf buf = (ByteBuf) msg;
+
+ int type = buf.readUnsignedByte();
+ int index = buf.readUnsignedByte();
+ buf.readUnsignedShort(); // length
+
+ if (type == MSG_LOGIN_REQUEST) {
+
+ buf.readUnsignedByte(); // protocol major version
+ buf.readUnsignedByte(); // protocol minor version
+
+ String id = buf.readCharSequence(buf.readUnsignedByte(), StandardCharsets.US_ASCII).toString();
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, id);
+
+ ByteBuf content = Unpooled.buffer();
+ content.writeByte(deviceSession != null ? 0 : 4);
+ sendResponse(channel, MSG_LOGIN_RESPONSE, index, content);
+
+ } else if (type == MSG_HEARTBEAT_REQUEST) {
+
+ sendResponse(channel, MSG_HEARTBEAT_RESPONSE, index, null);
+
+ } else if (type == MSG_RECORD_REPORT) {
+
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress);
+ if (deviceSession == null) {
+ return null;
+ }
+
+ buf.readUnsignedByte(); // count
+
+ Position position = new Position(getProtocolName());
+ position.setDeviceId(deviceSession.getDeviceId());
+
+ position.setTime(new Date(buf.readUnsignedInt() * 1000));
+
+ while (buf.readableBytes() > 2) {
+ decodeValue(position, buf.readUnsignedByte(), buf);
+ }
+
+ sendResponse(channel, MSG_RECORD_RESPONSE, index, null);
+
+ return position;
+
+ }
+
+ return null;
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Tk103ProtocolDecoder.java
index 5dad1458d..ff33cb103 100644
--- a/src/main/java/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -60,9 +60,9 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
.groupEnd()
.number("(dd)(dd)(dd),?") // date (mmddyy if comma-delimited, otherwise yyddmm)
.expression("([AV]),?") // validity
- .number(" *(d+)(dd.d+)") // latitude
+ .number(" *(d*)(dd.d+)") // latitude
.expression("([NS]),?")
- .number(" *(d+)(dd.d+)") // longitude
+ .number(" *(d*)(dd.d+)") // longitude
.expression("([EW]),?")
.number("([ d.]{1,5})(?:d*,)?") // speed
.number("(dd)(dd)(dd),?") // time (hhmmss)
diff --git a/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java
index 3ce6438f8..ad7dfa886 100644
--- a/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 - 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2013 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,9 @@ import org.traccar.Protocol;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
+import org.traccar.model.Network;
import org.traccar.model.Position;
+import org.traccar.model.WifiAccessPoint;
import java.net.SocketAddress;
import java.util.LinkedList;
@@ -51,10 +53,11 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
.compile();
private static final Pattern PATTERN_POSITION = new PatternBuilder()
- .number("#(x+)?") // cell info
+ .text("#")
+ .number("(?:(dd)|x*)") // cell or voltage
.text("$GPRMC,")
.number("(dd)(dd)(dd).d+,") // time (hhmmss.sss)
- .expression("([AV]),") // validity
+ .expression("([AVL]),") // validity
.number("(d+)(dd.d+),") // latitude
.expression("([NS]),")
.number("(d+)(dd.d+),") // longitude
@@ -65,6 +68,18 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
.any()
.compile();
+ private static final Pattern PATTERN_WIFI = new PatternBuilder()
+ .text("#")
+ .number("(?:(dd)|x+)") // cell or voltage
+ .text("$WIFI,")
+ .number("(dd)(dd)(dd).d+,") // time (hhmmss.sss)
+ .expression("[AVL],") // validity
+ .expression("(.*)") // access points
+ .number("(dd)(dd)(dd)") // date (ddmmyy)
+ .text("*")
+ .number("xx") // checksum
+ .compile();
+
private void decodeStatus(Position position, String status) {
switch (status) {
case "AUTOSTART":
@@ -141,38 +156,74 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
List<Position> positions = new LinkedList<>();
for (String message : messages) {
- parser = new Parser(PATTERN_POSITION, message);
- if (parser.matches()) {
+ Position position = new Position(getProtocolName());
+ position.setDeviceId(deviceSession.getDeviceId());
+
+ if (message.contains("$GPRMC")) {
+
+ parser = new Parser(PATTERN_POSITION, message);
+ if (parser.matches()) {
+
+ if (parser.hasNext()) {
+ position.set(Position.KEY_BATTERY, parser.nextInt() * 0.1);
+ }
+
+ DateBuilder dateBuilder = new DateBuilder()
+ .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt());
- Position position = new Position(getProtocolName());
- position.setDeviceId(deviceSession.getDeviceId());
+ position.setValid(parser.next().equals("A"));
+ position.setLatitude(parser.nextCoordinate());
+ position.setLongitude(parser.nextCoordinate());
+ position.setSpeed(parser.nextDouble(0));
+ position.setCourse(parser.nextDouble(0));
- parser.next(); // base station info
+ dateBuilder.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt());
+ position.setTime(dateBuilder.getDate());
- DateBuilder dateBuilder = new DateBuilder()
- .setTime(parser.nextInt(0), parser.nextInt(0), parser.nextInt(0));
+ } else {
+ continue;
+ }
- position.setValid(parser.next().equals("A"));
- position.setLatitude(parser.nextCoordinate());
- position.setLongitude(parser.nextCoordinate());
- position.setSpeed(parser.nextDouble(0));
- position.setCourse(parser.nextDouble(0));
+ } else if (message.contains("$WIFI")) {
- dateBuilder.setDateReverse(parser.nextInt(0), parser.nextInt(0), parser.nextInt(0));
- position.setTime(dateBuilder.getDate());
+ parser = new Parser(PATTERN_WIFI, message);
+ if (parser.matches()) {
- position.set(Position.KEY_DOOR, door);
- position.set(Position.PREFIX_ADC + 1, adc);
- position.set(Position.KEY_POWER, power);
- position.set(Position.KEY_BATTERY, battery);
- position.set(Position.PREFIX_TEMP + 1, temperature);
- decodeStatus(position, status);
+ position.set(Position.KEY_BATTERY, parser.nextInt() * 0.1);
+
+ DateBuilder dateBuilder = new DateBuilder()
+ .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt());
+
+ String[] values = parser.next().split(",");
+ Network network = new Network();
+ for (int i = 0; i < values.length / 2; i++) {
+ String mac = values[i * 2 + 1].replaceAll("(..)", "$1:").substring(0, 17);
+ network.addWifiAccessPoint(WifiAccessPoint.from(mac, Integer.parseInt(values[i * 2])));
+ }
+ position.setNetwork(network);
+
+ dateBuilder.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt());
+
+ getLastLocation(position, dateBuilder.getDate());
+ }
+
+ } else {
+
+ getLastLocation(position, null);
- positions.add(position);
}
+
+ position.set(Position.KEY_DOOR, door);
+ position.set(Position.PREFIX_ADC + 1, adc);
+ position.set(Position.KEY_POWER, power);
+ position.set(Position.KEY_BATTERY, battery);
+ position.set(Position.PREFIX_TEMP + 1, temperature);
+ decodeStatus(position, status);
+
+ positions.add(position);
}
- return positions;
+ return positions.isEmpty() ? null : positions;
}
}
diff --git a/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java b/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java
index 4042e348c..87db95946 100644
--- a/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TopinProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2019 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import org.traccar.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
import org.traccar.helper.BcdUtil;
+import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.CellTower;
@@ -151,6 +152,21 @@ public class TopinProtocolDecoder extends BaseProtocolDecoder {
Gt06ProtocolDecoder.decodeGps(position, buf, false, TimeZone.getTimeZone("UTC"));
+ if (buf.readableBytes() >= 5) {
+ position.setAltitude(buf.readShort());
+
+ int alarms = buf.readUnsignedByte();
+ if (BitUtil.check(alarms, 0)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_VIBRATION);
+ }
+ if (BitUtil.check(alarms, 1)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED);
+ }
+ if (BitUtil.check(alarms, 4)) {
+ position.set(Position.KEY_ALARM, Position.ALARM_LOW_POWER);
+ }
+ }
+
ByteBuf content = Unpooled.buffer();
content.writeBytes(time);
sendResponse(channel, length, type, content);
@@ -174,9 +190,18 @@ public class TopinProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte());
buf.readUnsignedByte(); // timezone
int interval = buf.readUnsignedByte();
- if (length >= 7) {
+ if (buf.readableBytes() >= 1 + 2) {
position.set(Position.KEY_RSSI, buf.readUnsignedByte());
}
+ if (buf.readableBytes() >= 3 + 2) {
+ buf.skipBytes(3); // temperature
+ }
+ if (buf.readableBytes() >= 1 + 2) {
+ position.set(Position.KEY_CHARGE, buf.readUnsignedByte() > 0);
+ }
+ if (buf.readableBytes() >= 1 + 2) {
+ position.set(Position.KEY_HEART_RATE, buf.readUnsignedByte());
+ }
ByteBuf content = Unpooled.buffer();
content.writeByte(interval);
diff --git a/src/main/java/org/traccar/protocol/Tr20Protocol.java b/src/main/java/org/traccar/protocol/Tr20Protocol.java
index 3eee9d9c3..1b71db03f 100644
--- a/src/main/java/org/traccar/protocol/Tr20Protocol.java
+++ b/src/main/java/org/traccar/protocol/Tr20Protocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,6 +34,14 @@ public class Tr20Protocol extends BaseProtocol {
pipeline.addLast(new Tr20ProtocolDecoder(Tr20Protocol.this));
}
});
+ addServer(new TrackerServer(true, getName()) {
+ @Override
+ protected void addProtocolHandlers(PipelineBuilder pipeline) {
+ pipeline.addLast(new StringEncoder());
+ pipeline.addLast(new StringDecoder());
+ pipeline.addLast(new Tr20ProtocolDecoder(Tr20Protocol.this));
+ }
+ });
}
}
diff --git a/src/main/java/org/traccar/protocol/Tr20ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Tr20ProtocolDecoder.java
index c2e6c381f..2f11bd152 100644
--- a/src/main/java/org/traccar/protocol/Tr20ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Tr20ProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,7 +52,7 @@ public class Tr20ProtocolDecoder extends BaseProtocolDecoder {
.number("(ddd)(dd.d+),") // longitude
.number("(d+),") // speed
.number("(d+),") // course
- .number("(?:NA|[FC]?(-?d+)),") // temperature
+ .number("(?:NA|[FC]?(-?d+)[^,]*),") // temperature
.number("(x{8}),") // status
.number("(d+)") // event
.any()
diff --git a/src/main/java/org/traccar/protocol/UlbotechProtocol.java b/src/main/java/org/traccar/protocol/UlbotechProtocol.java
index b99ec1cc6..dfe5235f0 100644
--- a/src/main/java/org/traccar/protocol/UlbotechProtocol.java
+++ b/src/main/java/org/traccar/protocol/UlbotechProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,14 +18,18 @@ package org.traccar.protocol;
import org.traccar.BaseProtocol;
import org.traccar.PipelineBuilder;
import org.traccar.TrackerServer;
+import org.traccar.model.Command;
public class UlbotechProtocol extends BaseProtocol {
public UlbotechProtocol() {
+ setSupportedDataCommands(
+ Command.TYPE_CUSTOM);
addServer(new TrackerServer(false, getName()) {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new UlbotechFrameDecoder());
+ pipeline.addLast(new UlbotechProtocolEncoder(UlbotechProtocol.this));
pipeline.addLast(new UlbotechProtocolDecoder(UlbotechProtocol.this));
}
});
diff --git a/src/main/java/org/traccar/protocol/UlbotechProtocolEncoder.java b/src/main/java/org/traccar/protocol/UlbotechProtocolEncoder.java
new file mode 100644
index 000000000..5528c7242
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/UlbotechProtocolEncoder.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import io.netty.buffer.Unpooled;
+import org.traccar.BaseProtocolEncoder;
+import org.traccar.Protocol;
+import org.traccar.model.Command;
+
+import java.nio.charset.StandardCharsets;
+
+public class UlbotechProtocolEncoder extends BaseProtocolEncoder {
+
+ public UlbotechProtocolEncoder(Protocol protocol) {
+ super(protocol);
+ }
+
+ @Override
+ protected Object encodeCommand(Command command) {
+ switch (command.getType()) {
+ case Command.TYPE_CUSTOM:
+ return Unpooled.copiedBuffer(
+ "*TS01," + command.getString(Command.KEY_DATA) + "#", StandardCharsets.US_ASCII);
+ default:
+ return null;
+ }
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/UuxProtocol.java b/src/main/java/org/traccar/protocol/UuxProtocol.java
new file mode 100644
index 000000000..41b59d829
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/UuxProtocol.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
+import org.traccar.BaseProtocol;
+import org.traccar.PipelineBuilder;
+import org.traccar.TrackerServer;
+
+public class UuxProtocol extends BaseProtocol {
+
+ public UuxProtocol() {
+ addServer(new TrackerServer(false, getName()) {
+ @Override
+ protected void addProtocolHandlers(PipelineBuilder pipeline) {
+ pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 3, 1));
+ pipeline.addLast(new UuxProtocolDecoder(UuxProtocol.this));
+ }
+ });
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/UuxProtocolDecoder.java b/src/main/java/org/traccar/protocol/UuxProtocolDecoder.java
new file mode 100644
index 000000000..cb8656545
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/UuxProtocolDecoder.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.protocol;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import io.netty.channel.Channel;
+import org.traccar.BaseProtocolDecoder;
+import org.traccar.DeviceSession;
+import org.traccar.NetworkMessage;
+import org.traccar.Protocol;
+import org.traccar.helper.BitUtil;
+import org.traccar.helper.DateBuilder;
+import org.traccar.model.Position;
+
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.util.Calendar;
+
+public class UuxProtocolDecoder extends BaseProtocolDecoder {
+
+ public UuxProtocolDecoder(Protocol protocol) {
+ super(protocol);
+ }
+
+ public static final int MSG_IMMOBILIZER = 0x9E;
+ public static final int MSG_ACK = 0xD0;
+ public static final int MSG_NACK = 0xF0;
+
+ private void sendResponse(Channel channel, int productCode, int protocolVersion, int type) {
+ if (channel != null && BitUtil.check(protocolVersion, 7)) {
+ ByteBuf response = Unpooled.buffer();
+ response.writeShort(productCode);
+ response.writeByte(BitUtil.to(protocolVersion, 7));
+ response.writeByte(1); // length
+ response.writeByte(type);
+ channel.writeAndFlush(new NetworkMessage(response, channel.remoteAddress()));
+ }
+ }
+
+ @Override
+ protected Object decode(
+ Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
+
+ ByteBuf buf = (ByteBuf) msg;
+
+ int productCode = buf.readUnsignedShort();
+ int protocolVersion = buf.readUnsignedByte();
+ buf.readUnsignedByte(); // length
+ int type = buf.readUnsignedByte();
+
+ String vehicleId = buf.readCharSequence(10, StandardCharsets.US_ASCII).toString();
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, vehicleId);
+ if (deviceSession == null) {
+ sendResponse(channel, productCode, protocolVersion, MSG_NACK);
+ return null;
+ }
+
+ if (type == MSG_IMMOBILIZER) {
+
+ Position position = new Position(getProtocolName());
+ position.setDeviceId(deviceSession.getDeviceId());
+
+ DateBuilder dateBuilder = new DateBuilder()
+ .setDate(Calendar.getInstance().get(Calendar.YEAR), buf.readUnsignedByte(), buf.readUnsignedByte())
+ .setTime(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte());
+
+ getLastLocation(position, dateBuilder.getDate());
+
+ position.set("companyId", buf.readCharSequence(6, StandardCharsets.US_ASCII).toString());
+ position.set("tripId", buf.readUnsignedShort());
+
+ return position;
+
+ }
+
+ sendResponse(channel, productCode, protocolVersion, MSG_ACK);
+
+ return null;
+ }
+
+}
diff --git a/src/main/java/org/traccar/protocol/WialonProtocolDecoder.java b/src/main/java/org/traccar/protocol/WialonProtocolDecoder.java
index 223d032b8..80299ff08 100644
--- a/src/main/java/org/traccar/protocol/WialonProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/WialonProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2013 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,12 +49,12 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder {
private static final Pattern PATTERN = new PatternBuilder()
.number("(dd)(dd)(dd);") // date (ddmmyy)
.number("(dd)(dd)(dd);") // time (hhmmss)
- .number("(dd)(dd.d+);") // latitude
- .expression("([NS]);")
- .number("(ddd)(dd.d+);") // longitude
- .expression("([EW]);")
+ .number("(?:NA|(dd)(dd.d+));") // latitude
+ .expression("(?:NA|([NS]));")
+ .number("(?:NA|(ddd)(dd.d+));") // longitude
+ .expression("(?:NA|([EW]));")
.number("(d+.?d*)?;") // speed
- .number("(d+.?d*)?;") // course
+ .number("(?:NA|(d+.?d*))?;") // course
.number("(?:NA|(-?d+.?d*));") // altitude
.number("(?:NA|(d+))") // satellites
.groupBegin().text(";")
@@ -97,11 +97,15 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder {
position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS));
- position.setLatitude(parser.nextCoordinate());
- position.setLongitude(parser.nextCoordinate());
- position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble(0)));
- position.setCourse(parser.nextDouble(0));
- position.setAltitude(parser.nextDouble(0));
+ if (parser.hasNext(9)) {
+ position.setLatitude(parser.nextCoordinate());
+ position.setLongitude(parser.nextCoordinate());
+ position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble(0)));
+ position.setCourse(parser.nextDouble(0));
+ position.setAltitude(parser.nextDouble(0));
+ } else {
+ getLastLocation(position, position.getDeviceTime());
+ }
if (parser.hasNext()) {
int satellites = parser.nextInt(0);
diff --git a/src/main/java/org/traccar/sms/SnsSmsClient.java b/src/main/java/org/traccar/sms/SnsSmsClient.java
new file mode 100644
index 000000000..bdd4104f5
--- /dev/null
+++ b/src/main/java/org/traccar/sms/SnsSmsClient.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ * Copyright 2021 Subodh Ranadive (subodhranadive3103@gmail.com)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar.sms;
+
+import com.amazonaws.auth.AWSStaticCredentialsProvider;
+import com.amazonaws.auth.BasicAWSCredentials;
+import com.amazonaws.handlers.AsyncHandler;
+import com.amazonaws.services.sns.AmazonSNSAsync;
+import com.amazonaws.services.sns.AmazonSNSAsyncClientBuilder;
+import com.amazonaws.services.sns.model.MessageAttributeValue;
+import com.amazonaws.services.sns.model.PublishRequest;
+
+import com.amazonaws.services.sns.model.PublishResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.traccar.Context;
+import org.traccar.config.Keys;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class SnsSmsClient implements SmsManager {
+ private static final Logger LOGGER = LoggerFactory.getLogger(SnsSmsClient.class);
+
+ private final AmazonSNSAsync snsClient;
+
+ public SnsSmsClient() {
+ if (Context.getConfig().hasKey(Keys.SMS_AWS_REGION)
+ && Context.getConfig().hasKey(Keys.SMS_AWS_ACCESS)
+ && Context.getConfig().hasKey(Keys.SMS_AWS_SECRET)) {
+ BasicAWSCredentials awsCredentials =
+ new BasicAWSCredentials(Context.getConfig().getString(Keys.SMS_AWS_ACCESS),
+ Context.getConfig().getString(Keys.SMS_AWS_SECRET));
+ snsClient = AmazonSNSAsyncClientBuilder.standard()
+ .withRegion(Context.getConfig().getString(Keys.SMS_AWS_REGION))
+ .withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).build();
+ } else {
+ throw new RuntimeException("SNS Not Configured Properly. Please provide valid config.");
+ }
+ }
+
+ @Override
+ public void sendMessageSync(String destAddress, String message, boolean command) {
+ Map<String, MessageAttributeValue> smsAttributes = new HashMap<>();
+ smsAttributes.put("AWS.SNS.SMS.SenderID",
+ new MessageAttributeValue().withStringValue("SNS").withDataType("String"));
+ smsAttributes.put("AWS.SNS.SMS.SMSType",
+ new MessageAttributeValue().withStringValue("Transactional").withDataType("String"));
+
+ PublishRequest publishRequest = new PublishRequest().withMessage(message)
+ .withPhoneNumber(destAddress).withMessageAttributes(smsAttributes);
+
+ snsClient.publishAsync(publishRequest, new AsyncHandler<PublishRequest, PublishResult>() {
+ @Override
+ public void onError(Exception exception) {
+ LOGGER.error("SMS send failed", exception);
+ }
+ @Override
+ public void onSuccess(PublishRequest request, PublishResult result) {
+ }
+ });
+ }
+
+ @Override
+ public void sendMessageAsync(String destAddress, String message, boolean command) {
+ sendMessageSync(destAddress, message, command);
+ }
+}
diff --git a/src/main/java/org/traccar/web/WebServer.java b/src/main/java/org/traccar/web/WebServer.java
index 82e9397e4..ffa06adfd 100644
--- a/src/main/java/org/traccar/web/WebServer.java
+++ b/src/main/java/org/traccar/web/WebServer.java
@@ -29,6 +29,7 @@ import org.eclipse.jetty.server.handler.gzip.GzipHandler;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.glassfish.jersey.jackson.JacksonFeature;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletContainer;
@@ -149,6 +150,7 @@ public class WebServer {
private void initApi(Config config, ServletContextHandler servletHandler) {
servletHandler.addServlet(new ServletHolder(new AsyncSocketServlet()), "/api/socket");
+ JettyWebSocketServletContainerInitializer.configure(servletHandler, null);
String mediaPath = config.getString(Keys.MEDIA_PATH);
if (mediaPath != null) {
diff --git a/src/main/resources/ical4j.properties b/src/main/resources/ical4j.properties
new file mode 100644
index 000000000..a08674709
--- /dev/null
+++ b/src/main/resources/ical4j.properties
@@ -0,0 +1 @@
+net.fortuna.ical4j.timezone.cache.impl=net.fortuna.ical4j.util.MapTimeZoneCache
diff --git a/src/test/java/org/traccar/geocoder/GeocoderTest.java b/src/test/java/org/traccar/geocoder/GeocoderTest.java
index d93a72a87..5f1748984 100644
--- a/src/test/java/org/traccar/geocoder/GeocoderTest.java
+++ b/src/test/java/org/traccar/geocoder/GeocoderTest.java
@@ -93,4 +93,12 @@ public class GeocoderTest {
String address = geocoder.getAddress(28.6129602407977, 77.2294557094574, null);
assertEquals("India Gate, New Delhi, India", address);
}
+
+ @Ignore
+ @Test
+ public void testMapbox() {
+ Geocoder geocoder = new MapboxGeocoder("", 0, new AddressFormat("%f"));
+ String address = geocoder.getAddress(40.733, -73.989, null);
+ assertEquals("120 East 13th Street, New York, New York 10003, United States", address);
+ }
}
diff --git a/src/test/java/org/traccar/protocol/AdmFrameDecoderTest.java b/src/test/java/org/traccar/protocol/AdmFrameDecoderTest.java
index e7297cdbd..1682ca56d 100644
--- a/src/test/java/org/traccar/protocol/AdmFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AdmFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class AdmFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- AdmFrameDecoder decoder = new AdmFrameDecoder();
+ var decoder = new AdmFrameDecoder();
verifyFrame(
binary("38363931353330343235323337383400003728e000001402441d5f42c3711642930d000000c7000a461954f25fd82ed508000000000000000044000000010000000000140000"),
diff --git a/src/test/java/org/traccar/protocol/AdmProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AdmProtocolDecoderTest.java
index bf8a81dc1..7c8769925 100644
--- a/src/test/java/org/traccar/protocol/AdmProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AdmProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class AdmProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- AdmProtocolDecoder decoder = new AdmProtocolDecoder(null);
+ var decoder = new AdmProtocolDecoder(null);
verifyPosition(decoder, binary(
"38363931353330343235323337383400003728e000001402441d5f42c3711642930d000000c7000a461954f25fd82ed508000000000000000044000000010000000000140000"));
diff --git a/src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java
index fd6214c57..89ddef849 100644
--- a/src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java
@@ -27,7 +27,7 @@ public class AdmProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- AdmProtocolEncoder encoder = new AdmProtocolEncoder(null);
+ var encoder = new AdmProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/AisProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AisProtocolDecoderTest.java
index 9cb9f695a..f869ab8f3 100644
--- a/src/test/java/org/traccar/protocol/AisProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AisProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class AisProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- AisProtocolDecoder decoder = new AisProtocolDecoder(null);
+ var decoder = new AisProtocolDecoder(null);
verifyPositions(decoder, text(
"!AIVDM,2,1,8,A,53UlSb01l>Ei=H4KF218PTpv222222222222221?8h=766gB0<Ck11DTp888,0*14s:MTb827ebc7686b,c:1481688227737*4d\\\r\n" +
diff --git a/src/test/java/org/traccar/protocol/AlematicsProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AlematicsProtocolDecoderTest.java
index 47ea8137e..8bd457a97 100644
--- a/src/test/java/org/traccar/protocol/AlematicsProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AlematicsProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class AlematicsProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- AlematicsProtocolDecoder decoder = new AlematicsProtocolDecoder(null);
+ var decoder = new AlematicsProtocolDecoder(null);
verifyPosition(decoder, text(
"$T,2,64,866050035975497,20180726103446,20180726103514,23.033305,72.558032,0,0,41,5.4,4,0,0,0.000,12.960,0,"));
diff --git a/src/test/java/org/traccar/protocol/AnytrekProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AnytrekProtocolDecoderTest.java
index e3aa0550b..b6f95513c 100644
--- a/src/test/java/org/traccar/protocol/AnytrekProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AnytrekProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class AnytrekProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- AnytrekProtocolDecoder decoder = new AnytrekProtocolDecoder(null);
+ var decoder = new AnytrekProtocolDecoder(null);
verifyPosition(decoder, binary(
"78783500300086428703204121160085015111050C0A0D20C6FD24A102FF8EAC0C01001404000000FFFFFFFF131702210000000000000000000D0A"));
diff --git a/src/test/java/org/traccar/protocol/ApelProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/ApelProtocolDecoderTest.java
index c32abe6a8..b922d3ef1 100644
--- a/src/test/java/org/traccar/protocol/ApelProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/ApelProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class ApelProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- ApelProtocolDecoder decoder = new ApelProtocolDecoder(null);
+ var decoder = new ApelProtocolDecoder(null);
/*byte[] buf1 = {0x40,0x4E,0x54,0x43,0x01,0x00,0x00,0x00,0x7B,0x00,0x00,0x00,0x13,0x00,0x44,0x34,0x2A,0x3E,0x53,0x3A,0x38,0x36,0x31,0x37,0x38,0x35,0x30,0x30,0x35,0x32,0x30,0x35,0x30,0x37,0x39};
verifyNull(decoder, text( ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, buf1)));*/
diff --git a/src/test/java/org/traccar/protocol/AplicomFrameDecoderTest.java b/src/test/java/org/traccar/protocol/AplicomFrameDecoderTest.java
index 581f7696f..96a219d2a 100644
--- a/src/test/java/org/traccar/protocol/AplicomFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AplicomFrameDecoderTest.java
@@ -10,7 +10,7 @@ public class AplicomFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- AplicomFrameDecoder decoder = new AplicomFrameDecoder();
+ var decoder = new AplicomFrameDecoder();
assertEquals(
binary("44C20146B710C158DA009500B09F7700C054CA0EA454CA0EA403BE0BF6015D706B070000142A600000000000000002434946010801000754CA0EA4000000000000008400000000000000000000000000000000300000FE00FE0000000000000000000000000000000000000000000000000000000000000000000040502035000000000000020D0000030D0000040C0000040D0000050C0000050D0000058C0000060C"),
diff --git a/src/test/java/org/traccar/protocol/AplicomProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AplicomProtocolDecoderTest.java
index 0b4180bd0..5abe9550d 100644
--- a/src/test/java/org/traccar/protocol/AplicomProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AplicomProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class AplicomProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- AplicomProtocolDecoder decoder = new AplicomProtocolDecoder(null);
+ var decoder = new AplicomProtocolDecoder(null);
verifyNull(decoder, binary(
"434946010A0100075253F85F0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FEEA0000FEE90000F0030000F0040000FEF10000FEF20000FEF50000FEFC0000FEC10000FEE500"));
diff --git a/src/test/java/org/traccar/protocol/AppelloProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AppelloProtocolDecoderTest.java
index ac0858e82..da4d82938 100644
--- a/src/test/java/org/traccar/protocol/AppelloProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AppelloProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class AppelloProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- AppelloProtocolDecoder decoder = new AppelloProtocolDecoder(null);
+ var decoder = new AppelloProtocolDecoder(null);
verifyAttributes(decoder, text(
"FOLLOWIT,867273024233699,UTCTIME,0.000000,0.000000,0,0,0,0,L,262:3:c703:4bf8:64:255|262:3:c703:9a18:45|262:3:c703:e838:33|262:3:c703:7190:20|262:3:c704:d896:17|,02,44,,31,,4.20,0,0,86/44/24,,,,26,02264DFF6E16:69|4C09D408554E:79|4C09D408554F:79|E0885DE705E5:81|E2885DE705E7:81|246511122CCC:83|,34925"));
diff --git a/src/test/java/org/traccar/protocol/AppletProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AppletProtocolDecoderTest.java
index ad13c60f6..11c9c65d8 100644
--- a/src/test/java/org/traccar/protocol/AppletProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AppletProtocolDecoderTest.java
@@ -10,7 +10,7 @@ public class AppletProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- AppletProtocolDecoder decoder = new AppletProtocolDecoder(null);
+ var decoder = new AppletProtocolDecoder(null);
DefaultHttpHeaders headers = new DefaultHttpHeaders();
diff --git a/src/test/java/org/traccar/protocol/AquilaProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AquilaProtocolDecoderTest.java
index 489024ed5..57d793c71 100644
--- a/src/test/java/org/traccar/protocol/AquilaProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AquilaProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class AquilaProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeA() throws Exception {
- AquilaProtocolDecoder decoder = new AquilaProtocolDecoder(null);
+ var decoder = new AquilaProtocolDecoder(null);
verifyPosition(decoder, text(
"$$CLIENT_1ZF,170215089,20,18.462809,73.824188,170613182744,A,01,123456,*37"));
diff --git a/src/test/java/org/traccar/protocol/Ardi01ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Ardi01ProtocolDecoderTest.java
index 8498bb7f9..653e4346d 100644
--- a/src/test/java/org/traccar/protocol/Ardi01ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Ardi01ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Ardi01ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Ardi01ProtocolDecoder decoder = new Ardi01ProtocolDecoder(null);
+ var decoder = new Ardi01ProtocolDecoder(null);
verifyPosition(decoder, text(
"013227003054776,20141010052719,24.4736042,56.8445807,110,289,40,7,5,78,-1"),
diff --git a/src/test/java/org/traccar/protocol/ArknavProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/ArknavProtocolDecoderTest.java
index 18901d9a6..b95963f40 100644
--- a/src/test/java/org/traccar/protocol/ArknavProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/ArknavProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class ArknavProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- ArknavProtocolDecoder decoder = new ArknavProtocolDecoder(null);
+ var decoder = new ArknavProtocolDecoder(null);
verifyPosition(decoder, text(
"358266016278447,05*827,000,L001,V,4821.6584,N,01053.8650,E,000.0,000.0,00.0,08:46:04 17-03-16,9.5A,D7,0,79,0,,,,"),
diff --git a/src/test/java/org/traccar/protocol/ArknavX8ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/ArknavX8ProtocolDecoderTest.java
index dfe1435d1..c2d78dca6 100644
--- a/src/test/java/org/traccar/protocol/ArknavX8ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/ArknavX8ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class ArknavX8ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- ArknavX8ProtocolDecoder decoder = new ArknavX8ProtocolDecoder(null);
+ var decoder = new ArknavX8ProtocolDecoder(null);
verifyNull(decoder, text(
"351856045213782,241111"));
diff --git a/src/test/java/org/traccar/protocol/ArnaviFrameDecoderTest.java b/src/test/java/org/traccar/protocol/ArnaviFrameDecoderTest.java
index 90eb20296..3f495731a 100644
--- a/src/test/java/org/traccar/protocol/ArnaviFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/ArnaviFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class ArnaviFrameDecoderTest extends ProtocolTest {
@Test
public void testDecodeValidPackets() throws Exception {
- ArnaviFrameDecoder decoder = new ArnaviFrameDecoder();
+ var decoder = new ArnaviFrameDecoder();
verifyFrame(
binary("2441562c563344492c38353136342c3231342c2d312c31392c30303030344634462c30303030303935452c30433030303030322c3836333037313031333034313631382c38393939373031353630333832353236363232462c2a3039"),
diff --git a/src/test/java/org/traccar/protocol/ArnaviTextProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/ArnaviTextProtocolDecoderTest.java
index 79179d4f3..9e9047be4 100644
--- a/src/test/java/org/traccar/protocol/ArnaviTextProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/ArnaviTextProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class ArnaviTextProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- ArnaviTextProtocolDecoder decoder = new ArnaviTextProtocolDecoder(null);
+ var decoder = new ArnaviTextProtocolDecoder(null);
verifyPosition(decoder, buffer(
"$AV,V4,999999,12487,2277,203,65534,0,0,193,65535,65535,65535,65535,1,13,80.0,56.1,200741,5950.6773N,03029.1043E,300.0,360.0,121012,65535,65535,65535,SF*6E"));
diff --git a/src/test/java/org/traccar/protocol/AstraProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AstraProtocolDecoderTest.java
index 453ec9da5..3376fa3f0 100644
--- a/src/test/java/org/traccar/protocol/AstraProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AstraProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class AstraProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- AstraProtocolDecoder decoder = new AstraProtocolDecoder(null);
+ var decoder = new AstraProtocolDecoder(null);
verifyPositions(decoder, binary(
"4b00700529c0c265976b8202cba9ff00676d864554a9c30000000020073401006436000300030008000000000000a0000100001920c43d00009600428302cba9ff00676d864554aa3e000000002007240100643b000300020008000000000000b0000100001920c43d00009600420f0e"));
diff --git a/src/test/java/org/traccar/protocol/At2000FrameDecoderTest.java b/src/test/java/org/traccar/protocol/At2000FrameDecoderTest.java
index c5829d588..0782c2d34 100644
--- a/src/test/java/org/traccar/protocol/At2000FrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/At2000FrameDecoderTest.java
@@ -8,7 +8,7 @@ public class At2000FrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- At2000FrameDecoder decoder = new At2000FrameDecoder();
+ var decoder = new At2000FrameDecoder();
verifyFrame(
binary("01012f00000000000000000000000000003335363137333036343430373439320fad981997ae8e031fe10c0ea7641903ca32c0331df467233d2a9cd886fbeef8"),
diff --git a/src/test/java/org/traccar/protocol/AtrackFrameDecoderTest.java b/src/test/java/org/traccar/protocol/AtrackFrameDecoderTest.java
index bb86a9629..77e90ca53 100644
--- a/src/test/java/org/traccar/protocol/AtrackFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AtrackFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class AtrackFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- AtrackFrameDecoder decoder = new AtrackFrameDecoder();
+ var decoder = new AtrackFrameDecoder();
verifyFrame(
binary("4052698c032a924f000147027fe5d7425f642e56060f031847bb68cb500719e26752c25bebc11c7fddce2b8ed4eff4ed863b187cc6653b5b1c1fc6803884d21aeeedae2ec6e72781d97e95b965610c1d107e5400cd5a7b7b3b592e676091c6a5893d80af9b3c63ae4de20d6e5bc60440bf2c299fbabfe268039d558e4b8589dd5173c926b7f51b916ba29f21d46ff9170793fe450072d691896e114fddce4fd29f7f2f9b74e41ca83814015e8a00ffd1f9bd475e2a44624e074a009455ab5628e39fce8036a09368cf1d2ba0d2653b979c0a00e9edc82335a56d1ee6071401d468b0f4cd761a743d011401d15b4636015721870dd0500695b2edabeabf2f4a00a514645cc83a739ad165f320c1ed401617a0a2800a2803ffd2faa68a004660aa598e00acd8f4d866d54eab3c7994284881fe11ebf5e68034e8a0086e674850927f0ae2bc4dafa5844659674451d39e49a00e1dae23d76ed67bb72211d109e4d5bd756da3b68a4b755021e30076a00cf31431a064e41e6a19a68d5396518f7a00f1ff008bfe27f31068766dbb7e1a723d3fbbf8d79aeb764748b489662be7ccbbb6820e07d4500734caa727765aa32ac0720e28026b4bb9ed7ccf2594798bb5b2a0f1f8f4a82800a2803fffd3f9b97352ae02e45004c808e4f7a997823bd005e86600618f26b7b4a9cab819fa500767a749b9403cd74162b903de803acd1e3c28aebf4d4c81401d05a4441fad682444738a00b712f2055f03e502802b14c5dffbc2ac106343ed4012a905411e94b40051401fffd4faa6992488980c793d0773400d54676df2f1e8b9e054b400564ebb77750c463b442d2119247f08f53e9401e7da85d6a12cd221d427217a856c60fe15caea9689292f2832bfac8777f3a00e67538ef150ff00665d9b4b95fba4aee46f623fa8ae26fbe24f88b49b87d3b5bd2a12e38ca3950e3d41e7228008be2ac02d423dadc09071c1047e791fcab96d77c79acdf92969279113f1c1cb7e7401876c4c939b8ba73230e5998e49ac4d66ee6bebd796462ddb9f4ed40140a12339e9dea225b1824d0025140051401fffd5f9bc676f6a7ae4af6e280255cf5c7153a7b0a0052d8715bba64bf32f39a00ed74694902bb1d306e65c500763a5afca2baed2"),
diff --git a/src/test/java/org/traccar/protocol/AtrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AtrackProtocolDecoderTest.java
index b329f59f3..4a66dbf58 100644
--- a/src/test/java/org/traccar/protocol/AtrackProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AtrackProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class AtrackProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- AtrackProtocolDecoder decoder = new AtrackProtocolDecoder(null);
+ var decoder = new AtrackProtocolDecoder(null);
verifyNull(decoder, binary(
"4052698c032a924f000147027fe5d7425f642e56060f031847bb68cb500719e26752c25bebc11c7fddce2b8ed4eff4ed863b187cc6653b5b1c1fc6803884d21aeeedae2ec6e72781d97e95b965610c1d107e5400cd5a7b7b3b592e676091c6a5893d80af9b3c63ae4de20d6e5bc60440bf2c299fbabfe268039d558e4b8589dd5173c926b7f51b916ba29f21d46ff9170793fe450072d691896e114fddce4fd29f7f2f9b74e41ca83814015e8a00ffd1f9bd475e2a44624e074a009455ab5628e39fce8036a09368cf1d2ba0d2653b979c0a00e9edc82335a56d1ee6071401d468b0f4cd761a743d011401d15b4636015721870dd0500695b2edabeabf2f4a00a514645cc83a739ad165f320c1ed401617a0a2800a2803ffd2faa68a004660aa598e00acd8f4d866d54eab3c7994284881fe11ebf5e68034e8a0086e674850927f0ae2bc4dafa5844659674451d39e49a00e1dae23d76ed67bb72211d109e4d5bd756da3b68a4b755021e30076a00cf31431a064e41e6a19a68d5396518f7a00f1ff008bfe27f31068766dbb7e1a723d3fbbf8d79aeb764748b489662be7ccbbb6820e07d4500734caa727765aa32ac0720e28026b4bb9ed7ccf2594798bb5b2a0f1f8f4a82800a2803fffd3f9b97352ae02e45004c808e4f7a997823bd005e86600618f26b7b4a9cab819fa500767a749b9403cd74162b903de803acd1e3c28aebf4d4c81401d05a4441fad682444738a00b712f2055f03e502802b14c5dffbc2ac106343ed4012a905411e94b40051401fffd4faa6992488980c793d0773400d54676df2f1e8b9e054b400564ebb77750c463b442d2119247f08f53e9401e7da85d6a12cd221d427217a856c60fe15caea9689292f2832bfac8777f3a00e67538ef150ff00665d9b4b95fba4aee46f623fa8ae26fbe24f88b49b87d3b5bd2a12e38ca3950e3d41e7228008be2ac02d423dadc09071c1047e791fcab96d77c79acdf92969279113f1c1cb7e7401876c4c939b8ba73230e5998e49ac4d66ee6bebd796462ddb9f4ed40140a12339e9dea225b1824d0025140051401fffd5f9bc676f6a7ae4af6e280255cf5c7153a7b0a0052d8715bba64bf32f39a00ed74694902bb1d306e65c500763a5afca2baed2"));
@@ -44,6 +44,9 @@ public class AtrackProtocolDecoderTest extends ProtocolTest {
decoder.setCustom(true);
verifyPositions(decoder, buffer(
+ "@P,7A66,153,9022,863003048505515,20210207000103,20210207000103,20210207000103,103939276,1348903,97,2,5628,8,0,0,0,0,,2000,2000,\u001a,%CI%BC,3:224:F128833445E6002C09C6\r\n"));
+
+ verifyPositions(decoder, buffer(
"@P,9493,402,143,356961075931165,1546830150,1546830151,1546830151,-88429209,44271154,54,10,0,10,1,0,0,0,1858AE010000,2000,2000,\u001A,%CI%FL%ML%VN%PD%FC%EL%ET%AT%MF%MV%BV%DT%GN%GV%ME%RL%RP%SA%SM%TR%IA%MP,0,0,2T1KR32E28C706185,0,1,0,7,251,89,118,41,0,00A5001A040800A5001A040B00A5001A040C00A5001A040900A4001C040D00A50019040900A60019040900A4001B040B00A5001A040900A7001A040E\u001A,008CFE7C03C4\u001A,356961075931165,0,0,12,0,18,5,0\n"));
verifyPositions(decoder, buffer(
@@ -108,7 +111,7 @@ public class AtrackProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeCustom() throws Exception {
- AtrackProtocolDecoder decoder = new AtrackProtocolDecoder(null);
+ var decoder = new AtrackProtocolDecoder(null);
decoder.setCustom(true);
diff --git a/src/test/java/org/traccar/protocol/AuroProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AuroProtocolDecoderTest.java
index aeea48967..fbe3ad0a3 100644
--- a/src/test/java/org/traccar/protocol/AuroProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AuroProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class AuroProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- AuroProtocolDecoder decoder = new AuroProtocolDecoder(null);
+ var decoder = new AuroProtocolDecoder(null);
verifyPosition(decoder, text(
"M0028T0000816398975I357325031465123E00001W*****110620150437000068DA#RD01DA240000000001+100408425+013756121100620152137231112240330004400"));
diff --git a/src/test/java/org/traccar/protocol/AustinNbProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AustinNbProtocolDecoderTest.java
index fa8f3a071..0be22b333 100644
--- a/src/test/java/org/traccar/protocol/AustinNbProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AustinNbProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class AustinNbProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- AustinNbProtocolDecoder decoder = new AustinNbProtocolDecoder(null);
+ var decoder = new AustinNbProtocolDecoder(null);
verifyPosition(decoder, text(
"48666666666;2017-01-01 16:31:01;52,1133308410645;21,1000003814697;310;120;2292;1;ORANGE"));
diff --git a/src/test/java/org/traccar/protocol/AutoFonProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AutoFonProtocolDecoderTest.java
index 9e17b437f..3e64defdb 100644
--- a/src/test/java/org/traccar/protocol/AutoFonProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AutoFonProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class AutoFonProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- AutoFonProtocolDecoder decoder = new AutoFonProtocolDecoder(null);
+ var decoder = new AutoFonProtocolDecoder(null);
verifyNull(decoder, binary(
"10556103592310314825728F"));
diff --git a/src/test/java/org/traccar/protocol/AutoGradeProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AutoGradeProtocolDecoderTest.java
index f71fcd8eb..697ac8a06 100644
--- a/src/test/java/org/traccar/protocol/AutoGradeProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AutoGradeProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class AutoGradeProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- AutoGradeProtocolDecoder decoder = new AutoGradeProtocolDecoder(null);
+ var decoder = new AutoGradeProtocolDecoder(null);
verifyPosition(decoder, text(
"(000000001637868324027912356171116A2250.7611N07556.9425E000.9024427197.36\u008eA0000B0000C0000D0000E0000K0000L0000M0000N0000O0000)"));
diff --git a/src/test/java/org/traccar/protocol/AutoTrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AutoTrackProtocolDecoderTest.java
index 5daafcc40..64a7459ce 100644
--- a/src/test/java/org/traccar/protocol/AutoTrackProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AutoTrackProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class AutoTrackProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- AutoTrackProtocolDecoder decoder = new AutoTrackProtocolDecoder(null);
+ var decoder = new AutoTrackProtocolDecoder(null);
verifyNull(decoder, binary(
"f1f1f1f1330c00201007090006de7200000000daa3"));
diff --git a/src/test/java/org/traccar/protocol/AvemaProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AvemaProtocolDecoderTest.java
index 71bc83b4f..6138711aa 100644
--- a/src/test/java/org/traccar/protocol/AvemaProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AvemaProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class AvemaProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- AvemaProtocolDecoder decoder = new AvemaProtocolDecoder(null);
+ var decoder = new AvemaProtocolDecoder(null);
verifyAttribute(decoder, text(
"1000000000,20190527072358,121.646024,25.062135,0,0,0,0,10,0.0,1,0.02,12.32,0,0,15,2,466-5,10275,0,0.01,65EB812A000104E0,8000001234,NormanChang"),
diff --git a/src/test/java/org/traccar/protocol/Avl301ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Avl301ProtocolDecoderTest.java
index 0972e3fd4..fb1984d87 100644
--- a/src/test/java/org/traccar/protocol/Avl301ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Avl301ProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class Avl301ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Avl301ProtocolDecoder decoder = new Avl301ProtocolDecoder(null);
+ var decoder = new Avl301ProtocolDecoder(null);
verifyNull(decoder, binary(
"244c0f086058500087335500010d0a"));
diff --git a/src/test/java/org/traccar/protocol/BceProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/BceProtocolDecoderTest.java
index 862c69d31..544d49967 100644
--- a/src/test/java/org/traccar/protocol/BceProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/BceProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class BceProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- BceProtocolDecoder decoder = new BceProtocolDecoder(null);
+ var decoder = new BceProtocolDecoder(null);
verifyNull(decoder, binary(
"3ab90b71bc1503000300c10bff11"));
diff --git a/src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java
index be5877193..c72012e5a 100644
--- a/src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java
@@ -9,7 +9,7 @@ public class BceProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- BceProtocolEncoder encoder = new BceProtocolEncoder(null);
+ var encoder = new BceProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/BlackKiteProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/BlackKiteProtocolDecoderTest.java
index 9a24ece1f..3fdac8479 100644
--- a/src/test/java/org/traccar/protocol/BlackKiteProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/BlackKiteProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class BlackKiteProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- BlackKiteProtocolDecoder decoder = new BlackKiteProtocolDecoder(null);
+ var decoder = new BlackKiteProtocolDecoder(null);
verifyNull(decoder, binary(
"01150003313131313131313131313131313131209836055605BA"));
diff --git a/src/test/java/org/traccar/protocol/BlueProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/BlueProtocolDecoderTest.java
index 4aa50e56b..4e74adf38 100644
--- a/src/test/java/org/traccar/protocol/BlueProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/BlueProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class BlueProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- BlueProtocolDecoder decoder = new BlueProtocolDecoder(null);
+ var decoder = new BlueProtocolDecoder(null);
verifyAttribute(decoder, binary(
"AA0056860080E3E79E0C811F80000114020207170520011F00407F8005EE1938113B270000000000000000140202071705005AC7A621121F0002000100B7000080110000000000001A3A0000000001F400000000000078"),
diff --git a/src/test/java/org/traccar/protocol/BoxProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/BoxProtocolDecoderTest.java
index f7197a05d..5b639e12b 100644
--- a/src/test/java/org/traccar/protocol/BoxProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/BoxProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class BoxProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- BoxProtocolDecoder decoder = new BoxProtocolDecoder(null);
+ var decoder = new BoxProtocolDecoder(null);
verifyNull(decoder, text(
"H,BT,358281002435893,081028142432,F5813D19,6D6E6DC2"));
diff --git a/src/test/java/org/traccar/protocol/C2stekProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/C2stekProtocolDecoderTest.java
index 9f841fb8c..d6831c1cf 100644
--- a/src/test/java/org/traccar/protocol/C2stekProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/C2stekProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class C2stekProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- C2stekProtocolDecoder decoder = new C2stekProtocolDecoder(null);
+ var decoder = new C2stekProtocolDecoder(null);
verifyNull(decoder, text(
"PA$863083038046613$D#181123#162850#1#+37.92684#+23.75933#0.62#200.1#0.0#3768#000#9#00#sz-w1001#B0907839$AP"));
diff --git a/src/test/java/org/traccar/protocol/CalAmpProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/CalAmpProtocolDecoderTest.java
index 8be693ee6..79d27e2ab 100644
--- a/src/test/java/org/traccar/protocol/CalAmpProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/CalAmpProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class CalAmpProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- CalAmpProtocolDecoder decoder = new CalAmpProtocolDecoder(null);
+ var decoder = new CalAmpProtocolDecoder(null);
verifyPosition(decoder, binary(
"830547643586340101010400105f9c39ba5f9c302eeb36d5bddf39df700000000000000000003400040321ff9f4f0087080200001c30783330304544383946333335303139303030303030343637450d0a"));
diff --git a/src/test/java/org/traccar/protocol/CarTrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/CarTrackProtocolDecoderTest.java
index c8db07ee3..dd96c2585 100644
--- a/src/test/java/org/traccar/protocol/CarTrackProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/CarTrackProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class CarTrackProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- CarTrackProtocolDecoder decoder = new CarTrackProtocolDecoder(null);
+ var decoder = new CarTrackProtocolDecoder(null);
verifyNull(decoder, text(
"$$020040????????&A0000"));
diff --git a/src/test/java/org/traccar/protocol/CarscopProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/CarscopProtocolDecoderTest.java
index 412901d90..b1fe69bac 100644
--- a/src/test/java/org/traccar/protocol/CarscopProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/CarscopProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class CarscopProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- CarscopProtocolDecoder decoder = new CarscopProtocolDecoder(null);
+ var decoder = new CarscopProtocolDecoder(null);
verifyNull(decoder, text(
"*170821223045UB00HSO"));
diff --git a/src/test/java/org/traccar/protocol/CastelProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/CastelProtocolDecoderTest.java
index 3c35398a6..f90fbe5ba 100644
--- a/src/test/java/org/traccar/protocol/CastelProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/CastelProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class CastelProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- CastelProtocolDecoder decoder = new CastelProtocolDecoder(null);
+ var decoder = new CastelProtocolDecoder(null);
verifyAttribute(decoder, binary(
"40403a00043231334744503230313830323133343300000000a002000001000001012011004d414c43333831434d4b4d353637313438c8fc0d0a"),
diff --git a/src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java
index 1864d9e84..cdf6a7c3b 100644
--- a/src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java
@@ -9,7 +9,7 @@ public class CastelProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- CastelProtocolEncoder encoder = new CastelProtocolEncoder(null);
+ var encoder = new CastelProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/CautelaProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/CautelaProtocolDecoderTest.java
index 28236c87f..fe8586068 100644
--- a/src/test/java/org/traccar/protocol/CautelaProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/CautelaProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class CautelaProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- CautelaProtocolDecoder decoder = new CautelaProtocolDecoder(null);
+ var decoder = new CautelaProtocolDecoder(null);
verifyPosition(decoder, text(
"20,010907000000,14,02,18,16.816667,96.166667,1325,S,*2E"));
diff --git a/src/test/java/org/traccar/protocol/CellocatorFrameDecoderTest.java b/src/test/java/org/traccar/protocol/CellocatorFrameDecoderTest.java
index 914166a58..04a0f74d5 100644
--- a/src/test/java/org/traccar/protocol/CellocatorFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/CellocatorFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class CellocatorFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- CellocatorFrameDecoder decoder = new CellocatorFrameDecoder();
+ var decoder = new CellocatorFrameDecoder();
verifyFrame(
binary("4D4347500BA9880B00C80A7E003800000000000806000001210A14000613000000000D4457A5F71442AC02E80300000100040707000011171408060E1C08000100000200020000FD"),
diff --git a/src/test/java/org/traccar/protocol/CellocatorProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/CellocatorProtocolDecoderTest.java
index dcc4b267d..3ae5350f2 100644
--- a/src/test/java/org/traccar/protocol/CellocatorProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/CellocatorProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class CellocatorProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- CellocatorProtocolDecoder decoder = new CellocatorProtocolDecoder(null);
+ var decoder = new CellocatorProtocolDecoder(null);
verifyPosition(decoder, binary(
"4D43475000856308000004B2DE1F04009E00200100000000696CF7AB002F1A00000000000000325C000402069BFDE70857E22502F41C000036000000DF0B0932100B09DC0719"));
diff --git a/src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java
index 616640116..9d42bd65d 100644
--- a/src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class CellocatorProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- CellocatorProtocolEncoder encoder = new CellocatorProtocolEncoder(null);
+ var encoder = new CellocatorProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/CguardProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/CguardProtocolDecoderTest.java
index a386b6b47..a7ed0e754 100644
--- a/src/test/java/org/traccar/protocol/CguardProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/CguardProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class CguardProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- CguardProtocolDecoder decoder = new CguardProtocolDecoder(null);
+ var decoder = new CguardProtocolDecoder(null);
verifyNull(decoder, text(
"IDRO:354868050655283"));
diff --git a/src/test/java/org/traccar/protocol/CityeasyProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/CityeasyProtocolDecoderTest.java
index 146e13ae8..07d6368ab 100644
--- a/src/test/java/org/traccar/protocol/CityeasyProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/CityeasyProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class CityeasyProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- CityeasyProtocolDecoder decoder = new CityeasyProtocolDecoder(null);
+ var decoder = new CityeasyProtocolDecoder(null);
verifyNotNull(decoder, binary(
"545400853575570249020100033b3430342c34352c31303638312c31313632312c33352c31303638312c31313632322c32332c31303638312c32383938332c32332c31303638312c31313632332c32312c31303638312c32333338312c31372c31303638312c32323538332c31372c31303638312c32363434312c31330000000d352e0d0a"));
diff --git a/src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java
index f0eede4bf..2722f6474 100644
--- a/src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java
@@ -9,7 +9,7 @@ public class CityeasyProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- CityeasyProtocolEncoder encoder = new CityeasyProtocolEncoder(null);
+ var encoder = new CityeasyProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/ContinentalProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/ContinentalProtocolDecoderTest.java
index 83722ef97..2924d2c4d 100644
--- a/src/test/java/org/traccar/protocol/ContinentalProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/ContinentalProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class ContinentalProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- ContinentalProtocolDecoder decoder = new ContinentalProtocolDecoder(null);
+ var decoder = new ContinentalProtocolDecoder(null);
verifyPosition(decoder, binary(
"5356003216001eb48505025b4001e90f7f18ce0f00522200400001015b4001e9000e820100000c24000100014e0400736a7a"),
diff --git a/src/test/java/org/traccar/protocol/CradlepointProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/CradlepointProtocolDecoderTest.java
index 7ffad8015..1e3023b39 100644
--- a/src/test/java/org/traccar/protocol/CradlepointProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/CradlepointProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class CradlepointProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- CradlepointProtocolDecoder decoder = new CradlepointProtocolDecoder(null);
+ var decoder = new CradlepointProtocolDecoder(null);
verifyPosition(decoder, text(
"356526070063940,0,4337.19009,N,11612.34705,W,0.0,277.2,AT&T,,,-79,,-14.0,"));
diff --git a/src/test/java/org/traccar/protocol/DingtekFrameDecoderTest.java b/src/test/java/org/traccar/protocol/DingtekFrameDecoderTest.java
index 3bc2715db..6236410b3 100644
--- a/src/test/java/org/traccar/protocol/DingtekFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/DingtekFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class DingtekFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- DingtekFrameDecoder decoder = new DingtekFrameDecoder();
+ var decoder = new DingtekFrameDecoder();
verifyFrame(
binary("383030303031303131453032383830303138303030303030303030313545303038303545433430303031313836383832323034303130343433303831"),
diff --git a/src/test/java/org/traccar/protocol/DingtekProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/DingtekProtocolDecoderTest.java
index 3a7567106..8b3d07c22 100644
--- a/src/test/java/org/traccar/protocol/DingtekProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/DingtekProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class DingtekProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- DingtekProtocolDecoder decoder = new DingtekProtocolDecoder(null);
+ var decoder = new DingtekProtocolDecoder(null);
verifyPosition(decoder, text(
"800001011e0692001a00000000016e008027c40000186962703655111781"));
diff --git a/src/test/java/org/traccar/protocol/DishaProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/DishaProtocolDecoderTest.java
index ddb5aca18..4492b3ed0 100644
--- a/src/test/java/org/traccar/protocol/DishaProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/DishaProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class DishaProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- DishaProtocolDecoder decoder = new DishaProtocolDecoder(null);
+ var decoder = new DishaProtocolDecoder(null);
verifyPosition(decoder, text(
"$A#A#864161028848856#A#053523#010216#2232.7733#N#08821.1940#E#002.75#038.1#09#00.8#1800#0#000#0000#9999#11.7#285.7#0001*"));
diff --git a/src/test/java/org/traccar/protocol/DmtHttpProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/DmtHttpProtocolDecoderTest.java
index e9d98d6d3..634e37b89 100644
--- a/src/test/java/org/traccar/protocol/DmtHttpProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/DmtHttpProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class DmtHttpProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- DmtHttpProtocolDecoder decoder = new DmtHttpProtocolDecoder(null);
+ var decoder = new DmtHttpProtocolDecoder(null);
verifyPositions(decoder, request(HttpMethod.POST, "/",
buffer("{\"SerNo\":131693,\"IMEI\":\"356692063643328\",\"ICCID\":\"8944538523010771676\",\"ProdId\":33,\"FW\":\"33.4.1.27\",\"Records\":[{\"SeqNo\":125,\"Reason\":11,\"DateUTC\":\"2017-05-11 05:58:44\",\"Fields\":[{\"GpsUTC\":\"2017-05-08 18:04:57\",\"Lat\":43.7370138,\"Long\":-79.3462607,\"Alt\":197,\"Spd\":0,\"SpdAcc\":13,\"Head\":66,\"PDOP\":18,\"PosAcc\":37,\"GpsStat\":7,\"FType\":0},{\"DIn\":2,\"DOut\":0,\"DevStat\":2,\"FType\":2},{\"AnalogueData\":{\"1\":14641,\"3\":2484,\"4\":26,\"5\":10868},\"FType\":6},{\"AnalogueData\":{\"11\":34,\"12\":0,\"13\":309,\"14\":9921,\"15\":3},\"FType\":7}]},{\"SeqNo\":128,\"Reason\":11,\"DateUTC\":\"2017-05-11 17:59:45\",\"Fields\":[{\"GpsUTC\":\"2017-05-08 18:04:57\",\"Lat\":43.7370138,\"Long\":-79.3462607,\"Alt\":197,\"Spd\":0,\"SpdAcc\":13,\"Head\":66,\"PDOP\":18,\"PosAcc\":37,\"GpsStat\":7,\"FType\":0},{\"DIn\":2,\"DOut\":0,\"DevStat\":2,\"FType\":2},{\"AnalogueData\":{\"1\":14607,\"3\":2752,\"4\":26,\"5\":11062},\"FType\":6},{\"AnalogueData\":{\"11\":34,\"12\":1,\"13\":325,\"14\":10881,\"15\":3},\"FType\":7}]},{\"SeqNo\":130,\"Reason\":9,\"DateUTC\":\"2017-05-11 19:30:03\",\"Fields\":[{\"GpsUTC\":\"2017-05-08 18:04:57\",\"Lat\":43.7370138,\"Long\":-79.3462607,\"Alt\":197,\"Spd\":0,\"SpdAcc\":13,\"Head\":66,\"PDOP\":18,\"PosAcc\":37,\"GpsStat\":3,\"FType\":0},{\"DIn\":6,\"DOut\":0,\"DevStat\":2,\"FType\":2},{\"AnalogueData\":{\"1\":14599,\"3\":2731,\"4\":27,\"5\":10965},\"FType\":6},{\"AnalogueData\":{\"11\":34,\"12\":2,\"13\":329,\"14\":11121,\"15\":3},\"FType\":7}]},{\"SeqNo\":131,\"Reason\":11,\"DateUTC\":\"2017-05-11 19:32:03\",\"Fields\":[{\"GpsUTC\":\"2017-05-08 18:04:57\",\"Lat\":43.7370138,\"Long\":-79.3462607,\"Alt\":197,\"Spd\":0,\"SpdAcc\":13,\"Head\":66,\"PDOP\":18,\"PosAcc\":37,\"GpsStat\":7,\"FType\":0},{\"DIn\":6,\"DOut\":0,\"DevStat\":2,\"FType\":2},{\"AnalogueData\":{\"1\":14403,\"3\":2783,\"4\":27,\"5\":10965},\"FType\":6},{\"AnalogueData\":{\"11\":34,\"12\":2,\"13\":330,\"14\":11181,\"15\":3},\"FType\":7}]},{\"SeqNo\":133,\"Reason\":11,\"DateUTC\":\"2017-05-11 19:36:15\",\"Fields\":[{\"GpsUTC\":\"2017-05-08 18:04:57\",\"Lat\":43.7370138,\"Long\":-79.3462607,\"Alt\":197,\"Spd\":0,\"SpdAcc\":13,\"Head\":66,\"PDOP\":18,\"PosAcc\":37,\"GpsStat\":7,\"FType\":0},{\"DIn\":6,\"DOut\":0,\"DevStat\":2,\"FType\":2},{\"AnalogueData\":{\"1\":14319,\"3\":2898,\"4\":23,\"5\":10965},\"FType\":6},{\"AnalogueData\":{\"11\":34,\"12\":3,\"13\":331,\"14\":11241,\"15\":3},\"FType\":7}]}]}")));
diff --git a/src/test/java/org/traccar/protocol/DmtProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/DmtProtocolDecoderTest.java
index 8977cf194..82a4cd5ff 100644
--- a/src/test/java/org/traccar/protocol/DmtProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/DmtProtocolDecoderTest.java
@@ -8,11 +8,14 @@ public class DmtProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- DmtProtocolDecoder decoder = new DmtProtocolDecoder(null);
+ var decoder = new DmtProtocolDecoder(null);
verifyNull(decoder, binary(
"0255003300001b00003335333232393032373533393235310038393931353030303030303030313330343539340000000403041910780603"));
+ verifyPositions(decoder, binary(
+ "0255047a003d0035020000fbb53a0f030015fbb53a0f3c210e2145deeb051e001a0901940c070302080300000000000300060f011d1003400804180005e80f062e1c3d003602000086b93a0f03001586b93a0fe5421c21bbe1be051700c30901a50d070302080300000000000300060f011d1003bb0804180005e80f062e1c"));
+
verifyPositions(decoder, false, binary(
"025504ab013d00c21a00004829900c0300154929900cbd163617b08a94c7fa003c07032c131a0302080300000000000300060f019b14037e0e0463000558140607213d00c31a0000ca29900c030015ca29900ca3033817bbb895c71401be0603b310190302080300000000000300060f019b14036d0e0463000558140607213d00c41a0000472a900c030015472a900c8d453817423e96c7fa000200040013270302080300000000000300060f019b1403840e0463000546140606213d00c51a0000c52a900c030015c52a900c184c3817c35296c724010400050016180302080300000000000300060f019b1403750e0463000547140606213d00c61a0000462b900c030015462b900cbd8a361703b495c710018c07085a10210302080300000000000300060f019b1403630e0463000546140606213d00c71a0000c52b900c030015c52b900cf6d63517455a94c7e9004c05035a10240302080300000000000300060f019b14036e0e0463000545140606213d00c81a00004b2c900c0300154b2c900c766d3517ddf093c7320107000d00102e0302080300000000000300060f019b1403750e046300054314060521"));
diff --git a/src/test/java/org/traccar/protocol/DolphinProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/DolphinProtocolDecoderTest.java
index 2a668563e..0215973e8 100644
--- a/src/test/java/org/traccar/protocol/DolphinProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/DolphinProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class DolphinProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- DolphinProtocolDecoder decoder = new DolphinProtocolDecoder(null);
+ var decoder = new DolphinProtocolDecoder(null);
verifyPositions(decoder, binary(
"ababff8f0300000100000100e03c0b86c70e03005c0f0000ab4cd12d0aa9010d0d7f0e4215f6fe6c421d00b0ce4420122daa9a9042359a99f9413806455e53fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa0662404801010ce41bb8f4cc2ad801fe98f3030893dd9a010001019299f303155400000007b401000000000072ac01b99401f8de8a0adc03900e0049000003004bfa010aa7010d4f7f0e421505ff6c421dcd1cce4420112d3ef984423552b89e413806456053fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa06623e4201010ce41bd8f4cc2a20ff98f3030193dd9a010001019399f30315420000000000000000000072ad018f950181df8a0aee03cd0d004b000003004bfa010aa7010da67f0e42154fff6c421d3393cd4420112d073c9942358fc2df413806456253fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa06623e4c010111f51d88f5cc2a308199f3030293dd9a010001019599f303154c0000000000000000000072ad01ef95018bdf8a0aee03d30d004a000003004bfa010aa9010dfd800e421525006d421d3373d04420102da5b7aa4235ec51c4413806456853fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa0662405501010ef01db0f6cc2aa8018899f3030793dd9a010001019c99f3031555000000068a010000000000739d01df9501acdf8a0ac0028a150031000003004bfa010aa8010d3b830e421561016d421dcddcd04420102d8edda94235cdccbe413806457353fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa06623f5401010ef01db8f8cc2a88029499f3030c93dd9a01000101a899f303155500000004480000000000728a018f9501e5df8a0aa9018d280015000003004bfa010aa8010ddd850e4215b3026d421dcd3cd04420112d2e9ba942359a99af413806458053fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa06623f5401010df01df0facc2ab802a199f3030d93dd9a01000101b599f303155500000005760000000000728b01f59401a2e08a0a9b01c12b0018000003004bfa010aa9010d4a870e421554036d421d66d6cf4420112d5f29a842355c8faa413806458753fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa0662405401010dea1d98fccc2aa801a899f3030793dd9a01000101bc99f303155400000007a4010000000000719701b29401bae08a0a9202be180026000003004bfa010aa7010da7870e421591036d421d33d3cf4420112d6329a942353333a7413806458953fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa06623e5401010df51dc8fccc2a30aa99f3030293dd9a01000101be99f3031554000000022c0000000000719901db9401c3e08a0aae02a016002b000003004bfa010aa7010d1a880e4215b6036d421d33e3cf4420112ddc45aa423514aea3413806458b53fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa06623e5501010df51df8fccc2a30ac99f3030293dd9a01000101c099f303155500000002320000000000719e01f69401d1e08a0a9f02b3170031000003004bfa010aa8010d50890e42154d046d421d3363d04420102da0b7a94235d7a3a2413806459253fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa06623f5401010edf1d88fecc2a9001b399f3030793dd9a01000101c799f303155400000000000000000000729a01e69501f7e08a0ab0028e16002d000003004bfa010aa9010d188c0e421573056d421d00c0ce4420102d300c84423514ae7741380645a053fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa06624042010110da1dd080cd2ac802c199f3030e93dd9a01000101d599f303155500000009e2010000000000729801b19501afe18a0a97029018002a000003004bfa010aa7010d528c0e42159d056d421d3313cf4420102dfec98c423552b8c241380645a053fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa06623e46010110da1df080cd2a20c299f3030193dd9a01000101d699f303154600000000000000000000729701df9501b8e18a0aa002b9170029000003004bfa010aa9010d198f0e42159e066d421d9a49d04420112dfae6a642359a999941380645ad53fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa06624053010111e51da883cd2ab802cf99f3030d93dd9a01000101e399f30315540000000ca4020000000000729601c49501f1e18a0a9102dc180028000003004bfa010aa7010da68f0e4215e9066d421d9a19d044200f2d83dda74235ec519441380645b153fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa06623e53010111e51df083cd2a48d299f3030393dd9a01000101e699f303155300000003400000000000729701de950183e28a0a8e02ff180028000003004bfa010aa7010d40900e42151a076d421d33c3cf4420102d717e9b423548e15e41380645b453fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa06623e4d010110e51db884cd2a48d599f3030393dd9a01000101e999f303154d00000003420000000000729801bf950191e28a0a9a02f117002a000003004bfa010aa7010d5f900e42153c076d421d66c6cf44200f2de3028d4235713daa41380645b553fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa06623e46010110da1dc884cd2a10d699f3030193dd9a01000101ea99f303154600000001120000000000729901bf950191e28a0a98029318002b000003004bfa010aa7010dae900e42153d076d421d9ad9cf44200f2d324fa342357b144241380645b653fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa06623e51010110da1de884cd2a20d799f3030193dd9a01000101eb99f303155100000000000000000000729b01a5950196e28a0aa2029b17002c000003004bfa010aa7010d08910e42157e076d421d33b3cf4420102d51b79a42357b14b241380645b853fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa06623e4d010110da1d9885cd2a30d999f3030293dd9a01000101ed99f3031552000000022c0000000000729b01ca95019be28a0ab602e815002f000003004bfa010aa9010d3b930e42153f086d421d9a99d044200f2d5a3ca9423552b88441380645c153fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa06624054010110f51d9087cd2af801e499f3030b93dd9a01000101f899f30315540000000bfa010000000000729901cf9501cee28a0ac502f814002e000003004bfa010aa9010df1950e421558096d421d6646d24420102da3a4a842357b149441380645cf53fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa0662405401010eea1dc889cd2ab802f199f3030d93dd9a01000101859af303155500000008be010000000000729901c7950190e38a0a9c02da17002c000003004bfa010aa9010dcf970e4215260a6d421d6676d34420112d653cab423552b89e41380645d853fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa0662405501010efa1ba08bcd2ad801fa99f3030993dd9a010001018e9af303155600000007a8010000000000729e01bb9501bae38a0ac00284150031000003004bfa010aa8010de89a0e4215510b6d421d00a0d44420112d1aaea74235cdcc6841380645e653fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa06623f53010110f51d808ecd2ae002899af3030f93dd9a010001019d9af30315550000000460000000000073a401e59501fce38a0a9003e510003e000003004bfa010aa9010d6b9c0e4215b00b6d421d00b0d44420112dd46bac423585eb0541380645ed53fc5f48015a41050a0b1e29323334353637464850649601a401a601aa01ab01ad01b401b501b601b701b801c905ca05cb05cd05d105d205e605e705ef059c069e06a206a906aa06624056010110ea1da88fcd2aa801919af3030893dd9a01000101a59af303155600000008a801000000000073a201a19501a1e48a0a8103ce110038000003004bfa01"));
diff --git a/src/test/java/org/traccar/protocol/DwayProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/DwayProtocolDecoderTest.java
index 107a2a435..368f8b4ac 100644
--- a/src/test/java/org/traccar/protocol/DwayProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/DwayProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class DwayProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- DwayProtocolDecoder decoder = new DwayProtocolDecoder(null);
+ var decoder = new DwayProtocolDecoder(null);
verifyPosition(decoder, text(
"AA55,36,10024,1,171025,161055,36.0294,-79.7881,201, 2.5,111,1000,0000,00000,3578,0,0,0,D"));
diff --git a/src/test/java/org/traccar/protocol/EasyTrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/EasyTrackProtocolDecoderTest.java
index abe5c5532..5fda7fb28 100644
--- a/src/test/java/org/traccar/protocol/EasyTrackProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/EasyTrackProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class EasyTrackProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- EasyTrackProtocolDecoder decoder = new EasyTrackProtocolDecoder(null);
+ var decoder = new EasyTrackProtocolDecoder(null);
verifyNotNull(decoder, text(
"*ET,354522180593498,JZ,0,20222,262,724,4#"));
diff --git a/src/test/java/org/traccar/protocol/EasyTrackProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/EasyTrackProtocolEncoderTest.java
index 376ddf1e7..79b4e66e3 100644
--- a/src/test/java/org/traccar/protocol/EasyTrackProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/EasyTrackProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class EasyTrackProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeEngineStop() {
- EasyTrackProtocolEncoder encoder = new EasyTrackProtocolEncoder(null);
+ var encoder = new EasyTrackProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/EelinkProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/EelinkProtocolDecoderTest.java
index 08b2641aa..d0c683abf 100644
--- a/src/test/java/org/traccar/protocol/EelinkProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/EelinkProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class EelinkProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- EelinkProtocolDecoder decoder = new EelinkProtocolDecoder(null);
+ var decoder = new EelinkProtocolDecoder(null);
verifyPositions(decoder, binary(
"454c029249a50354679090044671676712004321315f3cf43503fc94d3760c79328a0129000000000a01f9000190330905580d2e046f118a04ec00000000ccc7086c02fe000000000000000000000000000000000000676712004321325f3cf43e03fc94d3760c79328a0129000000000901f9000190330905580d2e046f117b04ec00000000ccc7086d02ff000000000000000000000000000000000000676712004321335f3cf44703fc94d3760c79328a0129000000000901f9000190330905580d2e046f117f04ec00000000ccc7086d02ff000000000000000000000000000000000000676712004321345f3cf45303fc94d3760c79328a0129000000000901f9000190330905580d2e046f119d04ec00000000ccc7086d02ff000000000000000000000000000000000000676712004321355f3cf45c03fc94d3760c79328a0129000000000801f9000190330905580d2e046f11a304ec00000000ccc7086d02ff000000000000000000000000000000000000676712004321365f3cf46603fc94d3760c79328a0129000000000801f9000190330905580d2e046f118804df00000000ccc7086d02ff000000000000000000000000000000000000676712004321375f3cf47103fc94d3760c79328a0129000000000901f9000190330905580d2e046f119704ec00000000ccc7086d02ff000000000000000000000000000000000000676712004321385f3cf47a03fc94d3760c79328a0129000000000901f9000190330905580d2e046f118204ec00000000ccc7086e0300000000000000000000000000000000000000676712004321395f3cf48303fc94d3760c79328a0129000000000901f9000190330905580d2e046f117604df00000000ccc7086e0300000000000000000000000000000000000000"));
diff --git a/src/test/java/org/traccar/protocol/EgtsFrameDecoderTest.java b/src/test/java/org/traccar/protocol/EgtsFrameDecoderTest.java
index 523d095f2..a1acb1e9d 100644
--- a/src/test/java/org/traccar/protocol/EgtsFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/EgtsFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class EgtsFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- EgtsFrameDecoder decoder = new EgtsFrameDecoder();
+ var decoder = new EgtsFrameDecoder();
verifyFrame(
binary("0100020B0025003A5701C91A003A5701CD6E68490202101700CBB4740F7617FD924364104F116A0000000000010300001EC2"),
diff --git a/src/test/java/org/traccar/protocol/EgtsProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/EgtsProtocolDecoderTest.java
index cdf27ee63..dcf70bcae 100644
--- a/src/test/java/org/traccar/protocol/EgtsProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/EgtsProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class EgtsProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeWithObjectId() throws Exception {
- EgtsProtocolDecoder decoder = new EgtsProtocolDecoder(null);
+ var decoder = new EgtsProtocolDecoder(null);
verifyNull(decoder, binary(
"0100020b002300020001871c00020000010105190000ab0800006247396e615734366347467a63336476636d513daadf"));
@@ -31,7 +31,7 @@ public class EgtsProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeWithAuth() throws Exception {
- EgtsProtocolDecoder decoder = new EgtsProtocolDecoder(null);
+ var decoder = new EgtsProtocolDecoder(null);
verifyNull(decoder, binary(
"0100010b002200c06401f21700c1640171360d00010101140071360d000238363539303500000000000000000047fc"));
diff --git a/src/test/java/org/traccar/protocol/EnforaProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/EnforaProtocolDecoderTest.java
index 1c2f9492a..14e982e39 100644
--- a/src/test/java/org/traccar/protocol/EnforaProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/EnforaProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class EnforaProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- EnforaProtocolDecoder decoder = new EnforaProtocolDecoder(null);
+ var decoder = new EnforaProtocolDecoder(null);
verifyNull(decoder, binary(
"000A08002020202020303131303730303030353730323637"));
diff --git a/src/test/java/org/traccar/protocol/EnnfuProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/EnnfuProtocolDecoderTest.java
index 7d40d956b..4afa5921f 100644
--- a/src/test/java/org/traccar/protocol/EnnfuProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/EnnfuProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class EnnfuProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- EnnfuProtocolDecoder decoder = new EnnfuProtocolDecoder(null);
+ var decoder = new EnnfuProtocolDecoder(null);
verifyPosition(decoder, text(
"Ennfu:354679095321652,041504.00,A,3154.86654,N,11849.08737,E,0.053,,080121,20,3.72,21.4,V0.01"));
diff --git a/src/test/java/org/traccar/protocol/EsealProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/EsealProtocolDecoderTest.java
index b615e5062..d0d9e3c41 100644
--- a/src/test/java/org/traccar/protocol/EsealProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/EsealProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class EsealProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- EsealProtocolDecoder decoder = new EsealProtocolDecoder(null);
+ var decoder = new EsealProtocolDecoder(null);
verifyPosition(decoder, text(
"##S,eSeal,1000821,256,3.0.6,Normal,34,2017-08-31,08:14:40,15,A,25.708828N 100.372870W,10,0,Close,0.71,0:0:3:0,3.8,-73,E##"));
diff --git a/src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java
index 7bf4f844e..88be3ebc9 100644
--- a/src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class EsealProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- EsealProtocolEncoder encoder = new EsealProtocolEncoder(null);
+ var encoder = new EsealProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/EskyFrameDecoderTest.java b/src/test/java/org/traccar/protocol/EskyFrameDecoderTest.java
index 20b5dfcd5..c3926c8d7 100644
--- a/src/test/java/org/traccar/protocol/EskyFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/EskyFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class EskyFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- EskyFrameDecoder decoder = new EskyFrameDecoder();
+ var decoder = new EskyFrameDecoder();
verifyNull(
decoder.decode(null, null, binary("00")));
diff --git a/src/test/java/org/traccar/protocol/EskyProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/EskyProtocolDecoderTest.java
index 8ce9eca78..ace55f934 100644
--- a/src/test/java/org/traccar/protocol/EskyProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/EskyProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class EskyProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- EskyProtocolDecoder decoder = new EskyProtocolDecoder(null);
+ var decoder = new EskyProtocolDecoder(null);
verifyAttribute(decoder, text(
"ET;0;860337031066546;R;9+200717114059+41.32053+19.80761+0.30+0+0x2+8+40381744+0+1409+11"),
diff --git a/src/test/java/org/traccar/protocol/ExtremTracProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/ExtremTracProtocolDecoderTest.java
index c5b3364cf..29d11e02f 100644
--- a/src/test/java/org/traccar/protocol/ExtremTracProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/ExtremTracProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class ExtremTracProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- ExtremTracProtocolDecoder decoder = new ExtremTracProtocolDecoder(null);
+ var decoder = new ExtremTracProtocolDecoder(null);
verifyPosition(decoder, text(
"$GPRMC,862106020628733,050859.000,A,1404.8573,N,08710.9967,W,0.00,0,080117,0,,00C8,00218,99,,,,,,0.00"));
diff --git a/src/test/java/org/traccar/protocol/FifotrackFrameDecoderTest.java b/src/test/java/org/traccar/protocol/FifotrackFrameDecoderTest.java
index 6b39b6c17..32657b277 100644
--- a/src/test/java/org/traccar/protocol/FifotrackFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/FifotrackFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class FifotrackFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- FifotrackFrameDecoder decoder = new FifotrackFrameDecoder();
+ var decoder = new FifotrackFrameDecoder();
verifyFrame(
binary("24243132362c3836393436373034393239303738372c324138432c4130312c2c3139303431333135333235342c412c2d31352e3132373836382c33392e3236323530362c302c3136322c3431352c38303937323234332c302c303030302c30302c302c3634337c337c353141467c424632462c3141337c3446367c3833327c302c312c2a3534"),
diff --git a/src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java
index 48b74c904..fdac158dd 100644
--- a/src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java
@@ -9,7 +9,11 @@ public class FifotrackProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- FifotrackProtocolDecoder decoder = new FifotrackProtocolDecoder(null);
+ var decoder = new FifotrackProtocolDecoder(null);
+
+ verifyAttribute(decoder, buffer(
+ "$$25,863003046473534,1,B03,OK*4D"),
+ Position.KEY_RESULT, "OK");
verifyPosition(decoder, buffer(
"$$118,863003046473534,258,A01,,201007231735,V,3.067783,101.672858,0,176,96,189890,0,A0,03,0,502|19|5C1|93349F,196|4E0|6C,1,*13"));
diff --git a/src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java
index b60313956..2da7f0842 100644
--- a/src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class FifotrackProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- FifotrackProtocolEncoder encoder = new FifotrackProtocolEncoder(null);
+ var encoder = new FifotrackProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/FlespiProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/FlespiProtocolDecoderTest.java
index 9e5a45a83..88fdb0959 100644
--- a/src/test/java/org/traccar/protocol/FlespiProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/FlespiProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class FlespiProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- FlespiProtocolDecoder decoder = new FlespiProtocolDecoder(null);
+ var decoder = new FlespiProtocolDecoder(null);
verifyPositions(decoder, request(HttpMethod.POST, "/",
buffer("[{\"position.speed\":0,\"position.latitude\":53.90573,\"time.valid.status\":true,\"timestamp\":1506956075,\"position.satellites\":10,\"message.buffered.status\":false,\"business.mode.status\":true,\"gps.status\":true,\"position.longitude\":27.455848,\"position.direction\":0,\"ident\":\"605630\"},{\"siren.status\":false,\"business.mode.status\":true,\"position.satellites\":8,\"timestamp\":1506695785,\"led.status\":false,\"position.latitude\":53.905569,\"position.longitude\":27.455986,\"position.speed\":0,\"gradual.stop.status\":false,\"position.direction\":262.643854,\"hardware.version.enum\":223,\"vehicle.mileage\":160,\"message.buffered.status\":false,\"blinkers.status\":false,\"ident\":\"605630\",\"position.altitude\":233.48,\"immobilizer.status\":false}]")));
diff --git a/src/test/java/org/traccar/protocol/FlexCommProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/FlexCommProtocolDecoderTest.java
index 28ecaf646..3e988ba4f 100644
--- a/src/test/java/org/traccar/protocol/FlexCommProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/FlexCommProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class FlexCommProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- FlexCommProtocolDecoder decoder = new FlexCommProtocolDecoder(null);
+ var decoder = new FlexCommProtocolDecoder(null);
verifyPosition(decoder, text(
"7E00865067022408382201705302358271024932258006712785200700022601010224100040002C5002A2210001000000010012342107"));
diff --git a/src/test/java/org/traccar/protocol/FlexibleReportProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/FlexibleReportProtocolDecoderTest.java
new file mode 100644
index 000000000..8763887a5
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/FlexibleReportProtocolDecoderTest.java
@@ -0,0 +1,21 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class FlexibleReportProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ var decoder = new FlexibleReportProtocolDecoder(null);
+
+ verifyPosition(decoder, binary(
+ "7d010015875000013001001028fd98991830002e7fffffff0c28fd989903f6540a07f250ed00000f02f2140f5ea20000000000000202d4000a1f8b0100000708ffff"));
+
+ verifyAttributes(decoder, binary(
+ "7D010860112040978399000027E3CFC30130002E7FFFFFFF0C00000000055D4A800ABA9500000000000000002F5D0E800000000000FFFFFFFF158A0000000000FFFF"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/FlextrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/FlextrackProtocolDecoderTest.java
index 3f268fde9..0c1c18a0c 100644
--- a/src/test/java/org/traccar/protocol/FlextrackProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/FlextrackProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class FlextrackProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- FlextrackProtocolDecoder decoder = new FlextrackProtocolDecoder(null);
+ var decoder = new FlextrackProtocolDecoder(null);
verifyNull(decoder, text(
"-1,LOGON,7000000123,8945000000"));
diff --git a/src/test/java/org/traccar/protocol/FoxProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/FoxProtocolDecoderTest.java
index 837b36b64..439a5553a 100644
--- a/src/test/java/org/traccar/protocol/FoxProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/FoxProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class FoxProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- FoxProtocolDecoder decoder = new FoxProtocolDecoder(null);
+ var decoder = new FoxProtocolDecoder(null);
verifyPosition(decoder, text(
"<fox><gps id=\"10\" data=\"51,A,010416,085317,4444.4158,N,02025.4466,E,1,182,,1110111111110111 141 0 0 0 0 0 10010000 10142,018C81851800009B\"/></fox>"));
diff --git a/src/test/java/org/traccar/protocol/FreedomProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/FreedomProtocolDecoderTest.java
index b2fc1fd8d..c8f7a444b 100644
--- a/src/test/java/org/traccar/protocol/FreedomProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/FreedomProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class FreedomProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- FreedomProtocolDecoder decoder = new FreedomProtocolDecoder(null);
+ var decoder = new FreedomProtocolDecoder(null);
verifyPosition(decoder, text(
"IMEI,353358011714362,2014/05/22, 20:49:32, N, Lat:4725.9624, E, Lon:01912.5483, Spd:5.05"),
diff --git a/src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java
index a84c4e357..6a7a15397 100644
--- a/src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java
@@ -8,7 +8,10 @@ public class FreematicsProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- FreematicsProtocolDecoder decoder = new FreematicsProtocolDecoder(null);
+ var decoder = new FreematicsProtocolDecoder(null);
+
+ verifyPositions(decoder, text(
+ "M0ZR4X0#0:204391,11:140221,10:8445000,A:49.215920,B:18.737755,C:410,D:0,E:208,24:1252,20:0;0;0,82:47*B5"));
verifyNull(decoder, text(
"1#EV=2,TS=1871902,ID=ESP32305C06C40A24*AC"));
@@ -31,6 +34,12 @@ public class FreematicsProtocolDecoderTest extends ProtocolTest {
verifyPositions(decoder, text(
"1#0=68338,10D=79,30=1010,105=199,10C=4375,104=56,111=62,20=0;-1;95,10=6454200,A=-32.727482,B=150.150301,C=159,D=0,F=5,24=1250*7A"));
+ verifyPositions(decoder, false, text(
+ "M0ZR4X0#0:566624,24:1246,20:0;0;0*D"));
+
+ verifyNull(decoder, text(
+ "M0ZR4X0#DF=4208,SSI=-71,EV=1,TS=20866,ID=M0ZR4X0*9E"));
+
}
}
diff --git a/src/test/java/org/traccar/protocol/FutureWayFrameDecoderTest.java b/src/test/java/org/traccar/protocol/FutureWayFrameDecoderTest.java
index fb1597474..b8eb3908e 100644
--- a/src/test/java/org/traccar/protocol/FutureWayFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/FutureWayFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class FutureWayFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- FutureWayFrameDecoder decoder = new FutureWayFrameDecoder();
+ var decoder = new FutureWayFrameDecoder();
verifyFrame(
binary("343130303030303039424130303030344750533a562c3230303930323039333333332c302e3030303030304e2c302e303030303030452c302e3030302c302e3030300d0a574946493a332c317c39302d36372d31432d46372d32312d36437c353226327c38302d38392d31372d43362d37392d41307c353426337c34302d46342d32302d45462d44442d32417c35380d0a4c42533a3436302c302c34363437353036362c36390d0a36413432"),
diff --git a/src/test/java/org/traccar/protocol/FutureWayProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/FutureWayProtocolDecoderTest.java
index e3df385df..fbb0a2aba 100644
--- a/src/test/java/org/traccar/protocol/FutureWayProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/FutureWayProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class FutureWayProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- FutureWayProtocolDecoder decoder = new FutureWayProtocolDecoder(null);
+ var decoder = new FutureWayProtocolDecoder(null);
verifyNull(decoder, text(
"410000003F2000020,IMEI:354828100126461,battery level:6,network type:7,CSQ:236F42"));
diff --git a/src/test/java/org/traccar/protocol/GalileoFrameDecoderTest.java b/src/test/java/org/traccar/protocol/GalileoFrameDecoderTest.java
index 4f4972895..0d3199eab 100644
--- a/src/test/java/org/traccar/protocol/GalileoFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GalileoFrameDecoderTest.java
@@ -10,7 +10,7 @@ public class GalileoFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- GalileoFrameDecoder decoder = new GalileoFrameDecoder();
+ var decoder = new GalileoFrameDecoder();
assertEquals(
binary("011780011102e603383633353931303238393630323437043200801c"),
diff --git a/src/test/java/org/traccar/protocol/GalileoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GalileoProtocolDecoderTest.java
index 74612caab..66b375b8a 100644
--- a/src/test/java/org/traccar/protocol/GalileoProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GalileoProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class GalileoProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- GalileoProtocolDecoder decoder = new GalileoProtocolDecoder(null);
+ var decoder = new GalileoProtocolDecoder(null);
verifyPositions(decoder, binary(
"011801018202130338363833343530333230343234323604640010a406207caa9f5b300c830a7901ca0ec802330000000034b802350540003e41703f422b1043234504004600e09000000000a000a100a200a300a400a500a600a700a800a900aa00ab00ac00ad00ae00af00b00000b10000b20000b30000b40000b50000b60000b70000b80000b90000c000000000c100000000c200000000c300000000c400c500c600c700c800c900ca00cb00cc00cd00ce00cf00d000d100d200d4d3140000d60000d70000d80000d90000da0000db00000000dc00000000dd00000000de00000000df00000000f000000000f100000000f200000000f300000000f400000000f500000000f600000000f700000000f800000000f9000000008960"));
diff --git a/src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java
index 6a68752bb..b25100c48 100644
--- a/src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java
@@ -9,7 +9,7 @@ public class GalileoProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- GalileoProtocolEncoder encoder = new GalileoProtocolEncoder(null);
+ var encoder = new GalileoProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/GatorProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GatorProtocolDecoderTest.java
index 7e1ccb79d..24686e220 100644
--- a/src/test/java/org/traccar/protocol/GatorProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GatorProtocolDecoderTest.java
@@ -17,7 +17,7 @@ public class GatorProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- GatorProtocolDecoder decoder = new GatorProtocolDecoder(null);
+ var decoder = new GatorProtocolDecoder(null);
verifyAttributes(decoder, binary(
"242480002600341cad190917022021812497260280594200000000c047010000135400009bb600ff00b90d"));
diff --git a/src/test/java/org/traccar/protocol/GenxProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GenxProtocolDecoderTest.java
index 373c8c49e..382c974ce 100644
--- a/src/test/java/org/traccar/protocol/GenxProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GenxProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class GenxProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- GenxProtocolDecoder decoder = new GenxProtocolDecoder(null);
+ var decoder = new GenxProtocolDecoder(null);
decoder.setReportColumns("28,2,3,4,13,17,10,23,27,11,7,8,46,56,59,70,74,75,77,89,90,93,99,107,112,113,114,176,175,178,181,182");
diff --git a/src/test/java/org/traccar/protocol/Gl100ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gl100ProtocolDecoderTest.java
index ffafcd7b1..50f993839 100644
--- a/src/test/java/org/traccar/protocol/Gl100ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gl100ProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class Gl100ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Gl100ProtocolDecoder decoder = new Gl100ProtocolDecoder(null);
+ var decoder = new Gl100ProtocolDecoder(null);
verifyPosition(decoder, text(
"+RESP:GTLGL,359464030492644,1,2,1,0,0.4,0,299.7,1,5.455551,51.449776,20160311083229,0204,0016,03EC,BD94,00,0036,0102090501"));
diff --git a/src/test/java/org/traccar/protocol/Gl200BinaryProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gl200BinaryProtocolDecoderTest.java
index e6fb98340..b8ce8af5d 100644
--- a/src/test/java/org/traccar/protocol/Gl200BinaryProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gl200BinaryProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Gl200BinaryProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Gl200BinaryProtocolDecoder decoder = new Gl200BinaryProtocolDecoder(null);
+ var decoder = new Gl200BinaryProtocolDecoder(null);
verifyPosition(decoder, binary(
"2b4556542d00fc1fbf0063450102020956325403000343056437f8220700000200000000010000160100f2007eff75a1f0025c6b1a07e1080108241a02680003189c1ac500000000000002100800000000000000000007e1080108241a19e24e4e0d0a"));
diff --git a/src/test/java/org/traccar/protocol/Gl200FrameDecoderTest.java b/src/test/java/org/traccar/protocol/Gl200FrameDecoderTest.java
index ed5e9d226..17eed8a59 100644
--- a/src/test/java/org/traccar/protocol/Gl200FrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gl200FrameDecoderTest.java
@@ -10,7 +10,7 @@ public class Gl200FrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Gl200FrameDecoder decoder = new Gl200FrameDecoder();
+ var decoder = new Gl200FrameDecoder();
assertEquals(
binary("2b4c474e00ff0026fe110b07020106563454040d054905000007e4031911213905083abd0d0a"),
diff --git a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
index 915876609..8978f64e5 100644
--- a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
@@ -9,7 +9,13 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Gl200TextProtocolDecoder decoder = new Gl200TextProtocolDecoder(null);
+ var decoder = new Gl200TextProtocolDecoder(null);
+
+ verifyAttributes(decoder, buffer(
+ "+RESP:GTINF,DC0103,865284049247079,gv600mg,21,89883070000007211665,22,0,11,12913,12917,4.26,0,1,,,20210216154607,1,79,,01,00,,,20210216104606,1EBE$"));
+
+ verifyPositions(decoder, buffer(
+ "+RESP:GTERI,040A00,862894022579562,gv200,00000002,,10,1,1,96.1,180,749.7,39.222692,24.165463,20210225065756,0420,0004,759C,3360,00,15529.8,,,2789,,01,00,2,2,282BD47A0B000063,1,FFE2,281FDD5D0B000057,1,FFC8,20210225065800,6974$"));
verifyAttribute(decoder, buffer(
"+RESP:GTERI,DE0115,865284042104863,gl500m,00000100,0,0,1,2,0.0,0,36.9,-1.844589,52.177779,20201006125701,0234,0015,0135,34A1,19,0,,79,1,,0,20201006125723,184D$"),
diff --git a/src/test/java/org/traccar/protocol/GlobalSatProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GlobalSatProtocolDecoderTest.java
index eac948cc4..3f5296f4b 100644
--- a/src/test/java/org/traccar/protocol/GlobalSatProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GlobalSatProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class GlobalSatProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- GlobalSatProtocolDecoder decoder = new GlobalSatProtocolDecoder(null);
+ var decoder = new GlobalSatProtocolDecoder(null);
verifyNull(decoder, text(
"GSh,131826789036289,3,M,ea04*3d"));
diff --git a/src/test/java/org/traccar/protocol/GlobalSatProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/GlobalSatProtocolEncoderTest.java
index 8cfa9299b..ae4b52167 100644
--- a/src/test/java/org/traccar/protocol/GlobalSatProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/GlobalSatProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class GlobalSatProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeAlarmDismiss() {
- GlobalSatProtocolEncoder encoder = new GlobalSatProtocolEncoder(null);
+ var encoder = new GlobalSatProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -24,7 +24,7 @@ public class GlobalSatProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeOutputControl() {
- GlobalSatProtocolEncoder encoder = new GlobalSatProtocolEncoder(null);
+ var encoder = new GlobalSatProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/GlobalstarProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GlobalstarProtocolDecoderTest.java
index 75d30ec47..1dd5c2542 100644
--- a/src/test/java/org/traccar/protocol/GlobalstarProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GlobalstarProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class GlobalstarProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- GlobalstarProtocolDecoder decoder = new GlobalstarProtocolDecoder(null);
+ var decoder = new GlobalstarProtocolDecoder(null);
verifyNull(decoder, request(HttpMethod.POST, "/", buffer(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
diff --git a/src/test/java/org/traccar/protocol/GnxProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GnxProtocolDecoderTest.java
index 91aca50c8..8bd5e2bd5 100644
--- a/src/test/java/org/traccar/protocol/GnxProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GnxProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class GnxProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- GnxProtocolDecoder decoder = new GnxProtocolDecoder(null);
+ var decoder = new GnxProtocolDecoder(null);
verifyPosition(decoder, text(
"$GNX_MIF,865733022354161,143,0,172642,180316,172642,180316,1,13.034581,N,080.234521,E,0,05396274,ROUTE_2#########,Deo ############,GNX04008,B0*"));
diff --git a/src/test/java/org/traccar/protocol/GoSafeProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GoSafeProtocolDecoderTest.java
index 2ad080219..3ede9017f 100644
--- a/src/test/java/org/traccar/protocol/GoSafeProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GoSafeProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class GoSafeProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- GoSafeProtocolDecoder decoder = new GoSafeProtocolDecoder(null);
+ var decoder = new GoSafeProtocolDecoder(null);
verifyAttribute(decoder, text(
"*GS06,356449068350122,013519070819,,SYS:G6S;V3.37;V1.1.8,GPS:A;12;N23.169866;E113.450728;0;255;54;0.79,COT:18779;,ADC:12.66;0.58,DTT:4084;E1;0;0;0;1,IWD:0;1;ad031652643fff28;23.2;1;1;86031652504fff28;24.3;2;1;e603165252a5ff28;24.2;3;1;bb0416557da6ff28;24.0#"),
diff --git a/src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java
index 23762f572..bae187959 100644
--- a/src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class GotopProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- GotopProtocolDecoder decoder = new GotopProtocolDecoder(null);
+ var decoder = new GotopProtocolDecoder(null);
verifyNull(decoder, text(
""));
diff --git a/src/test/java/org/traccar/protocol/Gps056FrameDecoderTest.java b/src/test/java/org/traccar/protocol/Gps056FrameDecoderTest.java
index ce21f733f..f6524f82b 100644
--- a/src/test/java/org/traccar/protocol/Gps056FrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gps056FrameDecoderTest.java
@@ -10,7 +10,7 @@ public class Gps056FrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Gps056FrameDecoder decoder = new Gps056FrameDecoder();
+ var decoder = new Gps056FrameDecoder();
assertEquals(
binary("242435314750534c5f30323836323436323033333738323934361905110f160b0b7710584e1cbd1b9b4500005b100300fb0a071700ffff23"),
diff --git a/src/test/java/org/traccar/protocol/Gps056ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gps056ProtocolDecoderTest.java
index a6d0c024a..01fa98ba4 100644
--- a/src/test/java/org/traccar/protocol/Gps056ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gps056ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Gps056ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Gps056ProtocolDecoder decoder = new Gps056ProtocolDecoder(null);
+ var decoder = new Gps056ProtocolDecoder(null);
verifyNull(decoder, buffer(
"$$25LOGN_118624620337829462.1#"));
diff --git a/src/test/java/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gps103ProtocolDecoderTest.java
index f22b3801c..79dc8ab7b 100644
--- a/src/test/java/org/traccar/protocol/Gps103ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gps103ProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class Gps103ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(null);
+ var decoder = new Gps103ProtocolDecoder(null);
verifyPosition(decoder, text(
"imei:864035050002451,tracker,201223064947,,F,064947,A,1935.70640,N,09859.94436,W,0.025,;"));
diff --git a/src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java
index 23a05fcee..5edfbf629 100644
--- a/src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class Gps103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionPeriodic() throws Exception {
- Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder(null);
+ var encoder = new Gps103ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -25,7 +25,7 @@ public class Gps103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeCustom() throws Exception {
- Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder(null);
+ var encoder = new Gps103ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/GpsGateProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GpsGateProtocolDecoderTest.java
index d35666b56..c935fb3c2 100644
--- a/src/test/java/org/traccar/protocol/GpsGateProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GpsGateProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class GpsGateProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- GpsGateProtocolDecoder decoder = new GpsGateProtocolDecoder(null);
+ var decoder = new GpsGateProtocolDecoder(null);
verifyPosition(decoder, text(
"$FRCMD,0097,_SendMessage,,7618.51990,S,4002.26182,E,350.0,1.08,0.0,250816,183522.000,0*7F"));
diff --git a/src/test/java/org/traccar/protocol/GpsMarkerProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GpsMarkerProtocolDecoderTest.java
index d6ba11cb7..c0b4966a8 100644
--- a/src/test/java/org/traccar/protocol/GpsMarkerProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GpsMarkerProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class GpsMarkerProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- GpsMarkerProtocolDecoder decoder = new GpsMarkerProtocolDecoder(null);
+ var decoder = new GpsMarkerProtocolDecoder(null);
verifyPosition(decoder, text(
"$GM23D863071014445404T260816142611N55441051E037325071033063C0530304#"));
diff --git a/src/test/java/org/traccar/protocol/GpsmtaProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GpsmtaProtocolDecoderTest.java
index 438d0fb3a..7170718f6 100644
--- a/src/test/java/org/traccar/protocol/GpsmtaProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GpsmtaProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class GpsmtaProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- GpsmtaProtocolDecoder decoder = new GpsmtaProtocolDecoder(null);
+ var decoder = new GpsmtaProtocolDecoder(null);
verifyPosition(decoder, text(
"3085a94ef459 1446536867 49.81621 24.054207 1 0 22 0 10 12 24 0 0"));
diff --git a/src/test/java/org/traccar/protocol/GranitFrameDecoderTest.java b/src/test/java/org/traccar/protocol/GranitFrameDecoderTest.java
index 7c4bb06c2..b4e24f961 100644
--- a/src/test/java/org/traccar/protocol/GranitFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GranitFrameDecoderTest.java
@@ -10,7 +10,7 @@ public class GranitFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- GranitFrameDecoder decoder = new GranitFrameDecoder();
+ var decoder = new GranitFrameDecoder();
assertEquals(
binary("2b525243427e1a003e2934757c57b8b03c38d279b4e61e9bd7006b000000001c00002a4533"),
diff --git a/src/test/java/org/traccar/protocol/GranitProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GranitProtocolDecoderTest.java
index fc75b2a53..7fd5ffe0e 100644
--- a/src/test/java/org/traccar/protocol/GranitProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GranitProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class GranitProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- GranitProtocolDecoder decoder = new GranitProtocolDecoder(null);
+ var decoder = new GranitProtocolDecoder(null);
verifyPositions(decoder, binary(
"2b444441547e8400c500040130050c43495808002839aee3150200000000640000000000000008002839aee3150200000000640000000000000008002839aee3150200000000640000000000000008002839aee3150200000000640000000000000008002839aee3150200000000640000000000000008002839aee3150200000000640000000000000014002a37420d0a"));
diff --git a/src/test/java/org/traccar/protocol/Gs100ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gs100ProtocolDecoderTest.java
new file mode 100644
index 000000000..68c9b8219
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/Gs100ProtocolDecoderTest.java
@@ -0,0 +1,24 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class Gs100ProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ var decoder = new Gs100ProtocolDecoder(null);
+
+ verifyNull(decoder, binary(
+ "474C490F383632343632303332353036373030133839333831303131363039313838343837323546084657312E302E3236"));
+
+ verifyPositions(decoder, binary(
+ "47440416900000124833220421018478956c445263460110426616900000124838220421018478907c445263470055824116900000124839220421018478890c445263440091526116900000124840220421018478867c4452634401312272"));
+
+ verifyPositions(decoder, binary(
+ "47440216900000064113030417020236402C452286650051929716900000064115030417020236408C4522866800379020"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/Gt02ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt02ProtocolDecoderTest.java
index f9b8f6509..9d36ef346 100644
--- a/src/test/java/org/traccar/protocol/Gt02ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gt02ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Gt02ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Gt02ProtocolDecoder decoder = new Gt02ProtocolDecoder(null);
+ var decoder = new Gt02ProtocolDecoder(null);
verifyAttributes(decoder, binary(
"6868150000035889905895258400831c07415045584f4b210d0a"));
diff --git a/src/test/java/org/traccar/protocol/Gt06FrameDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06FrameDecoderTest.java
index cf6d1cfd7..059674398 100644
--- a/src/test/java/org/traccar/protocol/Gt06FrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gt06FrameDecoderTest.java
@@ -8,7 +8,7 @@ public class Gt06FrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Gt06FrameDecoder decoder = new Gt06FrameDecoder();
+ var decoder = new Gt06FrameDecoder();
verifyFrame(
binary("787803691604130318491475905BD30E25001E10BBF7635D14759006E626560501CC0028660F213228660F1F2828660EA81E286610731428660F20140D0A"),
diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index eeafbbdc4..ab1fc33f4 100644
--- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Gt06ProtocolDecoder decoder = new Gt06ProtocolDecoder(null);
+ var decoder = new Gt06ProtocolDecoder(null);
verifyNull(decoder, binary(
"787805120099abec0d0a"));
@@ -18,6 +18,14 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
"78780D01086471700328358100093F040D0A"));
verifyAttribute(decoder, binary(
+ "78782b1215050d03041bcf031ff30a0be795bc001c17014e14a065dd95314504b6040000001c00000cd90ab8fb6f0d0a"),
+ Position.PREFIX_TEMP + 1, 0x1c);
+
+ verifyAttribute(decoder, binary(
+ "7878151330802b00000642014f0008720000802b5ee4d4c90d0a"),
+ Position.KEY_BATTERY_LEVEL, 6);
+
+ verifyAttribute(decoder, binary(
"7878281520000000003c49434349443a38393838323339303030303039373330323635303e00020d446f260d0a"),
Position.KEY_ICCID, "89882390000097302650");
diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java
index 178c7b763..79165d9dc 100644
--- a/src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java
@@ -9,7 +9,7 @@ public class Gt06ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- Gt06ProtocolEncoder encoder = new Gt06ProtocolEncoder(null);
+ var encoder = new Gt06ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/Gt30ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt30ProtocolDecoderTest.java
index cb792ba09..24addc8b4 100644
--- a/src/test/java/org/traccar/protocol/Gt30ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gt30ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Gt30ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Gt30ProtocolDecoder decoder = new Gt30ProtocolDecoder(null);
+ var decoder = new Gt30ProtocolDecoder(null);
verifyPosition(decoder, text(
"$$005D3037811014 9955102834.000,A,3802.8629,N,02349.7163,E,0.00,,060117,,*13|1.3|26225BD"));
diff --git a/src/test/java/org/traccar/protocol/H02FrameDecoderTest.java b/src/test/java/org/traccar/protocol/H02FrameDecoderTest.java
index bdb2ff37b..2294b773b 100644
--- a/src/test/java/org/traccar/protocol/H02FrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/H02FrameDecoderTest.java
@@ -10,7 +10,7 @@ public class H02FrameDecoderTest extends ProtocolTest {
@Test
public void testDecodeShort() throws Exception {
- H02FrameDecoder decoder = new H02FrameDecoder(0);
+ var decoder = new H02FrameDecoder(0);
assertEquals(
binary("2a48512c3335353438383032303131333931312c56312c3031323934352c412c353233312e37393238332c4e2c30313332342e31303731382c452c302e30352c302c3137303231372c464646464646464623"),
@@ -37,7 +37,7 @@ public class H02FrameDecoderTest extends ProtocolTest {
@Test
public void testDecodeLong() throws Exception {
- H02FrameDecoder decoder = new H02FrameDecoder(0);
+ var decoder = new H02FrameDecoder(0);
assertEquals(
binary("24410600082621532131081504419390060740418306000000fffffbfdff0015060000002c02dc0c000000001f"),
@@ -48,7 +48,7 @@ public class H02FrameDecoderTest extends ProtocolTest {
@Test
public void testDecodeAlternative() throws Exception {
- H02FrameDecoder decoder = new H02FrameDecoder(0);
+ var decoder = new H02FrameDecoder(0);
assertEquals(
binary("2a48512c343230363131393133302c4e42522c3130323430332c3233382c312c302c372c313131312c323236342c36332c313131312c323236352c35382c313131312c323236362c35302c313131312c333133352c33372c313131312c3630352c33332c313131312c343932302c33302c313131312c3630372c32382c3131303131372c46464646444646462c3623"),
diff --git a/src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java
index 07411b55f..f9bf574cd 100644
--- a/src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class H02ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- H02ProtocolDecoder decoder = new H02ProtocolDecoder(null);
+ var decoder = new H02ProtocolDecoder(null);
verifyAttribute(decoder, buffer(
"*HQ,135790246811220,HTBT,100#"),
@@ -264,7 +264,7 @@ public class H02ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeStatus() throws Exception {
- H02ProtocolDecoder decoder = new H02ProtocolDecoder(null);
+ var decoder = new H02ProtocolDecoder(null);
verifyAttribute(decoder, buffer(
"*HQ,2705171109,V1,213324,A,5002.5849,N,01433.7822,E,0.00,000,140613,FFFFFFFF#"),
diff --git a/src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java
index 155869b24..3ed0a7e91 100644
--- a/src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java
@@ -19,7 +19,7 @@ public class H02ProtocolEncoderTest extends ProtocolTest {
LocalDateTime.of(LocalDate.now(), LocalTime.of(1, 2, 3)).atZone(ZoneOffset.systemDefault()).toInstant());
@Test
- public void testAlarmArmEncode() throws Exception {
+ public void testAlarmArmEncode() {
Command command = new Command();
command.setDeviceId(1);
@@ -29,7 +29,7 @@ public class H02ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testAlarmDisarmEncode() throws Exception {
+ public void testAlarmDisarmEncode() {
Command command = new Command();
command.setDeviceId(1);
@@ -39,7 +39,7 @@ public class H02ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEngineStopEncode() throws Exception {
+ public void testEngineStopEncode() {
Command command = new Command();
command.setDeviceId(1);
@@ -49,7 +49,7 @@ public class H02ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEngineResumeEncode() throws Exception {
+ public void testEngineResumeEncode() {
Command command = new Command();
command.setDeviceId(1);
@@ -59,7 +59,7 @@ public class H02ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testPositionPeriodicEncode() throws Exception {
+ public void testPositionPeriodicEncode() {
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/HaicomProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HaicomProtocolDecoderTest.java
index 6d879daf2..9d80940ea 100644
--- a/src/test/java/org/traccar/protocol/HaicomProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/HaicomProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class HaicomProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- HaicomProtocolDecoder decoder = new HaicomProtocolDecoder(null);
+ var decoder = new HaicomProtocolDecoder(null);
verifyPosition(decoder, text(
"$GPRS012497007097169,T100001,150618,230031,5402267400332464,0004,2014,000001,,,1,00#V040*"),
diff --git a/src/test/java/org/traccar/protocol/HomtecsProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HomtecsProtocolDecoderTest.java
index 9acf2ce87..192aa3010 100644
--- a/src/test/java/org/traccar/protocol/HomtecsProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/HomtecsProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class HomtecsProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- HomtecsProtocolDecoder decoder = new HomtecsProtocolDecoder(null);
+ var decoder = new HomtecsProtocolDecoder(null);
verifyNull(decoder, text(
"MDS0001_R6d1821f7,170323,143601.00,04,,,,,,,,,"));
diff --git a/src/test/java/org/traccar/protocol/HuaShengFrameDecoderTest.java b/src/test/java/org/traccar/protocol/HuaShengFrameDecoderTest.java
index 0f24d4b5c..228f41ee8 100644
--- a/src/test/java/org/traccar/protocol/HuaShengFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/HuaShengFrameDecoderTest.java
@@ -10,7 +10,7 @@ public class HuaShengFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- HuaShengFrameDecoder decoder = new HuaShengFrameDecoder();
+ var decoder = new HuaShengFrameDecoder();
assertEquals(
binary("c0010c00120060000000000004000600010100c0"),
diff --git a/src/test/java/org/traccar/protocol/HuaShengProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HuaShengProtocolDecoderTest.java
index 7348ec547..51a5d18ae 100644
--- a/src/test/java/org/traccar/protocol/HuaShengProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/HuaShengProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class HuaShengProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- HuaShengProtocolDecoder decoder = new HuaShengProtocolDecoder(null);
+ var decoder = new HuaShengProtocolDecoder(null);
verifyNull(decoder, binary(
"c0010c003c0002000000000044020010a0014f42445f3347315f56322e320013a0043335353835353035313032303536360006a08700000006a0a105c9c0"));
diff --git a/src/test/java/org/traccar/protocol/HuabaoFrameDecoderTest.java b/src/test/java/org/traccar/protocol/HuabaoFrameDecoderTest.java
index 3b32be8dd..d4789032d 100644
--- a/src/test/java/org/traccar/protocol/HuabaoFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/HuabaoFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class HuabaoFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- HuabaoFrameDecoder decoder = new HuabaoFrameDecoder();
+ var decoder = new HuabaoFrameDecoder();
verifyFrame(
binary("283734303139303331313138352c312c3030312c454c4f434b2c332c35323934333929"),
diff --git a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
index 552b5bb2d..07442fbef 100644
--- a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
@@ -9,11 +9,14 @@ public class HuabaoProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- HuabaoProtocolDecoder decoder = new HuabaoProtocolDecoder(null);
+ var decoder = new HuabaoProtocolDecoder(null);
verifyNull(decoder, binary(
"7E01000021013345678906000F002C012F373031313142534A2D4D3742203030303030303001D4C1423838383838B47E"));
+ verifyNotNull(decoder, binary(
+ "7e07040226046110426684002b000601005f0000000000000000000000000000000000000000000021031410530001040000000030011b310101e4020064e50101e60100e7080000000000000000eb2101cc00253510260100000000000000000000000000000000000000000000000000005f00000000004c0001000000000000000000000000000021031410531401040000000030011f310103e4020064e50101e60100e7080000000000000000eb2101cc0025351026012535100f32263d11f931000000000000000000000000000000005f00000000004c0001000000000000000000000000000021031410534001040000000030011f310104e4020064e50101e60100e7080000000000000000eb2101cc002535102601263d11f92d0000000000000000000000000000000000000000005f00000000004c00010000000000000000000000000000210314105350010400000000300118310104e4020064e50101e60100e7080000000000000000eb2101cc002535102601263d11f92e25350f6f2c263d120d2c00000000000000000000005f00000000004c0001000000000000000000000000000021031410540001040000000030011d310105e4020064e50101e60100e7080000000000000000eb2101cc002535102601263d11f93025350f6f2e263d120d2e00000000000000000000003c00000000004c0003015ae3e106c82ab900000010010b21031410540901040000000030011b310105e4020064e50101e60100e7080000000000000000f97e"));
+
verifyAttribute(decoder, binary(
"7e02000033421030000018004c000200000004000201556dcb06c4d41d000c00f100fc210118095853010400000000fe0140ff0c01cc000000002694000055d87a7e"),
Position.KEY_ALARM, Position.ALARM_TAMPERING);
@@ -109,6 +112,9 @@ public class HuabaoProtocolDecoderTest extends ProtocolTest {
verifyPosition(decoder, binary(
"7e020000220014012499170007000000000000400e012af16f02cbd2ba000000000000150101194257010400000077a97e"));
+ verifyNull(decoder, binary(
+ "7e0002000004304832546500b7ca7e"));
+
}
}
diff --git a/src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java
index d0a0427c8..1cb273c2b 100644
--- a/src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class HuabaoProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- HuabaoProtocolEncoder encoder = new HuabaoProtocolEncoder(null);
+ var encoder = new HuabaoProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/HunterProProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HunterProProtocolDecoderTest.java
index f0697f423..81fdae95c 100644
--- a/src/test/java/org/traccar/protocol/HunterProProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/HunterProProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class HunterProProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- HunterProProtocolDecoder decoder = new HunterProProtocolDecoder(null);
+ var decoder = new HunterProProtocolDecoder(null);
verifyPosition(decoder, text(
">0002<$GPRMC,170559.000,A,0328.3045,N,07630.0735,W,0.73,266.16,200816,,,A77, s000078015180\",0MD"));
diff --git a/src/test/java/org/traccar/protocol/IdplProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/IdplProtocolDecoderTest.java
index d211d80ce..a5141c389 100644
--- a/src/test/java/org/traccar/protocol/IdplProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/IdplProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class IdplProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- IdplProtocolDecoder decoder = new IdplProtocolDecoder(null);
+ var decoder = new IdplProtocolDecoder(null);
verifyPosition(decoder, text(
"*ID1,863071011086474,210314,153218,A,1831.4577,N,07351.1433,E,0.79,240.64,9,20,A,1,4.20,0,1,01,1,0,0,A01,R,935D#"),
diff --git a/src/test/java/org/traccar/protocol/IntellitracProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/IntellitracProtocolDecoderTest.java
index eb6480213..ee3a25cbe 100644
--- a/src/test/java/org/traccar/protocol/IntellitracProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/IntellitracProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class IntellitracProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- IntellitracProtocolDecoder decoder = new IntellitracProtocolDecoder(null);
+ var decoder = new IntellitracProtocolDecoder(null);
verifyPosition(decoder, text(
"359316075744331,20201008181424,12.014662,57.826301,0,76,24,10,997,3,0,0.000,4.208,20201008181424,0"));
diff --git a/src/test/java/org/traccar/protocol/IotmProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/IotmProtocolDecoderTest.java
index 9a8c6534c..ca72874ef 100644
--- a/src/test/java/org/traccar/protocol/IotmProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/IotmProtocolDecoderTest.java
@@ -10,7 +10,7 @@ public class IotmProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- IotmProtocolDecoder decoder = new IotmProtocolDecoder(null);
+ var decoder = new IotmProtocolDecoder(null);
verifyNull(decoder, MqttMessageBuilders.connect().clientId(
"123456789012345").build());
diff --git a/src/test/java/org/traccar/protocol/ItsFrameDecoderTest.java b/src/test/java/org/traccar/protocol/ItsFrameDecoderTest.java
index f5c98b1aa..363185b4c 100644
--- a/src/test/java/org/traccar/protocol/ItsFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/ItsFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class ItsFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- ItsFrameDecoder decoder = new ItsFrameDecoder();
+ var decoder = new ItsFrameDecoder();
verifyFrame(
binary("242c2c3836383732383033373731373434312c312e3444335f4149533134305f312e302c56455253494f4e312e302c32382e3633333731372c4e2c37372e3232323730322c45"),
diff --git a/src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java
index 69abfd837..dfd86969a 100644
--- a/src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java
@@ -9,11 +9,17 @@ public class ItsProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- ItsProtocolDecoder decoder = new ItsProtocolDecoder(null);
+ var decoder = new ItsProtocolDecoder(null);
+
+ verifyNull(decoder, text(
+ "$,LGN,MARK,000000000,358980100077446,V0.0.1,AIS140,19.804487,N,75.225876,E,*"));
verifyNull(decoder, text(
"$LGN,,869867037009679,3.2AIH,9.99546000,N,76.35886167,E"));
+ verifyPosition(decoder, text(
+ "$,NRM,MARK,V0.0.1,NR,01,L,358980100040246,000000000,1,10032021,073239,25.932051,N,71.509872,E,0.6,1.40,13,211.2,1.4,0.7,IDEA,0,1,0.1,3.7,0,N,20,404,60,A5F,FD3F,A5F,6F88,29,A5F,5855,18,A5F,6F87,18,A5F,FD41,14,0000,00,0.1,0,000027,0,0,0,4E9C,*"));
+
verifyAttribute(decoder, text(
"$,C,CTPL,4.0.0,NR,01,L,869247045166383,NA00000000,1,12032020,144453,30.452524,N,077.610351,E,1.4,34.8,14,384.19,1.8,0.8,IDEA P,1,1,14.2,4.17,0,C,22,404,82,0FB1,3B26,516B,0FB1,18,3B25,0FB1,15,5169,0FB1,14,3B27,0FB1,13,0000,00,8083,194.9,0B,*,IP=106.67.5.173"),
Position.KEY_ODOMETER, 194900.0);
diff --git a/src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java
index 225edd643..5302709fc 100644
--- a/src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class ItsProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- ItsProtocolEncoder encoder = new ItsProtocolEncoder(null);
+ var encoder = new ItsProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/Ivt401ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Ivt401ProtocolDecoderTest.java
index b0b416891..8a71cb4d5 100644
--- a/src/test/java/org/traccar/protocol/Ivt401ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Ivt401ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Ivt401ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Ivt401ProtocolDecoder decoder = new Ivt401ProtocolDecoder(null);
+ var decoder = new Ivt401ProtocolDecoder(null);
verifyPosition(decoder, text(
"(TLA,356917051007891,190118,090211,+16.986606,+82.242416,0,66,4,13,1,5,000,00,0.0,11.59,8.30,37.77,0.0,1,1.02,0,0,208,0,0,0,0,000000000,0,0,0,0,0,0,0,1,8654604,5,9,114)"));
diff --git a/src/test/java/org/traccar/protocol/JpKorjarProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/JpKorjarProtocolDecoderTest.java
index 8179a2bae..13137006c 100644
--- a/src/test/java/org/traccar/protocol/JpKorjarProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/JpKorjarProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class JpKorjarProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- JpKorjarProtocolDecoder decoder = new JpKorjarProtocolDecoder(null);
+ var decoder = new JpKorjarProtocolDecoder(null);
verifyPosition(decoder, text(
"KORJAR.PL,329587014519383,160910144240,52.247254N,021.013375E,0.00,1,F:4.18V,1 260 01 794B 3517,"));
diff --git a/src/test/java/org/traccar/protocol/Jt600FrameDecoderTest.java b/src/test/java/org/traccar/protocol/Jt600FrameDecoderTest.java
index e695624a9..cd2d5b102 100644
--- a/src/test/java/org/traccar/protocol/Jt600FrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Jt600FrameDecoderTest.java
@@ -8,7 +8,7 @@ public class Jt600FrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Jt600FrameDecoder decoder = new Jt600FrameDecoder();
+ var decoder = new Jt600FrameDecoder();
verifyFrame(
binary("2478905197081711003405101917164812492365028134847d0a1c000002640c0000000020c032759600731000000f0f0f0f0f0f0f0f0f0f000702850274"),
diff --git a/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java
index 4a3c752cd..be384c0f1 100644
--- a/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class Jt600ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Jt600ProtocolDecoder decoder = new Jt600ProtocolDecoder(null);
+ var decoder = new Jt600ProtocolDecoder(null);
verifyPositions(decoder, binary(
"2478807035371711003419081920061851380856003256223b000000000000070000000020c0ff965d54de1800000f0f0f0f0f0f0f0f0f0f02d600ea0a21"));
diff --git a/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java
index c0b399c63..51cefb962 100644
--- a/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java
@@ -11,26 +11,26 @@ public class Jt600ProtocolEncoderTest extends ProtocolTest {
Command command = new Command();
@Test
- public void testEngineStop() throws Exception {
+ public void testEngineStop() {
command.setType(Command.TYPE_ENGINE_STOP);
assertEquals("(S07,0)", encoder.encodeCommand(command));
}
@Test
- public void testEngineResume() throws Exception {
+ public void testEngineResume() {
command.setType(Command.TYPE_ENGINE_RESUME);
assertEquals("(S07,1)", encoder.encodeCommand(command));
}
@Test
- public void testSetTimezone() throws Exception {
+ public void testSetTimezone() {
command.setType(Command.TYPE_SET_TIMEZONE);
command.set(Command.KEY_TIMEZONE, "GMT+4");
assertEquals("(S09,1,240)", encoder.encodeCommand(command));
}
@Test
- public void testReboot() throws Exception {
+ public void testReboot() {
command.setType(Command.TYPE_REBOOT_DEVICE);
assertEquals("(S17)", encoder.encodeCommand(command));
}
diff --git a/src/test/java/org/traccar/protocol/KenjiProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/KenjiProtocolDecoderTest.java
index 5596913c9..53ef1d5ca 100755
--- a/src/test/java/org/traccar/protocol/KenjiProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/KenjiProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class KenjiProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- KenjiProtocolDecoder decoder = new KenjiProtocolDecoder(null);
+ var decoder = new KenjiProtocolDecoder(null);
verifyPosition(decoder, text(
">C800000,M005004,O0000,I0002,D124057,A,S3137.2783,W05830.2978,T000.0,H254.3,Y240116,G06*17"),
diff --git a/src/test/java/org/traccar/protocol/KhdProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/KhdProtocolDecoderTest.java
index b82a277b3..76f4d83d2 100644
--- a/src/test/java/org/traccar/protocol/KhdProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/KhdProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class KhdProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- KhdProtocolDecoder decoder = new KhdProtocolDecoder(null);
+ var decoder = new KhdProtocolDecoder(null);
verifyPosition(decoder, binary(
"292980002825863156210105095059035109370460010100000211ffff000002fc0000001e780b12000034e70d"));
diff --git a/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java
index 390defe6f..287d05fca 100644
--- a/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java
@@ -9,14 +9,17 @@ public class KhdProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- KhdProtocolEncoder encoder = new KhdProtocolEncoder(null);
+ var encoder = new KhdProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
- command.setType(Command.TYPE_ENGINE_STOP);
+ command.setType(Command.TYPE_ENGINE_STOP);
verifyCommand(encoder, command, binary("29293900065981972d5d0d"));
+ command.setType(Command.TYPE_POSITION_SINGLE);
+ verifyCommand(encoder, command, binary("29293000065981972d540d"));
+
}
}
diff --git a/src/test/java/org/traccar/protocol/L100FrameDecoderTest.java b/src/test/java/org/traccar/protocol/L100FrameDecoderTest.java
index 5ffa3d8d1..45c69105b 100644
--- a/src/test/java/org/traccar/protocol/L100FrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/L100FrameDecoderTest.java
@@ -8,7 +8,7 @@ public class L100FrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- L100FrameDecoder decoder = new L100FrameDecoder();
+ var decoder = new L100FrameDecoder();
verifyFrame(
binary("41544c2c4c2c3836383334353033383137313936332c4e2c3230313231382c3039333031362c412c3032352e3036373134342c4e2c3035352e3134343833332c452c3030302e302c4750532c333933392c3432342c30332c30303430352c303038383334"),
diff --git a/src/test/java/org/traccar/protocol/L100ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/L100ProtocolDecoderTest.java
index 04f586f7a..d4bef3885 100644
--- a/src/test/java/org/traccar/protocol/L100ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/L100ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class L100ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- L100ProtocolDecoder decoder = new L100ProtocolDecoder(null);
+ var decoder = new L100ProtocolDecoder(null);
verifyPosition(decoder, text(
"ATL,NP,868004029750174,$GPRMC,062943,A,2533.6719,N,09154.3203,E,0,179,311218,,,*39,#01111011000000,0,0,0,934.82,27.13,4.0,25,405,755,15af,974b,0,0,0,ATL"));
diff --git a/src/test/java/org/traccar/protocol/LaipacProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/LaipacProtocolDecoderTest.java
index 5b66ed865..1d5819603 100644
--- a/src/test/java/org/traccar/protocol/LaipacProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/LaipacProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class LaipacProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- LaipacProtocolDecoder decoder = new LaipacProtocolDecoder(null);
+ var decoder = new LaipacProtocolDecoder(null);
verifyPosition(decoder, text(
"$AVRMC,80006405,212645,r,3013.9938,N,08133.3998,W,0.00,0.00,010317,a,4076,0,1,0,0,53170583,310260*78"));
diff --git a/src/test/java/org/traccar/protocol/LeafSpyProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/LeafSpyProtocolDecoderTest.java
index 7fe405ea8..aed82eb41 100644
--- a/src/test/java/org/traccar/protocol/LeafSpyProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/LeafSpyProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class LeafSpyProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- LeafSpyProtocolDecoder decoder = new LeafSpyProtocolDecoder(null);
+ var decoder = new LeafSpyProtocolDecoder(null);
verifyNull(decoder, request(
"/?Lat=60.0&Long=30.0"));
diff --git a/src/test/java/org/traccar/protocol/M2cProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/M2cProtocolDecoderTest.java
index 65c9cc43b..ede056f96 100644
--- a/src/test/java/org/traccar/protocol/M2cProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/M2cProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class M2cProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- M2cProtocolDecoder decoder = new M2cProtocolDecoder(null);
+ var decoder = new M2cProtocolDecoder(null);
verifyPositions(decoder, text(
"[#M2C,2020,P1.B1.H3.F9.R1,102,864547034433966,1,L,0,20,171221,062016,28.647552,77.192841,0,0,0.0,0,0,64,255,11983,0,0,0,0.0,0,0,0,404,4,1F6,4D77,31,0*7524\r\n",
diff --git a/src/test/java/org/traccar/protocol/M2mProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/M2mProtocolDecoderTest.java
index 1c45c976b..f318dcfef 100644
--- a/src/test/java/org/traccar/protocol/M2mProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/M2mProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class M2mProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- M2mProtocolDecoder decoder = new M2mProtocolDecoder(null);
+ var decoder = new M2mProtocolDecoder(null);
verifyNull(decoder, binary(
"235A3C2A2624215C287D70212A21254C7C6421220B0B0B"));
diff --git a/src/test/java/org/traccar/protocol/MaestroProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MaestroProtocolDecoderTest.java
index c7a7624c0..19f9b9da7 100644
--- a/src/test/java/org/traccar/protocol/MaestroProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/MaestroProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class MaestroProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- MaestroProtocolDecoder decoder = new MaestroProtocolDecoder(null);
+ var decoder = new MaestroProtocolDecoder(null);
verifyPosition(decoder, text(
"@353893040202807,705,UPV-02,1,13.2,17,0,0,16/09/11,11:42:49,0.352705,32.647918,1210.5,0.000000,35.33,11,0.8,0.000,0!\0"));
diff --git a/src/test/java/org/traccar/protocol/ManPowerProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/ManPowerProtocolDecoderTest.java
index 1d6f80ae3..74f3ff1ec 100644
--- a/src/test/java/org/traccar/protocol/ManPowerProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/ManPowerProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class ManPowerProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- ManPowerProtocolDecoder decoder = new ManPowerProtocolDecoder(null);
+ var decoder = new ManPowerProtocolDecoder(null);
verifyPosition(decoder, text(
"simei:352581250259539,,,tracker,51,24,1.73,130426023608,A,3201.5462,N,03452.2975,E,0.01,28B9,1DED,425,01,1x0x0*0x1*60x+2,en-us,"),
diff --git a/src/test/java/org/traccar/protocol/Mavlink2ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Mavlink2ProtocolDecoderTest.java
new file mode 100644
index 000000000..ccddb6a11
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/Mavlink2ProtocolDecoderTest.java
@@ -0,0 +1,21 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class Mavlink2ProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ var decoder = new Mavlink2ProtocolDecoder(null);
+
+ verifyAttributes(decoder, binary(
+ "fd1c0000ce01012100004da91f004005d323b89aa30ea6ed070099fb0100f7fffdff0000942c4a88"));
+
+ verifyAttributes(decoder, binary(
+ "fd1c0000e7010121000047aa1f004005d323b89aa30e9ced070093fb0100f8fffdff0000952c70ff"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/MegastekFrameDecoderTest.java b/src/test/java/org/traccar/protocol/MegastekFrameDecoderTest.java
index 68606a98a..f1650b1b2 100644
--- a/src/test/java/org/traccar/protocol/MegastekFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/MegastekFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class MegastekFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- MegastekFrameDecoder decoder = new MegastekFrameDecoder();
+ var decoder = new MegastekFrameDecoder();
verifyFrame(
binary("30313337244d47563030322c3335343535303035303239323636392c4756543930302c522c3134313231352c3033313830342c412c2c532c2c452c30302c30332c30302c332e36372c302e3030302c302e30302c3131372e312c302e302c3531302c31302c2c2c2c303030302c303030302c32322c31322c302c202c202c2c312d312c39382c5057204f4e3b21"),
diff --git a/src/test/java/org/traccar/protocol/MegastekProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MegastekProtocolDecoderTest.java
index 1bf3dbd25..3747d9200 100644
--- a/src/test/java/org/traccar/protocol/MegastekProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/MegastekProtocolDecoderTest.java
@@ -1,6 +1,7 @@
package org.traccar.protocol;
import org.junit.Test;
+import org.traccar.model.Position;
import org.traccar.ProtocolTest;
public class MegastekProtocolDecoderTest extends ProtocolTest {
@@ -8,7 +9,7 @@ public class MegastekProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- MegastekProtocolDecoder decoder = new MegastekProtocolDecoder(null);
+ var decoder = new MegastekProtocolDecoder(null);
verifyPosition(decoder, text(
"0132$MGV002,869152024261561,,S,310818,133945,V,3814.35442,N,02144.50662,E,00,00,00,99.9,,,44.2,,202,10,,,13,0,0,0,0,90,,,,11,100,Timer;!"));
@@ -28,6 +29,10 @@ public class MegastekProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, text(
"0140$MGV002,354550056642321,GVT900-3,S,300917,071731,V,,,,,00,00,00,99.9,0.000,0.00,,0.0,457,01,0741,00CD,,0000,0000,20,10,0, , ,,1-1,94,PW ON;!"));
+ verifyAttribute(decoder, text(
+ "$MGV002,869152024446923,,S,290816,200627,V,5056.21059,N,00439.25034,E,00,00,00,99.9,,,-25.1,,206,01,0BBB,4418,28,,,,,,,,,01,093,PW ON;"),
+ Position.KEY_ALARM, Position.ALARM_POWER_ON);
+
verifyPosition(decoder, text(
"$MGV002,869152024446923,,S,290816,200627,V,5056.21059,N,00439.25034,E,00,00,00,99.9,,,-25.1,,206,01,0BBB,4418,28,,,,,,,,,01,093,Timer;"));
@@ -50,9 +55,20 @@ public class MegastekProtocolDecoderTest extends ProtocolTest {
"0125$MGV002,860719020193193,DeviceName,R,240214,104742,A,2238.20471,N,11401.97967,E,00,03,00,1.20,0.462,356.23,137.9,1.5,460,07,262C,0F54,25,0000,0000,0,0,0,28.5,28.3,,,100,Timer;"));
verifyPosition(decoder, text(
+ "0339$MGV002,860719020193193,DeviceName,R,240214,104742,A,2238.20471,N,11401.97967,E,00,03,00,1.20,0.462,356.23,137.9,1.5,460,07,262C,0F54,25,0000,0000,0,0,0,28.5,28.3,,10,100,Timer,18339df945d0:53|108c0fb0a2f1:57|e46f133d6f5c:59|108ccf109f21:59|8adc963d752a:82|04c5a48cc6c0:82|9adc963d752a:83|8800b0b00004:85|90671c80e2fc:85|80c5e68c8d36:86,;!"));
+
+ verifyPosition(decoder, text(
"$MGV002,860719020193193,DeviceName,R,240214,104742,A,2238.20471,N,11401.97967,E,00,03,00,1.20,0.462,356.23,137.9,1.5,460,07,262C,0F54,25,0000,0000,0,0,0,28.5,28.3,,,100,Timer;!"),
position("2014-02-24 10:47:42.000", true, 22.63675, 114.03299));
+ verifyAttribute(decoder, text(
+ "$MGV002,860719020193193,DeviceName,R,240214,104742,A,2238.20471,N,11401.97967,E,00,03,00,1.20,0.462,356.23,137.9,1.5,460,07,262C,0F54,25,0000,0000,0,0,0,28.5,28.3,,10,100,Timer;!"),
+ Position.KEY_CHARGE, true);
+
+ verifyAttribute(decoder, text(
+ "$MGV002,860719020193193,DeviceName,R,240214,104742,A,2238.20471,N,11401.97967,E,00,03,00,1.20,0.462,356.23,137.9,1.5,460,07,262C,0F54,25,0000,0000,0,0,0,28.5,28.3,,02,100,Timer;!"),
+ "belt", 2);
+
verifyPosition(decoder, text(
"STX2010101801 j$GPRMC,101053.000,A,2232.7607,N,11404.7669,E,0.00,,231110,,,A*7F,460,00,2795,0E6A,14,94,1000,0000,91,Timer;1D"));
diff --git a/src/test/java/org/traccar/protocol/MeiligaoFrameDecoderTest.java b/src/test/java/org/traccar/protocol/MeiligaoFrameDecoderTest.java
index 2d09c626b..c0e5f1e97 100644
--- a/src/test/java/org/traccar/protocol/MeiligaoFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/MeiligaoFrameDecoderTest.java
@@ -11,7 +11,7 @@ public class MeiligaoFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- MeiligaoFrameDecoder decoder = new MeiligaoFrameDecoder();
+ var decoder = new MeiligaoFrameDecoder();
assertNull(
decoder.decode(null, null, binary("00")));
diff --git a/src/test/java/org/traccar/protocol/MeiligaoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
index c8851c747..087701be4 100644
--- a/src/test/java/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class MeiligaoProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- MeiligaoProtocolDecoder decoder = new MeiligaoProtocolDecoder(null);
+ var decoder = new MeiligaoProtocolDecoder(null);
verifyAttribute(decoder, binary(
"2424008f142180340967ff99553033333233302e3030302c412c313531362e383039392c4e2c31303435322e383835352c452c302e30302c33332c3038313232302c2c2a33367c302e387c3132337c323130307c303030302c303030302c303230452c303241417c30323038303030353038394530304531434638347c31437c31373243353832437c3042a8060d0a"),
diff --git a/src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java
index d7aa25be8..9c50d972a 100644
--- a/src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java
@@ -9,7 +9,7 @@ public class MeiligaoProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- MeiligaoProtocolEncoder encoder = new MeiligaoProtocolEncoder(null);
+ var encoder = new MeiligaoProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/MeitrackFrameDecoderTest.java b/src/test/java/org/traccar/protocol/MeitrackFrameDecoderTest.java
index 53749816e..38d0f2f92 100644
--- a/src/test/java/org/traccar/protocol/MeitrackFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/MeitrackFrameDecoderTest.java
@@ -10,7 +10,7 @@ public class MeitrackFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- MeitrackFrameDecoder decoder = new MeitrackFrameDecoder();
+ var decoder = new MeitrackFrameDecoder();
assertEquals(
binary("24244e3132372c3836333037313031333830333036362c4141412c33352c2d312e3330323638302c33362e3835323133352c3135303430393231313032362c412c392c302c302e312c302c352c313635332c343039362c33323634382c3633397c30327c313030347c3930432c303030302c307c307c307c3346467c3330302c2a37430d0a"),
diff --git a/src/test/java/org/traccar/protocol/MeitrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MeitrackProtocolDecoderTest.java
index ea7ea19a2..3f0e5b2d3 100644
--- a/src/test/java/org/traccar/protocol/MeitrackProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/MeitrackProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class MeitrackProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- MeitrackProtocolDecoder decoder = new MeitrackProtocolDecoder(null);
+ var decoder = new MeitrackProtocolDecoder(null);
verifyPositions(decoder, binary(
"2424413132332c3836313538353034333230303836322c4343452c010000000100590015000305010609071b0b081c000939010a07000b1700199e011a9505921a0099c4089c5500c93e00405a000602a8b114000343f12e0604d18806270c654a2e000da20537009bb8963904010e0c0d020300aa7a0af69e0100002a35340d0a"));
diff --git a/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java
index 2b5054cee..64fc7e17b 100644
--- a/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class MeitrackProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- MeitrackProtocolEncoder encoder = new MeitrackProtocolEncoder(null);
+ var encoder = new MeitrackProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java
index 22f0974ec..5c9e74a2d 100644
--- a/src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java
@@ -2,16 +2,22 @@ package org.traccar.protocol;
import org.junit.Test;
import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
public class MictrackProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeStandard() throws Exception {
- MictrackProtocolDecoder decoder = new MictrackProtocolDecoder(null);
+ var decoder = new MictrackProtocolDecoder(null);
- verifyNull(decoder, text(
- "mode=Success!"));
+ verifyAttribute(decoder, text(
+ "867035041390699 netlock=Success!"),
+ Position.KEY_RESULT, "netlock=Success");
+
+ verifyAttribute(decoder, text(
+ "mode=Success!"),
+ Position.KEY_RESULT, "mode=Success");
verifyPosition(decoder, text(
"MT;6;866425031361423;R0;10+190109091803+22.63827+114.02922+2.14+69+2+3744+113"),
@@ -39,7 +45,7 @@ public class MictrackProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeLowAltitude() throws Exception {
- MictrackProtocolDecoder decoder = new MictrackProtocolDecoder(null);
+ var decoder = new MictrackProtocolDecoder(null);
verifyPositions(decoder, text(
"861108032038761$062232.00,A,2238.2832,N,11401.7381,E,0.01,309.62,95.0,131117"));
diff --git a/src/test/java/org/traccar/protocol/MilesmateProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MilesmateProtocolDecoderTest.java
index be0209975..69fd82886 100644
--- a/src/test/java/org/traccar/protocol/MilesmateProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/MilesmateProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class MilesmateProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- MilesmateProtocolDecoder decoder = new MilesmateProtocolDecoder(null);
+ var decoder = new MilesmateProtocolDecoder(null);
verifyPosition(decoder, text(
"ApiString={A:861359037373030,B:09.8,C:00.0,D:083506,E:2838.5529N,F:07717.8049E,G:000.00,H:170918,I:G,J:00004100,K:0000000A,L:1234,M:126.86}"));
diff --git a/src/test/java/org/traccar/protocol/MiniFinderProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MiniFinderProtocolDecoderTest.java
index afa930e5b..2d7e4e597 100644
--- a/src/test/java/org/traccar/protocol/MiniFinderProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/MiniFinderProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class MiniFinderProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- MiniFinderProtocolDecoder decoder = new MiniFinderProtocolDecoder(null);
+ var decoder = new MiniFinderProtocolDecoder(null);
verifyNull(decoder, text(
"!1,867273023933661,V07S.5701.1621,100"));
diff --git a/src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java
index 5de1346a2..652490b72 100644
--- a/src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class MiniFinderProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- MiniFinderProtocolEncoder encoder = new MiniFinderProtocolEncoder(null);
+ var encoder = new MiniFinderProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java
index 18985a429..407d065f1 100644
--- a/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Minifinder2ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Minifinder2ProtocolDecoder decoder = new Minifinder2ProtocolDecoder(null);
+ var decoder = new Minifinder2ProtocolDecoder(null);
verifyNull(decoder, binary(
"ab10150076f1320003100133353534363530373130323933303602105a"));
diff --git a/src/test/java/org/traccar/protocol/MobilogixProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MobilogixProtocolDecoderTest.java
index 875a79b42..dc60edb15 100644
--- a/src/test/java/org/traccar/protocol/MobilogixProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/MobilogixProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class MobilogixProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- MobilogixProtocolDecoder decoder = new MobilogixProtocolDecoder(null);
+ var decoder = new MobilogixProtocolDecoder(null);
verifyNull(decoder, text(
"[2020-12-01 14:00:22,T1,1,V1.1.1,201951132031,,,12345678,724108005415815,359366080211420"));
diff --git a/src/test/java/org/traccar/protocol/MoovboxProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MoovboxProtocolDecoderTest.java
index 9b3f6823a..af19b8222 100644
--- a/src/test/java/org/traccar/protocol/MoovboxProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/MoovboxProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class MoovboxProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- MoovboxProtocolDecoder decoder = new MoovboxProtocolDecoder(null);
+ var decoder = new MoovboxProtocolDecoder(null);
verifyPositions(decoder, request(HttpMethod.POST, "/",
buffer("<gps id=\"911\">\n<coordinates><coordinate>\n<fix>3</fix>\n<time>1597580050</time>\n<latitude>100.726257</latitude>\n<longitude>13.821351</longitude>\n<altitude>9.500000</altitude>\n<climb>0.000000</climb>\n<speed>0.064000</speed>\n<separation>-27.300000</separation>\n<track>0.000000</track>\n<satellites>9</satellites>\n</coordinate></coordinates>\n</gps>")));
diff --git a/src/test/java/org/traccar/protocol/MotorProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MotorProtocolDecoderTest.java
index 60351d497..bd4a97ef4 100644
--- a/src/test/java/org/traccar/protocol/MotorProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/MotorProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class MotorProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- MotorProtocolDecoder decoder = new MotorProtocolDecoder(null);
+ var decoder = new MotorProtocolDecoder(null);
verifyPosition(decoder, text(
"341200007E7E00007E7E020301803955352401161766210162090501010108191625132655351234567F12345F"));
diff --git a/src/test/java/org/traccar/protocol/MtxProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MtxProtocolDecoderTest.java
index c4f15d907..28b5d3be0 100644
--- a/src/test/java/org/traccar/protocol/MtxProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/MtxProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class MtxProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- MtxProtocolDecoder decoder = new MtxProtocolDecoder(null);
+ var decoder = new MtxProtocolDecoder(null);
verifyPosition(decoder, text(
"#MTX,353815011138124,20101226,195550,41.6296399,002.3611174,000,035,000000.00,X,X,1111,000,0,0"));
diff --git a/src/test/java/org/traccar/protocol/MxtProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MxtProtocolDecoderTest.java
index 834a35011..71ad22a96 100644
--- a/src/test/java/org/traccar/protocol/MxtProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/MxtProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class MxtProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- MxtProtocolDecoder decoder = new MxtProtocolDecoder(null);
+ var decoder = new MxtProtocolDecoder(null);
verifyPosition(decoder, binary(
"01a631144c7e0008643ad2f456fb2d49747cfe4cbe0ffd002008800000001021000fd43d3f1403000000ff300000f42760001031102445a81fda04"));
diff --git a/src/test/java/org/traccar/protocol/NavigilProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/NavigilProtocolDecoderTest.java
index 2db4afbf2..60d88999e 100644
--- a/src/test/java/org/traccar/protocol/NavigilProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/NavigilProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class NavigilProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- NavigilProtocolDecoder decoder = new NavigilProtocolDecoder(null);
+ var decoder = new NavigilProtocolDecoder(null);
verifyNull(decoder, binary(
"01004300040020000000f60203080200e7cd0f510c0000003b00000000000000"));
diff --git a/src/test/java/org/traccar/protocol/NavisProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/NavisProtocolDecoderTest.java
index 33a6bab24..b1282cac7 100644
--- a/src/test/java/org/traccar/protocol/NavisProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/NavisProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class NavisProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeNtcb() throws Exception {
- NavisProtocolDecoder decoder = new NavisProtocolDecoder(null);
+ var decoder = new NavisProtocolDecoder(null);
verifyNull(decoder, binary(
"404E5443010000007B000000130044342A3E533A383631373835303035323035303739"));
@@ -41,7 +41,7 @@ public class NavisProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeFlex10() throws Exception {
- NavisProtocolDecoder decoder = new NavisProtocolDecoder(null);
+ var decoder = new NavisProtocolDecoder(null);
verifyNull(decoder, binary(
"404e544301000000c9b5f602130046c52a3e533a383639363936303439373232383235"));
@@ -60,7 +60,7 @@ public class NavisProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeFlex20() throws Exception {
- NavisProtocolDecoder decoder = new NavisProtocolDecoder(null);
+ var decoder = new NavisProtocolDecoder(null);
verifyNull(decoder, binary(
"404e544301000000a9eef602130043fb2a3e533a383639363936303439373337333835"));
diff --git a/src/test/java/org/traccar/protocol/NavisetFrameDecoderTest.java b/src/test/java/org/traccar/protocol/NavisetFrameDecoderTest.java
index 450f77144..e73c173b7 100644
--- a/src/test/java/org/traccar/protocol/NavisetFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/NavisetFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class NavisetFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- NavisetFrameDecoder decoder = new NavisetFrameDecoder();
+ var decoder = new NavisetFrameDecoder();
verifyFrame(
binary("1310e4073836383230343030353935383436362a060716"),
diff --git a/src/test/java/org/traccar/protocol/NavisetProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/NavisetProtocolDecoderTest.java
index 09ea10f1f..df4e57e8d 100644
--- a/src/test/java/org/traccar/protocol/NavisetProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/NavisetProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class NavisetProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- NavisetProtocolDecoder decoder = new NavisetProtocolDecoder(null);
+ var decoder = new NavisetProtocolDecoder(null);
verifyNull(decoder, binary(
"1310e4073836383230343030353935383436362a060716"));
diff --git a/src/test/java/org/traccar/protocol/NavtelecomProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/NavtelecomProtocolDecoderTest.java
new file mode 100644
index 000000000..b8797daf3
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/NavtelecomProtocolDecoderTest.java
@@ -0,0 +1,18 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class NavtelecomProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ var decoder = new NavtelecomProtocolDecoder(null);
+
+ verifyNull(decoder, binary(
+ "404e5443010000000000000013004e452a3e533a383636373935303331343130363839"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/NeosProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/NeosProtocolDecoderTest.java
index a8db30476..b77bdf658 100644
--- a/src/test/java/org/traccar/protocol/NeosProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/NeosProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class NeosProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- NeosProtocolDecoder decoder = new NeosProtocolDecoder(null);
+ var decoder = new NeosProtocolDecoder(null);
verifyPosition(decoder, text(
">12345678,1,1,070201,144111,W05829.2613,S3435.2313,,00,034,25,00,126-000,0,3,11111111*2d!\r\n"));
diff --git a/src/test/java/org/traccar/protocol/NetProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/NetProtocolDecoderTest.java
index 678e5c6c3..9ab4aea4f 100644
--- a/src/test/java/org/traccar/protocol/NetProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/NetProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class NetProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- NetProtocolDecoder decoder = new NetProtocolDecoder(null);
+ var decoder = new NetProtocolDecoder(null);
verifyPosition(decoder, text(
"@L03686090604017761712271020161807037078881037233751000000010F850036980A4000"));
diff --git a/src/test/java/org/traccar/protocol/NiotProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/NiotProtocolDecoderTest.java
index e436fb4ed..7707094a5 100644
--- a/src/test/java/org/traccar/protocol/NiotProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/NiotProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class NiotProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- NiotProtocolDecoder decoder = new NiotProtocolDecoder(null);
+ var decoder = new NiotProtocolDecoder(null);
verifyPosition(decoder, binary(
"585880004c08675430347318522007161451458024b28003f566ee00000328f8000748217ffc500729007a280000000000160001383932353430323130363431363738373136323100050002004e00570d"),
diff --git a/src/test/java/org/traccar/protocol/NoranProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/NoranProtocolDecoderTest.java
index 7c02402b1..a30847160 100644
--- a/src/test/java/org/traccar/protocol/NoranProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/NoranProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class NoranProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- NoranProtocolDecoder decoder = new NoranProtocolDecoder(null);
+ var decoder = new NoranProtocolDecoder(null);
verifyNull(decoder, binary(
"0d0a2a4b57000d000080010d0a"));
diff --git a/src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java
index 4991f1371..76486d024 100644
--- a/src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java
@@ -9,7 +9,7 @@ public class NoranProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- NoranProtocolEncoder encoder = new NoranProtocolEncoder(null);
+ var encoder = new NoranProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/NvsFrameDecoderTest.java b/src/test/java/org/traccar/protocol/NvsFrameDecoderTest.java
index 8a00207eb..76c7cafb9 100644
--- a/src/test/java/org/traccar/protocol/NvsFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/NvsFrameDecoderTest.java
@@ -10,7 +10,7 @@ public class NvsFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- NvsFrameDecoder decoder = new NvsFrameDecoder();
+ var decoder = new NvsFrameDecoder();
assertEquals(
binary("0012333537303430303630303137383234312e38"),
diff --git a/src/test/java/org/traccar/protocol/NvsProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/NvsProtocolDecoderTest.java
index 9a516e733..ed4008d47 100644
--- a/src/test/java/org/traccar/protocol/NvsProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/NvsProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class NvsProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- NvsProtocolDecoder decoder = new NvsProtocolDecoder(null);
+ var decoder = new NvsProtocolDecoder(null);
verifyNull(decoder, binary(
"0012333537303430303630303137383234312e38"));
diff --git a/src/test/java/org/traccar/protocol/NyitechProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/NyitechProtocolDecoderTest.java
index 4cafd7612..81de06f89 100644
--- a/src/test/java/org/traccar/protocol/NyitechProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/NyitechProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class NyitechProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- NyitechProtocolDecoder decoder = new NyitechProtocolDecoder(null);
+ var decoder = new NyitechProtocolDecoder(null);
verifyPosition(decoder, binary(
"4040690030313436383230303238373201201c0c12031a308080801c0c12031a3007d67e7e08aceb841002000000ae08000000000000000000000000001e002900f0ffdd002700f2ffe0002700f2ffe1002400f0ffdf002400f3ffe3008a00ffff01010000a9c70d0a"));
diff --git a/src/test/java/org/traccar/protocol/ObdDongleProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/ObdDongleProtocolDecoderTest.java
index 4c33d1766..08ebf9995 100644
--- a/src/test/java/org/traccar/protocol/ObdDongleProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/ObdDongleProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class ObdDongleProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- ObdDongleProtocolDecoder decoder = new ObdDongleProtocolDecoder(null);
+ var decoder = new ObdDongleProtocolDecoder(null);
verifyNull(decoder, binary(
"55550003383634383637303232353131303135010009010011023402010201ABAAAA"));
diff --git a/src/test/java/org/traccar/protocol/OigoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/OigoProtocolDecoderTest.java
index c79978f88..023158f21 100644
--- a/src/test/java/org/traccar/protocol/OigoProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/OigoProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class OigoProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- OigoProtocolDecoder decoder = new OigoProtocolDecoder(null);
+ var decoder = new OigoProtocolDecoder(null);
verifyPosition(decoder, binary(
"7e002e000000146310002523830400001bfb000369150f310c0591594d062ac0c0141508011303cd63101604fd00000000"));
diff --git a/src/test/java/org/traccar/protocol/OkoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/OkoProtocolDecoderTest.java
index 19fb25135..0df537642 100644
--- a/src/test/java/org/traccar/protocol/OkoProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/OkoProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class OkoProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- OkoProtocolDecoder decoder = new OkoProtocolDecoder(null);
+ var decoder = new OkoProtocolDecoder(null);
verifyPosition(decoder, text(
"{861001001012919,090745,A,4944.302,N,02353.366,E,0.0,225,251120,7,0.27,F9,11.3,1}"));
diff --git a/src/test/java/org/traccar/protocol/OmnicommFrameDecoderTest.java b/src/test/java/org/traccar/protocol/OmnicommFrameDecoderTest.java
index ae21de107..c8bbf399a 100644
--- a/src/test/java/org/traccar/protocol/OmnicommFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/OmnicommFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class OmnicommFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- OmnicommFrameDecoder decoder = new OmnicommFrameDecoder();
+ var decoder = new OmnicommFrameDecoder();
verifyFrame(
binary("c08600004566"),
diff --git a/src/test/java/org/traccar/protocol/OmnicommProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/OmnicommProtocolDecoderTest.java
index 89cb7fadf..76b476fc2 100644
--- a/src/test/java/org/traccar/protocol/OmnicommProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/OmnicommProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class OmnicommProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- OmnicommProtocolDecoder decoder = new OmnicommProtocolDecoder(null);
+ var decoder = new OmnicommProtocolDecoder(null);
verifyNull(decoder, binary(
"c080080061a61915340100001dec"));
diff --git a/src/test/java/org/traccar/protocol/OpenGtsProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/OpenGtsProtocolDecoderTest.java
index a04cf4e72..9fbd79cbf 100644
--- a/src/test/java/org/traccar/protocol/OpenGtsProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/OpenGtsProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class OpenGtsProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- OpenGtsProtocolDecoder decoder = new OpenGtsProtocolDecoder(null);
+ var decoder = new OpenGtsProtocolDecoder(null);
verifyPosition(decoder, request(
"/?id=999000000000003&gprmc=$GPRMC,082202.0,A,5006.747329,N,01416.512315,E,0.0,,131018,1.2,E,A*2E"));
diff --git a/src/test/java/org/traccar/protocol/OrionProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/OrionProtocolDecoderTest.java
index bb5f1f135..7368a9d4e 100644
--- a/src/test/java/org/traccar/protocol/OrionProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/OrionProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class OrionProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- OrionProtocolDecoder decoder = new OrionProtocolDecoder(null);
+ var decoder = new OrionProtocolDecoder(null);
verifyPositions(decoder, binary(
"5057000137bf6236235a0331b5c6e402a3b5ecff5102980003000e0c1d172936080e0c1d172936b03b01000882050000008e080000000000008c0300940500000084030085030003067600900113150000000000000000000000000000000000000004a4c8"));
diff --git a/src/test/java/org/traccar/protocol/OsmAndProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/OsmAndProtocolDecoderTest.java
index 3c38bd831..a87b45ec4 100644
--- a/src/test/java/org/traccar/protocol/OsmAndProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/OsmAndProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class OsmAndProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- OsmAndProtocolDecoder decoder = new OsmAndProtocolDecoder(null);
+ var decoder = new OsmAndProtocolDecoder(null);
verifyNotNull(decoder, request(
"/?id=123456&timestamp=1377177267&cell=257,02,16,2224&cell=257,02,16,2223,-90&wifi=00-14-22-01-23-45,-80&wifi=00-1C-B3-09-85-15,-70"));
diff --git a/src/test/java/org/traccar/protocol/OutsafeProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/OutsafeProtocolDecoderTest.java
index 20b6617ef..1194f7970 100644
--- a/src/test/java/org/traccar/protocol/OutsafeProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/OutsafeProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class OutsafeProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- OutsafeProtocolDecoder decoder = new OutsafeProtocolDecoder(null);
+ var decoder = new OutsafeProtocolDecoder(null);
verifyPosition(decoder, request(HttpMethod.POST, "/",
buffer("{\"device\":\"865303040103725\",\"owner\":\"\",\"data\":{\"cmd\":\"\",\"ms1\":-1,\"ms2\":-1,\"ms3\":0,\"ms4\":0,\"observation\":\"\",\"content\":null},\"time\":1589277568,\"origin\":\"mqgatte\",\"latitude\":19.346855,\"longitude\":-99.29587,\"altitude\":2757,\"heading\":0,\"rssi\":0}")));
diff --git a/src/test/java/org/traccar/protocol/OwnTracksProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/OwnTracksProtocolDecoderTest.java
index 248920e21..55b48fb05 100644
--- a/src/test/java/org/traccar/protocol/OwnTracksProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/OwnTracksProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class OwnTracksProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- OwnTracksProtocolDecoder decoder = new OwnTracksProtocolDecoder(null);
+ var decoder = new OwnTracksProtocolDecoder(null);
verifyPosition(decoder, request(HttpMethod.POST, "/",
buffer("{\"_type\":\"location\",\"acc\":15,\"alt\":440,\"batt\":46,\"conn\":\"w\",\"lat\":46.0681247,\"lon\":11.1512805,\"t\":\"u\",\"tid\":\"5t\",\"tst\":1551874878,\"vac\":2,\"vel\":0}")));
diff --git a/src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java
index b3293dacf..e170bc98e 100644
--- a/src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java
@@ -22,7 +22,7 @@ public class PacificTrackProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- PacificTrackProtocolDecoder decoder = new PacificTrackProtocolDecoder(null);
+ var decoder = new PacificTrackProtocolDecoder(null);
verifyAttributes(decoder, binary(
"fb80c88181b00280883592151012618820b18b1f123340f004c90001300301928a0080008100c00000000091971c0b0417020d074df0ec03c242550b20081d0c009a0601a1855571a30000"));
diff --git a/src/test/java/org/traccar/protocol/PathAwayProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/PathAwayProtocolDecoderTest.java
index 4b9739242..e4c9bf449 100644
--- a/src/test/java/org/traccar/protocol/PathAwayProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/PathAwayProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class PathAwayProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- PathAwayProtocolDecoder decoder = new PathAwayProtocolDecoder(null);
+ var decoder = new PathAwayProtocolDecoder(null);
verifyPosition(decoder, request(
"?UserName=name&Password=pass&LOC=$PWS,1,\"Roger\",,,100107,122846,45.317270,-79.642219,45.00,42,1,\"Comment\",0*58"));
diff --git a/src/test/java/org/traccar/protocol/PiligrimProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/PiligrimProtocolDecoderTest.java
index 03d0dd7b9..b39060420 100644
--- a/src/test/java/org/traccar/protocol/PiligrimProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/PiligrimProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class PiligrimProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- PiligrimProtocolDecoder decoder = new PiligrimProtocolDecoder(null);
+ var decoder = new PiligrimProtocolDecoder(null);
verifyPositions(decoder, request(HttpMethod.POST,
"/bingps?imei=868204005544720&csq=18&vout=00&vin=4050&dataid=00000000",
diff --git a/src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java
index 0fe3a3a01..2d134d967 100644
--- a/src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java
@@ -9,7 +9,10 @@ public class PluginProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- PluginProtocolDecoder decoder = new PluginProtocolDecoder(null);
+ var decoder = new PluginProtocolDecoder(null);
+
+ verifyPosition(decoder, text(
+ "$$STATUS,000000900005,20210521111252,27.171105,-25.600934,62.0,323,0,-1,2,0.000,2147489155,0.00,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0"));
verifyAttribute(decoder, text(
"$$STATUS,60925,20190829123115,28.254151,-25.860605,0.0,0,0,-1,2,0.000,13699,0.00,0,0,28.4,23.4,0,0,0,0,0,0,0,0,0"),
diff --git a/src/test/java/org/traccar/protocol/PolteProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/PolteProtocolDecoderTest.java
index 61ee6771f..592267b9e 100644
--- a/src/test/java/org/traccar/protocol/PolteProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/PolteProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class PolteProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- PolteProtocolDecoder decoder = new PolteProtocolDecoder(null);
+ var decoder = new PolteProtocolDecoder(null);
verifyPosition(decoder, request(HttpMethod.POST, "/",
buffer("{\"_id\":\"5f75cf7b02c5023bfc0beaf7\",\"location\":{\"LocationMetrics\":{\"EnvironmentDensity\":1,\"LocationType\":2,\"carrierInfo\":{\"aux\":{\"PLMN\":\"310410\",\"country\":\"United States\",\"name\":\"ATT Wireless Inc\"},\"crs\":{\"PLMN\":\"310410\",\"country\":\"United States\",\"name\":\"ATT Wireless Inc\"}},\"hdop\":1850000,\"leversion\":\"2.2.18-20200729T140651\",\"towercount\":1},\"altitude\":0.0011297669261693954,\"confidence\":783.7972188868215,\"detected_at\":1601556342,\"latitude\":29.77368956725161,\"longitude\":-98.26530342694024,\"towerDB\":\"default\",\"ueToken\":\"ALT12503DE04336CB2E3A4A113FCDE05DF05A6F\",\"uid\":\"WZuDMv5Je\"},\"report\":{\"battery\":{\"count\":555,\"level\":100,\"voltage\":3.52},\"event\":3,\"time\":\"2020-10-01T12:45:48.207Z\"},\"time\":\"2020-10-01T12:45:42Z\",\"ueToken\":\"ALT12503DE04336CB2E3A4A113FCDE05DF05A6F\",\"uid\":\"WZuDMv5Je\"}")));
diff --git a/src/test/java/org/traccar/protocol/PortmanProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/PortmanProtocolDecoderTest.java
index 0b5dcf0cf..5cc98d7e4 100644
--- a/src/test/java/org/traccar/protocol/PortmanProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/PortmanProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class PortmanProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- PortmanProtocolDecoder decoder = new PortmanProtocolDecoder(null);
+ var decoder = new PortmanProtocolDecoder(null);
verifyPosition(decoder, text(
"$PTMLA,355854050074633,A,200612153351,N2543.0681W10009.2974,0,190,NA,C9830000,NA,108,8,2.66,16,GNA"));
diff --git a/src/test/java/org/traccar/protocol/PortmanProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/PortmanProtocolEncoderTest.java
index 281229cf4..61f6c4a4e 100644
--- a/src/test/java/org/traccar/protocol/PortmanProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/PortmanProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class PortmanProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeEngineStop() {
- PortmanProtocolEncoder encoder = new PortmanProtocolEncoder(null);
+ var encoder = new PortmanProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -24,7 +24,7 @@ public class PortmanProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeEngineResume() {
- PortmanProtocolEncoder encoder = new PortmanProtocolEncoder(null);
+ var encoder = new PortmanProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/PretraceProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/PretraceProtocolDecoderTest.java
index 61a057dd7..8a4f257f5 100644
--- a/src/test/java/org/traccar/protocol/PretraceProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/PretraceProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class PretraceProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- PretraceProtocolDecoder decoder = new PretraceProtocolDecoder(null);
+ var decoder = new PretraceProtocolDecoder(null);
verifyPosition(decoder, text(
"(867967021915915U1110A1701201500102238.1700N11401.9324E000264000000000009001790000000,&P11A4,F1050^47"));
diff --git a/src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java
index aa08ecea2..403c89e9e 100644
--- a/src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class PretraceProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionPeriodic() throws Exception {
- PretraceProtocolEncoder encoder = new PretraceProtocolEncoder(null);
+ var encoder = new PretraceProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -25,7 +25,7 @@ public class PretraceProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeCustom() throws Exception {
- PretraceProtocolEncoder encoder = new PretraceProtocolEncoder(null);
+ var encoder = new PretraceProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/PricolProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/PricolProtocolDecoderTest.java
index dbc1665fb..a9373e22e 100644
--- a/src/test/java/org/traccar/protocol/PricolProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/PricolProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class PricolProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- PricolProtocolDecoder decoder = new PricolProtocolDecoder(null);
+ var decoder = new PricolProtocolDecoder(null);
verifyPosition(decoder, binary(
"3c5052493030303350020000011402110b222b0455152e4e001de819ca450000000000000003820249000000000000000000000000000000000000000040003e"));
diff --git a/src/test/java/org/traccar/protocol/ProgressProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/ProgressProtocolDecoderTest.java
index 5f6f564b1..6e59f2876 100644
--- a/src/test/java/org/traccar/protocol/ProgressProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/ProgressProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class ProgressProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- ProgressProtocolDecoder decoder = new ProgressProtocolDecoder(null);
+ var decoder = new ProgressProtocolDecoder(null);
verifyNull(decoder, binary(
"020037000100000003003131310f003335343836383035313339303036320f00323530303136333832383531353535010000000100000000000000e6bb97b6"));
diff --git a/src/test/java/org/traccar/protocol/PstFrameDecoderTest.java b/src/test/java/org/traccar/protocol/PstFrameDecoderTest.java
index 790c2c1d9..96993b97b 100644
--- a/src/test/java/org/traccar/protocol/PstFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/PstFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class PstFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- PstFrameDecoder decoder = new PstFrameDecoder();
+ var decoder = new PstFrameDecoder();
verifyFrame(
binary("2fafac5a050f0000e0022fafac5a01891e882bbfdd06dd577c9865620a0efe524c419f940b6710f5ba0c86e5868ffc97c77eaaf166a31dba63f9894e98a91b9486c94e79ce537359737a5e9385431a590eb20b5115a2b7939e4e66ae"),
diff --git a/src/test/java/org/traccar/protocol/PstProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/PstProtocolDecoderTest.java
index d0276eb69..445c333c1 100644
--- a/src/test/java/org/traccar/protocol/PstProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/PstProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class PstProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- PstProtocolDecoder decoder = new PstProtocolDecoder(null);
+ var decoder = new PstProtocolDecoder(null);
verifyPosition(decoder, binary(
"2faf97de06000024db0551380cbb08070b040000015a0c09b50177e5100a1822da0d010d0f0451380628101451380cc384b800488a84036901b202d3010001061103ffff00150203523687"));
diff --git a/src/test/java/org/traccar/protocol/PstProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/PstProtocolEncoderTest.java
index ddf6d460c..abcfa29ec 100644
--- a/src/test/java/org/traccar/protocol/PstProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/PstProtocolEncoderTest.java
@@ -9,7 +9,7 @@ public class PstProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeEngineStop() {
- PstProtocolEncoder encoder = new PstProtocolEncoder(null);
+ var encoder = new PstProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -22,7 +22,7 @@ public class PstProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeEngineResume() {
- PstProtocolEncoder encoder = new PstProtocolEncoder(null);
+ var encoder = new PstProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/Pt215ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Pt215ProtocolDecoderTest.java
index 59574aeee..24cfd316a 100644
--- a/src/test/java/org/traccar/protocol/Pt215ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Pt215ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Pt215ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Pt215ProtocolDecoder decoder = new Pt215ProtocolDecoder(null);
+ var decoder = new Pt215ProtocolDecoder(null);
verifyNull(decoder, binary(
"58580d010359339075435451010d0a"));
diff --git a/src/test/java/org/traccar/protocol/Pt3000ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Pt3000ProtocolDecoderTest.java
index e7d87d583..44f57601c 100644
--- a/src/test/java/org/traccar/protocol/Pt3000ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Pt3000ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Pt3000ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Pt3000ProtocolDecoder decoder = new Pt3000ProtocolDecoder(null);
+ var decoder = new Pt3000ProtocolDecoder(null);
verifyPosition(decoder, text(
"%356939010012099,$GPRMC,124945.752,A,4436.6245,N,01054.4634,E,0.11,358.52,060408,,,A,+393334347445,N028d"),
diff --git a/src/test/java/org/traccar/protocol/Pt502FrameDecoderTest.java b/src/test/java/org/traccar/protocol/Pt502FrameDecoderTest.java
index 487a8500c..2559ad145 100644
--- a/src/test/java/org/traccar/protocol/Pt502FrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Pt502FrameDecoderTest.java
@@ -8,7 +8,7 @@ public class Pt502FrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Pt502FrameDecoder decoder = new Pt502FrameDecoder();
+ var decoder = new Pt502FrameDecoder();
verifyFrame(
binary("24504844302c3936302cffd8ffdb008400140e0f120f0d14121012171514181e32211e1c1c1e3d2c2e243249404c4b47404645505a736250556d5645466488656d777b8182814e608d978c7d96737e817c011517171e1a1e3b21213b7c5346537c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7cffc000110800f0014003012100021101031101ffdd0004000affc401a20000010501010101010100000000000000000102030405060708090a0b100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9fa0100030101010101010101010000000000000102030405060708090a0b1100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00e5292800ef450020a2800a2801d49400b450014b40052e2800a69340094a05007fffd0e5d14b10055b51b00c76a00527273494005250014500251400525001450015347c25003a928010d25007ffd1e52909a00290d0014b40052d0014500145002e297b50018a280109a6d002d2e2803fffd2e7a04da3777a94fbd0025140052500145002514005250014940054e381400b494008690d007fffd3e4f345001486800a5a005a2800a2801680280168a002909e280100cd028016a48937bfb5007fffd4c5038a42280128a004a280128a003ad2500251400945002a8cb0a9a80133450026692803ffd5e4e8a004a2801694500145002d18a005c5140052e280109a69a0029680140abb147b139eb401ffd6c62290d00251400949400114940052500252d002525003e31c93525002521a004a4a00ffd7e4a8a00281400a29d40094b40053ba500252d0018a31400d3cd250018cd2d005ab58777ccdd074ab645007ffd0c72290d00348a2801280"),
diff --git a/src/test/java/org/traccar/protocol/Pt502ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Pt502ProtocolDecoderTest.java
index a7c8be21f..a68471c95 100644
--- a/src/test/java/org/traccar/protocol/Pt502ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Pt502ProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class Pt502ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Pt502ProtocolDecoder decoder = new Pt502ProtocolDecoder(null);
+ var decoder = new Pt502ProtocolDecoder(null);
verifyNull(decoder, binary(
"24504844302c3936302cffd8ffdb008400140e0f120f0d14121012171514181e32211e1c1c1e3d2c2e243249404c4b47404645505a736250556d5645466488656d777b8182814e608d978c7d96737e817c011517171e1a1e3b21213b7c5346537c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7cffc000110800f0014003012100021101031101ffdd0004000affc401a20000010501010101010100000000000000000102030405060708090a0b100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9fa0100030101010101010101010000000000000102030405060708090a0b1100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00e5292800ef450020a2800a2801d49400b450014b40052e2800a69340094a05007fffd0e5d14b10055b51b00c76a00527273494005250014500251400525001450015347c25003a928010d25007ffd1e52909a00290d0014b40052d0014500145002e297b50018a280109a6d002d2e2803fffd2e7a04da3777a94fbd0025140052500145002514005250014940054e381400b494008690d007fffd3e4f345001486800a5a005a2800a2801680280168a002909e280100cd028016a48937bfb5007fffd4c5038a42280128a004a280128a003ad2500251400945002a8cb0a9a80133450026692803ffd5e4e8a004a2801694500145002d18a005c5140052e280109a69a0029680140abb147b139eb401ffd6c62290d00251400949400114940052500252d002525003e31c93525002521a004a4a00ffd7e4a8a00281400a29d40094b40053ba500252d0018a31400d3cd250018cd2d005ab58777ccdd074ab645007ffd0c72290d00348a2801280"));
diff --git a/src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java
index 9e4a8a9a0..62b83c61c 100644
--- a/src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class Pt502ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeCustom() throws Exception {
- Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(null);
+ var encoder = new Pt502ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -25,7 +25,7 @@ public class Pt502ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeOutputControl() throws Exception {
- Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(null);
+ var encoder = new Pt502ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -40,7 +40,7 @@ public class Pt502ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeTimezone() throws Exception {
- Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(null);
+ var encoder = new Pt502ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -55,7 +55,7 @@ public class Pt502ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeAlarmSpeed() throws Exception {
- Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(null);
+ var encoder = new Pt502ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/Pt60ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Pt60ProtocolDecoderTest.java
index 1ba8d25c7..ad987240c 100644
--- a/src/test/java/org/traccar/protocol/Pt60ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Pt60ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Pt60ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Pt60ProtocolDecoder decoder = new Pt60ProtocolDecoder(null);
+ var decoder = new Pt60ProtocolDecoder(null);
verifyNull(decoder, text(
"@B#@|01|006|864891030184954|9425010450971470|20181213093127|2|1|"));
diff --git a/src/test/java/org/traccar/protocol/R12wProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/R12wProtocolDecoderTest.java
new file mode 100644
index 000000000..acb7277b5
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/R12wProtocolDecoderTest.java
@@ -0,0 +1,18 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class R12wProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ var decoder = new R12wProtocolDecoder(null);
+
+ verifyNull(decoder, text(
+ "$HX,0001,860721009104316,e92c,933402042499509,55792760080,12345678,01,a8d940a9,#,50,"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/RaceDynamicsProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/RaceDynamicsProtocolDecoderTest.java
index 318cbdb51..22902079a 100644
--- a/src/test/java/org/traccar/protocol/RaceDynamicsProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/RaceDynamicsProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class RaceDynamicsProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- RaceDynamicsProtocolDecoder decoder = new RaceDynamicsProtocolDecoder(null);
+ var decoder = new RaceDynamicsProtocolDecoder(null);
verifyNull(decoder, text(
"$GPRMC,12,260819,100708,862549040661129,"));
diff --git a/src/test/java/org/traccar/protocol/RadarProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/RadarProtocolDecoderTest.java
index 7dfdd7c21..be1e4de0b 100644
--- a/src/test/java/org/traccar/protocol/RadarProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/RadarProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class RadarProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- RadarProtocolDecoder decoder = new RadarProtocolDecoder(null);
+ var decoder = new RadarProtocolDecoder(null);
verifyPositions(decoder, binary(
"361800011459015cb497554c01c101ff003500050038000207ff831c04c01f1c00555cb464895cb46487ff7f04eafeffdbd80000079402ead0000000110000000000120d2aff150000000000000002000a00050002436c61726f0000000000008b00000003764500037653005207ff831c04c01f1c00555cb4648a5cb46489ff7f04eafeffdbd80000079402ead0000000010000000000120e00ff150000000000000002000800060002436c61726f0000000000008d00000003764600037654000207ff831c04c01f1c00555cb464d85cb464d7ff7f04eafeffdbd80000079402ead0000000110000000000120e2aff150000000000000002000700070003436c61726f0000000000008d000000037694000376a2005207ff831c04c01f1c00555cb464d95cb464d9ff7f04eafeffdbd80000079402eac0000000010000000000120e00ff150000000000000002000700070003436c61726f0000000000008d000000037695000376a3000207ff831c04c01f1c00555cb465065cb46504ff7f04eafeffdbd80000079402ead0000000110000000000120e2aff150000000000000000000500060005436c61726f0000000000008d0000000376c2000376d07ed7"));
diff --git a/src/test/java/org/traccar/protocol/RaveonProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/RaveonProtocolDecoderTest.java
index 165027351..1b111ee5d 100644
--- a/src/test/java/org/traccar/protocol/RaveonProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/RaveonProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class RaveonProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- RaveonProtocolDecoder decoder = new RaveonProtocolDecoder(null);
+ var decoder = new RaveonProtocolDecoder(null);
verifyPosition(decoder, text(
"$PRAVE,0001,0001,3308.9051,-11713.1164,195348,1,10,168,31,13.3,3,-83,0,0,,1003.4*66"));
diff --git a/src/test/java/org/traccar/protocol/RecodaProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/RecodaProtocolDecoderTest.java
index 668879787..803cfb48a 100644
--- a/src/test/java/org/traccar/protocol/RecodaProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/RecodaProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class RecodaProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- RecodaProtocolDecoder decoder = new RecodaProtocolDecoder(null);
+ var decoder = new RecodaProtocolDecoder(null);
verifyNull(decoder, binary(
"01100020480000000300000030393535360000000000000001000000303030303000000000000000000000000000000000000000006100004531313037353500ffffffffffff0000"));
diff --git a/src/test/java/org/traccar/protocol/RetranslatorProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/RetranslatorProtocolDecoderTest.java
index 779e21823..4af77cfbf 100644
--- a/src/test/java/org/traccar/protocol/RetranslatorProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/RetranslatorProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class RetranslatorProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- RetranslatorProtocolDecoder decoder = new RetranslatorProtocolDecoder(null);
+ var decoder = new RetranslatorProtocolDecoder(null);
verifyPosition(decoder, binary(
"74000000333533393736303133343435343835004B0BFB70000000030BBB000000270102706F73696E666F00A027AFDF5D9848403AC7253383DD4B400000000000805A40003601460B0BBB0000001200047077725F657874002B8716D9CE973B400BBB00000011010361766C5F696E707574730000000001"));
diff --git a/src/test/java/org/traccar/protocol/RitiProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/RitiProtocolDecoderTest.java
index 73d07efd6..e0890a5fc 100644
--- a/src/test/java/org/traccar/protocol/RitiProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/RitiProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class RitiProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- RitiProtocolDecoder decoder = new RitiProtocolDecoder(null);
+ var decoder = new RitiProtocolDecoder(null);
verifyPosition(decoder, binary(
"3b28a2a2056315316d4000008100000000000000005f710000244750524d432c3138303535332e3030302c412c353532342e383437312c4e2c30313133342e313837382c452c302e30302c2c3032313231332c2c2c412a37340d0a00000000000000000000000000000000040404"));
diff --git a/src/test/java/org/traccar/protocol/RoboTrackFrameDecoderTest.java b/src/test/java/org/traccar/protocol/RoboTrackFrameDecoderTest.java
index 2e3853f86..eaf83458d 100644
--- a/src/test/java/org/traccar/protocol/RoboTrackFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/RoboTrackFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class RoboTrackFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- RoboTrackFrameDecoder decoder = new RoboTrackFrameDecoder();
+ var decoder = new RoboTrackFrameDecoder();
verifyFrame(
binary("00524f424f545241434b00000000000000383638323034303032323533343136313233343536373839303132312e313261000000312e353761000000312e3030000000003e"),
diff --git a/src/test/java/org/traccar/protocol/RoboTrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/RoboTrackProtocolDecoderTest.java
index 0c969ab68..40218efdb 100644
--- a/src/test/java/org/traccar/protocol/RoboTrackProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/RoboTrackProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class RoboTrackProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- RoboTrackProtocolDecoder decoder = new RoboTrackProtocolDecoder(null);
+ var decoder = new RoboTrackProtocolDecoder(null);
verifyNull(decoder, binary(
"00524f424f545241434b00000000000000383638323034303032323533343136313233343536373839303132312e313261000000312e353761000000312e3030000000003e"));
diff --git a/src/test/java/org/traccar/protocol/RstProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/RstProtocolDecoderTest.java
index fb6dca3e6..71313e449 100644
--- a/src/test/java/org/traccar/protocol/RstProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/RstProtocolDecoderTest.java
@@ -9,7 +9,10 @@ public class RstProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- RstProtocolDecoder decoder = new RstProtocolDecoder(null);
+ var decoder = new RstProtocolDecoder(null);
+
+ verifyNull(decoder, text(
+ "RST;A;RST-MINIv2;V7.04;008051261;124;29;04-04-2021 17:27:26;04-04-2021 17:27:26;-1.280811;-47.931755;7353;79;1;14;7315;26;10;0;1855;0;0;0;0;5;5;-1.280821;-47.931747;04-04-2021 17:52:23;6;-1.280863;-47.931770;04-04-2021 18:12:19;5;-1.280844;-47.931763;04-04-2021 17:28:02;5;-1.280900;-47.931770;04-04-2021 19:04:27;4;-1.280843;-47.931747;04-04-2021 18:21:45;04-04-2021 19:29:59;04-04-2021 19:29:59;-1.280770;-47.931595;1;15;0;0;0;0;FIM;"));
verifyPosition(decoder, text(
"RST;L;RST-MINIv2;V7.02;008068078;61;1;27-01-2020 21:36:33;27-01-2020 21:36:33;-16.696159;-49.284275;0;67;786;1;15;0;00;B0;00;19;06;12.42;4.16;79;20;FE;0000;01;E0;00800020;0;467;FIM;"));
diff --git a/src/test/java/org/traccar/protocol/RuptelaProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/RuptelaProtocolDecoderTest.java
index 4c7b09bcc..5f3e190a5 100644
--- a/src/test/java/org/traccar/protocol/RuptelaProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/RuptelaProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class RuptelaProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- RuptelaProtocolDecoder decoder = new RuptelaProtocolDecoder(null);
+ var decoder = new RuptelaProtocolDecoder(null);
verifyNull(decoder, binary(
"03fc0003142b0c152acd2502003544444131464144000a0000ffd8ffe000104a46494600010100000100010000ffdb00c50006040506050406060506070706080a100a0a09090a140e0f0c1017141818171416161a1d251f1a1b231c1616202c20232627292a29191f2d302d283025282928010707070a080a130a0a13281a161a2828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828020707070a080a130a0a13281a161a2828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828ffc000110800f0014003012200021101031102ffc401a20000010501010101010100000000000000000102030405060708090a0b100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9fa0100030101010101010101010000000000000102030405060708090a0b1100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffdd00040000ffda000c03010002110311003f00e27534fde484fa66950079add40e153754d73892794f552e00a6da0c4b282794f947d2aa92b2b1d7887795fb9b5a4200eee7e957e6bdfb2b0f2cb6eff669cba4dee99656d25f5acb02dd209622e38753d08fc315177cf151562e337196e8e46f5352cb5d6603cd52ebeb8c1adcb4be82e07eedc67d0f06b8f071daa64618c8383508573ae991251891430f7a836cd07fa97de9fdc7fe86b0adf51b8830377989e8d5a96daa413603131bfa350061fc49d41adbc39e5edc34ee14f7c639af1b91f2719aef7e2c5d4bf6cb780b7ee7607500f19e735e7a06e3c9e2b4a4b4b88b51b2aaf14bbc1351226796a79e3815b81283c500d460d381a405988d7a6785ad8c3a241bc9f9f2e47d7ffad5e73a5db35dddc30a757603e83bd7aba011c6a8bc2a8000a89e8807b1551815a5636fba38ce3af359248cd7516298862ff7456713fc58"));
diff --git a/src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java
index 613a89b96..409cd4da5 100644
--- a/src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java
@@ -9,7 +9,7 @@ public class RuptelaProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- RuptelaProtocolEncoder encoder = new RuptelaProtocolEncoder(null);
+ var encoder = new RuptelaProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/S168ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/S168ProtocolDecoderTest.java
index 8a4a42b54..d4918e121 100644
--- a/src/test/java/org/traccar/protocol/S168ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/S168ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class S168ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- S168ProtocolDecoder decoder = new S168ProtocolDecoder(null);
+ var decoder = new S168ProtocolDecoder(null);
verifyNull(decoder, text(
"S168#358511139046180#00c9#0009#SYNC:0000"));
diff --git a/src/test/java/org/traccar/protocol/SabertekFrameDecoderTest.java b/src/test/java/org/traccar/protocol/SabertekFrameDecoderTest.java
index 7a42a71a0..ced40acd0 100644
--- a/src/test/java/org/traccar/protocol/SabertekFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SabertekFrameDecoderTest.java
@@ -10,7 +10,7 @@ public class SabertekFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- SabertekFrameDecoder decoder = new SabertekFrameDecoder();
+ var decoder = new SabertekFrameDecoder();
assertEquals(
binary("2c3939393939393939392c332c34302c36352c372c302c312c2d32352e3738313636362c32382e3235343730322c34302c3236382c313431342c382c35353632332c"),
diff --git a/src/test/java/org/traccar/protocol/SabertekProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SabertekProtocolDecoderTest.java
index 20b02841e..148695dcd 100644
--- a/src/test/java/org/traccar/protocol/SabertekProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SabertekProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class SabertekProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- SabertekProtocolDecoder decoder = new SabertekProtocolDecoder(null);
+ var decoder = new SabertekProtocolDecoder(null);
verifyPosition(decoder, text(
",999999999,3,40,65,7,0,1,-25.781666,28.254702,40,268,1414,8,55623,"));
diff --git a/src/test/java/org/traccar/protocol/SanavProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SanavProtocolDecoderTest.java
index 36fd7ecba..223f4f12f 100644
--- a/src/test/java/org/traccar/protocol/SanavProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SanavProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class SanavProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- SanavProtocolDecoder decoder = new SanavProtocolDecoder(null);
+ var decoder = new SanavProtocolDecoder(null);
verifyPosition(decoder, text(
"imei=353197040023431&rmc=$GPRMC,015258.000,A,2457.8101,N,12125.5393,E,0.00,0.00,210111,,*18,AUTO,0300,2.1,10,466,97,34E7,3391,74,466,9 7,3F2D,3391,65,466,97,39C9,3391,79,466,97,3F2C,3391,81,466,97,0000,00 00,83,466,97,0000,0000,85,466,97,0000,0000,85,1,24"));
diff --git a/src/test/java/org/traccar/protocol/SanulProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SanulProtocolDecoderTest.java
index 882a63fe6..23bd6d80b 100644
--- a/src/test/java/org/traccar/protocol/SanulProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SanulProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class SanulProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- SanulProtocolDecoder decoder = new SanulProtocolDecoder(null);
+ var decoder = new SanulProtocolDecoder(null);
verifyNull(decoder, binary(
"aa007020000100000000000033353333353830313831353431313700000000000000000000"));
diff --git a/src/test/java/org/traccar/protocol/SatsolProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SatsolProtocolDecoderTest.java
index 45e919bbb..dcd51063c 100644
--- a/src/test/java/org/traccar/protocol/SatsolProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SatsolProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class SatsolProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- SatsolProtocolDecoder decoder = new SatsolProtocolDecoder(null);
+ var decoder = new SatsolProtocolDecoder(null);
verifyPositions(decoder, binary(
"f0e1bf4cb2ec1600e1005f8791e901000000c959515c2cc24a03aeadcd010e01a800250001090201878e92e901000000cb59515c2dc24a03b8adcd018801a8001d0001080201325993e901000000cc59515c2fc24a03bfadcd01ab01a800220001080201dd8194e901000000cd59515c32c24a03ceadcd015801a8002500010802015f3795e905000900ce59515c32c24a03d8adcd01f600a700250001091401000000000000000000863496e901000000cf59515c34c24a03ddadcd019b00a700280001090201714197e904000600cf59515c34c24a03ddadcd019b00a7002800010a1401becd07001901"));
diff --git a/src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java
index f31773e0c..7e2812714 100644
--- a/src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java
@@ -10,7 +10,7 @@ public class SigfoxProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- SigfoxProtocolDecoder decoder = new SigfoxProtocolDecoder(null);
+ var decoder = new SigfoxProtocolDecoder(null);
verifyPosition(decoder, request(HttpMethod.POST, "/",
buffer("{ \"device\":\"BFE47E\", \"time\":1590497040, \"data\":\"10297eb01e621122070000be\", \"seqNumber\":8, \"deviceTypeId\":\"5ecb8bfac563d620cc9e6798\", \"ack\":false }")));
diff --git a/src/test/java/org/traccar/protocol/SiwiProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SiwiProtocolDecoderTest.java
index 3a91d8482..d264895fc 100644
--- a/src/test/java/org/traccar/protocol/SiwiProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SiwiProtocolDecoderTest.java
@@ -8,7 +8,16 @@ public class SiwiProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- SiwiProtocolDecoder decoder = new SiwiProtocolDecoder(null);
+ var decoder = new SiwiProtocolDecoder(null);
+
+ verifyPosition(decoder, text(
+ "$SIWI,868957040831465,44,E,,,1,1,1,16.79,0,0,5,A,17.204447,78.355087,534,44,140955,180221,11,1,15,5,4322,0,0,0,0,0,0,1.0,1.6CPTASF_6.60,0!"));
+
+ verifyPosition(decoder, text(
+ "$SIWI,868957040777510,13,E,,,0,1,1,24.15,1118097,0,18,A,16.080666,80.331451,0,29,142451,180221,24,1,15,5,4282,2269,0,0,0,0,0,1.0,1.6CPASF_6.60,0!"));
+
+ verifyPosition(decoder, text(
+ "$RTPL,1234567890123,45,E,,89917650642221590319,0,1,0,12.36,141313,0,9,A,21.981985,85.221165,804,280,105113,220420,17,1,13,5,4071,1,0,8,0,0,0,1.0,1.2CPLUS_6.52,0!"));
verifyPosition(decoder, text(
"$SIWI,9803932,23992,E,0,,0,1,1,0,5055,0,5,A,22.289887,70.807192,152,168,102922,090317,28,1,12,5,4098,1,0,13,0,0,0,1.0,3.1CHKS_4.82,0!"));
diff --git a/src/test/java/org/traccar/protocol/SkypatrolProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SkypatrolProtocolDecoderTest.java
index bc2dac7e9..a248056f8 100644
--- a/src/test/java/org/traccar/protocol/SkypatrolProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SkypatrolProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class SkypatrolProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- SkypatrolProtocolDecoder decoder = new SkypatrolProtocolDecoder(null);
+ var decoder = new SkypatrolProtocolDecoder(null);
verifyNull(decoder, binary(
"000a02171101303131373232303031333537393833060200000006202020202020202020312020202020202030313137323230303133353739383320"));
diff --git a/src/test/java/org/traccar/protocol/SmartSoleProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SmartSoleProtocolDecoderTest.java
index 183af899b..740d1b62c 100644
--- a/src/test/java/org/traccar/protocol/SmartSoleProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SmartSoleProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class SmartSoleProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- SmartSoleProtocolDecoder decoder = new SmartSoleProtocolDecoder(null);
+ var decoder = new SmartSoleProtocolDecoder(null);
verifyPosition(decoder, text(
"#GTXRP=359366080000385,8,180514200051,34.041981,-118.255806,60,1,1,7,1.80,180514200051,4.16,11"));
diff --git a/src/test/java/org/traccar/protocol/SmokeyProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SmokeyProtocolDecoderTest.java
index c2d74b433..d806fd790 100644
--- a/src/test/java/org/traccar/protocol/SmokeyProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SmokeyProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class SmokeyProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- SmokeyProtocolDecoder decoder = new SmokeyProtocolDecoder(null);
+ var decoder = new SmokeyProtocolDecoder(null);
verifyAttributes(decoder, binary(
"534d0300865101019383025f0403000000000b86250200000c0000028f000102f8cc0900127f08"));
diff --git a/src/test/java/org/traccar/protocol/SolarPoweredProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SolarPoweredProtocolDecoderTest.java
index 4e08ce7a5..7202aaefb 100644
--- a/src/test/java/org/traccar/protocol/SolarPoweredProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SolarPoweredProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class SolarPoweredProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- SolarPoweredProtocolDecoder decoder = new SolarPoweredProtocolDecoder(null);
+ var decoder = new SolarPoweredProtocolDecoder(null);
verifyAttribute(decoder, binary(
"7e850256553309440011003e81131914030600332301a61ed709209ff40014b89082020f0283100000f908000000440000003d1f19021784114161726f6e34475630312d323030333031057e"),
diff --git a/src/test/java/org/traccar/protocol/SpotProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SpotProtocolDecoderTest.java
index dd63c07ac..7f8e2b58f 100644
--- a/src/test/java/org/traccar/protocol/SpotProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SpotProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class SpotProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- SpotProtocolDecoder decoder = new SpotProtocolDecoder(null);
+ var decoder = new SpotProtocolDecoder(null);
verifyPositions(decoder, request(HttpMethod.POST, "/", buffer(
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n",
diff --git a/src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java
index c15e9e48a..1710ccbb9 100644
--- a/src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java
@@ -9,7 +9,13 @@ public class StarLinkProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- StarLinkProtocolDecoder decoder = new StarLinkProtocolDecoder(null);
+ var decoder = new StarLinkProtocolDecoder(null);
+
+ decoder.setFormat("#IMEI#,#EDT#,#PDT#,#LAT#,#LONG#,#SPD#,#IGN#,#ODO#,#DUR#,#TDUR#,#LAC#,#CID#,#VIN#,#VBAT#,#EID#,#EDSC#,#DRV#,#SATU#,#CSS#,#OUT1#,#OUT2#,#CFL#");
+
+ verifyAttribute(decoder, text(
+ "$SLU0AF334,06,14260,352353088342073,210322083942,210322083940,+0937.2191,+04151.8206,000.0,0,006782,,30707,14010,11685,12.994,04.159,01,Location,0,20,64,0,0,12,0,2*7F"),
+ Position.KEY_FUEL_LEVEL, 12);
decoder.setFormat("#IMEI#,#EDT#,#EDSC#,#EID#,#PDT#,#LAT#,#LONG#,#SPDK#,#IGNL#,#HEAD#,#ODO#,#DUR#,#TDUR#,#VIN#,#VBAT#,#BATC#,#SATU#,#CSS#,#IN2#,#TVI#,#OUT1#,#OUT2#,#OUT3#,#OUTC#");
diff --git a/src/test/java/org/traccar/protocol/StarcomProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/StarcomProtocolDecoderTest.java
index 88be86054..851d4eac6 100644
--- a/src/test/java/org/traccar/protocol/StarcomProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/StarcomProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class StarcomProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- StarcomProtocolDecoder decoder = new StarcomProtocolDecoder(null);
+ var decoder = new StarcomProtocolDecoder(null);
verifyPosition(decoder, text(
"|unit=416307,unittype=5,address=186.167.243.28,kind=14,software_version=14.02.18,hardware_type=17,gps_type=6,longitude=-67.85891,latitude=10.21988,datetime_actual=2019/05/07 21:59:38,network=TCPIP.1|\r\n"));
diff --git a/src/test/java/org/traccar/protocol/StartekProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/StartekProtocolDecoderTest.java
new file mode 100644
index 000000000..802d65ab9
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/StartekProtocolDecoderTest.java
@@ -0,0 +1,29 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
+
+public class StartekProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ var decoder = new StartekProtocolDecoder(null);
+
+ verifyAttribute(decoder, text(
+ "&&a152,860262050010565,000,53,8F5300,210528015706,A,-38.229746,145.043446,6,1.5,0,285,84,2102994,505|1|306E|082D6101,31,0000003D,02,02,04C0|01A0|0000|0000,1,,DC"),
+ Position.KEY_DRIVER_UNIQUE_ID, "8F5300");
+
+ verifyPosition(decoder, text(
+ "&&>141,860262050010565,000,36,,210407094323,V,-38.229711,145.043161,0,0.0,0,0,0,14222,505|1|306E|082D6115,24,00000039,00,00,04C0|0164|0000|0000,1,,41"));
+
+ verifyPosition(decoder, text(
+ "&&A147,021104023195429,000,0,,180106093046,A,22.646430,114.065730,8,0.9,54,86,76,326781,460|0|27B3|0EA7,27,0000000F,02,01,04E2|018C|01C8|0000,1,0104B0,01013D|02813546"));
+
+ verifyPosition(decoder, text(
+ "&&y139,860262050009146,000,0,,210323131512,A,22.678655,114.046223,14,1.1,0,231,71,5,460|0|249F|0099C257,28,0000003D,00,00,0493|0199|0000|0000,1,,33"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/StartekProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/StartekProtocolEncoderTest.java
new file mode 100644
index 000000000..7eeb19edf
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/StartekProtocolEncoderTest.java
@@ -0,0 +1,24 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+import org.traccar.model.Command;
+
+import static org.junit.Assert.assertEquals;
+
+public class StartekProtocolEncoderTest extends ProtocolTest {
+
+ @Test
+ public void testEncodeEngineStop() {
+
+ var encoder = new StartekProtocolEncoder(null);
+
+ Command command = new Command();
+ command.setDeviceId(1);
+ command.setType(Command.TYPE_ENGINE_STOP);
+
+ assertEquals("$$:24,123456789012345,900,1,19F\r\n", encoder.encodeCommand(null, command));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/Stl060ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Stl060ProtocolDecoderTest.java
index e2be2028e..e13f74604 100644
--- a/src/test/java/org/traccar/protocol/Stl060ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Stl060ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Stl060ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Stl060ProtocolDecoder decoder = new Stl060ProtocolDecoder(null);
+ var decoder = new Stl060ProtocolDecoder(null);
verifyPosition(decoder, text(
"$1,357804048043099,D001,AP29AW0963,23/02/14,14:06:54,17248488N,078342226E,0.08,193.12,1,1,1,1,1,A"),
diff --git a/src/test/java/org/traccar/protocol/SuntechFrameDecoderTest.java b/src/test/java/org/traccar/protocol/SuntechFrameDecoderTest.java
index 1c84b5c89..99cbeac2f 100644
--- a/src/test/java/org/traccar/protocol/SuntechFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SuntechFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class SuntechFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- SuntechFrameDecoder decoder = new SuntechFrameDecoder();
+ var decoder = new SuntechFrameDecoder();
verifyFrame(
binary("81004e05200013383fffff3401000301130a0512080400000000000000000000000047f9d5846a06810072225214010100020300a8002604c1000004b000000470000025a100000000000025c4000000a6"),
diff --git a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java
index 847f6707d..8cc4148f0 100644
--- a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class SuntechProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeTemperature() throws Exception {
- SuntechProtocolDecoder decoder = new SuntechProtocolDecoder(null);
+ var decoder = new SuntechProtocolDecoder(null);
decoder.setHbm(true);
decoder.setIncludeAdc(true);
@@ -38,7 +38,7 @@ public class SuntechProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeRpm() throws Exception {
- SuntechProtocolDecoder decoder = new SuntechProtocolDecoder(null);
+ var decoder = new SuntechProtocolDecoder(null);
decoder.setHbm(true);
decoder.setIncludeRpm(true);
@@ -52,7 +52,7 @@ public class SuntechProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeHours() throws Exception {
- SuntechProtocolDecoder decoder = new SuntechProtocolDecoder(null);
+ var decoder = new SuntechProtocolDecoder(null);
decoder.setHbm(true);
@@ -65,7 +65,7 @@ public class SuntechProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeDriver() throws Exception {
- SuntechProtocolDecoder decoder = new SuntechProtocolDecoder(null);
+ var decoder = new SuntechProtocolDecoder(null);
verifyAttribute(decoder, buffer(
"ST300HTE;511050566;45;308;20200909;13:38:38;0;12.50;001354;0.0;1;0;1;1;0;-27.636632;-052.277933;-27.636675;-052.277947;000.000;002.296;0;00000000000000"),
@@ -80,7 +80,11 @@ public class SuntechProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- SuntechProtocolDecoder decoder = new SuntechProtocolDecoder(null);
+ var decoder = new SuntechProtocolDecoder(null);
+
+ verifyAttribute(decoder, buffer(
+ "ST300UEX;511331307;45;311;20210420;12:41:01;12361;-01.280825;-047.931773;000.000;000.00;16;1;0;12.54;000000;23;GTSL|6|1|0|9255143|2|;6F;000276;0.0;1;00000000000000;0"),
+ Position.KEY_DRIVER_UNIQUE_ID, "9255143");
verifyAttribute(decoder, buffer(
"STT;0560001616;BFFFFF;56;1.0.15;1;20200219;20:52:25;00008D6C;334;20;0925;24;+20.741764;-103.430364;0.00;0.00;19;1;00000001;00000000;2;1;1765;00008003;0.0;12.14;136598"),
diff --git a/src/test/java/org/traccar/protocol/SupermateProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SupermateProtocolDecoderTest.java
index 2a7ab2dee..29ec670aa 100755
--- a/src/test/java/org/traccar/protocol/SupermateProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SupermateProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class SupermateProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- SupermateProtocolDecoder decoder = new SupermateProtocolDecoder(null);
+ var decoder = new SupermateProtocolDecoder(null);
verifyPosition(decoder, text(
"2:359672050130411:1:*,00000000,XT,A,10031b,140b28,80ad4c72,81ba2d2c,06ab,238c,020204010000,12,0,0000,0003e6"));
diff --git a/src/test/java/org/traccar/protocol/SviasProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SviasProtocolDecoderTest.java
index f7b15ca2e..8a3a74753 100644
--- a/src/test/java/org/traccar/protocol/SviasProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SviasProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class SviasProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- SviasProtocolDecoder decoder = new SviasProtocolDecoder(null);
+ var decoder = new SviasProtocolDecoder(null);
verifyPosition(decoder, text(
"[7061,3041,57,20324277,710,40618,141342,-93155840,-371754060,0,20469,0,16,1,0,0,11323,100,9,,32,4695"));
diff --git a/src/test/java/org/traccar/protocol/SwiftechProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SwiftechProtocolDecoderTest.java
index 88006606e..10b033985 100644
--- a/src/test/java/org/traccar/protocol/SwiftechProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SwiftechProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class SwiftechProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- SwiftechProtocolDecoder decoder = new SwiftechProtocolDecoder(null);
+ var decoder = new SwiftechProtocolDecoder(null);
verifyPosition(decoder, text(
"@@861551041946971,,0,102040,1023.9670,N,07606.8160,E,2.26,151220,A,0127,1,1,03962,00000,#"));
diff --git a/src/test/java/org/traccar/protocol/T55ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/T55ProtocolDecoderTest.java
index 25fef58f1..ba981598d 100644
--- a/src/test/java/org/traccar/protocol/T55ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/T55ProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class T55ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- T55ProtocolDecoder decoder = new T55ProtocolDecoder(null);
+ var decoder = new T55ProtocolDecoder(null);
verifyPosition(decoder, text(
"QZE,868994033976700,35,28062020,113553,22.13673,114.57263,0,22,A,0"));
@@ -121,7 +121,7 @@ public class T55ProtocolDecoderTest extends ProtocolTest {
// Maxon devices can send NMEA before identification
- T55ProtocolDecoder decoder = new T55ProtocolDecoder(null);
+ var decoder = new T55ProtocolDecoder(null);
verifyNull(decoder, text(
"$GPRMC,012006,A,4828.10,N,1353.52,E,0.00,0.00,180915,020.3,E*42"));
diff --git a/src/test/java/org/traccar/protocol/T57FrameDecoderTest.java b/src/test/java/org/traccar/protocol/T57FrameDecoderTest.java
index f74d3c350..dd5929b04 100644
--- a/src/test/java/org/traccar/protocol/T57FrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/T57FrameDecoderTest.java
@@ -8,7 +8,7 @@ public class T57FrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- T57FrameDecoder decoder = new T57FrameDecoder();
+ var decoder = new T57FrameDecoder();
verifyFrame(
binary("2a5435372346312354353731313137303031233330313131372330303038343323323233342e31333033234e2330383832362e313731342345232b302e3234322c2b302e3130392c2d302e37383923302e30303023362e323030303023413223342e3223"),
diff --git a/src/test/java/org/traccar/protocol/T57ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/T57ProtocolDecoderTest.java
index c457b4602..376aab1da 100644
--- a/src/test/java/org/traccar/protocol/T57ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/T57ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class T57ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- T57ProtocolDecoder decoder = new T57ProtocolDecoder(null);
+ var decoder = new T57ProtocolDecoder(null);
verifyPosition(decoder, text(
"*T57#F1#T571117001#301117#000843#2234.1303#N#08826.1714#E#+0.242,+0.109,-0.789#0.000#6.20000#A2#4.2#"));
diff --git a/src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java
index 9e443309a..9fb57f400 100644
--- a/src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class T800xProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- T800xProtocolDecoder decoder = new T800xProtocolDecoder(null);
+ var decoder = new T800xProtocolDecoder(null);
verifyAttributes(decoder, binary(
"252510003100180865284041080544201221191023000003ffff9702eff820014700000000912a6ac26dff09c200000000"));
diff --git a/src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java
index 9a628cdb6..1d17ee5d5 100644
--- a/src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java
@@ -9,7 +9,7 @@ public class T800xProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- T800xProtocolEncoder encoder = new T800xProtocolEncoder(null);
+ var encoder = new T800xProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java
index 6682a4d99..56af8830a 100644
--- a/src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class TaipProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TaipProtocolDecoder decoder = new TaipProtocolDecoder(null);
+ var decoder = new TaipProtocolDecoder(null);
verifyAttribute(decoder, text(
">RUS00,111220124402-3138067-06417623000012200FF,000000000000000000000000000,0000000111,15640422,00000,+25.5,00000,51;ID=CST3G0443;#IP1:089F;*34<"),
diff --git a/src/test/java/org/traccar/protocol/TechTltProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TechTltProtocolDecoderTest.java
index 767f175fe..c5de8e62a 100644
--- a/src/test/java/org/traccar/protocol/TechTltProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TechTltProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class TechTltProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TechTltProtocolDecoder decoder = new TechTltProtocolDecoder(null);
+ var decoder = new TechTltProtocolDecoder(null);
verifyPosition(decoder, text(
"002422269*POS=Y,16:21:20,25/11/09,3809.8063N,01444.7438E,4.17,117.23,0.4,09,40076,56341\r\n"),
diff --git a/src/test/java/org/traccar/protocol/TekFrameDecoderTest.java b/src/test/java/org/traccar/protocol/TekFrameDecoderTest.java
index 0446670d8..f315e6432 100644
--- a/src/test/java/org/traccar/protocol/TekFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TekFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class TekFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TekFrameDecoder decoder = new TekFrameDecoder();
+ var decoder = new TekFrameDecoder();
verifyFrame(
binary("020315048715E70861074028023219026200400A0340002C007F0009000000000000000000402842064028420641284206402844064128440640284406402844064028440641284406402844060010010C04052B000253000000000001060A0000000000000228330000FF0000FF360014B394"),
diff --git a/src/test/java/org/traccar/protocol/TekProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TekProtocolDecoderTest.java
index f67ae9c3f..a371ffe6b 100644
--- a/src/test/java/org/traccar/protocol/TekProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TekProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class TekProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TekProtocolDecoder decoder = new TekProtocolDecoder(null);
+ var decoder = new TekProtocolDecoder(null);
verifyPosition(decoder, binary(
"0501E304E00E76086107502100455111492C33332C3137303935342E302C353235352E393933344E2C30303833322E34333935572C322E312C3133342E382C322C302E30302C302E302C302E302C3234303931352C30362C3C45"));
diff --git a/src/test/java/org/traccar/protocol/TelemaxProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TelemaxProtocolDecoderTest.java
index e330600e5..8c3650f4e 100644
--- a/src/test/java/org/traccar/protocol/TelemaxProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TelemaxProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class TelemaxProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TelemaxProtocolDecoder decoder = new TelemaxProtocolDecoder(null);
+ var decoder = new TelemaxProtocolDecoder(null);
verifyNull(decoder, text(
"%067374070128"));
diff --git a/src/test/java/org/traccar/protocol/TelicFrameDecoderTest.java b/src/test/java/org/traccar/protocol/TelicFrameDecoderTest.java
index 5fcbcbb57..125b61d48 100644
--- a/src/test/java/org/traccar/protocol/TelicFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TelicFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class TelicFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TelicFrameDecoder decoder = new TelicFrameDecoder();
+ var decoder = new TelicFrameDecoder();
verifyFrame(
binary("303032363230333339337c3232367c31307c303032303034303130"),
diff --git a/src/test/java/org/traccar/protocol/TelicProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TelicProtocolDecoderTest.java
index 3e3bafb34..03824d91b 100644
--- a/src/test/java/org/traccar/protocol/TelicProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TelicProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class TelicProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TelicProtocolDecoder decoder = new TelicProtocolDecoder(null);
+ var decoder = new TelicProtocolDecoder(null);
verifyNull(decoder, text(
"0026355565071347499|206|01|001002008"));
diff --git a/src/test/java/org/traccar/protocol/TeltonikaFrameDecoderTest.java b/src/test/java/org/traccar/protocol/TeltonikaFrameDecoderTest.java
index 8d2e70bd4..7787907b6 100644
--- a/src/test/java/org/traccar/protocol/TeltonikaFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TeltonikaFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class TeltonikaFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TeltonikaFrameDecoder decoder = new TeltonikaFrameDecoder();
+ var decoder = new TeltonikaFrameDecoder();
verifyFrame(
binary("000F313233343536373839303132333435"),
diff --git a/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
index 2f43733c4..082d410c2 100644
--- a/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
@@ -9,12 +9,18 @@ public class TeltonikaProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TeltonikaProtocolDecoder decoder = new TeltonikaProtocolDecoder(null, false);
+ var decoder = new TeltonikaProtocolDecoder(null, false);
verifyNull(decoder, binary(
"000F313233343536373839303132333435"));
verifyPositions(decoder, binary(
+ "00000000000000b98e0200000179555c7bf8010b3a1cfbebc142b00000000000000000ec000f000900f00000150000c80000450200710100740001070100fa0000ec01000500b500000018000000430d560044000000190000000100f1000000000000000000000179555c83c8010b3a1cfbebc142b0000000000000000185000f000900f00000150000c80000450200710100740001070100fa00018511000500b500000018000000430d560044000000190000000100f100000000000000000200003251"));
+
+ verifyPositions(decoder, binary(
+ "00000000000000a38e0100000178b11c9e1000040bbbc91f03190c002100e113001300000010000600ef0100f00100150300c800004501001e070005004237e00018000a00ce166200430f970024059f000300f10000665900c70000001e00100000a1b500000002010000115756315a5a5a32455a38363031353338380119002950303239392c50303637352c50303637342c50303637322c50303637312c50303437312c50324241430100001ad8"));
+
+ verifyPositions(decoder, binary(
"00000000000000858e0200000174431aadc100061d888f21000e8a0032002e0c000001810001000000000000000000010181001711210102030405060708090a0b0c0d0e0f10020b010ad000000174431a389100061d888f21000e8a0033002e0d000001810001000000000000000000010181001711210102030405060708090a0b0c0d0e0f10020b010ad2020000492b"));
verifyPositions(decoder, false, binary(
@@ -118,7 +124,7 @@ public class TeltonikaProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodePhoto() throws Exception {
- TeltonikaProtocolDecoder decoder = new TeltonikaProtocolDecoder(null, false);
+ var decoder = new TeltonikaProtocolDecoder(null, false);
verifyNull(decoder, binary(
"000F313233343536373839303132333435"));
@@ -138,7 +144,7 @@ public class TeltonikaProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeConnectionless() throws Exception {
- TeltonikaProtocolDecoder decoder = new TeltonikaProtocolDecoder(null, true);
+ var decoder = new TeltonikaProtocolDecoder(null, true);
verifyPositions(decoder, false, binary(
"0049cafe0122000f33353734353430373237313339373508010000015d3766f6a800003eef961ec6215e0063006d09003100070401000200f001c8000242381c18003201c7000000e10001"));
diff --git a/src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java
index 0318b9896..008a2b9dd 100644
--- a/src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java
@@ -9,7 +9,7 @@ public class TeltonikaProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- TeltonikaProtocolEncoder encoder = new TeltonikaProtocolEncoder(null);
+ var encoder = new TeltonikaProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/ThinkPowerProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/ThinkPowerProtocolDecoderTest.java
new file mode 100644
index 000000000..ff808e667
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/ThinkPowerProtocolDecoderTest.java
@@ -0,0 +1,27 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class ThinkPowerProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ var decoder = new ThinkPowerProtocolDecoder(null);
+
+ verifyNull(decoder, binary(
+ "0103002C01020F38363737333030353038323030343606544C3930344111522D312E302E31372E32303231303431300011C3"));
+
+ verifyPosition(decoder, binary(
+ "05300012016099E995010D743CC943EB481500000000EED4"));
+
+ verifyPosition(decoder, binary(
+ "05000007016099E768020162D8"));
+
+ verifyNull(decoder, binary(
+ "03040000C3DC"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/ThinkRaceProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/ThinkRaceProtocolDecoderTest.java
index a30d17502..39e7ed473 100644
--- a/src/test/java/org/traccar/protocol/ThinkRaceProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/ThinkRaceProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class ThinkRaceProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- ThinkRaceProtocolDecoder decoder = new ThinkRaceProtocolDecoder(null);
+ var decoder = new ThinkRaceProtocolDecoder(null);
verifyNull(decoder, binary(
"48415349483031343730303134382C8000100134363030303134363139363239343806FF"));
diff --git a/src/test/java/org/traccar/protocol/Tk102ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Tk102ProtocolDecoderTest.java
index f1ba7c593..2185fda29 100644
--- a/src/test/java/org/traccar/protocol/Tk102ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Tk102ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Tk102ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Tk102ProtocolDecoder decoder = new Tk102ProtocolDecoder(null);
+ var decoder = new Tk102ProtocolDecoder(null);
verifyNull(decoder, buffer(
"[\u00800000000000\u000821315452]"));
diff --git a/src/test/java/org/traccar/protocol/Tk103FrameDecoderTest.java b/src/test/java/org/traccar/protocol/Tk103FrameDecoderTest.java
index 1f42e588f..57df2ac5b 100644
--- a/src/test/java/org/traccar/protocol/Tk103FrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Tk103FrameDecoderTest.java
@@ -9,7 +9,7 @@ public class Tk103FrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Tk103FrameDecoder decoder = new Tk103FrameDecoder();
+ var decoder = new Tk103FrameDecoder();
verifyFrame(
binary("283836343735353535353535353535352C445733422C3133313131372C412C353536322E30323837304E2C30313334382E3038313934452C312E3539372C3232333730372C3239312E36352C2D302E31302C3429"),
diff --git a/src/test/java/org/traccar/protocol/Tk103ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Tk103ProtocolDecoderTest.java
index 106a24375..321d0cb50 100644
--- a/src/test/java/org/traccar/protocol/Tk103ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Tk103ProtocolDecoderTest.java
@@ -9,7 +9,10 @@ public class Tk103ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Tk103ProtocolDecoder decoder = new Tk103ProtocolDecoder(null);
+ var decoder = new Tk103ProtocolDecoder(null);
+
+ verifyPosition(decoder, text(
+ "(868822040452227,DW3B,150421,A,4154.51607N,45.78950E,0.050,103142,0.000,595.200,7,0)"));
verifyPosition(decoder, text(
"(086375304593BR00210119A2220.0160N11335.4073E0000014000309.84001000293L0000015FP23BS27F)"));
diff --git a/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java
index 82e0e0d88..c34674128 100644
--- a/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeOutputControl() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+ var encoder = new Tk103ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -25,7 +25,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeEngineStop() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+ var encoder = new Tk103ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -38,7 +38,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionSingle() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+ var encoder = new Tk103ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -51,7 +51,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionPeriodic() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+ var encoder = new Tk103ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -65,7 +65,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionStop() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+ var encoder = new Tk103ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -78,7 +78,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeGetVersion() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+ var encoder = new Tk103ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -91,7 +91,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeRebootDevice() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+ var encoder = new Tk103ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -104,7 +104,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeSetOdometer() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+ var encoder = new Tk103ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -117,7 +117,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionSingleAlternative() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
+ var encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -130,7 +130,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionPeriodicAlternative() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
+ var encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -143,7 +143,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionStopAlternative() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
+ var encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -156,7 +156,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeGetVersionAlternative() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
+ var encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -169,7 +169,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeRebootDeviceAlternative() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
+ var encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -182,7 +182,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeIdentificationAlternative() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
+ var encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -195,7 +195,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeSosOnAlternative() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
+ var encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -209,7 +209,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeSosOffAlternative() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
+ var encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -223,7 +223,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeCustom() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+ var encoder = new Tk103ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -237,7 +237,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeCustomAlternative() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
+ var encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -251,7 +251,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeSetConnectionAlternative() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
+ var encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -266,7 +266,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeSosNumberAlternative() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
+ var encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
index 216e65a5d..b747fa960 100644
--- a/src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
@@ -9,7 +9,19 @@ public class Tlt2hProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Tlt2hProtocolDecoder decoder = new Tlt2hProtocolDecoder(null);
+ var decoder = new Tlt2hProtocolDecoder(null);
+
+ verifyNull(decoder, text(
+ "#860517049471362#MT700#0000#AUTO#1\r\n",
+ "#36$GPRMC,,V,,,,,,,,,,A*5C\r\n"));
+
+ verifyPositions(decoder, text(
+ "#867198059727390#MT700#0000#AUTO#1\r\n",
+ "#38$GPRMC,105721.00,A,2238.3071,N,11401.7575,E,,96.70,250321,,,A*74\r\n"));
+
+ verifyPositions(decoder, false, text(
+ "#867198059727390#MT700#0000#AUTO#1\r\n",
+ "#40$WIFI,123532.00,A,-62,D8325A0ABADD,-64,EC172F8965BC,-64,7405A5D457D4,260321*07\r\n"));
verifyPositions(decoder, text(
"#860425040088567#MT600+#0000#0#1#129#40#0#AUTOLOW#1\r\n",
diff --git a/src/test/java/org/traccar/protocol/TlvProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TlvProtocolDecoderTest.java
index 0aaf567e8..54d66dac9 100644
--- a/src/test/java/org/traccar/protocol/TlvProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TlvProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class TlvProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TlvProtocolDecoder decoder = new TlvProtocolDecoder(null);
+ var decoder = new TlvProtocolDecoder(null);
verifyNull(decoder, binary(
"30430f383630323437303330303934333931ff10393233323132323030303834353433340f533636385f415f56312e30315f454eff1130303a30433a45373a30303a30303a30300132"));
diff --git a/src/test/java/org/traccar/protocol/TmgFrameDecoderTest.java b/src/test/java/org/traccar/protocol/TmgFrameDecoderTest.java
index c351b7775..886470745 100644
--- a/src/test/java/org/traccar/protocol/TmgFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TmgFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class TmgFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TmgFrameDecoder decoder = new TmgFrameDecoder();
+ var decoder = new TmgFrameDecoder();
verifyNull(
decoder.decode(null, null, binary("2424242424")));
diff --git a/src/test/java/org/traccar/protocol/TmgProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TmgProtocolDecoderTest.java
index 5df2378d9..722df5306 100644
--- a/src/test/java/org/traccar/protocol/TmgProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TmgProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class TmgProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TmgProtocolDecoder decoder = new TmgProtocolDecoder(null);
+ var decoder = new TmgProtocolDecoder(null);
verifyPosition(decoder, text(
"$loc,869309013800417,08032014,094459,1,2826.1956,N,07659.7690,E,0.0,2.5,4441,31,6,95,1,LLLL,NNTN,HH,0.15,0.26,HR38AU1389,0,SW0.1a"));
diff --git a/src/test/java/org/traccar/protocol/TopflytechProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TopflytechProtocolDecoderTest.java
index 666a48bfa..dbc7210e0 100644
--- a/src/test/java/org/traccar/protocol/TopflytechProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TopflytechProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class TopflytechProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TopflytechProtocolDecoder decoder = new TopflytechProtocolDecoder(null);
+ var decoder = new TopflytechProtocolDecoder(null);
verifyPosition(decoder, text(
"(880316890094910BP00XG00b600000000L00074b54S00000000R0C0F0014000100f0130531152205A0706.1395S11024.0965E000.0251.25"));
diff --git a/src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java
index 8320b1388..8f5b5ebbb 100644
--- a/src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class TopinProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TopinProtocolDecoder decoder = new TopinProtocolDecoder(null);
+ var decoder = new TopinProtocolDecoder(null);
verifyNull(decoder, binary(
"787801080D0A"));
@@ -16,6 +16,12 @@ public class TopinProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"78780d0103593390754169634d0d0a"));
+ verifyAttributes(decoder, binary(
+ "78780A13424008196400041F000D0A"));
+
+ verifyPosition(decoder, binary(
+ "78781510120B05030D2498038077200BE2078F0034000102030D0A"));
+
verifyPosition(decoder, binary(
"7878200813081A0733211608C8D1710DED1D1608DFFB710E06D51039050100286489000D0A"));
diff --git a/src/test/java/org/traccar/protocol/TotemFrameDecoderTest.java b/src/test/java/org/traccar/protocol/TotemFrameDecoderTest.java
index 8fb5f8d54..95949c51b 100644
--- a/src/test/java/org/traccar/protocol/TotemFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TotemFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class TotemFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TotemFrameDecoder decoder = new TotemFrameDecoder();
+ var decoder = new TotemFrameDecoder();
verifyFrame(
binary("24243030323542423836323031303033373239343836313345"),
diff --git a/src/test/java/org/traccar/protocol/TotemProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TotemProtocolDecoderTest.java
index fa56797be..e16774782 100644
--- a/src/test/java/org/traccar/protocol/TotemProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TotemProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class TotemProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TotemProtocolDecoder decoder = new TotemProtocolDecoder(null);
+ var decoder = new TotemProtocolDecoder(null);
verifyPosition(decoder, text(
"$$0112E5864606045334223|201112223514,-68.923106,-22.455926,$Cloud,1738,621,730,12100,0,0,255,0,40,40,0,0,255,|13"));
diff --git a/src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java
index d8c54afbe..51e5bac92 100644
--- a/src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class TotemProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- TotemProtocolEncoder encoder = new TotemProtocolEncoder(null);
+ var encoder = new TotemProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(2);
diff --git a/src/test/java/org/traccar/protocol/Tr20ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Tr20ProtocolDecoderTest.java
index 76355066b..def280b04 100644
--- a/src/test/java/org/traccar/protocol/Tr20ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Tr20ProtocolDecoderTest.java
@@ -8,7 +8,10 @@ public class Tr20ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Tr20ProtocolDecoder decoder = new Tr20ProtocolDecoder(null);
+ var decoder = new Tr20ProtocolDecoder(null);
+
+ verifyPosition(decoder, text(
+ "%%TR20GRANT,L,210602170135,N0951.1733W08356.7672,000,000,C80:F0,00020008,108,CFG:6980.00|"));
verifyPosition(decoder, text(
"%%123456789012345,A,120101121800,N6000.0000E13000.0000,0,000,0,01034802,150,[Message]"));
diff --git a/src/test/java/org/traccar/protocol/Tr900ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Tr900ProtocolDecoderTest.java
index 92fe0da29..d3d35b356 100644
--- a/src/test/java/org/traccar/protocol/Tr900ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Tr900ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Tr900ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Tr900ProtocolDecoder decoder = new Tr900ProtocolDecoder(null);
+ var decoder = new Tr900ProtocolDecoder(null);
verifyPosition(decoder, text(
">00001001,4,1,150626,131252,W05830.2978,S3137.2783,,00,348,18,00,003-000,0,3,11111011*3b!"),
diff --git a/src/test/java/org/traccar/protocol/TrackboxProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TrackboxProtocolDecoderTest.java
index e83824fb4..caac520e1 100644
--- a/src/test/java/org/traccar/protocol/TrackboxProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TrackboxProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class TrackboxProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TrackboxProtocolDecoder decoder = new TrackboxProtocolDecoder(null);
+ var decoder = new TrackboxProtocolDecoder(null);
verifyNull(decoder, text(
"a=connect&v=11&i=111111111111111"));
diff --git a/src/test/java/org/traccar/protocol/TrakMateProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TrakMateProtocolDecoderTest.java
index 4352fc935..ef99527d7 100644
--- a/src/test/java/org/traccar/protocol/TrakMateProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TrakMateProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class TrakMateProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TrakMateProtocolDecoder decoder = new TrakMateProtocolDecoder(null);
+ var decoder = new TrakMateProtocolDecoder(null);
verifyPosition(decoder, text(
"^TMSTP|352984083995323|116|13.07809|77.55979|131508|131118|0.0|146.51|7|0|71 -2 248|0|13.1|0.0|10.5|1|0|0|0|#"));
diff --git a/src/test/java/org/traccar/protocol/TramigoFrameDecoderTest.java b/src/test/java/org/traccar/protocol/TramigoFrameDecoderTest.java
index f482a00bb..80e6a6e81 100644
--- a/src/test/java/org/traccar/protocol/TramigoFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TramigoFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class TramigoFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TramigoFrameDecoder decoder = new TramigoFrameDecoder();
+ var decoder = new TramigoFrameDecoder();
verifyFrame(
binary("8000ed2bb0009c000101bee000050b09633d925b5472616d69676f3a205472697020737461727465642c2053686f636b2053656e736f722c206174204b696e6720437265656b20526f61642d46726565746f776e205374726565742c20506f727420486172636f7572742c205269766572732c204e472c20342e37363336312c20372e30313836382c2030373a31383a333620536570203320454f46"),
diff --git a/src/test/java/org/traccar/protocol/TramigoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TramigoProtocolDecoderTest.java
index d35c5c54e..8b556b356 100644
--- a/src/test/java/org/traccar/protocol/TramigoProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TramigoProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class TramigoProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TramigoProtocolDecoder decoder = new TramigoProtocolDecoder(null);
+ var decoder = new TramigoProtocolDecoder(null);
verifyAttributes(decoder, binary(
"8000c426b000a6000101c557037598050d5c8a595472616d69676f3a204d6f76696e672c20302e3132206b6d2045206f66204c617275742054696e2049736c616d6963205072696d617279205363686f6f6c2c2054616970696e672c20506572616b2c204d592c20342e38333134392c203130302e37333038352c204e572077697468207370656564203130206b6d2f682c2030303a34393a30382041756720392020454f46"));
diff --git a/src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java
index aceb9e122..44735abcb 100644
--- a/src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class TrvProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TrvProtocolDecoder decoder = new TrvProtocolDecoder(null);
+ var decoder = new TrvProtocolDecoder(null);
verifyNull(decoder, text(
"TRVAP00352121088015548"));
diff --git a/src/test/java/org/traccar/protocol/Tt8850ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Tt8850ProtocolDecoderTest.java
index e3833bcc7..5d0e86a3f 100644
--- a/src/test/java/org/traccar/protocol/Tt8850ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Tt8850ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Tt8850ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Tt8850ProtocolDecoder decoder = new Tt8850ProtocolDecoder(null);
+ var decoder = new Tt8850ProtocolDecoder(null);
verifyPosition(decoder, text(
"\u0000\u0004,007F,0,GTFRI,020102,867844000667538,4142726856,0,0,1,3,1.6,0,997.3,-66.830786,10.483394,20171212171418,0734,0004,041A,4220,69,20171212171657,FF61"));
diff --git a/src/test/java/org/traccar/protocol/TytanProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TytanProtocolDecoderTest.java
index ed75cee38..1cab0f8b1 100644
--- a/src/test/java/org/traccar/protocol/TytanProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TytanProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class TytanProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TytanProtocolDecoder decoder = new TytanProtocolDecoder(null);
+ var decoder = new TytanProtocolDecoder(null);
verifyPositions(decoder, binary(
"B500192000001405125652CA9B1A325FC98D11A9990018020118FC0D"));
diff --git a/src/test/java/org/traccar/protocol/TzoneProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TzoneProtocolDecoderTest.java
index f90497292..0aeea0f1a 100644
--- a/src/test/java/org/traccar/protocol/TzoneProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TzoneProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class TzoneProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- TzoneProtocolDecoder decoder = new TzoneProtocolDecoder(null);
+ var decoder = new TzoneProtocolDecoder(null);
verifyAttributes(decoder, binary(
"545A004B2424041302000000086706003324776413030C0A1A2900180513030C0A1A25080F7E1028CAC830000A000F0000000005000AA53201633D05046000010009AA201737019408973B0032B0260D0A"));
diff --git a/src/test/java/org/traccar/protocol/UlbotechFrameDecoderTest.java b/src/test/java/org/traccar/protocol/UlbotechFrameDecoderTest.java
index 31e748f27..77afbb50f 100644
--- a/src/test/java/org/traccar/protocol/UlbotechFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/UlbotechFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class UlbotechFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- UlbotechFrameDecoder decoder = new UlbotechFrameDecoder();
+ var decoder = new UlbotechFrameDecoder();
verifyFrame(
binary("f8010103515810532780699f7e2e3f010e015ee4c906bde45c00000000008b0304004000000404002c776005060373193622110b00240b00fee8ffff807dffff606d0b00fee9af000000af0000000b00feee7d78807dffffffff100101cc2af8"),
diff --git a/src/test/java/org/traccar/protocol/UlbotechProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/UlbotechProtocolDecoderTest.java
index a2bc1b46e..b7c6d2d45 100644
--- a/src/test/java/org/traccar/protocol/UlbotechProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/UlbotechProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class UlbotechProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- UlbotechProtocolDecoder decoder = new UlbotechProtocolDecoder(null);
+ var decoder = new UlbotechProtocolDecoder(null);
verifyPosition(decoder, binary(
"f801010353323083177450a703f6f0010efe55a31a0923d01400050070007003040a42000004040070cca00506039b1876220f060800000000000000000725310553410c0c9e310d05310f4641100440311119411f00476101810f8000310487411f00480804203a14c009033320159310f8"));
diff --git a/src/test/java/org/traccar/protocol/UlbotechProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/UlbotechProtocolEncoderTest.java
new file mode 100644
index 000000000..288f8dc70
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/UlbotechProtocolEncoderTest.java
@@ -0,0 +1,23 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+import org.traccar.model.Command;
+
+public class UlbotechProtocolEncoderTest extends ProtocolTest {
+
+ @Test
+ public void testEncode() {
+
+ var encoder = new UlbotechProtocolEncoder(null);
+
+ Command command = new Command();
+ command.setDeviceId(1);
+ command.setType(Command.TYPE_CUSTOM);
+ command.set(Command.KEY_DATA, "UNO;13912345678");
+
+ verifyCommand(encoder, command, buffer("*TS01,UNO;13912345678#"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java
index e758725f2..0369f47ed 100644
--- a/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class UproProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- UproProtocolDecoder decoder = new UproProtocolDecoder(null);
+ var decoder = new UproProtocolDecoder(null);
verifyPosition(decoder, buffer(
"*HQ201861909268000132,BA&A1820223307024309650492530000311019&B0100000000&F0000&V0036&R0500&J000182&M0052&W00000091&I231026027BD39090827BD5ACA04&X(501E0)(B0000)(E0136)(J01E0)(L3)(k8937204016201240376F)&K00200&T85&N01#"));
diff --git a/src/test/java/org/traccar/protocol/UuxProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/UuxProtocolDecoderTest.java
new file mode 100644
index 000000000..203ff2492
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/UuxProtocolDecoderTest.java
@@ -0,0 +1,18 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class UuxProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ var decoder = new UuxProtocolDecoder(null);
+
+ verifyAttributes(decoder, binary(
+ "81918c2d9e31395533443630363631041c0c16043030313030300007000000000000000000000000000000000000000000"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/V680ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/V680ProtocolDecoderTest.java
index e3761c3ef..59b6dbea9 100644
--- a/src/test/java/org/traccar/protocol/V680ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/V680ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class V680ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- V680ProtocolDecoder decoder = new V680ProtocolDecoder(null);
+ var decoder = new V680ProtocolDecoder(null);
verifyPosition(decoder, text(
"#867967020910610#01234567890#1#0000#AUT#1#0500000000120000#114.036291,E,22.665795,N,111.00,000.00#111116#193333##"),
diff --git a/src/test/java/org/traccar/protocol/VisiontekProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/VisiontekProtocolDecoderTest.java
index 11596945e..b079346c9 100644
--- a/src/test/java/org/traccar/protocol/VisiontekProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/VisiontekProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class VisiontekProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- VisiontekProtocolDecoder decoder = new VisiontekProtocolDecoder(null);
+ var decoder = new VisiontekProtocolDecoder(null);
verifyPosition(decoder, text(
"$1,117,28,01,16,15,05,48,1725.0518N,07824.5298E,0620,11,0,185,2062,0,0,0,1,1,1,1,24,00.0000,00.3740,00.0000,VAJRA V1.00,A"));
diff --git a/src/test/java/org/traccar/protocol/VnetProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/VnetProtocolDecoderTest.java
index 3281aae34..d43176a45 100644
--- a/src/test/java/org/traccar/protocol/VnetProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/VnetProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class VnetProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- VnetProtocolDecoder decoder = new VnetProtocolDecoder(null);
+ var decoder = new VnetProtocolDecoder(null);
verifyNull(decoder, binary(
"24240000140029111909062986818303379282604c452e322e30302ea32b020f0000d3552323"));
diff --git a/src/test/java/org/traccar/protocol/Vt200FrameDecoderTest.java b/src/test/java/org/traccar/protocol/Vt200FrameDecoderTest.java
index 9422f6d74..91cc3d317 100644
--- a/src/test/java/org/traccar/protocol/Vt200FrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Vt200FrameDecoderTest.java
@@ -8,7 +8,7 @@ public class Vt200FrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Vt200FrameDecoder decoder = new Vt200FrameDecoder();
+ var decoder = new Vt200FrameDecoder();
verifyFrame(
binary("28631037309456208400340102dc0906171616454415760201144494473f920a0c0000030500200100417c1f383a9d1090510000006a00007000000e00180ee129"),
diff --git a/src/test/java/org/traccar/protocol/Vt200ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Vt200ProtocolDecoderTest.java
index 1b492b40a..791751c27 100644
--- a/src/test/java/org/traccar/protocol/Vt200ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Vt200ProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class Vt200ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Vt200ProtocolDecoder decoder = new Vt200ProtocolDecoder(null);
+ var decoder = new Vt200ProtocolDecoder(null);
verifyPosition(decoder, binary(
"28192030961807208200210101b919011818375801245774036424612500160917000003aa008800007b00aa3429"));
diff --git a/src/test/java/org/traccar/protocol/VtfmsFrameDecoderTest.java b/src/test/java/org/traccar/protocol/VtfmsFrameDecoderTest.java
index a5eb0b49b..c03511160 100644
--- a/src/test/java/org/traccar/protocol/VtfmsFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/VtfmsFrameDecoderTest.java
@@ -10,7 +10,7 @@ public class VtfmsFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- VtfmsFrameDecoder decoder = new VtfmsFrameDecoder();
+ var decoder = new VtfmsFrameDecoder();
assertEquals(
buffer("(863071010087648,0HK44,00,000,14,2,9,,A,114946,180313,11.0244,076.9768,282,000,00000,00000,K,0000128,1,12.8,,200,2.501,,4.001,0,0,0,0,0,0,0,,)105"),
diff --git a/src/test/java/org/traccar/protocol/VtfmsProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/VtfmsProtocolDecoderTest.java
index ede5dc7ac..1d4fa7f21 100644
--- a/src/test/java/org/traccar/protocol/VtfmsProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/VtfmsProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class VtfmsProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- VtfmsProtocolDecoder decoder = new VtfmsProtocolDecoder(null);
+ var decoder = new VtfmsProtocolDecoder(null);
verifyPosition(decoder, text(
"(861359037432331,0EF87,00,0,21,2,01,,A,154559,230119,1101.4046,07656.3859,241,000,00078,00000,K,0000812,1,12.7,,,,,,1,0,0,0,1,1,1,+919566531111*+919994462226,)054"),
diff --git a/src/test/java/org/traccar/protocol/WatchFrameDecoderTest.java b/src/test/java/org/traccar/protocol/WatchFrameDecoderTest.java
index 4e40eea86..91bccb4c0 100644
--- a/src/test/java/org/traccar/protocol/WatchFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/WatchFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class WatchFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- WatchFrameDecoder decoder = new WatchFrameDecoder();
+ var decoder = new WatchFrameDecoder();
verifyFrame(
binary("5b33472a3335323636313039303134333135302a303030412a4c4b2c302c302c3130305d"),
diff --git a/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java
index 260a1ff8d..ddfc8e619 100644
--- a/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java
@@ -13,7 +13,7 @@ public class WatchProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- WatchProtocolDecoder decoder = new WatchProtocolDecoder(null);
+ var decoder = new WatchProtocolDecoder(null);
verifyPosition(decoder, buffer(
"[3G*358839237678820*0122*ALCUSTOMER1,251120,081821,V,0.0,N,0.0,E,2.58,317.462,35.147,14,100,2,11089,0,00100008,1,1,460,01,42308,101992452,100,5,shizhou1,44:56:e2:03:ea:2a,-69,FART3,30:0d:9e:bb:fa:4d,-70,ZKY-A209,88:c3:97:c1:f4:7f,-73,ChinaNet-HNeD,e8:84:c6:21:7c:dc,-77,,30:45:96:10:14:5d,-79,1.2035439]"));
@@ -127,7 +127,7 @@ public class WatchProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeVoiceMessage() throws Exception {
- WatchProtocolDecoder decoder = new WatchProtocolDecoder(null);
+ var decoder = new WatchProtocolDecoder(null);
verifyNull(decoder.decode(null, null, buffer("[CS*1234567890*0004*TK,1]")));
diff --git a/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java
index a4a795050..bcfc8df41 100644
--- a/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java
@@ -9,7 +9,7 @@ public class WatchProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- WatchProtocolEncoder encoder = new WatchProtocolEncoder(null);
+ var encoder = new WatchProtocolEncoder(null);
Command command;
@@ -60,7 +60,7 @@ public class WatchProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeTimezone() {
- WatchProtocolEncoder encoder = new WatchProtocolEncoder(null);
+ var encoder = new WatchProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/WialonProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/WialonProtocolDecoderTest.java
index 72e56fb44..7387f5325 100644
--- a/src/test/java/org/traccar/protocol/WialonProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/WialonProtocolDecoderTest.java
@@ -8,11 +8,14 @@ public class WialonProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- WialonProtocolDecoder decoder = new WialonProtocolDecoder(null);
+ var decoder = new WialonProtocolDecoder(null);
verifyNull(decoder, text(
"#L#2.0;42001300083;;CE45"));
+ verifyAttributes(decoder, text(
+ "#D#120319;112003;NA;NA;NA;NA;0.000;NA;NA;0;NA;NA;NA;NA;NA;101_521347:1:521246,101_158:1:510,101_521055:1:510,101_521055_2.9:1:509,101_521056:1:3;626B"));
+
verifyNull(decoder, text(
"#L#123456789012345;test"));
diff --git a/src/test/java/org/traccar/protocol/WliFrameDecoderTest.java b/src/test/java/org/traccar/protocol/WliFrameDecoderTest.java
index 48380738e..2e0d86a61 100644
--- a/src/test/java/org/traccar/protocol/WliFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/WliFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class WliFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- WliFrameDecoder decoder = new WliFrameDecoder();
+ var decoder = new WliFrameDecoder();
verifyFrame(
binary("0231000101bba758c900010034000500ff001001258fc9013e80ed00001183350101e20006003200090030000a0032000b003331000c0031000d00343438000e003530000f003100100031303800130032001b003134001c0033392c33352c32382c33382c34302c33372c33332c33382c33352c34322c33372c3335001d003130001e0038002300343235002400303100250031303432320026003336343733002700323800280037002900312c312c312c312c31302e3232352e3135312e3230342c36353533352c302c39392c39392c3235352c3235352c3235352c323535002a0030002c0030003000300032003000330031003400ff001c0214130502061b0101258fc9013e80ed000001e2000000000000004d004500302c323031392f30352f30322c30363a33333a30302c323031392f30352f30322c30363a32363a3230005a003000f100352c302c342c302c2d312c2d3100f2003300f3003100f50038363634323530333137303639323400f600312c302c302c3431322c3000f70038343437373200f80032312c31312c302c302c302c302c2c2c2c2c2c302c3000f9003300fa00393100fb0032313100fc0032313000ff00313535363737383533340003"),
diff --git a/src/test/java/org/traccar/protocol/WliProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/WliProtocolDecoderTest.java
index 642201222..6f86a9fd9 100644
--- a/src/test/java/org/traccar/protocol/WliProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/WliProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class WliProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- WliProtocolDecoder decoder = new WliProtocolDecoder(null);
+ var decoder = new WliProtocolDecoder(null);
verifyNull(decoder, binary(
"0232776c693a30343930333332303332343103"));
diff --git a/src/test/java/org/traccar/protocol/WondexFrameDecoderTest.java b/src/test/java/org/traccar/protocol/WondexFrameDecoderTest.java
index 642473f2d..85a878aef 100644
--- a/src/test/java/org/traccar/protocol/WondexFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/WondexFrameDecoderTest.java
@@ -11,7 +11,7 @@ public class WondexFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- WondexFrameDecoder decoder = new WondexFrameDecoder();
+ var decoder = new WondexFrameDecoder();
assertNull(
decoder.decode(null, null, binary("f0d70b0001ca9a3b")));
diff --git a/src/test/java/org/traccar/protocol/WondexProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/WondexProtocolDecoderTest.java
index b51ca03f3..111cc9fbe 100644
--- a/src/test/java/org/traccar/protocol/WondexProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/WondexProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class WondexProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- WondexProtocolDecoder decoder = new WondexProtocolDecoder(null);
+ var decoder = new WondexProtocolDecoder(null);
verifyPosition(decoder, buffer(
"2005010051,19990925063830,26.106181,44.440225,0,0,0,7,2,0.0,0,,,0"));
diff --git a/src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java
index 41fee2723..ed0af844e 100644
--- a/src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java
@@ -10,7 +10,7 @@ public class WondexProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- WondexProtocolEncoder encoder = new WondexProtocolEncoder(null);
+ var encoder = new WondexProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(2);
diff --git a/src/test/java/org/traccar/protocol/WristbandProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/WristbandProtocolDecoderTest.java
index 5635ce3d4..10381168e 100644
--- a/src/test/java/org/traccar/protocol/WristbandProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/WristbandProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class WristbandProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- WristbandProtocolDecoder decoder = new WristbandProtocolDecoder(null);
+ var decoder = new WristbandProtocolDecoder(null);
verifyNotNull(decoder, binary(
"000102004459583836383730343034343735303035357c56312e307c317c7b4630342331382c30372c332c3539303139322c33303a31382c30372c332c3539303139322c33307d0d0afffefc"));
diff --git a/src/test/java/org/traccar/protocol/XexunFrameDecoderTest.java b/src/test/java/org/traccar/protocol/XexunFrameDecoderTest.java
index b91cd0ebf..43b8bdc0e 100644
--- a/src/test/java/org/traccar/protocol/XexunFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/XexunFrameDecoderTest.java
@@ -8,7 +8,7 @@ public class XexunFrameDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- XexunFrameDecoder decoder = new XexunFrameDecoder();
+ var decoder = new XexunFrameDecoder();
verifyFrame(
binary("4750524d432c3230353933352e3030302c412c353134302e343335302c4e2c3530312e303638362c452c302e30302c302e30302c3132313031352c30302c303030302e302c412a37302c462c2c696d65693a3335393538373031343731383339322c"),
diff --git a/src/test/java/org/traccar/protocol/XexunProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/XexunProtocolDecoderTest.java
index 8b0f245a2..d2caa9c55 100644
--- a/src/test/java/org/traccar/protocol/XexunProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/XexunProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class XexunProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- XexunProtocolDecoder decoder = new XexunProtocolDecoder(null, false);
+ var decoder = new XexunProtocolDecoder(null, false);
verifyAttributes(decoder, text(
"GPRMC,.000,A,0.000000,S,0.0000,W,0.00,0.00,,00,0000.0,A*55,L,,imei:353579010727036,"));
diff --git a/src/test/java/org/traccar/protocol/XirgoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/XirgoProtocolDecoderTest.java
index d85364d22..f3a56a79d 100644
--- a/src/test/java/org/traccar/protocol/XirgoProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/XirgoProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class XirgoProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeCustom() throws Exception {
- XirgoProtocolDecoder decoder = new XirgoProtocolDecoder(null);
+ var decoder = new XirgoProtocolDecoder(null);
decoder.setForm("UID,EV,D,T,LT,LN,AL,GSPT,HD,SV,HP,BV,CQ,GS,SI,IG,OT");
@@ -31,7 +31,7 @@ public class XirgoProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeNew() throws Exception {
- XirgoProtocolDecoder decoder = new XirgoProtocolDecoder(null);
+ var decoder = new XirgoProtocolDecoder(null);
verifyPosition(decoder, text(
"$$352054058132185,4001,2017/04/21,00:01:05,32.54659,-116.90670,143.2,0,0,0,598,0.0,12,0.9,765840,7.0,14.5,19,1,1,0011,8.5,63.2,5,21999,184,255,671,207,100,185##"));
@@ -59,7 +59,7 @@ public class XirgoProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecodeOld() throws Exception {
- XirgoProtocolDecoder decoder = new XirgoProtocolDecoder(null);
+ var decoder = new XirgoProtocolDecoder(null);
verifyPosition(decoder, text(
"$$354660046140722,6001,2013/01/22,15:36:18,25.80907,-80.32531,7.1,19,165.2,11,0.8,11.1,17,1,1,3.9,2##"),
diff --git a/src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java
index 0ff47cad3..4f01aa72b 100644
--- a/src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class XirgoProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- XirgoProtocolEncoder encoder = new XirgoProtocolEncoder(null);
+ var encoder = new XirgoProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/Xrb28ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Xrb28ProtocolDecoderTest.java
index 20adacd6b..3197ba854 100644
--- a/src/test/java/org/traccar/protocol/Xrb28ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Xrb28ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Xrb28ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Xrb28ProtocolDecoder decoder = new Xrb28ProtocolDecoder(null);
+ var decoder = new Xrb28ProtocolDecoder(null);
verifyAttributes(decoder, text(
"*SCOR,OM,123456789123456,Q0,412,80,28#"));
diff --git a/src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java
index 27efbd6db..357da8f7b 100644
--- a/src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class Xrb28ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionPeriodic() {
- Xrb28ProtocolEncoder encoder = new Xrb28ProtocolEncoder(null);
+ var encoder = new Xrb28ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -25,7 +25,7 @@ public class Xrb28ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeCustom() {
- Xrb28ProtocolEncoder encoder = new Xrb28ProtocolEncoder(null);
+ var encoder = new Xrb28ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/Xt013ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Xt013ProtocolDecoderTest.java
index aa44929ab..f8ddd35c3 100644
--- a/src/test/java/org/traccar/protocol/Xt013ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Xt013ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Xt013ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Xt013ProtocolDecoder decoder = new Xt013ProtocolDecoder(null);
+ var decoder = new Xt013ProtocolDecoder(null);
verifyPosition(decoder, text(
"TK,862950021650364,150131090859,+53.267863,+5.767363,0,38,12,0,F,204,08,C94,336C,24,,4.09,1,,,,,,,,"),
diff --git a/src/test/java/org/traccar/protocol/Xt2400ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Xt2400ProtocolDecoderTest.java
index 6d49f2516..9562a75e2 100644
--- a/src/test/java/org/traccar/protocol/Xt2400ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Xt2400ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Xt2400ProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- Xt2400ProtocolDecoder decoder = new Xt2400ProtocolDecoder(null);
+ var decoder = new Xt2400ProtocolDecoder(null);
decoder.setConfig("\n::wycfg pcr[1] 012801030405060708090a1213c8545657585a656e7d2cd055595d5e71797a7b7c7e7f80818285866b\n");
diff --git a/src/test/java/org/traccar/protocol/YwtProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/YwtProtocolDecoderTest.java
index 332d15fa5..1d29b1282 100644
--- a/src/test/java/org/traccar/protocol/YwtProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/YwtProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class YwtProtocolDecoderTest extends ProtocolTest {
@Test
public void testDecode() throws Exception {
- YwtProtocolDecoder decoder = new YwtProtocolDecoder(null);
+ var decoder = new YwtProtocolDecoder(null);
verifyPosition(decoder, text(
"%RP,1222102985:1,170509033842,E102.146563,N14.582175,,0,320,10,0,00-00-00-00-00-00-00-00-00-00-00-00,,1db2-02b3-52004,3>941.523-32,7>1,19>-16,20>30.9V"));