aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MeiligaoProtocolEncoder.java
diff options
context:
space:
mode:
authorPhilipp Prangenberg <philipp.prangenberg@derkurier.de>2016-12-05 12:03:08 +0100
committerPhilipp Prangenberg <philipp.prangenberg@derkurier.de>2016-12-05 12:03:08 +0100
commita21f436a58133f7da0cae06366d729665f3b8f9c (patch)
tree72ff1743d96f79e4a9d85b0d48715e5f9aa67cf9 /src/org/traccar/protocol/MeiligaoProtocolEncoder.java
parent960bf899414d89221e92138fdb98777c3f4f73ec (diff)
parent40607036c5aa6385a7ae3f3a283bf107238a5944 (diff)
downloadtrackermap-server-a21f436a58133f7da0cae06366d729665f3b8f9c.tar.gz
trackermap-server-a21f436a58133f7da0cae06366d729665f3b8f9c.tar.bz2
trackermap-server-a21f436a58133f7da0cae06366d729665f3b8f9c.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/org/traccar/protocol/MeiligaoProtocolEncoder.java')
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolEncoder.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolEncoder.java b/src/org/traccar/protocol/MeiligaoProtocolEncoder.java
index 93399df60..268bae392 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolEncoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2015 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.model.Command;
import javax.xml.bind.DatatypeConverter;
import java.nio.charset.StandardCharsets;
-import java.util.Map;
public class MeiligaoProtocolEncoder extends BaseProtocolEncoder {
@@ -62,13 +61,12 @@ public class MeiligaoProtocolEncoder extends BaseProtocolEncoder {
protected Object encodeCommand(Command command) {
ChannelBuffer content = ChannelBuffers.dynamicBuffer();
- Map<String, Object> attributes = command.getAttributes();
switch (command.getType()) {
case Command.TYPE_POSITION_SINGLE:
return encodeContent(command.getDeviceId(), MSG_TRACK_ON_DEMAND, content);
case Command.TYPE_POSITION_PERIODIC:
- content.writeShort(((Number) attributes.get(Command.KEY_FREQUENCY)).intValue() / 10);
+ content.writeShort(command.getInteger(Command.KEY_FREQUENCY) / 10);
return encodeContent(command.getDeviceId(), MSG_TRACK_BY_INTERVAL, content);
case Command.TYPE_ENGINE_STOP:
content.writeByte(0x01);
@@ -77,10 +75,10 @@ public class MeiligaoProtocolEncoder extends BaseProtocolEncoder {
content.writeByte(0x00);
return encodeContent(command.getDeviceId(), MSG_OUTPUT_CONTROL, content);
case Command.TYPE_ALARM_GEOFENCE:
- content.writeShort(((Number) attributes.get(Command.KEY_RADIUS)).intValue());
+ content.writeShort(command.getInteger(Command.KEY_RADIUS));
return encodeContent(command.getDeviceId(), MSG_MOVEMENT_ALARM, content);
case Command.TYPE_SET_TIMEZONE:
- int offset = ((Number) attributes.get(Command.KEY_TIMEZONE)).intValue() / 60;
+ int offset = command.getInteger(Command.KEY_TIMEZONE) / 60;
content.writeBytes(String.valueOf(offset).getBytes(StandardCharsets.US_ASCII));
return encodeContent(command.getDeviceId(), MSG_TIME_ZONE, content);
case Command.TYPE_REBOOT_DEVICE: