1

Does anyone know how I can send custom commands using the ObdRawCommand in pires Java api? I have little to no experience with this api and I have contacted the creator but I haven't gotten any answer yet.

I have searched online for some project that uses the ObdRawCommand to send custom commands but I can't find anything.

So any help is appreciated!

Snippet

public void run() {
            OBDcmds();

            try {

                ModuleVoltageCommand voltageCommand = new ModuleVoltageCommand();
                OdbRawCommand command1 = new OdbRawCommand("22 40 28");

                while (!Thread.currentThread().isInterrupted()) {
                    guiHandler(Constants.VOLTAGE_STATUS, 0, voltageCommand.getFormattedResult());
                    guiHandler(Constants.cmd1_STATUS, 0, command1.getFormattedResult());
                    Log.d("Log", "Voltage:" + voltageCommand.getFormattedResult());
                    Log.d("Log", "cmd1:" + command1.getFormattedResult()); //null

                    try {
                        voltageCommand.run(mmInStream, mmOutStream);
                        command1.run(mmInStream, mmOutStream);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                System.out.println("inside catch before while");
            }
        }


private void OBDcmds() { // execute commands


            try {
                new EchoOffCommand().run(mmInStream, mmOutStream);
                new LineFeedOffCommand().run(mmInStream, mmOutStream);
                new TimeoutCommand(125).run(mmInStream, mmOutStream);
                new SelectProtocolCommand(ObdProtocols.AUTO).run(mmInStream, mmOutStream); //ISO_15765_4_CAN
                new ModuleVoltageCommand().run(mmInStream, mmOutStream);
            } catch (Exception e) {
                Log.v("OBDcmds", "e");
                // handle errors
            }
        }
swess
  • 171
  • 19

1 Answers1

0

I was right about how to send custom commands.

OdbRawCommand command1 = new OdbRawCommand("custom cmd here");

swess
  • 171
  • 19