add j2534 support

git-svn-id: https://svn2.assembla.com/svn/romraider/trunk@144 38686702-15cf-42e4-a595-3071df8bf5ea
This commit is contained in:
kascade 2008-09-20 12:37:40 +00:00
parent 81d593bef8
commit 74e2aea1bd
3 changed files with 7 additions and 1 deletions

View File

@ -17,7 +17,6 @@ public interface J2534 {
void writeMsg(int channelId, byte[] data);
// FIX - Needs to return msg type, etc. Create Response object.
byte[] readMsg(int channelId);
void stopMsgFilter(int channelId, int msgId);

View File

@ -6,6 +6,7 @@ import static com.romraider.io.j2534.op20.OpenPort20.CONFIG_P3_MIN;
import static com.romraider.io.j2534.op20.OpenPort20.CONFIG_P4_MIN;
import static com.romraider.io.j2534.op20.OpenPort20.FLAG_NONE;
import static com.romraider.io.j2534.op20.OpenPort20.PROTOCOL_ISO9141;
import com.romraider.util.HexUtil;
public final class TestJ2534 {
private static final J2534 api = new J2534OpenPort20(PROTOCOL_ISO9141);
@ -26,7 +27,12 @@ public final class TestJ2534 {
try {
byte[] ecuInit = {(byte) 0x80, (byte) 0x10, (byte) 0xF0, (byte) 0x01, (byte) 0xBF};
api.writeMsg(channelId, ecuInit);
byte[] response = api.readMsg(channelId);
System.out.println("Request = " + HexUtil.asHex(ecuInit));
System.out.println("Response = " + HexUtil.asHex(response));
} finally {
api.stopMsgFilter(channelId, msgId);

View File

@ -88,6 +88,7 @@ public final class J2534OpenPort20 implements J2534 {
if (status != STATUS_NOERROR) handleError(status);
}
// FIX - Needs to check msg type and retry until msg received
public byte[] readMsg(int channelId) {
PassThruMessage msg = passThruMessage();
int[] pNumMsgs = {1};