Suntech decode issue

Mvv 5 years ago

Hi, I’m using traccar server.
Everything was ok, but when I set up an st940 I get an error for input string on suntechProtocolDecode method.
Does anyone know how to fix this error?
Thanks

Anton Tananaev 5 years ago

Logs?

Mvv 5 years ago
2020-10-29 16:50:49  INFO: [55a66c00: suntech < 187.237.25.96] HEX: 5354333030414c563b3930373530313735360d
2020-10-29 16:51:53  INFO: [6456cbb6: suntech < 187.237.25.97] HEX: 53543931303b4c6f636174696f6e3b3930373532373135333b3535323b32303230313032393b32323a35313a33313b373537643135663930343b2b31392e3634313135383b2d3039392e3232373033343b3030302e3134333b3030302e30303b313b3933353233333b3130303b313b303b313331320d
2020-10-29 16:51:53  WARN: [6456cbb6] error - For input string: "757d15f904" - NumberFormatException (... < SuntechProtocolDecoder:136 < *:697 < ExtendedObjectDecoder::51 < ... < WrapperContext:102 < ...)
2020-10-29 16:51:53  INFO: [6456cbb6] disconnected
Anton Tananaev 5 years ago

What's your server version? Did you make any config changes?

Mvv 5 years ago

is the 4.10. I did, but only on traccar.xml on database connection. I´m using mysql

Mvv 5 years ago

I realized this parameter has this structure CELL ID (4 hex digits), Location Code (4 hex digits) And Serving Cell 2 dec digits.
this parameter is called CELL on the st940 manual

Anton Tananaev 5 years ago

You need to set suntech.protocolType to 1 in the config or device attributes.

Mvv 5 years ago

Ok. How can i do that?

Anton Tananaev 5 years ago

Read documentation.

Mvv 5 years ago

I have read the documentation, but I didn’t see protocolType parameter. Can you please give me a new lead to get this done?

Anton Tananaev 5 years ago

This is what you need:

<entry key='suntech.protocolType'>1</entry>
Mvv 5 years ago

I did the change and it worked. You’re the man Anton

Ferreira 4 years ago

Great, with the link you sent I was analyzing and I believe it may be at this point in the code but I can't identify.

For support would it be an email reporting the problem like here and will the hours be calculated with value?

case "UEX":
                int remaining = Integer.parseInt(values[index++]);
                double totalFuel = 0;
                while (remaining > 0) {
                    String attribute = values[index++];
                    if (attribute.startsWith("CabAVL")) {
                        String[] data = attribute.split(",");
                        double fuel1 = Double.parseDouble(data[2]);
                        if (fuel1 > 0) {
                            totalFuel += fuel1;
                            position.set("fuel1", fuel1);
                        }
                        double fuel2 = Double.parseDouble(data[3]);
                        if (fuel2 > 0) {
                            totalFuel += fuel2;
                            position.set("fuel2", fuel2);
                        }
                    } else if (attribute.startsWith("GTSL")) {
                        position.set(Position.KEY_DRIVER_UNIQUE_ID, attribute.split("\\|")[4]);
                    } else if (attribute.contains("=")) {
                        String[] pair = attribute.split("=");
                        if (pair.length >= 2) {
                            String value = pair[1].trim();
                            if (value.contains(".")) {
                                value = value.substring(0, value.indexOf('.'));
                            }
                            switch (pair[0].charAt(0)) {
                                case 't':
                                    position.set(Position.PREFIX_TEMP + pair[0].charAt(2), Integer.parseInt(value, 16));
                                    break;
                                case 'N':
                                    int fuel = Integer.parseInt(value, 16);
                                    totalFuel += fuel;
                                    position.set("fuel" + pair[0].charAt(2), fuel);
                                    break;
                                case 'Q':
                                    position.set("drivingQuality", Integer.parseInt(value, 16));
                                    break;
                                default:
                                    break;
                            }
                        }
                    } else {
                        position.set("serial", attribute);
                    }
                    remaining -= attribute.length() + 1;
                }
                if (totalFuel > 0) {
                    position.set(Position.KEY_FUEL_LEVEL, totalFuel);
                }
                index += 1; // checksum
                break;
            default:
                break;
        }
Anton Tananaev 4 years ago

If you're interested in paid support, send an email.

estebanmg 3 years ago

What exactly does the next config changes? couldn't find any documentation about it.

Will it affect newer suntech devices if activated? where can I find more info about this config?

<entry key='suntech.protocolType'>1</entry>