ultrasonic fuel sensor integrate

lumuna 2 years ago

Hello everyone, I acquired a TUB-002 sensor which works with an Ulbotech T381 tracker. I see the data on the configurator but my devices do not send anything to traccar can anyone help me to integrate it thank you

Anton Tananaev 2 years ago

Why is this under the server forum? Do you think it's a server issue?

lumuna 2 years ago

the tracers retrieve the information but on the server I cannot find this information. the manufacturer recommends that I see how to integrate it into the server

Anton Tananaev 2 years ago

Do you have the protocol documentation?

lumuna 2 years ago

I use an ulbotech protocol the manufacturer gives me this for adding the sensor.
I use windows can you make this expression simple for me thank you

 private void decodeAdc(Position position, ByteBuf buf, int length) {
        for (int i = 0; i < length / 2; i++) {
            int value = buf.readUnsignedShort();
            int id = BitUtil.from(value, 12);
            value = BitUtil.to(value, 12);
            switch (id)
 {
                case 0:
                    position.set(Position.KEY_POWER, value * (100 + 10) / 4096.0 - 10);
                    break;
                case 1:
                    position.set(Position.PREFIX_TEMP + 1, value * (125 + 55) / 4096.0 - 55);
                    break;
                case 2:
                    position.set(Position.KEY_BATTERY, value * (100 + 10) / 4096.0 - 10);
                    break;
                case 3:
                    position.set(Position.PREFIX_ADC + 1, value * (100 + 10) / 4096.0 - 10);
                    break;
                case 5:
                    position.set("fuelLevel1", value * (2000 - 0) / 4096.0 + 0);
                    break;
                case 6:
                    position.set("fuelLevel2", value * (2000 - 0) / 4096.0 + 0);
                    break;
                case 7:
                    position.set("fuelLevel3", value * (2000 - 0) / 4096.0 + 0);
                    break;
                case 8:
                    position.set("fuelLevel4", value * (2000 - 0) / 4096.0 + 0);
                    break;
                case 9:
                    position.set("fuelLevel5", value * (2000 - 0) / 4096.0 + 0);
                    break;
                default:
                    position.set(Position.PREFIX_IO + id, value);
                    break;
            }
        }
    }

I use windows can you make this expression simple for me thank you