The online racing simulator
Searching in All forums
(5 results)
FireTiger
S3 licensed
It's run. Thank you
I think it was the bitwise operation
FireTiger
S3 licensed
No, because the function Float Speed = Float.intBitsToFloat(bits);
needs as parameter a integer value.
Integer is in Java 4byte and Float 4byte too.

Are the packets right?
Outgauge Packet - Java
FireTiger
S3 licensed
Hello,
i'm programming my own Outgauge Tool in Java.
I take the Outgauge UDP Packet and want to get the 4 Speed Bytes (12 - 15). After that i use a bitshifter to convert this 4 bytes into float.

But the float is totally wrong with the values.
Can anybody see my fault?

Here is the code:

<?php 
import java
.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;

/* Data Packet in detail
 * Time [0 - 3]
 * AutoName [4 - 7]
 * Flags [8 - 9]
 * Gang [10]
 * SpareB [11]
 * Speed [12 - 15]
 * RPM [16 - 19]
 * Turbo [20 - 23]
 * EngTemp [24-27]
 * Fuel [28 - 31]
 * Öldruck [32 - 35]
 * ÖlTemp [36 - 39]
 * Dashlight [40 - 43]
 * ShowLights [44 - 47]
 * Throttle [48 - 51]
 * Brake [52 - 55]
 * Clutch [56 - 59]
 * Display1 [60 - 75]
 * Display2 [76 - 91]
 * ID [92 - 95]
 */

public class client {
    private static final 
int MASK 0xff;
    
/**
     * @param args
     * @throws IOException 
     */
    
public static void main(String[] args) {
        
DatagramSocket socket null;
        
DatagramPacket packet = new DatagramPacket(new byte[92], 92);
        
        try {
            
socket = new DatagramSocket(9090);
            for(;;) {
                
socket.receive(packet);

                
byte data[] = packet.getData();
                
String AutoName = new String();
                
AutoName += (char)data[4];
                
AutoName += (char)data[5];
                
AutoName += (char)data[6];
                
AutoName += (char)data[7];
                
                
int bits 0;
                
int i 12;
                for (
int shifter 3shifter >= 0shifter--) {
                    
bits |= ((int)data[i] & MASK) << (shifter 8);
                    
i++;
                }
                
Float Speed Float.intBitsToFloat(bits);

                
System.out.print("Car: " AutoName " | Gear: " + (int)data[10]);
                
System.out.print(" | Speed: " Speed "| Len: " data.length "\n");
            }
            
        } catch (
IOException e) {
            
e.printStackTrace();
        } finally {
            
socket.close();
        }
        
        
    }
}
?>

thx
When is "early in 2009" ?
FireTiger
S3 licensed
It seems as if someone cannot wait any longer for the new version. So he has programmed his owen counter.

Take a look at this: http://liveforspeed.funpic.de
FireTiger
S3 licensed
Hi IMPREZioniST

I made a Subaru WRC Skin for you

Link: http://img168.imageshack.us/img168/103/subaruskingw8.jpg

Link: http://img141.imageshack.us/img141/8279/fxrsubaruwrxtl7.jpg

Greeting
FireTiger
FGED GREDG RDFGDR GSFDG