Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Megastel Protocol - Exstended with WiFi data and Protocol Encoder #5134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hellenthal
Copy link

Improvements on MegastekProtocolDecoder decodeNew;

  • Added WifiAccessPoint (for LBS Geolocation).
  • BatteryLevel (percentage) was wrongly stored as battery what is battery voltage.
  • Satellite counts now all satellites (BDS, GPS and Glonass).
  • Belt status set to KEY_LOCK
  • A 'restart' was not covered, this will now trigger a ALARM_POWER_ON.
  • A 'detect water'. was not covered, this will now trigger a ALARM_FUEL_LEAK (most similar of all Alarm options)
  • Command Response messages (for new and old protocol) including for new protocol sending current timestamp back to the device on request (Q051;).

Added;

  • MegastekProtocolEncoder, for new and old protocol. New protocol has more SupportedDataCommands. With Custom Commands only need to enter the actual command and not the full message including device id. This part is only tested with the new protocol.

--
The old and the already existing new Megastek protocol in Traccar could perhaps better be divided up in two protocols? Megastek and Megastek2 like with Xexun and Xexun2 protocol?

Improvements on MegastekProtocolDecoder decodeNew;
- Added WifiAccessPoint (for LBS Geolocation).
- BatteryLevel (percentage) was wrongly stored as battery what is battery voltage.
- Satellite counts now all satellites (BDS, GPS and Glonass).
- Belt status set to KEY_LOCK
- A 'restart' was not covered, this will now trigger a ALARM_POWER_ON.
- A 'detect water'. was not covered, this will now trigger a ALARM_FUEL_LEAK (most similar of all Alarm options)
- Command Response messages (for new and old protocol) including for new protocol sending current timestamp back to the device on request (Q051;).

Added;
- MegastekProtocolEncoder, for new and old protocol. New protocol has more SupportedDataCommands. With Custom Commands only need to enter the actual command and not the full message including device id. This part is only tested with  the new protocol.

--
The old and the already existing new Megastek protocol in Traccar could perhaps better be divided up in two protocols? Megastek and Megastek2 like with Xexun and Xexun2 protocol?
@tananaev
Copy link
Member

To start with please clean up the formatting in the code. And also please provide the protocol documentation.

@hellenthal
Copy link
Author

Megastel Protocol v2.pdf
Megastek Command List v2.pdf

Here are the Megastek Protocol and Command List documentation.

@hellenthal
Copy link
Author

Can I ask what you like to be cleaned up of the formatting?
Except the Satellites part is everything taken over from other protocol class files.

Copy link
Member

@tananaev tananaev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of examples. You should run the check before pushing the code though. It will catch a log of these things.

private static final Pattern PATTERN_COMMAND_RESULT_OLD = new PatternBuilder()
.text("$") // start
.number("(d+),") // device id
.expression("(.*);") // command
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting is not right.

.number("(d+),") // device id
.expression("(.*);") // command
.number("xx") // checksum
.any() //
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this comment?

.expression("[^,]*,") // name
.expression("([RS]),")
.expression("[^,]*,") // device name
.expression("([RS]),") // R = Realtime data, S = Stored data
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. You shouldn't use tabs anywhere in the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants