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
base: master
Are you sure you want to change the base?
Conversation
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?
To start with please clean up the formatting in the code. And also please provide the protocol documentation. |
Megastel Protocol v2.pdf Here are the Megastek Protocol and Command List documentation. |
Can I ask what you like to be cleaned up of the formatting? |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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() // |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
Improvements on MegastekProtocolDecoder decodeNew;
Added;
--
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?