PDA

View Full Version : Java - JInSim - a Java InSim library


rheiser
17th August 2006, 18:04
JInSim is an easy to use Java library for communicating with InSim, OutSim and OutGauge. It's currently in pre-alpha form, but I've created a few small examples that work correctly to get you started. The examples are well commented and straightforward, so if you have any Java knowledge at all, you should be able to understand them and move on to creating your own clients.

Right now, the core communication with InSim is done and I'm starting to create specialized classes for common use scenarios. The first one is a "RaceEventClient" that will notify you about crashes in progress and the closest race on the track. What I really would like is some feedback from people who are interested in using a library like this.

I've created a SourceForge project where you can get the code through anonymous CVS. If you aren't familiar with CVS and want JInSim, let me know. You can find the project at http://jinsim.sourceforge.net

Thanks,

--
Rob

the_angry_angel
17th August 2006, 18:28
Nice work Rob :up: I probably won't use it, but the more libraries the better :D I've added it as a link to the FAQ thread.

Dygear
18th August 2006, 07:26
I don't quite know how to word this. I've used CodeWarrior at school, but I don't really know where to start with Java. I'd love to use it for a web program I'm working on. Any clues as where I should look?

rheiser
18th August 2006, 07:41
1. Make sure you have java installed. You can download a JDK from http://java.sun.com if you don't. If you can type "java -version" at a command line and get version information, you're on your way.

2. Download JInSim from SourceForge. Go to http://sourceforge.net/projects/jinsim/ and click the big green Download button to download the zip file. The current one is jinsim-0.1.zip

3. Unzip jinsim-0.1.zip somewhere on your hard drive that's handy.

4. Look at the README file inside the newly unzipped directory. There's some information there on how to run the "Hello World!" example. Once you have that working, you're well on your way.

To start off with, you may just want to edit simple java files with your favorite text editor, figure out how to compile them with javac and run them. Once you're comfortable with that, you can download one of the freely available Java IDEs like Eclipse or NetBeans. I use Eclipse, because that's what I use at work. I actually prefer IntelliJ, but that's a (spendy) commercial package. If you have any questions, let me know.

--
Rob

Dygear
19th August 2006, 07:15
I start IntelliJ and it thows me out to a screen full of XML when I try to make a web application. I don't want a screen with XML, I want a screen where I can write java code. Now I've never done a java program for the web, but I don't think this was ment to happen. I need ... a tutorial. Anyone got a good one for making java programs for web browser?

rheiser
26th August 2006, 18:22
I'll announce new releases on this thread from now on instead of spamming the forum with new threads. The new release includes:

- An experimental client using the selectable sockets from Java's nio package.
- Fixes for thread synchronization (thanks Brilwing!)
- Fixes and additions to the request and response classes.
- Additions to InSimHelper
- Fixes to the packaging so that the speedometer example can find its images :)
- Fixes to some of the math on the RaceEventClient
- More documentation.

abz1
27th August 2006, 00:22
Im sure theres nothing wrong with Brilwing way, but (http://www.lfsforum.net/member.php?u=19797) you might want to check this out.

http://java.sun.com/javase/6/docs/api/java/util/concurrent/locks/Lock.html

rheiser
27th August 2006, 06:27
Yep, the new features of Java 6 (Java SE 6? Java 1.6? What's with Sun and their versions?) Anyway...the new features are nice. I'm trying to stay 1.4 compliant for right now. You'll notice I don't use things like parameterized types in JInSim. I'm not doing anything fancy with locks either, so the cool new Lock objects wouldn't make a difference, I don't think. Thanks for pointing them out, though. It made me sit down and check out the feature more deeply.

Tanuva
28th August 2006, 15:39
Oh nice to see someone developing such thing, will be very useful... :> :thumb:

Pablo.CZ
2nd January 2007, 18:33
I'm trying to make my own appl based on JInSim v0.3 and I have problems with getting

total time, split1 time, split2 time, split3 time, (last) lap time
front gap, back (rear) gap
actual lap number, total number of laps

Thx for help.

z3r0c00l
2nd January 2007, 23:24
Brilliant!!!!!!!

I write AI programs in Java, and this will save me a lot of work!

thank you so much!

Brilwing
3rd January 2007, 10:34
I'm trying to make my own appl based on JInSim v0.3 and I have problems with getting

total time, split1 time, split2 time, split3 time, (last) lap time
front gap, back (rear) gap
actual lap number, total number of laps

Thx for help.

I have done such a program (except the front and back gap) and you find the source code here: https://openbakery.org/svn/repos/trunk/gstats/

The output of the program is a textfile that contains the stats and you find an example here:
http://dev.guglhupf.net/gstats/downloads/SO5_race_0608271626.gstats

I use the *.gstats files in a php program to manage the austrian championship league. (see liveforspeed.at -> Events/ÖLFSM)

Pablo.CZ
4th January 2007, 10:48
Thank you Brilwing. I don't have some packages you are using (org.apache.commons.logging*) but I'm working on it. I'm new to Java, so my progress is slow.

Brilwing
4th January 2007, 11:56
You can put the jars manually in your classpath. You need:
commons-logging: http://jakarta.apache.org/commons/logging/
commons-cli: http://jakarta.apache.org/commons/cli/
log4j: http://logging.apache.org/log4j/docs/
junit: http://junit.org
and jinsim ;)

Or you can use Yeast, which is a tool that a made to manage these dependences. This means that the jars automatically downloaded ;)
Yeast can be found here: http://yeast.openbakery.org

Brilwing
17th May 2007, 10:26
I currently working on updating jinsim for patch X. It is not finished by now, but you can find a first test release here: http://liveforspeed.at/download/jinsim-0.4.91.zip
In this release all jinsim response and request packets are updated and should now work with lfs patch w24, but only UDP connections are supported right now. I will add the TCP support soon.
JInSim now requieres Java 5.0.

You should also look into the Changes file and also exam the examples, because I also have done some refactorings.

phelan
17th May 2007, 11:16
Great :) Now if there only was support for tyre temp and damage output in the game, ... but anyways, i'll definately have some use for the jinsim lib.

Brilwing
19th July 2007, 17:28
Here is a new package of the current jinsim for patch x: http://liveforspeed.at/download/jinsim-0.4.95.zip

Changes:
- Both TCP and UDP is supported
- New button system added
- Encoding support. The LFS codepages are converted.

So this package should now have all features of the new InSim in patch x. If I missed something let me know :D

joelbarton1987
29th July 2007, 20:59
Here is a new package of the current jinsim for patch x: http://liveforspeed.at/download/jinsim-0.4.95.zip

Changes:
- Both TCP and UDP is supported
- New button system added
- Encoding support. The LFS codepages are converted.

So this package should now have all features of the new InSim in patch x. If I missed something let me know :D

i keep getting this error Microsoft Windows XP [Version 5.1.2600]

Exception in thread "main" java.lang.NoClassDefFoundError: org/kerf/jinsim/examp
les/helloworld/Main
:scratchch:shrug::scratchch:shrug::scratchch:shrug ::scratchch:shrug::scratchch:shrug:

please help ............... me

Brilwing
30th July 2007, 09:44
i keep getting this error Microsoft Windows XP [Version 5.1.2600]

Exception in thread "main" java.lang.NoClassDefFoundError: org/kerf/jinsim/examp
les/helloworld/Main
:scratchch:shrug::scratchch:shrug::scratchch:shrug ::scratchch:shrug::scratchch:shrug:

please help ............... me
I'm wondering how you get this error.
Try this:
java -cp dist\jinsim.jar;lib\commons-logging-1.0.4.jar org.kerf.jinsim.examples.helloworld.Main
You need Java 5.0 of course.

joelbarton1987
30th July 2007, 10:53
I'm wondering how you get this error.
Try this:
java -cp dist\jinsim.jar;lib\commons-logging-1.0.4.jar org.kerf.jinsim.examples.helloworld.Main
You need Java 5.0 of course.


same error aaaarrrrrrrggggg ....... any segestions

Brilwing
30th July 2007, 17:21
same error aaaarrrrrrrggggg ....... any segestions

You must execute this command in the jinsim-0.4.95 directory.


C:\workspace\jinsim-0.4.95>java -cp dist\jinsim.jar;lib\commons-logging-1.0.4.jar org.kerf.jinsim.examples.helloworld.Main 192.168.99.
2 60000

vs.

C:\workspace\jinsim-0.4.95>cd ..

C:\workspace>java -cp dist\jinsim.jar;lib\commons-logging-1.0.4.jar org.kerf.jinsim.examples.helloworld.Main 192.168.99.2 60000
Exception in thread "main" java.lang.NoClassDefFoundError: org/kerf/jinsim/examples/helloworld/Main

GeForz
30th July 2007, 17:39
Perhaps you don't have the system classpath var set. try adding the current directory (".") to the -cp list

java -cp .;dist\jinsim.jar;lib\commons-logging-1.0.4.jar org.kerf.jinsim.examples.helloworld.Main 192.168.99.
2 60000

Brilwing
30th July 2007, 20:50
The system classpath is not need cause the Main class is in the jinsim.jar

shiny_red_cobra
30th July 2007, 20:59
i keep getting this error Microsoft Windows XP [Version 5.1.2600]

Exception in thread "main" java.lang.NoClassDefFoundError: org/kerf/jinsim/examp
les/helloworld/Main

Simple workaround: use Eclipse (http://www.eclipse.org/downloads/).

joelbarton1987
7th August 2007, 09:27
Simple workaround: use Eclipse (http://www.eclipse.org/downloads/).

witch one do i download ??????

joelbarton1987
7th August 2007, 09:40
You must execute this command in the jinsim-0.4.95 directory.


C:\workspace\jinsim-0.4.95>java -cp dist\jinsim.jar;lib\commons-logging-1.0.4.jar org.kerf.jinsim.examples.helloworld.Main 192.168.99.
2 60000

vs.

C:\workspace\jinsim-0.4.95>cd ..

C:\workspace>java -cp dist\jinsim.jar;lib\commons-logging-1.0.4.jar org.kerf.jinsim.examples.helloworld.Main 192.168.99.2 60000
Exception in thread "main" java.lang.NoClassDefFoundError: org/kerf/jinsim/examples/helloworld/Main


ok thanks but new error : error = in dedi host screen when trying to load insim : = " insim: first byte in packet does not match size "

:(:shrug::(:shrug::(:shrug::(:shrug::(:shrug:

PLEASE HELP!!!!!

Brilwing
7th August 2007, 13:08
ok thanks but new error : error = in dedi host screen when trying to load insim : = " insim: first byte in packet does not match size "
Hmm, I have tested this example only with LFS not with the dedi, so I don't know if the example works with a dedi, because it only sends a chat message. But you error message look like that you are using an older dedi version. Are you using the latest dedi version patch X?

@Eclipse: download this: http://www.eclipse.org/downloads/moreinfo/java.php

shiny_red_cobra
9th August 2007, 23:11
Ok I've managed to run the Hello World thingy, and it does what it's supposed to do in LFS, but in the console I get this over and over (nonstop):

java.nio.channels.ClosedChannelException
at sun.nio.ch.DatagramChannelImpl.ensureOpen(Datagram ChannelImpl.java:107)
at sun.nio.ch.DatagramChannelImpl.read(DatagramChanne lImpl.java:313)
at org.kerf.jinsim.UDPChannel.receive(UDPChannel.java :120)
at org.kerf.jinsim.AbstractChannel.run(AbstractChanne l.java:57)
at java.lang.Thread.run(Thread.java:619)

Brilwing
10th August 2007, 07:57
Hmm I don't have this exception when I run the hello world example. Nevertheless, I have updated jinsim that this exception is handled, cause it indicates that the jinsim connection is closed.

here you find the update: http://liveforspeed.at/download/jinsim-0.4.96.zip

joelbarton1987
11th August 2007, 08:29
Hmm, I have tested this example only with LFS not with the dedi, so I don't know if the example works with a dedi, because it only sends a chat message. But you error message look like that you are using an older dedi version. Are you using the latest dedi version patch X?

@Eclipse: download this: http://www.eclipse.org/downloads/moreinfo/java.php

yep using the latest release 0.5 X10 ...... :smileypul:scratchch

Brilwing
5th December 2007, 20:54
I have created new package of jinsim with the latest fixes:
http://liveforspeed.at/download/jinsim-0.4.97.zip (http://liveforspeed.at/download/jinsim-0.4.96.zip)

* Some fixes at the button requests
* added java.lang.String to LFS codepages encoding
* fixed a synchronizing issue when sending lots of insim requests
* and maybe some more that I can't remember ;)

Brilwing
12th December 2007, 08:14
I updated jinsim with the minor X30 changes:
http://liveforspeed.at/download/jinsim-0.4.99.zip

Also changed:
* InSim relay support is now included + example program
* Fixes at the comp car and MCI requests
* Fixes a the set camera request
* Added a Track enum so that track codes like 100 or BL1 can be converted in an enum value and then to the real trackname.

I have tested this version only with a X30 Dedi, but it should also work with X10.

GeForz
12th December 2007, 17:50
Are the examples shipped within the zip file for older versions or are they just not working? ^^

The raceclient example throws a nullpointer exception

Brilwing
12th December 2007, 20:41
Yes some examples do not work, cause I haven't updated all by now. If everything is stable the version number whould be 0.5 :D

The UDPChannel has some bugs, and I will fix this soon, until then try the examples using the TCPChannel.

GeForz
12th December 2007, 23:09
oh btw your NodeLap type is missing the position byte (and remember to change it in the CompCar, too when you change the NodeLap :))

and in the Client class the bit flag with value 16 is not for new players but for node lap packets ;)

Brilwing
13th December 2007, 08:34
Thx, fixed this in my version.
I will post a new version as soon as I have fixed the UDP issue.

wheel4hummer
16th December 2007, 13:34
It won't compile for me. I'm really not sure what the problem is:

insimApplication.java:6: unreported exception java.io.IOException; must be caught or declared to be thrown
Client insimConnection1 = new Client("localhost", 6699, "adminpass");

GeForz
16th December 2007, 18:33
You just have to catch the exception? ^^
That Client class isn't the one in the library, right?

Brilwing
16th December 2007, 22:14
Yes, the connect throws an IOException.

Starblue
23rd December 2007, 17:22
I updated jinsim with the minor X30 changes:
http://liveforspeed.at/download/jinsim-0.4.99.zip

Also changed:
* InSim relay support is now included + example program
* Fixes at the comp car and MCI requests
* Fixes a the set camera request
* Added a Track enum so that track codes like 100 or BL1 can be converted in an enum value and then to the real trackname.

I have tested this version only with a X30 Dedi, but it should also work with X10.
Thnx for the update Brilwing! :)
There's a little mistake in SetCarCameraRequest, line 55:
super(PacketType.CAMERA_POSITION, 8);it should be:
super(PacketType.SET_CAR_CAMERA, 8);Thanks again for all your work :)

Starblue

Brilwing
4th January 2008, 14:44
new version: http://liveforspeed.at/download/jinsim-0.5rc1.zip

Changes:
* Renamed packages from org.kerf to net.sf
* Fixed camera packet (thx. Starblue)
* UDP communication works now again
* OutGauge and OutSim also works again
* Fixed the not working examples, and all should work now fine.

All I wanted in version 0.5 is now included so this is the first release candidate. ;)

Starblue
7th January 2008, 17:23
new version: http://liveforspeed.at/download/jinsim-0.5rc1.zip

Changes:
* Renamed packages from org.kerf to net.sf
* Fixed camera packet (thx. Starblue)
* UDP communication works now again
* OutGauge and OutSim also works again
* Fixed the not working examples, and all should work now fine.

All I wanted in version 0.5 is now included so this is the first release candidate. ;)
Hi Brilwing,
I get a "page not found" on that link :)
Two more things I fixed on my local version of 0.4.99:
SetCarCameraRequest: uniqueId and cameraType were inverted, the correct order is:
data.put(uniqueId);
data.put(cameraType);
NodeLap: the Position byte (after PlayerId byte) was not implemented. I added the getter/setter for position and setPosition(buffer.get()); after setPlayerId(buffer.get()); in the constuctor.

Starblue

Brilwing
7th January 2008, 19:00
Hi Brilwing,
I get a "page not found" on that link :)
Two more things I fixed on my local version of 0.4.99:
SetCarCameraRequest: uniqueId and cameraType were inverted, the correct order is:
data.put(uniqueId);
data.put(cameraType);
NodeLap: the Position byte (after PlayerId byte) was not implemented. I added the getter/setter for position and setPosition(buffer.get()); after setPlayerId(buffer.get()); in the constuctor.

Starblue

Ups, was a typo in the Url...

So here we go: http://liveforspeed.at/download/jinsim-0.5.rc2.zip

Changes:
* fixed SetCarCameraRequest (thx Starblue)
* added Car enum

(set position is already in 0.5rc1 at the NodeLap)

Starblue
10th January 2008, 16:52
So here we go: http://liveforspeed.at/download/jinsim-0.5.rc2.zip

Thanks for the update :)
I'm currently using 0.5.rc2 for a project and I noticed the following behaviour, while connecting with the SimpleClient class:
if an unchecked exception is thrown in the registered listener, the jvm will start increasing its memory without limits, until.... I had to terminate it because my pc was freezing :)
That happened me twice, once for a mistaken object cast and once because I received a string of unexpected size and went out of bound doing a substring :)
If I had enabled logging, I guess I would have seen the "Something went wrong!" message of AbstractChannel.java line 122, as I think the exception got caught there.
As it's not nice to have an application crash everything by stealing all the available memory, you may want to change that behaviour..
Maybe you could have a dedicated try/catch around the notify action, like this:
try {
client.notifyListeners(packetData);
}
catch (Exception e) {
log.error("Something went wrong!", e);
}This way the custom listeners can be wrong and throw whatever they like but it won't crash the whole InSim connection & program.
It's probably not the best way to handle the situation, but I think it may be worth to change it.

Starblue

Brilwing
13th January 2008, 19:14
try {
client.notifyListeners(packetData);
}
catch (Exception e) {
log.error("Something went wrong!", e);
}This way the custom listeners can be wrong and throw whatever they like but it won't crash the whole InSim connection & program.
It's probably not the best way to handle the situation, but I think it may be worth to change it.

Starblue
Sorry I haven't got the time to test this problem, but I read the code and I have an idea to solve this problem without using an extra try-catch. I hope I find time this week to fix this.

Starblue
4th February 2008, 12:14
Hi Brilwing,
I've found a problem with the MessageResponse class.
I wanted to check what users said so I used getTextStart() to make a substring of the getMessage() and filter their name to get only the actual text they typed.
However, it didn't work for people with "^" in their name.. that's because LFS encodes it with "^^" and getMessage() returns it to just "^"..
So basically the number of characters in getMessage() is not the original one and so the position returned by getTextStart() becomes wrong.
I changed my local copy of MessageResponse constructor like this:

public void construct(ByteBuffer buffer) throws BufferUnderflowException {
super.construct(buffer);
buffer.position(buffer.position()+1);
connectionId = buffer.get();
playerId = buffer.get();
typedByUser = buffer.get();
textStart = buffer.get();
message = getString(buffer, 128);

// Starblue 04/01/2008
// Rewind the buffer and check how long the "pre-message" part really is:
int pos = buffer.position();
buffer.position(pos-128);

String preMessage = getString(buffer,textStart);
textStart = (byte)(preMessage.length()+1);

buffer.position(pos);
}
After this change, it became safe to get the typed message like this:
String typedMessage = response.getMessage().substring(response.getTextSt art());Starblue

Starblue
12th February 2008, 15:10
Hi Brilwing,
I found another problem related to the try/catch in AbstractChannel: sometimes I get this exception:
15:13:58,890 ERROR - Something went wrong!
java.io.IOException: Connessione interrotta dal software del computer host
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(Unknown Source)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
at sun.nio.ch.IOUtil.read(Unknown Source)
at sun.nio.ch.SocketChannelImpl.read(Unknown Source)
at net.sf.jinsim.TCPChannel.receive(TCPChannel.java:3 6)
at net.sf.jinsim.AbstractChannel.run(AbstractChannel. java:60)The description "Connessione interrotta dal software del computer host" (which means "connection interrupted by computer host software") makes me think that this a particular implementation of an event similar to the ClosedChannelException, for which you had already provided a try/catch:
try {
numberRead = receive(sizeBuffer);
} catch (ClosedChannelException ex) {
// do nothing chase numberRead is already -1
}
Unfortunately, this time it's an IOException so it does not get caught into the ClosedChannelException catch and it goes on to be catched by the generic try/catch you've put at the end of the loop:
while (running) {
try {
[...]
} catch (Exception e) {
log.error("Something went wrong!", e);
}
}As there is no action in the catch to solve the problem, the thread keeps looping and logging the same error, eventually filling up all the space available on the disk and crashing the program...
(I think this explains my previous problem where I had not enabled logging on disk, so it filled up memory instead of disk space).
I'm going to put a return statement in the generic Exception catch, so that if something "unexpected" happens, the thread stops working (since it is not supposed to be able to "fix" an unexpected event anyway).

Starblue

Brilwing
14th February 2008, 18:24
Here is a new jinsim release 0.5.rc4: http://downloads.sourceforge.net/jinsim/jinsim-0.5.rc4.zip?use_mirror=osdn

Changes:

Fixed the bugs Starblue reported:

fixed the endless loop when the ResponseListener throws an exception
The MessageResponse getMessage only returns the message without the driver name. For the driver name use the getDriverName() method
Changed the ChannelCloseException to an IOException so that the Channel is closed when an error happened.

minor fixes at the buttons

Starblue
15th February 2008, 13:13
Thank you Brilwing :)

Starblue

Starblue
24th February 2008, 22:42
Hi Brilwing,
I wanted to use the prefix variable in the ISP_ISI packet, but the Client class generates its InitRequest inside the connect method and it's not possible to set a prefix from outside. Could you add a prefix parameter in the next release? :)

Starblue

Brilwing
25th February 2008, 09:04
Ok I will add this in the next release ;)

Starblue
1st April 2008, 18:14
Ok I will add this in the next release ;)
Hi Brilwing,
any plans about the next release date? :)

Starblue

Brilwing
3rd April 2008, 08:31
Hi Brilwing,
any plans about the next release date? :)

Starblue

I was busy with other stuff, I try to create a version in the next days.

Starblue
4th April 2008, 21:14
I was busy with other stuff, I try to create a version in the next days.
Excellent :)
I'm currently working on a new version of the tracker for IGTC endurance league and it could benefit from the "hide message with special prefix" feature :)

Starblue

mcgas001
4th April 2008, 21:17
Starblue: There is a way around it. You could send a clickable button to all the players on track. Maybe "Panic" or "Help" button. When clicked, It sends a message to all admins privatly(MTC).

Starblue
5th April 2008, 00:26
Starblue: There is a way around it. You could send a clickable button to all the players on track. Maybe "Panic" or "Help" button. When clicked, It sends a message to all admins privatly(MTC).
Yes, thanks for the suggestion :) We already thought about using a button but clicking a button with a mouse while you are driving is a lot less easy than just pushing a binded button on your wheel :)
Plus, there is another workaround: modifying the library by myself :) But I prefer to use official library releases if possible :)

Starblue

Brilwing
7th April 2008, 14:42
Here a new version 0.5rc5:

https://sourceforge.net/project/showfiles.php?group_id=174994

Changes:
* added prefix for the init request
* fixed NodeLapInfoResponse

Starblue
14th April 2008, 00:27
Here a new version 0.5rc5:

https://sourceforge.net/project/showfiles.php?group_id=174994

Changes:
* added prefix for the init request
* fixed NodeLapInfoResponse
Thanks :)

Starblue

Technique
22nd April 2008, 02:48
Nice work guys. Has anyone used jinsim with outgauge?

I played around with a bit today. I was wondering what kind of performance you guys were seeing.

Running the Speedometer example with a replay I'm frequently seeing a delay of ~1 second or more. It's especially noticeable in higher power cars like the GTR's that can stop on the dime.

The specs of my system are:
AMD Athlon 3400+
6800GT
1GB memory
Java 6u3
FPS: ~90

I tried running a different setup:
* LFS on the AMD machine above
* Speedo example on a lan machine
- 1.86ghz Pentium M laptop
- 2GB memory
- onboard video (gets 6-10fps running LFS)
- Java 6u3

I got roughly the same performance. For my final test, I created my own test class using active rendering and it seemed to improve a bit but there was still a noticeable delay. So I guess I was wondering... is anyone is using JInsim for realtime stuff with outgauge and having good results? Perhaps I just need to upgrade my h/w :)

Also, besides the performance issues, I noticed the outgauge response would often contain bad speed values. For example, the speed should be 60mph but getSpeed() returns 7.56005E-39. This happens once every few seconds causing the speedometer needle to flicker to ~0mph. To prevent this I just ignore any speed updates greater than 0 and less than 1. The needle rotation also jumps past the 270 degrees even though it shouldn't be anywhere near that value. I'm not sure if this is a bug in JInsim or LFS's outgauge.

I should point out that I've done all my tests with multiplayer replays. I'm not sure if that causes any issues.

Brilwing
22nd April 2008, 07:32
I only used OutGauge in the Speedometer example and with the short tests I can remember any delays, but my tests were only very brief.

I will try to run some longer tests and do also so some profiling.

Technique
24th April 2008, 05:50
I'm getting great performance out of it now. I think I might have just had too many applications open at the time :shrug:

Brilwing
24th April 2008, 09:11
I'm getting great performance out of it now. I think I might have just had too many applications open at the time :shrug:

Nevertheless i will run a test in the profile, just to make sure that everything is fine ;)

MaKaKaZo
7th July 2008, 09:00
I can't get the Hello World example to compile either in command line or using Eclipse. I don't care much about command line as I wouldn't be using it, but... damn Eclipse is such a bitch! I don't know how to create a project from an existing java file. The other day I think I got it, but there were errors everywhere and I think it was because I had to link the commons logging jar file to my project, and I couldn't do it. And Eclipse tutorials are quite poor...

Could anyone post a quick guide on running the Hello World example in Eclipse? It could be very useful for beginners in Java like me to get started :)

EDIT: OK, I finally got it to work :schwitz: I found the way to create a project from existing sources (it wasn't as hidden as I thought, I was just blind), and then I added the common logging JAR, but totally forgot to add the jinsim JAR :D Anyway, after that Eclipse asked me to move "package net.sf.jinsim.examples.helloworld" and so I did. Then I found how to add arguments to the run call, and there I go with my "driver says: Hello World" :thumb:

Gonna try the other examples next!

Starblue
7th July 2008, 11:11
Could anyone post a quick guide on running the Hello World example in Eclipse? It could be very useful for beginners in Java like me to get started :)

Good idea! I love Eclipse but I remember it was quite a pain the first time I used it...trying to understand its many perspective windows and how to import an existing project, libraries and such :)
I'll try to make the tutorial you suggested.


EDIT: OK, I finally got it to work [...]

Gonna try the other examples next!
I'm glad you solved it and.... welcome to Jinsim!! :)

Starblue

bukhem
23rd July 2008, 22:03
Hi!

I just have two quick questions ...

Is this still active? Any changed need for Patch Z?

Is it possible to get the temperature of the wheels? and if so, how? :shrug:

Cheers,
buk

Starblue
24th July 2008, 00:05
Hi!

I just have two quick questions ...

Is this still active? Any changed need for Patch Z?

Is it possible to get the temperature of the wheels? and if so, how? :shrug:

Cheers,
buk
Yes, I think it's still active...no changes where needed for patch Z.
As for wheel temperatures, Insim&Outsim don't give this info.

bukhem
25th July 2008, 16:12
Hi.

I hope one of you guys has an idea on this ...
I run a dual-head setup here.
The main screen shows LFS, the second screen - an 8" touchscreen - shows my application.

That all works pretty good as long as I dont run LFS in fullscreen mode.
When I do that I don't get any mouse events anymore on the second display.
Running TouchBuddy excatly that is working, I just don't have an idea on how to get the mouse back on the second display ...

So, any thoughts?

Thanks and greetings.

bdshan
15th August 2008, 17:12
This is killing me and to save my life I can't figure out a solution.

I am trying to read a Path file, AS1.pth to be exact. It was going along swimmingly until I need the number of nodes. When I do a readInt() I get a wacky number 536936448, but I know for a fact that AS1 has 288 nodes. Am I using the wrong function call here? Any suggestions?


File pathfile = new File("c:/temp/AS1.pth");
if (!pathfile.exists()) System.exit(0);
FileInputStream fi = new FileInputStream(pathfile);
DataInputStream di = new DataInputStream(fi);
byte[] bLFSPTH = new byte[6];
di.read(bLFSPTH, 0, 6);
String _LFSPTH = new String(bLFSPTH);
// _LFSPTH must match LFSPTH
if (!_LFSPTH.equals("LFSPTH")) System.exit(0);
// version header
byte version = di.readByte();
if (version > 0) System.exit(0);
// revision header
byte revision = di.readByte();
if (revision > 0) System.exit(0);
// number of nodes
int nodes = di.readInt();
...

rheiser
15th August 2008, 17:43
Not JInSim related, but...

I think you're running into a byte ordering problem. The decimal number 536936448 is 0x20010000 in hex. The decimal number 288 is 0x120 in hex. So it looks to me like the least significant bit (LSB) is first. You can try doing this in your code instead of the readInt():


int nodes = di.readByte() + (di.readByte() << 8) +
(di.readByte() << 16) + (di.readByte() << 24);
You'll have to do that with all value types larger that a byte. And you might have to mask the bytes returned from readByte with 0x000000ff (i.e., di.readByte() & 0x000000ff).

If would probably be best to abstract the calculation into a method call for each data type you need, to save typing :)

Try that and see if it works.

bukhem
26th August 2008, 13:57
Hi.

I currently wonder how I can get a list of players that is currently connected.
I'm writing a small app that keeps track of lap and split times and therefor would need a list of existing players when it connects to the LFS-Client.

Thanks for your help. :thumb:

Greetings.

bdshan
26th August 2008, 14:09
After the client connects you can request the list of connections and players.


// request for connection info
client.send(new TinyRequest(Tiny.ALL_CONNECTIONS));
// request for player info
client.send(new TinyRequest(Tiny.ALL_PLAYERS));


After getting the initial list above you need to listen for new connections and players by checking the packet type in your packetReceived and then dealing with the appropriate type (NewConnectionResponse or NewPlayerResponse).

MaKaKaZo
26th August 2008, 14:15
Hi.

I currently wonder how I can get a list of players that is currently connected.
I'm writing a small app that keeps track of lap and split times and therefor would need a list of existing players when it connects to the LFS-Client.

Thanks for your help. :thumb:

Greetings.

This is a generic answer, not JInSim specific. As stated in the insim documentation, at any time you can request info about all connections and players sending an IS_TINY, with the following values (marked in red) in the field SubT:

enum // the fourth byte of IS_TINY packets is one of these
{
TINY_NONE, // 0 : see "maintaining the connection"
TINY_VER, // 1 - info request : get version
TINY_CLOSE, // 2 - instruction : close insim
TINY_PING, // 3 - ping request : external progam requesting a reply
TINY_REPLY, // 4 - ping reply : reply to a ping request
TINY_VTC, // 5 - info : vote cancelled
TINY_SCP, // 6 - info request : send camera pos
TINY_SST, // 7 - info request : send state info
TINY_GTH, // 8 - info request : get time in hundredths (i.e. SMALL_RTP)
TINY_MPE, // 9 - info : multi player end
TINY_ISM, // 10 - info request : get multiplayer info (i.e. ISP_ISM)
TINY_REN, // 11 - info : race end (return to game setup screen)
TINY_CLR, // 12 - info : all players cleared from race
TINY_NCN, // 13 - info : get all connections
TINY_NPL, // 14 - info : get all players
TINY_RES, // 15 - info : get all results
TINY_NLP, // 16 - info request : send an IS_NLP
TINY_MCI, // 17 - info request : send an IS_MCI
TINY_REO, // 18 - info request : send an IS_REO
TINY_RST, // 19 - info request : send an IS_RST
TINY_AXI, // 20 - info request : send an IS_AXI
TINY_AXC, // 21 - info : autocross cleared
};

With TINY_NCN the server will send an IS_NCN packet for each of the connections present (UCIDs).

With TINY_NPL the server will send an IS_NPL packet for each of the players present (PLIDs).

If you are keeping track of both connection IDs and players IDs (you should), you must do both.

Brilwing
26th August 2008, 14:18
I have not tested it, but I think a tiny request will do. e.g. extend the net.sf.jinsim.examples.console.Console example with:

client.send(new TinyRequest(Tiny.ALL_RESULTS));

But when you want to keep track of all players, you must also response when a player connects or leaves, also when he joins the race.

I have done a stats application that tracks the laps over every driver etc.
Here is the source, but I'm currently refactoring this app, so there will be lots of bugs:
https://openbakery.org/svn/repos/trunk/racecontrol/

bukhem
26th August 2008, 16:57
After the client connects you can request the list of connections and players.


// request for connection info
client.send(new TinyRequest(Tiny.ALL_CONNECTIONS));
// request for player info
client.send(new TinyRequest(Tiny.ALL_PLAYERS));
After getting the initial list above you need to listen for new connections and players by checking the packet type in your packetReceived and then dealing with the appropriate type (NewConnectionResponse or NewPlayerResponse).
Thanks, works like expected.

bukhem
27th August 2008, 08:23
Good morning folks.

Is it possible that there is some inconsitent namen of "IDs" in the library?
If I got that right, there are two IDs per player.

1.) The "connection"-ID, given to the player during the connection.
Sometimes this id seems to be refered as getId() or getConnectionId(), depending on the InSimResponse-Class

2.) The "event"-ID, given to the player when he takes part in an event (race,qualy). I'm just guessing here, didn't really check when an "NewPlayerResponse" gets triggered.
This id seems to be refered as getId() or getPlayerId() depending on the InSimResponse-Class

I'd will to prepare some patches against the current HEAD when there is a chance that they will be at least checked. :shrug:
I'd try to add some documentation as well, cause that part seems to be missing in some classes. :tilt:

Greetings.

Brilwing
27th August 2008, 09:06
JInSim is only the Java implementation of the LFS InSim interface, and I think it should work the same way as InSim is described in Scawens documentation.

I understand your problem, with the player id and the connection id, but I don't think that a solution should be part of JInSim.

It would be better to create a new project that is a higher level object oriented api to communicate with LFS and uses JInSim as basis.
For example: When you want the list of all drivers you call a 'List<Driver> getDrivers()' method that returns a list driver object.

bukhem
27th August 2008, 10:10
And the InSim documenation (or Scawen) tells you how to name, or more importantly document, functions in your library? :wtf2:

Brilwing
27th August 2008, 10:42
:banghead:

Sorry, i though you want only one unique id for a driver (combine connection id and player id). I should read the posts more carefully :shy:

If you will create a patch that rename the getId methods and replaces it with a more readable getConnectionId or getPlayerId, then I'm on your site and will include the patch in JInSim.

(Note to me: first read, then think, then write an answer)

bukhem
27th August 2008, 10:50
:banghead:

Sorry, i though you want only one unique id for a driver (combine connection id and player id). I should read the posts more carefully :shy:

If you will create a patch that rename the getId methods and replaces it with a more readable getConnectionId or getPlayerId, then I'm on your site and will include the patch in JInSim.

(Note to me: first read, then think, then write an answer)

:D
Good to read that, I just thought I had pissed off the devs. :x

Ok, I'll try to clear things up a bit and provide some patches.
Are you using Eclipse as IDE?
Any thoughts about switching to SVN? :tilt:

Cheers,
buk

Brilwing
27th August 2008, 11:57
Are you using Eclipse as IDE?

Yes


Any thoughts about switching to SVN?

Not really. I don't see lots of changes coming to JInSim in the near future, so I think CVS is fine for now. (If I'm wrong, I have no problems switching to SVN)

If you provide patches in the future for JInSim it is also very likely that you get access to the source control ;)

RocksGt
30th October 2008, 19:52
Hi!

I'm a completly n00b on InSim and I'm starting with this library as I'm a bit familiar with Java (at least more than I'm with C :nod:)

I'm trying to get some info of time splits and time laps and I'm missing some info.
I've been able (thanks for that nice examples :thumb:) to get a button showing split times, but I would like to show the name (the LFS-World nick) of the player too. I'm capturing the SplitTimeResponse and I see that it have a playerId field, but I don't know how to get the rest of info about that Player... I think I miss a Player VO class or something :schwitz:

If you can tell me how to get all the info about one player via this PlayerId field I would be very pleased :nod:

Thanks a lot in advance and sorry for my crappy english :schwitz:

Brilwing
30th October 2008, 22:21
With the NewPlayerResponse you get the playername, car name, plate, skin etc.


public void packetReceived(InSimResponse response) {
if (response instanceof NewConnectionResponse) {
// here you get the connection id
} else if (response instanceof NewPlayerResponse) {
// here you get the player id and the player name etc.
}
}

RocksGt
31st October 2008, 08:37
With the NewPlayerResponse you get the playername, car name, plate, skin etc.


public void packetReceived(InSimResponse response) {
if (response instanceof NewConnectionResponse) {
// here you get the connection id
} else if (response instanceof NewPlayerResponse) {
// here you get the player id and the player name etc.
}
}


hmmm I've tried that, but maybe I've made something wrong :D
That packet NewPlayerResponse when is supposed to be sent? When a player connects to server? I'm testing my little app via HotLap... then, when I restart a HL that packet is sent again? :shrug:

The app I'm trying to make is a kind of LFS-Lapper... but I'm going slowly so while I learn the basics I'm just testing with HL's on local, not on a server with several players :nod:

P.S: Don't know if this is the correct thread to comment this type of things, maybe I should open another thread requesting help on the problems I find during my develop and kee this one only for the library per se :shrug:

Brilwing
31st October 2008, 11:10
I'm not sure when it is send when you are hotlapping. At an multiplayer race the NewConnectionResponse is send when a player connects (here you get the connection id). When the player leave the pits or the race is restarted, the NewPlayerResponse is send.
I think that the NewPlayerResonse is also send when you start hotlapping, but I have not tested it.

Just output all responses then you'll see what responses are send:

public void packetReceived(InSimResponse response) {
System.out.println(response);
}

RocksGt
31st October 2008, 11:59
I'm not sure when it is send when you are hotlapping. At an multiplayer race the NewConnectionResponse is send when a player connects (here you get the connection id). When the player leave the pits or the race is restarted, the NewPlayerResponse is send.
I think that the NewPlayerResonse is also send when you start hotlapping, but I have not tested it.

Just output all responses then you'll see what responses are send:

public void packetReceived(InSimResponse response) {
System.out.println(response);
}

Nice, thanks a lot!

Then I supposed I may have a Map of the players connected (I'm seriously thinking of having a PlayerVO just for making things easier :scratchch) and then searching on that map with the id to retrieve the PlayerVO containing all the data of the Player.
Then mantaining that Map when a player connects and when a player leaves the server :nod:

Another question (that I've didn't test it yet) it's about buttons... I'm showing split times on buttons, but I don't know how this could work on a multiplayer environment... may I set the button to a playerID for only that player sees the button of his split time and none of the others players?

bdshan
31st October 2008, 13:16
Maybe this will help.


// tracking HashMaps
Map<Byte, Connection> connections = new HashMap<Byte, Connection>();
Map<Byte, Player> players = new HashMap<Byte, Player>();

// handle new connections
if (pck instanceof NewConnectionResponse)
{
if (!connections.containsKey(connid))
{
connections.put(connid, new Connection(connid, ncr.isAdmin(), username));
}
}

// handle new players
if (pck instanceof NewPlayerResponse)
{
if (!players.containsKey(plyid))
{
players.put(plyid, new Player(npr, (Connection)connections.get(connid), b));
}
}


There might be better ways to do this, but this works for me.

Brilwing
31st October 2008, 13:47
About Button with Split times and a PlayerVO object...
I'm currently working on a tool that I call RaceControl, that does this stuff. But it is not stable enough to release it. RaceControl is OpenSource (Apache 2.0 License) so you can investigate my code here: https://openbakery.org/svn/repos/trunk/racecontrol/

The PlayerControl.java class is where I create my Driver object (=PlayerVO).
You can investigate the Board.java class, here I display the last three laps with button to the current driver.

RocksGt
31st October 2008, 19:32
Thanks for the responses, they solved most of my doubts :nod:

Another question... can a single program connect to several LFS-Servers and listen to all of their responses or may I run one execution of my app for each of the servers I want to receive data from? :shrug:

Brilwing
3rd November 2008, 10:01
Another question... can a single program connect to several LFS-Servers and listen to all of their responses or may I run one execution of my app for each of the servers I want to receive data from? :shrug:

It should be doable, but jinsim has no support to identify from which server the packet comes from, so you have to keep track of this by yourself.

RocksGt
21st November 2008, 08:26
I keep working on my little app :nod:

One more doubt... Is there any way to connect to a server by his name. I mean, now I'm connecting by the server IP but it would be much better if I could connect using only the server name. Maybe connecting to the Master Server and asking him to resolve the IP by the name? :shrug:

Thanks a lot, and very good job with JInSim, the more I work with it the more I apreciate the effort you put on it :thumb:

Brilwing
21st November 2008, 08:47
One more doubt... Is there any way to connect to a server by his name. I mean, now I'm connecting by the server IP but it would be much better if I could connect using only the server name. Maybe connecting to the Master Server and asking him to resolve the IP by the name? :shrug:

AFAIK you cannot resolve the IP using the master server, so you need to know the IP adress or the hostname.
You can also use the insim relay. Here you can connect using the server name. You will get all InSim data through the relay, but sending insim request packets is limited. (see RelayClient.java in the jinsim source code)
JInSim also contains an example how to connect to a host via the insim relay.

RocksGt
21st November 2008, 09:04
AFAIK you cannot resolve the IP using the master server, so you need to know the IP adress or the hostname.
You can also use the insim relay. Here you can connect using the server name. You will get all InSim data through the relay, but sending insim request packets is limited. (see RelayClient.java in the jinsim source code)
JInSim also contains an example how to connect to a host via the insim relay.
Yes, I have looked at it already, but the servers I want to connect to are not in the relay system :(

Well, I'll put the IP's in a parameters file and let's hope there will be no need to change it usually :)

RocksGt
21st November 2008, 16:40
More problems :schwitz:

The server I'm trying to connect to is on a host where more servers are running, all with the same IP and each one on a different port.

I can connect to the server passing that port as the InSim port, I mean:

public JInSimClient(String name, String hostname, int port, String adminPassword)
hostname: The IP
port: the port where that actual server is listening

But then it seems I can get no data as the InSim port is another one :schwitz:

I've seen that the Client class have an udpPort, but no way of getting it working...

I've tried (stupid I think but meh... need to try :D) passing IP:port as hostname, but didn't work :(


Any help? :hug:

Brilwing
23rd November 2008, 11:15
I also have multiple hosts running on one machine and this should not be a problem at all. When you have one host running on port 29999 and the other on 29998, and you specify 29999 as port in jinsim, all should be working fine an the communication should all run on the port 29999.

You do not need the udp port for the insim communication, only when you use outgauge and outsim then the udp port is needed as far as i remember.

RocksGt
24th November 2008, 07:54
I also have multiple hosts running on one machine and this should not be a problem at all. When you have one host running on port 29999 and the other on 29998, and you specify 29999 as port in jinsim, all should be working fine an the communication should all run on the port 29999.

You do not need the udp port for the insim communication, only when you use outgauge and outsim then the udp port is needed as far as i remember.
I think the problem is that ports that I want to use in InSim are not open on the firewall / router of the server :doh:

I've asked the server owner to open that ports and today (maybe tomorrow) will test if it's working :nod:

Again, thanks a lot for the support :thumb:

mihu86
18th December 2008, 14:13
Hi!

I've found a little error in ReorderResponse.java:

public void construct(ByteBuffer buffer) throws BufferUnderflowException {
super.construct(buffer);
numberPlayers = buffer.get();
for (int i = 1; i < MAX_PLAYERS; i++) {
playerPositions.add(new Byte(buffer.get()));
}
}

There sould be "int i = 0" in the for loop. If i == 1, then the list will only contain 31 elements (or there should be "<=" instead of "<").

I've written a Class for sending a reorder packet to LFS.
You can find it here: http://mihu86.uw.hu/lfs/SendReorderRequest.java

Mihu

RocksGt
2nd January 2009, 19:07
In a server-side InSim, is there a way to get the host name?

What I'm trying to do is connect to several servers, and mantain a Map of JInSimClient identified by the host name, so when I receive a packet from LFS I can link the host from where the packet is sent :scratchch

Maybe this could be done by the connectionId or something like that, but the responses don't include a field like that I think :shrug:

So the idea is to override the public void packetReceived(InSimResponse response) method in my Client (the one that implements the JInsimClient) and call to my packetProcessor linking the hostName (or some identifier) to get access to the correct client (send messages back to the server, buttons, etc...)

If you can get me a tip it would be very nice :nod:


******** SOLVED **********

Finally I've used an Integer as clientId :)

Each Client (extended JInsimClient) has a clientId. In the main class I read the config file with the host list and I link each client with an Id (starting at 1). Then I keep a static Map<Integer, Client> at the requestProcessor, so when a packet is received each client do this:

public void packetReceived(InSimResponse response) {

RequestProcessor.getInstance().process(response, clientId);

}


So I can get the client from the Map if the process of that packet Type require it :thumb:

Anyway... I think I need to override some methods as the setVisible of Button cause it calls to JInsimClient.getInstance() and in my environment I have several JInsimClients objects...

I don't know if the JInSim have a better method to deal with an multi server app :shrug:

Brilwing
3rd January 2009, 12:40
I don't know if the JInSim have a better method to deal with an multi server app :shrug:
No, JInSim dones not have a code to deal with multiple clients. If you have such code and you would share it, I could include in the future version of JInSim.

Ramon F.
3rd February 2009, 17:51
Hi, I'm trying to get this information from NewConnectionResponse and ConnectionLeaveResponse but I can't figure it out:


struct IS_NCN // New ConN
{
byte Size; // 56
byte Type; // ISP_NCN
byte ReqI; // 0 unless this is a reply to a TINY_NCN request
byte UCID; // new connection's unique id (0 = host)

char UName[24]; // username
char PName[24]; // nickname

byte Admin; // 1 if admin
byte Total; // number of connections including host
byte Flags; // bit 2 : remote
byte Sp3;
};

struct IS_CNL // ConN Leave
{
byte Size; // 8
byte Type; // ISP_CNL
byte ReqI; // 0
byte UCID; // unique id of the connection which left

byte Reason; // leave reason (see below)
byte Total; // number of connections including host
byte Sp2;
byte Sp3;
};
Please help :schwitz:

Brilwing
4th February 2009, 13:02
I checked the jinsim source and both flags are not implemented yet in jinsim :ashamed:

I've added this to my todo list for the next release, but I cannot give you any estimation when this will be done.

Ramon F.
4th February 2009, 18:08
Uhhh... bad news :(, thanks Brilwing.

GabbO
4th March 2009, 18:32
Hi there!

Is there a documentation for the JInsim package? I started to do something with and inside game gui (clickable buttons, fields, whatsoever). But i actually couldnt find out how to create a button in the game. The ButtonRequest thing sounded promising, but without docu or source code i have no idea what it does.

Or if JInsim isn't the way to walk, lighten me up :)

Brilwing
5th March 2009, 08:06
Hi there!

Is there a documentation for the JInsim package? I started to do something with and inside game gui (clickable buttons, fields, whatsoever). But i actually couldnt find out how to create a button in the game. The ButtonRequest thing sounded promising, but without docu or source code i have no idea what it does.

Or if JInsim isn't the way to walk, lighten me up :)

There is only the java api docu, but you can have a look into the examples that are in the jinsim package or in the svn.
For a simple button see:
http://jinsim.svn.sourceforge.net/viewvc/jinsim/trunk/src/net/sf/jinsim/examples/button/Main.java?view=markup

I hope that helps

GabbO
15th March 2009, 22:19
Thanks, it helped.

Now i worked offline and created a buttonfactory that helps manipulate/handle buttons. The tool i created is working very well,
but now when i wanted to test it online i can't see the buttons. I created them with my connectionId, so it should be visible for me. It hard to do without docs :) . Any hints what could be the problem?

Brilwing
16th March 2009, 16:11
I created them with my connectionId, so it should be visible for me. It hard to do without docs :)

Yes with your connection id you should see the button.

bdshan
16th March 2009, 16:20
Thanks, it helped.

Now i worked offline and created a buttonfactory that helps manipulate/handle buttons. The tool i created is working very well,
but now when i wanted to test it online i can't see the buttons. I created them with my connectionId, so it should be visible for me. It hard to do without docs :) . Any hints what could be the problem?

Do you have a code sample you can share? Did you hard code the connection id. I have never checked it out, but in single and multiplayer they could be different since the host take a connection in multiplayer.

GabbO
16th March 2009, 18:56
I can give a pseudocode example

i start the app with a user message, so i do:

connectionId= messageResponse.getConnectionId();

button.setConnectionId(connectionId);

sendButton();

works perfectly on singleplayer (connId == 0)
when im on a server the Id != 0, and i see no buttons

bdshan
16th March 2009, 23:14
I have always had trouble displaying buttons whenever I don't set the request info and clickid before sending the button.

b1.setRequestInfo((byte)(1));
b1.setClickId(BTN_ID);

GabbO
17th March 2009, 06:15
of course i also set these, thats just a sampe how i get the connId

butReq = new ButtonRequest();
butReq.setButtonStyle(butStyle);
butReq.setText(butText);
butReq.setLeft((byte)butPosition.x);
butReq.setTop((byte)butPosition.y);
butReq.setWidth((byte)butDimension.width);
butReq.setHeight((byte)butDimension.height);
butReq.setConnectionId(butConnectionId);
butReq.setClickId(butClickId);
butReq.setRequestInfo(butRequestId);

Thats what i set

Ramon F.
17th March 2009, 09:53
Check your flags parameter in SimpleClient().connect() method.


...
Channel channel = new TCPChannel("127.0.0.1", 29999);
SimpleClient client = new SimpleClient();
client.addListener(this);

client.connect(channel,
"somepassword",
"someInsimName",
(short) (InitRequest.RECEIVE_NODE_LAP | InitRequest.LOCAL),
0, 0, '!');
...
Insim.txt

// The ISF_LOCAL flag is important if your program creates buttons.
// It should be set if your program is not a host control system.
// If set, then buttons are created in the local button area, so
// avoiding conflict with the host buttons and allowing the user
// to switch them with SHIFT+B rather than SHIFT+I.

GabbO
17th March 2009, 17:13
:thumb: that was it

Ramon F.
2nd April 2009, 07:42
Hi java friends :thumb:

In OutGaugeResponse packet when i call getWaterTemperatur(), getOilPressure(), getTurbo() I always get a return of 0.0, other methods works perfect (fuel, brake, throttle, displays, etc.) ; could anyone confirm this please?

Also I think I found an error in Client class close() method:

0.5.RC5

public void close() throws IOException {
if (channel != null && channel.isConnected()) {
send(new TinyRequest(Tiny.CLOSE));
if (outChannel != null) {
disableOutGauge();
disableOutSim();
outChannel.close();
}
channel.close();
}
}


If Tiny.CLOSE is send before disableOutGauge() or disableOutSim() then this last two instructions are lost and the host keeps sending data, so I think it should be:


public void close() throws IOException {
if (channel != null && channel.isConnected()) {
if (outChannel != null) {
disableOutGauge();
disableOutSim();
outChannel.close();
}
send(new TinyRequest(Tiny.CLOSE));
channel.close();
}
}

Brilwing
2nd April 2009, 08:27
Hi java friends :thumb:

In OutGaugeResponse packet when i call getWaterTemperatur(), getOilPressure(), getTurbo() I always get a return of 0.0, other methods works perfect (fuel, brake, throttle, displays, etc.) ; could anyone confirm this please?

Hmm, I have checked the code, but cannot find any errors, so I have to run a test.


Also I think I found an error in Client class close() method:
...

Yes this could be a bug, I will change this.

P.S. If you want change such things yourself I can give you access to the svn repo at sourceforge

Ramon F.
3rd April 2009, 02:59
Thanks Brilwing, PM sent.

Ramon F.
7th April 2009, 13:24
Err... my bad :duck:

getTurbo() works, but getWaterTemperatur(), getOilPressure() doesn't :scratchch

amp88
17th June 2009, 22:25
I'm having a little problem at the moment using the "work done" flags in the PitStopResponse class. Hopefully someone here has some experience and can help me out. It seems like the "didBodyMinor()" method always returns true even when I don't think any work has been done. I have damage repair set to No, but didBodyMinor always returns true. Has anyone used this method successfully before? I'm using JInSim 0.5rc5 (latest version on the homepage).

Thanks in advance.

Ramon F.
18th June 2009, 07:46
It's a bug, I'm sure Brilwing will fix it in the next version, but meanwhile you could try this:

Edit: Fixed, thanks Brilwing.

Brilwing
18th June 2009, 08:01
It's a bug, I'm sure Brilwing will fix it in the next version, but meanwhile you could try this:


Here is a jar with the fix: http://liveforspeed.at/download/jinsim-0.5rc6.jar

amp88
18th June 2009, 10:45
Here is a jar with the fix: http://liveforspeed.at/download/jinsim-0.5rc6.jar

Fantastic! Thanks very much for the quick fix :)

For anyone else who downloads this update you'll need to switch from the commons logging library to SL4J (http://www.slf4j.org/download.html). Download the Zip archive on that site and add in the "slf4j-api-1.5.8.jar" and "slf4j-simple-1.5.8.jar" Jars to your build path (this is what I found using trial and error, it's working for me so I believe it's correct).

I have another question I forgot to ask yesterday. Is there any way to determine the Reset/Midrace Join/Must Pit etc flags if you don't have the RaceStartResponse for a particular race? If, for example, you miss the start of the race or an admin changes these flags during the race? I've taken a look at the StateResponse class (received as a result of sending the Tiny.SEND_STATE_INFO TinyRequest), but I can't see it in there.

Thanks again for any help on this second question.

Ramon F.
18th June 2009, 12:49
I've cheked the INSIM documentation and couldn't find those flags other than RaceStartResponse packet :shrug:

amp88
18th June 2009, 12:58
I've cheked the INSIM documentation and couldn't find those flags other than RaceStartResponse packet :shrug:

Yeah, that's what I'm worried about. Also, there doesn't seem to be any way to detect if an admin changes them during a race. I was hoping someone had come on this problem and sorted it already, but feared it was impossible :(

bdshan
18th June 2009, 13:07
Have you tested if Admin command such as /canreset are captured by the MessageResponse? If they are that how you can listen for the admin making changes during a race session.

amp88
18th June 2009, 13:15
Have you tested if Admin command such as /canreset are captured by the MessageResponse? If they are that how you can listen for the admin making changes during a race session.

Yes I've tested that before. I don't see any MessageResponses when the reset/midrace/mustpit are changed.

amp88
18th June 2009, 20:08
I think I've found a small bug with the split count on AS5/AS5R. The Track class has it as 4 sectors (see first attached screenshot), but in reality it's only 3 sectors (as shown by LFS World, second screenshot). I didn't see any other problems with the sector counts but I haven't checked each one rigorously. Thanks.

Brilwing
19th June 2009, 08:15
I think I've found a small bug with the split count on AS5/AS5R. The Track class has it as 4 sectors (see first attached screenshot), but in reality it's only 3 sectors (as shown by LFS World, second screenshot). I didn't see any other problems with the sector counts but I haven't checked each one rigorously. Thanks.

Changed AS5 to have 3 sectors and updated the jar: http://liveforspeed.at/download/jinsim-0.5rc6.jar

amp88
19th June 2009, 20:48
Changed AS5 to have 3 sectors and updated the jar: http://liveforspeed.at/download/jinsim-0.5rc6.jar

Thanks again for the quick update :)

I've created a new improvement suggestions thread (http://www.lfsforum.net/showthread.php?p=1190702#post1190702) to see if we can get the status flags into the state packet.

amp88
20th June 2009, 11:16
Me again. I have another problem but this time it's more difficult to track down. This has happened a couple of times but it's not reproducible so I'm not sure how it can be investigated. It looks as though an empty string is being passed to the getCarByName method in the Car class which throws an IllegalArgumentException. The couple of times it's happened to me have been when I started my application during an online race session. The code is called from the construct method in the NewPlayerResponse:

public void construct(ByteBuffer buffer) throws BufferUnderflowException {
super.construct(buffer);
connectionId = buffer.get();
playerType = buffer.get();;
playerFlags = buffer.getShort();
playerName = getString(buffer, 24);
numberPlate = getString(buffer, 8);
String carName = getString(buffer, 4);
car = Car.getCarByName(carName);
skinName = getString(buffer, 16);
tyres = new Tyres(buffer);
addedMass = buffer.get();
intakeRestriction = buffer.get();
model = buffer.get();
passengers = buffer.get();
buffer.position(buffer.position()+5);
numberInRace = buffer.get();
buffer.position(buffer.position()+2);
}

This is what I have in my log file:

163 [Thread-3] ERROR net.sf.jinsim.AbstractChannel - Something went wrong!
java.lang.IllegalArgumentException: No car for given name found:
at net.sf.jinsim.Car.getCarByName(Car.java:52)
at net.sf.jinsim.response.NewPlayerResponse.construct (NewPlayerResponse.java:87)
at net.sf.jinsim.response.ResponseFactory.getPacketDa ta(ResponseFactory.java:145)
at net.sf.jinsim.AbstractChannel.run(AbstractChannel. java:105)
at java.lang.Thread.run(Unknown Source)
163 [Thread-3] ERROR net.sf.jinsim.AbstractChannel - Something went wrong!
java.lang.IllegalArgumentException: No car for given name found:
at net.sf.jinsim.Car.getCarByName(Car.java:52)
at net.sf.jinsim.response.NewPlayerResponse.construct (NewPlayerResponse.java:87)
at net.sf.jinsim.response.ResponseFactory.getPacketDa ta(ResponseFactory.java:145)
at net.sf.jinsim.AbstractChannel.run(AbstractChannel. java:105)
at java.lang.Thread.run(Unknown Source)
163 [Thread-3] ERROR net.sf.jinsim.AbstractChannel - Something went wrong!
java.lang.IllegalArgumentException: No car for given name found:
at net.sf.jinsim.Car.getCarByName(Car.java:52)
at net.sf.jinsim.response.NewPlayerResponse.construct (NewPlayerResponse.java:87)
at net.sf.jinsim.response.ResponseFactory.getPacketDa ta(ResponseFactory.java:145)
at net.sf.jinsim.AbstractChannel.run(AbstractChannel. java:105)
at java.lang.Thread.run(Unknown Source)
164 [Thread-3] ERROR net.sf.jinsim.AbstractChannel - Something went wrong!
java.lang.IllegalArgumentException: No car for given name found:
at net.sf.jinsim.Car.getCarByName(Car.java:52)
at net.sf.jinsim.response.NewPlayerResponse.construct (NewPlayerResponse.java:87)
at net.sf.jinsim.response.ResponseFactory.getPacketDa ta(ResponseFactory.java:145)
at net.sf.jinsim.AbstractChannel.run(AbstractChannel. java:105)
at java.lang.Thread.run(Unknown Source)
164 [Thread-3] ERROR net.sf.jinsim.AbstractChannel - Something went wrong!
java.lang.IllegalArgumentException: No car for given name found:
at net.sf.jinsim.Car.getCarByName(Car.java:52)
at net.sf.jinsim.response.NewPlayerResponse.construct (NewPlayerResponse.java:87)
at net.sf.jinsim.response.ResponseFactory.getPacketDa ta(ResponseFactory.java:145)
at net.sf.jinsim.AbstractChannel.run(AbstractChannel. java:105)
at java.lang.Thread.run(Unknown Source)
164 [Thread-3] ERROR net.sf.jinsim.AbstractChannel - Something went wrong!
java.lang.IllegalArgumentException: No car for given name found:
at net.sf.jinsim.Car.getCarByName(Car.java:52)
at net.sf.jinsim.response.NewPlayerResponse.construct (NewPlayerResponse.java:87)
at net.sf.jinsim.response.ResponseFactory.getPacketDa ta(ResponseFactory.java:145)
at net.sf.jinsim.AbstractChannel.run(AbstractChannel. java:105)
at java.lang.Thread.run(Unknown Source)

...

10071 [Thread-3] ERROR net.sf.jinsim.AbstractChannel - Something went wrong!
java.lang.IllegalArgumentException: No car for given name found:
at net.sf.jinsim.Car.getCarByName(Car.java:52)
at net.sf.jinsim.response.NewPlayerResponse.construct (NewPlayerResponse.java:87)
at net.sf.jinsim.response.ResponseFactory.getPacketDa ta(ResponseFactory.java:145)
at net.sf.jinsim.AbstractChannel.run(AbstractChannel. java:105)
at java.lang.Thread.run(Unknown Source)
10071 [Thread-3] ERROR net.sf.jinsim.AbstractChannel - Something went wrong!
java.lang.IllegalArgumentException: No car for given name found:
at net.sf.jinsim.Car.getCarByName(Car.java:52)
at net.sf.jinsim.response.NewPlayerResponse.construct (NewPlayerResponse.java:87)
at net.sf.jinsim.response.ResponseFactory.getPacketDa ta(ResponseFactory.java:145)
at net.sf.jinsim.AbstractChannel.run(AbstractChannel. java:105)
at java.lang.Thread.run(Unknown Source)
10071 [Thread-3] ERROR net.sf.jinsim.AbstractChannel - Something went wrong!
java.lang.IllegalArgumentException: No car for given name found:
at net.sf.jinsim.Car.getCarByName(Car.java:52)
at net.sf.jinsim.response.NewPlayerResponse.construct (NewPlayerResponse.java:87)
at net.sf.jinsim.response.ResponseFactory.getPacketDa ta(ResponseFactory.java:145)
at net.sf.jinsim.AbstractChannel.run(AbstractChannel. java:105)
at java.lang.Thread.run(Unknown Source)

I don't know if it's significant but the number at the start of the error (163 and 10071 in the above example) appears to be repeated 3 times in each case. The numbers do not increase in a uniform manner (e.g. 163, 164, 165, 166, 167, 168, 169, 170, 200, 201, 2072...). I can't follow the code from the AbstractChannel class because there isn't source included with the updated 0.5rc6 jar you've posted. Sorry I can't be more specific.

edit: Something else that's got me puzzled now too. I set up a single player race with some AIs. I put qualifying to 15 minutes and the race length to 4 hours. When I look at the values in the RaceLaps object (obtained from getNumLaps() in StateResponse class) I get the following properties:

isTimedRace(): false
isPractice(): false
geLaps(): -62

I would have expected the results to be:

isTimedRace(): true
isPractice(): false
getLaps(): 4

Looking at the code in the RaceLaps constructor (from 0.5rc5):

if (readLap == 0) {
isPractice = true;
isTimedRace = false;
laps = 0;
} else if (readLap > 190) {
isPractice = false;
isTimedRace = true;
laps = readLap - 190;
} else if (readLap > 100) {
isPractice = false;
isTimedRace = false;
laps = (readLap - 100) * 10 + 100;
} else {
isPractice = false;
isTimedRace = false;
laps = readLap;
}

The last 2 branches are the only ones with both isPractice and isTimedRace flags false. The last branch should be the one which is executed, according to the InSim documentation:

// RaceLaps (rl) : (various meanings depending on range)

// 0 : practice
// 1-99 : number of laps... laps = rl
// 100-190 : 100 to 1000 laps... laps = (rl - 100) * 10 + 100
// 191-238 : 1 to 48 hours... hours = rl - 190

However, in that case the value of readLap should be 194, not -62.

Am I missing something here or is there a problem?

amp88
22nd June 2009, 03:00
Another small thing. When the player name has a vertical bar (or pipe) in it, like the following:

MoE|B. Keough

When they talk the getDriverName() method in MessageResponse will return the following:

MoE^vB. Keough

edit: And something else a little more serious. Calling toString() on a RaceStartResponse and a StateResponse object. They show different wind and weather conditions (the actual conditions were high wind and cloudy sunset, so the RaceStartResponse is correct and the StateResponse looks like it's incorrect).

Mon 22 Jun 2009 07:37:46: SessionInformation : raceStartResponse.toString(): [net.sf.jinsim.response.RaceStartResponse],
raceLaps: 0,
qualifingMinutes: 0,
numberOfPlayers: 1,
track: SOUTH_CITY_LONG,
weather: CLOUDY_SUNSET_DUSK,
wind: HIGH,
raceFlags: 163,
numberOfNodes: 533,
finishLineNodeIndex: 455,
split1NodeIndex: 70,
split2NodeIndex: 262,
split3NodeIndex: -1
Mon 22 Jun 2009 07:37:46: SessionInformation : stateResponse.toString(): [net.sf.jinsim.response.StateResponse]
Replay speed: 1.0X normal
Flags:
Show 2D display.
Camera: Driver View
Player: 0
Number of players: 1
Number of connections: 1
Number of racers finished: 0
Race in progress: No
Qualifying length: 0 laps.
Race length: 10 laps.
Track name: SO4
Weather type: 0
Wind type: None

Brilwing
22nd June 2009, 16:11
public void construct(ByteBuffer buffer) throws BufferUnderflowException {
super.construct(buffer);
connectionId = buffer.get();
playerType = buffer.get();;
playerFlags = buffer.getShort();
playerName = getString(buffer, 24);
numberPlate = getString(buffer, 8);
String carName = getString(buffer, 4);
car = Car.getCarByName(carName);
skinName = getString(buffer, 16);
tyres = new Tyres(buffer);
addedMass = buffer.get();
intakeRestriction = buffer.get();
model = buffer.get();
passengers = buffer.get();
buffer.position(buffer.position()+5);
numberInRace = buffer.get();
buffer.position(buffer.position()+2);
}


changed that the Car.getCarByName() returns null if the carName is not defined instead of the IllegalArgumentException



isTimedRace(): false
isPractice(): false
geLaps(): -62

I would have expected the results to be:

isTimedRace(): true
isPractice(): false
getLaps(): 4

snip



Thats a bug in jinsim I have fixed now.

Both changes are in the updated jar: http://liveforspeed.at/download/jinsim-0.5rc6.jar

For the other two Issues I have to test it with LFS that I don't have on my computer now, cause I'm working on my Mac.

amp88
22nd June 2009, 21:04
Thanks again, I really appreciate it.

amp88
24th June 2009, 11:24
Another issue. I'm not sure if this is to do with JInSim or InSim, but hopefully someone can point me in the right direction.

In the attached MPR there is a PitLaneResponse indicating the player entered the pitlane received immediately as the replay begins (when everyone is still waiting on the grid for the race to start). I don't understand why this is sent as it should only be sent when the player enters the pitlane from the race track.

As I said above, I don't know what the cause of this issue is, but please let me know what you think about it.

Thanks again.

edit: Just remembered another point. Would it be possible to make the InSimResponse a Serializable class?

bdshan
24th June 2009, 11:33
I believe ^9 returns the coloring back to the default from another color.

amp88
24th June 2009, 11:39
I believe ^9 returns the coloring back to the default from another color.

Yeah, I actually just realised that as I hit the "Post Message" button, so I tried to just remove it before anyone saw it. It's one of those situations where you see the solution to the problem when you talk about it or tell someone about it.

amp88
17th July 2009, 05:48
Another small issue. The Car enum has SVW for the car code for the Scirocco but it should be VWS.

amp88
23rd July 2009, 23:33
Another small issue and a question. The small issue is that the PacketType enum has "MULIT_CAR_INFO" rather than "MULTI_CAR_INFO" and the question is that I can't seen to find the button function request to clear all buttons made by an InSim application. I don't know whether I'm just missing it or if it's missing from JInSim.

enum // the fourth byte of IS_BFN packets is one of these
{
BFN_DEL_BTN, // 0 - instruction : delete one button (must set ClickID)
BFN_CLEAR, // 1 - instruction : clear all buttons made by this insim instance
BFN_USER_CLEAR, // 2 - info : user cleared this insim instance's buttons
BFN_REQUEST, // 3 - user request : SHIFT+B or SHIFT+I - request for buttons
};

Ramon F.
24th July 2009, 10:06
Thanks for the reports, I will check those issues on the weekend :magnify:

bdshan
24th July 2009, 12:39
I can't seen to find the button function request to clear all buttons made by an InSim application.

I wrote this utility function to remove buttons. To remove all buttons just send in the connection id of 255.


/*
* Utility function to clear a button from any connection
* or all connections
*/
public void clearButton(byte connid)
{
try
{
ButtonFunctionRequest r = new ButtonFunctionRequest();
r.setSubtype(ButtonSubtype.CLEAR);
r.setConnectionId(connid); // 255 is for all connections
r.setClickId(BTN_ID);
client.send(r);
}
catch (IOException e)
{
lg.writeToLog(e.toString());
}
}

amp88
24th July 2009, 13:16
Thanks for the reports, I will check those issues on the weekend :magnify:

Thanks :)

I wrote this utility function to remove buttons. To remove all buttons just send in the connection id of 255.

And thanks :)

amp88
25th July 2009, 02:01
This is killing me and to save my life I can't figure out a solution.

I am trying to read a Path file, AS1.pth to be exact. It was going along swimmingly until I need the number of nodes. When I do a readInt() I get a wacky number 536936448, but I know for a fact that AS1 has 288 nodes. Am I using the wrong function call here? Any suggestions?

...


Bit of a necrobump here. I was just playing about with pth files. After facing the same problem as you I got it to work by using little endian ordering. I've attached a few of the classes I've created to test this out with. The code for actually reading in the PTH file is in the PTHFileTesting class. TrackData and OneNode classes are also included. The getTrackLength() method in TrackData is "borrowed" from avetere (originally from this post (http://www.lfsforum.net/showthread.php?p=1173222#post1173222) with the subsequent modification noted in this post (http://www.lfsforum.net/showthread.php?p=1175007#post1175007)).

edit: Just realised the finish node is missing from the TrackData class attached to this post.

edit2: Also forgot to credit this post (http://www.lfsforum.net/showthread.php?p=981376#post981376) of Greenseed's for the algorithm (in C Sharp?).

Brilwing
25th July 2009, 09:31
Bit of a necrobump here. I was just playing about with pth files. After facing the same problem as you I got it to work by using little endian ordering. I've attached a few of the classes I've created to test this out with.

<snip>


Do you want to include this into JInSim?
If yes, you can do it yourself. I can add you as developer to the JInSim project on sourceforge if you like.

amp88
25th July 2009, 15:11
Do you want to include this into JInSim?
If yes, you can do it yourself. I can add you as developer to the JInSim project on sourceforge if you like.

No, I was just looking through the thread and saw bdshan was doing some work in an area I'd just been working in and he had a problem. You can include it in JInSim if you'd like.

amp88
10th August 2009, 01:45
Any thoughts? (http://www.lfsforum.net/showthread.php?t=60331)

amp88
15th August 2009, 13:34
As a follow on from this thread (http://www.lfsforum.net/showthread.php?t=60483) it seems like some major changes may be required to JInSim. The problem is that bytes sent by LFS through InSim are unsigned whereas the byte in Java is signed. So, InSim's byte can have values from 0-255 whereas JInSim's byte can have values from -128-127. If you try to represent a value outwith that range you'll get -1 (which was the cause of my problem in the other thread). So, it looks like all the bytes that come from InSim may have to be represented with shorts or ints instead to cover the range 0-255.

amp88
15th August 2009, 18:04
Another issue following on from this post (http://www.lfsforum.net/showthread.php?p=1238274#post1238274).

davidmd
16th August 2009, 01:07
Hi everyone:

I'm starting to use the JInSim library and I have one doubt about CameraPositionResponse class, in the InSim.txt of my game says that after the roll value comes the ID of the viewed player, but in the class I only could find a getPlayerIndex that I think is the same. Am I correct?? If so I would be nice to change the name of the method.

Thanks

amp88
16th August 2009, 01:12
Hi everyone:

I'm starting to use the JInSim library and I have one doubt about CameraPositionResponse class, in the InSim.txt of my game says that after the roll value comes the ID of the viewed player, but in the class I only could find a getPlayerIndex that I think is the same. Am I correct?? If so I would be nice to change the name of the method.

Thanks

Yes, getPlayerIndex returns the unique player ID (PLID).

davidmd
16th August 2009, 01:15
Yes, getPlayerIndex returns the unique player ID (PLID).

Thanks :thumb:

Dygear
16th August 2009, 06:58
As a follow on from this thread (http://www.lfsforum.net/showthread.php?t=60483) it seems like some major changes may be required to JInSim. The problem is that bytes sent by LFS through InSim are unsigned whereas the byte in Java is signed. So, InSim's byte can have values from 0-255 whereas JInSim's byte can have values from -128-127. If you try to represent a value outwith that range you'll get -1 (which was the cause of my problem in the other thread). So, it looks like all the bytes that come from InSim may have to be represented with shorts or ints instead to cover the range 0-255.

Modern CPUs use two’s complement integer arithmetic. For positive values, the bitwise representation of a value is the same in one’s complement and two’s complement, but the representations differ for negative values. For instance, the same bit pattern that means -5 in one’s complement stands for -6 in two’s complement

Wofford's Scientific Programming, Error's with Integer Arithmetic (http://www.wofford.org/ecs/ScientificProgramming/Error/IntegerArithmetic/material.htm)

Brilwing
16th August 2009, 09:52
see http://www.lfsforum.net/showthread.php?p=1238724#post1238724

davidmd
25th September 2009, 02:21
Hi,
I'm trying to send to spectator a player, now I have the playerId, but I have could figured out how to send a packet forcing a player to spectate. Any help would be really appreciated.
Thanks.

amp88
25th September 2009, 03:03
Hi,
I'm trying to send to spectator a player, now I have the playerId, but I have could figured out how to send a packet forcing a player to spectate. Any help would be really appreciated.
Thanks.

If you want to force a player to spectate you need to find out their license name. This is the the value returned by the "getUsername()" method in the NewConnectionResponse class associated with the player's connection. To find out which connection is associated with the player you need to use the value returned by the "getConnectionID()" method in the NewPlayerResponse. When have the player's connectionID you can get the username of the player's connection by using the "getUsername()" as I said above. When you know the player's license name you have to send the following command to LFS:

/spec amp88

Where you replace the "amp88" with the player's license name. To send the command to LFS you need to create a new MessageRequest containing the above String then send it to the client. Let me know if that's enough information for you or if you're still struggling.

davidmd
25th September 2009, 03:46
Got it, thank you very much.

bdshan
25th September 2009, 11:38
client.send(new MessageRequest("/spec " + lfsid));

davidmd
2nd October 2009, 01:07
Hi,
Now I'm working on an application to check the tyre compound at the beginning of the race and when does the player make a pit stop and change it. And I have found a problem, in the replay (at the end of the post) at about 3:45 minutes of the replay time, the player named 24[GRP]Ivan, made a pit stop, he came with the following tyre compound "Tyres [rearLeft=0, rearRight=0, frontLeft=0, frontRight=0]" (R1 type) and when the PitStopResponse event is generated, the tyres report "Tyres [rearLeft=-1, rearRight=-1, frontLeft=1, frontRight=1]" (should be R2(1) in front and R1(0) in rear). The problem is that there is no tyre type -1, it should be 0 (unless I don't understand something :) ).

am I correct??

REPLAY:
http://rapidshare.com/files/287554441/testing.mpr.html

amp88
2nd October 2009, 01:42
At the start of the race 24[GRP]Ivan has R1 tyres back and front (all of his tyres are equal to the value 0). When he pits he changes his front tyres to R2 compound but leaves his rears at R1 compound. Now his front tyres are equal to the value 1 (which corresponds to R2) and his rears have the value -1. Now, the -1 value doesn't correspond to any tyre type (like R1, R2, R3) but what it means is that those tyres haven't been changed. If you take a look at the source code of the Tyres.java class you'll see more:

public static final byte TYRE_R1 = 0;

public static final byte TYRE_R2 = 1;

public static final byte TYRE_R3 = 2;

public static final byte TYRE_R4 = 3;

public static final byte TYRE_ROAD_SUPER = 4;

public static final byte TYRE_ROAD_NORMAL = 5;

public static final byte TYRE_HYBRID = 6;

public static final byte TYRE_KNOBBLY = 7;

public static final byte NOT_CHANGED = (byte)0xff;

The value (byte) 0xff which represents the NOT_CHANGED value is equal to -1 (you can find this out by doing a System.out.println((byte) 0xff).

davidmd
2nd October 2009, 01:51
OK, once again thank you very very much for your help. Now I see what I was doing wrong. I'll take a look at the source code before.

amp88
2nd October 2009, 01:55
No problem, glad to help :)

amp88
23rd November 2009, 04:53
Something that's been bugging me for a while. If your own LFS project uses Log4J and you are logging at the debug level you also get debugging information that's being generated by JInSim. Is there any way to stop this debugging information being generated by JInSim (like a static global flag?) other than changing my own debugging level?

Brilwing
23rd November 2009, 08:54
Log4j comes with all you need. Here is an example configuration that sets the global log level to info and the log level for all classes under com.mypackage to debug.


<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
</layout>
</appender>

<logger name="com.mypackage">
<level value="debug"/>
</logger>

<root>
<priority value ="info"/>
<appender-ref ref="STDOUT"/>
</root>

</log4j:configuration>

amp88
23rd November 2009, 09:06
Log4j comes with all you need. Here is an example configuration that sets the global log level to info and the log level for all classes under com.mypackage to debug.

Thanks, I'd forgotten about setting specific log levels for different packages :)

apm
28th November 2009, 22:51
Could you guys guide me, I cant even get these examples to work. What I am doing wrong?
C:\Users\user\Desktop\prkl\jinsim-0.3>java -cp dist/jinsim-0.5.rc5.jar net.sf.ji
nsim.examples.helloworld.Main localhost 10000
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lo
gging/LogFactory
at net.sf.jinsim.AbstractChannel.<clinit>(AbstractChannel.java:17)
at net.sf.jinsim.examples.helloworld.Main.run(Main.ja va:93)
at net.sf.jinsim.examples.helloworld.Main.main(Main.j ava:150)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFacto
ry
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 3 more

Running on LFS Z25 with launch paremeter /insim=10000.

amp88
28th November 2009, 23:21
Could you guys guide me, I cant even get these examples to work. What I am doing wrong?

C:\Users\user\Desktop\prkl\jinsim-0.3>java -cp dist/jinsim-0.5.rc5.jar net.sf.jinsim.examples.helloworld.Main localhost 10000
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at net.sf.jinsim.AbstractChannel.<clinit>

The JInSim library uses a logging library that you need to specify on the class path to run any of the examples. A version of the required library is located in the lib directory. Try the following command to run the example instead:

java -cp dist\*;lib\*; net.sf.jinsim.examples.helloworld.Main 127.0.0.1 10000

What this does (by specifying the dist\* and lib\* classpath entries) is to put the logging library on the classpath. Also it's worth noting that I've replaced the "localhost" for the host parameter with "127.0.0.1". I've found that Vista and Java don't get on well together with "localhost" (I don't know if you're using Vista, but it's just something to put in the mind of anyone who does run Vista and looks at this thread). Good luck and happy coding :)

apm
29th November 2009, 00:43
The JInSim library uses a logging library that you need to specify on the class path to run any of the examples. A version of the required library is located in the lib directory. Try the following command to run the example instead:

java -cp dist\*;lib\*; net.sf.jinsim.examples.helloworld.Main 127.0.0.1 10000What this does (by specifying the dist\* and lib\* classpath entries) is to put the logging library on the classpath. Also it's worth noting that I've replaced the "localhost" for the host parameter with "127.0.0.1". I've found that Vista and Java don't get on well together with "localhost" (I don't know if you're using Vista, but it's just something to put in the mind of anyone who does run Vista and looks at this thread). Good luck and happy coding :)
Thanks for quick reply and solving my problem :thumb:. You were correct about localhost , as I'm running on Windows 7. Looking forward to spend some time with java on vacation :).

Lama Racing Team
8th December 2010, 15:54
Hello guys,

please I have problem. How I send a keypress from my program with jinsim ? I try write software for blinking headlight. Thank you.

Brilwing
8th December 2010, 16:05
Just use the MessageRequest class.

e.g.

MessageRequest msgRequest = new MessageRequest();
msgRequest.setMessage("/press 3"); // turns on and off the headlights
client.send(msgRequest);


You can use the helloworld/Main.java example that is included in jinsim so see a full example how a message request is send.

Lama Racing Team
9th December 2010, 09:16
thank you a lot man ! lights,blinkers works, but now I have problem with ignition. the script command /press I not works, Its posible to cut the ignition from jinsim ? i found the program in c# where the ignition cut works. sorry for wasting your time man.

Hidra Julika
19th January 2011, 17:46
I receive OutSim and OutGauge packets , based on the Speedometer example.

I can receive OutGauge packets _or_ OutSim packets very well, everything works. But not at the same time.

If I set...
client.enableOutGauge(1);
client.enableOutOutsim(1);

Monitoring the response I see no OutGauge packets only OutSim recieved. (response.toString)

(If I turn off OutSim, OutGauge packtes come.)

Any ideas what do I do wrong? I tried everything and googled for a day, but nothing moved me further.

Thanks in advance, and respect for the effort, jinsim seems to be a bliss form my motionsim project.

Hidra Julika
24th January 2011, 18:45
Well maybe my above post was not clear enough. Lets say, it's becouse I'm not a native speaker, and I was tried. :)

Nevertheless, I found the solution. I think it's a bug in OutChannel.java.

So the problem is, if both OutSim and OutGauge packages are sent by LFS, jinsim will interpret both as OutSim packages. From the user perspective it makes virtually no OutGauge packages received, and every second OutSim packages contains incorrect values. (This second packages are the OutGauge packages, only jinsim process them as they were OutSim packages.)

My solution was to change the run method of OutChannel.java.
I deleted every buffer.slip(); lines, and inserted buffer.position(0); at the end of the two if section.

I think the problem with the original, that the buffer.flip of the if else section sets the buffer limit to 68 (the last package's size). So after this every buffer.position(); reading will give 68 and will never go into the first if.

I run LFS on a PC, and jinsim on a laptop, that runs Ubuntu and connected via wireless to the PC. Just for the record, but I don't think this is an issue.

MadCatX
24th January 2011, 19:15
In which version of JInSim does this happen? I have 0.5-rc5 here and the code looks like it should work.

Perhaps calling buffer.clear() instead of the second buffer.flip() in each if-block would be a good idea, but other than that I think the code is OK in 0.5-rc5.

Hidra Julika
24th January 2011, 19:24
0.5RC5
Looking at the code, I don't think it could work otherwise, than buggy. But I'm not a veteran programmer, so I might miss something.
The code in question is as follows:


public void run() {
running = true;

ByteBuffer buffer = ByteBuffer.allocateDirect(BUFFER_SIZE);
buffer.order(ByteOrder.LITTLE_ENDIAN);

while (running) {
try {

datagramChannel.receive(buffer);

if (buffer.position() == OUT_GAUGE_SIZE) {
buffer.flip();

OutGaugeResponse reponse = new OutGaugeResponse();
reponse.construct(buffer);
client.notifyListeners(reponse);
buffer.flip();


} else if (buffer.position() == OUT_SIM_SIZE || buffer.position() == OUT_SIM_SIZE - 4) {
buffer.flip();

OutSimResponse response = new OutSimResponse();
response.construct(buffer);
client.notifyListeners(response);
buffer.flip();
}
Thread.sleep(10);
} catch (Exception e) {
log.error("Something went wrong!", e);
}
}
}

MadCatX
24th January 2011, 19:54
I can't fool around with it right now, but shouldn't this work?

try {
datagramChannel.receive(buffer);

if (buffer.position() == OUT_GAUGE_SIZE || buffer.position() == 92 //OutGauge size without ID) {
buffer.flip();
OutGaugeResponse reponse = new OutGaugeResponse();
reponse.construct(buffer);
client.notifyListeners(reponse);
buffer.clear(); //CHANGED
} else if (buffer.position() == OUT_SIM_SIZE || buffer.position() == OUT_SIM_SIZE - 4) {
buffer.flip();
OutSimResponse response = new OutSimResponse();
response.construct(buffer);
client.notifyListeners(response);
buffer.clear(); //CHANGED
}
Thread.sleep(10);
}

Hidra Julika
24th January 2011, 21:01
Maybe you misunderstand me.
The solution that i was posted works for me.
I think yours works too.
Maybe instead buffer.position(0) is better buffer.clear.

But the problem is buffer.flip I think. I dont really see the point of buffer.flip in the original code. As far I know it sets the new limit to the current position, and then sets position to zero.

The problem is with the original, that buffer.flips sets buffer limit to 68 (since OutSim package comes first) thats why the new buffer size becomes 68 bytes.

So, there will be never again 96 bytes buffer, because it is capped to 68 bytes to the rest of eternity. The next flips just "changes" form 68 to 68 again.

So the next OutGauge package fills the newly set 68 bytes buffer (the remaining bytes are ignored) and continues its life as an OutSim package (with completly meaningless data of course).

In other words we cant differ packages by size, if the buffer is set to the size of the smaller package. And that is what OutSim's buffer.flip does.

Am I thinking right?

MadCatX
24th January 2011, 21:22
I deleted every buffer.slip(); lines, and inserted buffer.position(0); at the end of the two if section.

It was the word "every" in this sentence that got me confused, I thought you somehow got rid of flipping the buffer altogether.

Does this code work in every case? The way I see it the current core ignores the possibility of an OutGauge packet with no ID which is only 92 bytes long.

Hidra Julika
24th January 2011, 21:32
Yes, I deleted all the buffer.flip lines.
I tried yours, it works too.

The way I see it the current core ignores the possibility of an OutGauge packet with no ID which is only 92 bytes long.

Yes, you are right I think.

It misses the OR relation, that OutSim's IF ELSE has.

else if (buffer.position() == OUT_SIM_SIZE || buffer.position() == OUT_SIM_SIZE - 4)

ghowden
29th April 2011, 12:45
Just looking through outguage, I understand what most of the flags are, except OG_1 OG_2 OG_3 OG_4, what are they?

Dygear
29th April 2011, 13:11
Reserved for later use?

ghowden
29th April 2011, 13:44
Ah OK makes sense, I haven't done algorithm stuff for ages, am I right in thinking to get the individual flags that are on I try taking away the largest flag number, if the result is minus it means its false, if its positive I make the flag number that amount less and then do the same with each of the rest of the flags in reverse number order?

Dygear
29th April 2011, 16:53
I would do a Bitwise AND (http://en.wikipedia.org/wiki/Bitwise_operation#AND) check to see if the bit is set or not. Basically as not as the expression's value is not Zero (0) then the bit is set.

ghowden
29th April 2011, 17:21
So basically:


if(flags & OutGaugeResponse.OG_BAR != 0){
//stuff to do if pressure is in bar
}


would check if the pressure is in bar?

Would clear what I have up a touch lol :)


edit:
Think I'm doing something wrong, the only flags I seem to be able to get are BAR and KM :/

Dygear
29th April 2011, 18:51
would check if the pressure is in bar?

That's correct as far as I can tell.

DarkTimes
29th April 2011, 18:55
Just had a look at the source on SourceForge, it looks to me that JInSim has not been updated for quite a while, and doesn't have the updated DashLights/ShowLights flags. So it seems you can't use JInSim with the latest version of OutGauge, you'd either need to modify the source, or find another library.

Edit: Or as Morpha below says, use his nifty script (http://www.lfsforum.net/showthread.php?p=1329031#post1329031).

morpha
29th April 2011, 19:05
Or use a relay with conversion ability, like the one (simple python script) I posted in the CarSoundRemixer thread somewhere. It can convert Z25+ OutGauge packets to pre Z25 packets on the fly.

ghowden
29th April 2011, 22:41
Ah thats great didn't know it was outdated code, the main download link pointed to 0.3, I went and got 0.5. Looking at this thread there seems to be a 0.6 out but I can't find source for it.

I'll use the relay for now, I can't seem to find the specs for outgauge atm, but I'll have a go at updating jinsim for new patches when I've finished my program.

ghowden
30th April 2011, 12:59
Well I've just tried this:


if((flags & OutGaugeResponse.DL_FULLBEAM) != 0)
System.out.print("FULLBEAM ");
if((flags & OutGaugeResponse.DL_ABS) != 0)
System.out.print("ABS ");
if((flags & OutGaugeResponse.DL_BATTERY) != 0)
System.out.print("BATTERY ");
if((flags & OutGaugeResponse.DL_HANDBRAKE) != 0)
System.out.print("HANDBRAKE ");
if((flags & OutGaugeResponse.DL_NUM) != 0)
System.out.print("NUM ");
if((flags & OutGaugeResponse.DL_OILWARN) != 0)
System.out.print("OIL ");
if((flags & OutGaugeResponse.DL_PITSPEED) != 0)
System.out.print("PIT ");
if((flags & OutGaugeResponse.DL_SHIFT) != 0)
System.out.print("SHIFT ");
if((flags & OutGaugeResponse.DL_SIGNAL_ANY) != 0)
System.out.print("SIGNALANY ");
if((flags & OutGaugeResponse.DL_SIGNAL_L) != 0)
System.out.print("SIGNALL ");
if((flags & OutGaugeResponse.DL_TC) != 0)
System.out.print("TC");
System.out.println("");


With the values found here:

http://pyinsim.codeplex.com/SourceControl/changeset/view/219226b8d279#pyinsim%2finsim.py

Which I'm assuming is current.

It prints nothing at all in normal use when flicking lights/indicators, but pressing 1/2 seems to give random flags and getting wrong route/restricted area seems to do the same. Even entering pits or pressing Esc seems to give results, anything but what I expected really. BAR and KM work tho.

Am I still using outdated flag values or has outgauage packets changed too and I need to fix parsing of them?

morpha
30th April 2011, 13:09
I think you misunderstood the problem. You want to use JInSim, which implements pre-Z25 (technically pre-Z22, but those were test patches) OutGauge, with the current LFS version (i.e. post-Z25). The actual content hasn't really changed, but the format did. What you have to do now, by means of the relay, is convert the post-Z25 packets to pre-Z25 (22) packets on the fly. That means you put the relay in-between LFS and your application, i.e. instead of specifying your application's port in LFS's cfg.txt, you specify the relay's and configure the relay to convert and finally forward the packets to your application's port.

In your JInSim application, you then treat the input as pre-Z25, or to clarify, like so:struct OutGaugePack
{
unsigned Time; // time in milliseconds (to check order)

char Car[4]; // Car name
word Flags; // OG_FLAGS (see below)
byte Gear; // Reverse:0, Neutral:1, First:2...
byte SpareB;
float Speed; // M/S
float RPM; // RPM
float Turbo; // BAR
float EngTemp; // C
float Fuel; // 0 to 1
float OilPress; // BAR
float OilTemp; // C
float Spare2;
float Spare3;
float Throttle; // 0 to 1
float Brake; // 0 to 1
float Clutch; // 0 to 1
char Display1[16]; // Usually Fuel
char Display2[16]; // Usually Settings

int ID; // optional - only if OutGauge ID is specified
};

#define OG_SHIFTLIGHT 1
#define OG_FULLBEAM 2
#define OG_HANDBRAKE 4
#define OG_PITSPEED 8
#define OG_TC 16
#define OG_HEADLIGHTS 32
#define OG_SIGNAL_L 64
#define OG_SIGNAL_R 128
#define OG_REDLINE 256
#define OG_OILWARN 512
#define OG_BATTERY 1024
#define OG_ABS 2048
#define OG_3 4096
#define OG_4 8192
#define OG_KM 16384
#define OG_BAR 32768

which would make your code (I hope):if((flags & OutGaugeResponse.DL_FULLBEAM) != 0)
System.out.print("FULLBEAM ");
if((flags & OutGaugeResponse.OG_ABS) != 0)
System.out.print("ABS ");
if((flags & OutGaugeResponse.OG_BATTERY) != 0)
System.out.print("BATTERY ");
if((flags & OutGaugeResponse.OG_HANDBRAKE) != 0)
System.out.print("HANDBRAKE ");
if((flags & OutGaugeResponse.OG_OILWARN) != 0)
System.out.print("OIL ");
if((flags & OutGaugeResponse.OG_PITSPEED) != 0)
System.out.print("PIT ");
if((flags & OutGaugeResponse.OG_SHIFTLIGHT) != 0)
System.out.print("SHIFT ");
if((flags & OutGaugeResponse.OG_SIGNAL_L) != 0)
System.out.print("SIGNALL ");
if((flags & OutGaugeResponse.OG_SIGNAL_R) != 0)
System.out.print("SIGNALR ");
if((flags & OutGaugeResponse.OG_TC) != 0)
System.out.print("TC");
System.out.println("");

ghowden
30th April 2011, 13:48
Yeah sorry, I decided to try updating jinsim instead of using a relay seeing as I'm trying to keep the thing pure java. Where can I find the technical details about insim/outgauge?

morpha
30th April 2011, 14:02
LFS comes with extensive documentation, located at LFS directory/docs/ where you'll find, among others, InSim.txt, OutGauge is at the end of the file.

For comparison, and to familiarise yourself with the protocol based on how it's currently implemented in JInSim, use the outdated version I posted above for reference.

Brilwing
30th April 2011, 15:57
I have renamed the latest 0.5rc6 JInSim version to 0.5 and uploaded the version to Sourceforge and here:
http://liveforspeed.at/download/jinsim-0.5.zip

I should have done that a long time ago: :sorry:

JInSim 0.5 covers LFS Z28

I have not yet started to add the new insim features that come with Z30+. I indent to do this in the near future. If anyone wants to help me with that I gladly accept patches or can give commit privileges on sourceforge.

ghowden
1st May 2011, 02:32
You have:


static public final int OG_TURBO = 8192; // show turbo gauge
static public final int OG_KM = 16384; // if not set - user prefers MILES
static public final int OG_BAR = 32768; // if not set - user prefers PSI

static public final int DL_SHIFT = 0;
static public final int DL_FULLBEAM = 1;
static public final int DL_HANDBRAKE = 2;
static public final int DL_PITSPEED = 3;
static public final int DL_TC = 4;
static public final int DL_SIGNAL_L = 5;
static public final int DL_SIGNAL_R = 6;
static public final int DL_SIGNAL_ANY = 7;
static public final int DL_OILWARN = 8;
static public final int DL_BATTERY = 9;
static public final int DL_ABS = 10;


in that version for OutGaugeResponse, shouldn't the DL_* ones be:

static public final int DL_SHIFT = 1;
static public final int DL_FULLBEAM = 2;
static public final int DL_HANDBRAKE = 4;
static public final int DL_PITSPEED = 8;
static public final int DL_TC = 16;
static public final int DL_SIGNAL_L = 32;
static public final int DL_SIGNAL_R = 64;
static public final int DL_SIGNAL_ANY = 128;
static public final int DL_OILWARN = 256;
static public final int DL_BATTERY = 512;
static public final int DL_ABS = 1024;
static public final int DL_SPARE = 2048;
static public final int DL_NUM = 4096;


seeing as the documentation says its bit numbers?

EDIT:
Yes it is, worked out dashlights wasn't in flasg (duh), then tried working with dashlights, then realised its in showlights lol xD I blame the alcohol. Anyways works fine now, thanks a lot :) Now to the program itself lol :)

ghowden
3rd May 2011, 14:03
Here's what I have for the new car contact stuff, I added COLLISION_REPORT(50) to the PacketType enum and registeredTypes.put(PacketType.COLLISION_REPORT, CollisionResponse.class); to ResponseFactory too. Testing shows nothing happening at all atm

morpha
3rd May 2011, 15:09
You have to initialise the connection with ISF_CON for LFS to send CONs :thumbsup:

ghowden
3rd May 2011, 15:26
You have to initialise the connection with ISF_CON for LFS to send CONs :thumbsup:

ah great work :), added the flag for collision events. Now I get buffer underruns, need to have a look at my response code now

EDIT: Buffer underrun fixed, I thought char would mean char, but no it's a byte. Closing speed seems to be returning 0 though, still needs more work

I reckon its java not having unsigned stuff messing with me, ffs

ghowden
3rd May 2011, 16:47
Here is the latest source code plus my collision packet code seems to work fine now. Learnt bitwise operators in java at long last lol

Brilwing
3rd May 2011, 19:12
Here is the latest source code plus my collision packet code seems to work fine now. Learnt bitwise operators in java at long last lol

I have created a new development branch for the Z30+ changes add have added your changes (with some modifications):
https://jinsim.svn.sourceforge.net/svnroot/jinsim/branch/z30

I have not applied the changes in the OutGaugeResponse file, cause the current version is correct.

(If you want build the jinsim jar use gradle (http://www.gradle.org/))

ghowden
3rd May 2011, 19:44
I have created a new development branch for the Z30+ changes add have added your changes (with some modifications):
https://jinsim.svn.sourceforge.net/svnroot/jinsim/branch/z30

I have not applied the changes in the OutGaugeResponse file, cause the current version is correct.

(If you want build the jinsim jar use gradle (http://www.gradle.org/))

Thats great thanks, its ok I merge the source with my code and build in eclipse in one final jar using fatjar :)

Is there any other changes needed for z31? I looked at changelog and it seemed to be only a couple of length changes

ghowden
5th May 2011, 14:14
Fixed a couple of spelling mistakes and what looks like a numbering issue for Aston in the Track class, also added all the new open configs

EDIT:
new MessageToConnectionRequest with larger message size and sound field

ghowden
5th May 2011, 14:55
I noticed you updated the Track list, how about the MessageToConnectionRequest? Is that alright?

Brilwing
5th May 2011, 15:27
I noticed you updated the Track list, how about the MessageToConnectionRequest? Is that alright?

I have updated both now. I changed the MessageToConnectionRequest to use the existing Sound enum for the setter.

ghowden
6th May 2011, 19:11
Changes needed for z32:

Still wrong code for VW in Car.java, should be VWS (non essential)

In SetDirectCameraRequest, CameraPositionResponse and StateResponse the line:


static public final short ISS_SHIFTU_HIGH = 16; // HIGH view


Is no longer needed as the flag can be removed (Shouldn't the flags be in some kind of ISS State enum anyway?)

In OutGaugeResponse the following two lines need to be added:


static public final int OG_SHIFT = 1;
static public final int OG_CTRL = 2;


Attached is the new code for RaceStartResponse to be cleaned up to be inkeeping with the style of the rest of the library

Assuming everything was implemented for z28 this is all that needs doing/testing for it to work with z32