Giter Site home page Giter Site logo

alexvoronov / geonetworking Goto Github PK

View Code? Open in Web Editor NEW
100.0 100.0 45.0 680 KB

ETSI ITS G5 GeoNetworking stack, in Java: CAM-DENM / ASN.1 PER / BTP / GeoNetworking

License: Apache License 2.0

Scala 0.59% Java 99.36% Shell 0.06%
asn1 btp car2x etsi etsi-plugtest geonet geonetwork geonetworking v2x vanet

geonetworking's People

Contributors

alexvoronov avatar dependabot[bot] avatar devfozgul avatar heuvendw avatar poolborges avatar severinson avatar snodnipper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geonetworking's Issues

GpsdClient semi-open connections?

Hi Alex,
I'm currently having some issues with the gpsdclient losing its active connection.
It appears as if the connection is semi-closed as it does no longer receive data from gpsd after a while (or on certain runs) but the sockets are 'connected'. In this case xgps or cgps can be run, which show the received data, but the application no longer receives it.

Did anyone else encounter the same issue?

Time to send messages & receive in vehicle adapter

Hello, for the past few days I've been testing the vehicle adapter along with the link layer (udp2eth).

So far nothing wrong for the link layer for sending and receiving data.

However, it seems there are some problems with the vehicle adapter for sending messages sometimes as it does not consistently output the messages on a 25 Hz frequency. Sometimes it even takes several seconds (1-8 seconds) to send a message. I measured the time as taken from the timestamp right before receiving a packet from simulink to right after sending the packet to the link layer.

Furthermore, additional tests gave indication that message congestion might be a problem for the vehicle adapter, as the packets started to "pile up" when it received packages from several distinct sources (cam, denm and iclcm messages) at 25 Hz but I have not investigated this further.

I will post figures containing the time distribution of the vehicle adapter shortly.

BUILD FAILURE

Hi Alex,

First of all, I want to thank you for this great work.
I have a build problem.
capture d ecran 2018-10-21 a 21 54 47
capture d ecran 2018-10-21 a 21 54 57

Thanks,

Cuita

Critical race in GN beacon generation?

Hi Alex,

From our experiences here in Spain, we think there is a 'critical race' in the GN beacon generation. In many cases, we found that stations send beacons at increasing rates, even in the presence of (e.g.) CAM transmissions. Actually, the more CAMs are sent (25 Hz :-)), the worse the problem gets.

I guess the following line of code in GeonetStation.java is somewhat suspicious:

@OverRide public void skipNextBeacon() { beaconFuture.cancel(false); scheduleNextBeacon(); }

because the beaconFuture.cancel (false) can actually fail, in which case more and more chains of 'beaconFuture' instances will remain dangling; each generating new beacons at (roughly) 1/3 Hz rate forever.

What do you think? Should we check/wait until we are sure that the beaconFuture is actually cancelled? (It seems to return a value indicating whether the cancellation succeeded or not).

Thanks, and best wishes from Spain,
Jan

Failing Test - AreaAndPositionTest#test2

I am getting inconsistent results with the following code between the JVM and Android.

@Test
public void test2() {
   EqualsVerifier.forClass(Area.class).verify();
}

I believe the root cause of the problem is because the Area equality check casts a double to a short and the EqualsVerifier test library has no knowledge of such behaviour.

With the JVM, I appear to get test values such as

reference: Area [center=Pos(0.5, 0.5), distanceAmeters=0.5, distanceBmeters=0.5, angleDegreesFromNorth=0.5, type=CIRCLE]
changed: Area [center=Pos(0.5, 0.5), distanceAmeters=1.0, distanceBmeters=0.5, angleDegreesFromNorth=0.5, type=CIRCLE]

which I have been debugging at line 167 in the 1.7.2 library. For a quick glance, a link to the current code.

You will note that the short cast make the distanceAmeters different (0 vs 1) but in the Android implementation I get test values:

reference: Area [center=null, distanceAmeters=0.0, distanceBmeters=0.0, angleDegreesFromNorth=0.0, type=null]
changed: Area [center=null, distanceAmeters=0.5, distanceBmeters=0.0, angleDegreesFromNorth=0.0, type=null]

where clearly 0 and 0.5 round down to 0 vs 0, which is a different result the JVM values of 0 vs 1.

Perhaps we can adjust the test or make the equality more robust given the input - e.g. int param at mm resolution....although I am not aware of any specification specifics.

Any thoughts / suggestions would be appreciated - thanks!

Error during building

When I execute the mvn clean install, an error appears due to the following

Running net.gcdc.geonetworking.BasicSocketTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.238 sec <<< FAILURE!
Running net.gcdc.geonetworking.DestinationTest

Tests in error:
test(net.gcdc.geonetworking.BasicSocketTest): test timed out after 3000 milliseconds

Could you explain what the problem is here?

we use the udp2eth from Jan de Jongh

Starting uppertester

Hi, I would like to test the v2x with 2 computers. I have already set up access with 802.11p protocol and OCB mode.

1)First device

I started by starting udp2eth and the result is:
Device name: wlp3s0 (my device)
Promiscuous: no
Serv Addr: 0.0.0.0:1235
Client Addr: 127.0.0.1:1236
open_eth_socket: unumble to create socket.

Then start:
mvn --projects uppertester exec: java -Dexec.mainClass = "net.gcdc.uppertester.ItsStation" -Dexec.args = "- localPortForUdpLinkLayer 1236 --remoteAddressForUdpLinkLayer 127.0.0.1:1235 --upperTesterUdpPort 1600 --hasEthernetHeader".

2)second device
Creating the network and starting udp2eth also in the second device, should it be enough to receive the cam packages?

Which address should I enter in the mvn command instead of 127.0.0.1, the others are correct? (Client and server address)

Sorry, I'm new in this environment...

When i decoding data which was ecoded by c++ use uper by your library I got a error :"java.lang.IllegalArgumentException: Incomplete input, constrained int required 7 bits, got 1"

I am so sorry to trouble you .My english is so pool. I hava many complex ASN1 file,they have dependce with each other. such as:

RSI DEFINITIONS AUTOMATIC TAGS ::= BEGIN

-- imports and exports

EXPORTS RoadSideInformation;
IMPORTS MsgCount FROM MsgFrame
MinuteOfTheYear FROM DefTime
Position3D FROM DefPosition
PositionOffsetLLV FROM DefPositionOffset;

RoadSideInformation ::= SEQUENCE {
	msgCnt MsgCount,
	timeStamp MinuteOfTheYear OPTIONAL,
	id OCTET STRING (SIZE(8)),
	-- RSU ID
	rsiId INTEGER (0..255),
	-- local ID of this rsi information set by RSU
	alertType AlertType,
	-- Text message warning or Traffic sign type according to China GB5768
	description IA5String (SIZE(1..256)) OPTIONAL,
	-- Text message if alertType = 0
	-- Additional description to the traffic sign if alertType > 0
	-- e.g. describe the subtype of the traffic sign
	priority Priority OPTIONAL,
	-- the urgency of this message, a relative
	-- degree of merit compared with other
	-- similar messages for this type (not other
	-- messages being sent by the device), nor a
	-- priority of display urgency
	refPos Position3D, 
	-- Position of traffic alert (traffic sign or incident)
	alertPath PathPointList,
	-- Warning is active if vehicle is within this path
	-- Points are listed from upstream to downstream
	-- along the vehicle drive direction.
	-- One path includes at least two points.
	alertRadius Radius,
	-- The biggest distance away from the alert path
	-- within which the warning is active.
	...
}

PathPointList ::= SEQUENCE (SIZE(2..32)) OF PositionOffsetLLV
-- Path point list for RSA message

Radius ::= INTEGER (0..1024)
-- Radius of roadside alert
-- Unit is 0.1m

AlertType ::= INTEGER (0..65535)
-- Text message warning = 0

-- Traffic signs according to China GB5768
-- Danger = 37
-- Rockfall = 15
-- SharpTurn = 2
-- UnderConstruction = 38
-- Slippy = 17
-- Tunnel = 21

Priority ::= OCTET STRING (SIZE(1))
-- The lower five bits are reserved and shall be set to zero
-- Value from B00000000 to B11100000 represents the lowest to the highest level

END

MsgFrame DEFINITIONS AUTOMATIC TAGS ::= BEGIN

-- imports and exports

EXPORTS MsgCount;
IMPORTS ;
MsgCount ::= INTEGER (0..127)

END

DefPosition DEFINITIONS AUTOMATIC TAGS ::= BEGIN

-- imports and exports

EXPORTS Latitude, Longitude, Elevation, PositionConfidenceSet, Position3D;
IMPORTS ;

Latitude ::= INTEGER (-900000000..900000001) 
-- LSB = 1/10 micro degree 
-- Providing a range of plus-minus 90 degrees

Longitude ::= INTEGER (-1799999999..1800000001) 
-- LSB = 1/10 micro degree 
-- Providing a range of plus-minus 180 degrees

Elevation ::= INTEGER (-4096..61439)
-- In units of 10 cm steps above or below the reference ellipsoid
-- Providing a range of -409.5 to + 6143.9 meters
-- The value -4096 shall be used when Unknown is to be sent


Position3D ::= SEQUENCE {
	lat Latitude, 
	-- in 1/10th micro degrees
	long Longitude, 
	-- in 1/10th micro degrees
	elevation Elevation OPTIONAL
	-- in 10 cm units
}

END

DefPositionOffset DEFINITIONS AUTOMATIC TAGS ::= BEGIN

-- imports and exports

EXPORTS PositionOffsetLLV;
IMPORTS Longitude, Latitude, Elevation FROM DefPosition;

PositionOffsetLLV ::= SEQUENCE {
	offsetLL PositionOffsetLL,
	-- offset in lon/lat
	offsetV VerticalOffset OPTIONAL
	-- offset in elevation
}

OffsetLL-B12 ::= INTEGER (-2048..2047) 
-- A range of +- 0.0002047 degrees 
-- In LSB units of 0.1 microdegrees 
OffsetLL-B14 ::= INTEGER (-8192..8191) 
-- A range of +- 0.0008191 degrees 
-- In LSB units of 0.1 microdegrees
OffsetLL-B16 ::= INTEGER (-32768..32767) 
-- A range of +- 0.0032767 degrees 
-- In LSB units of 0.1 microdegrees
OffsetLL-B18 ::= INTEGER (-131072..131071) 
-- A range of +- 0.0131071 degrees 
-- In LSB units of 0.1 microdegrees
OffsetLL-B22 ::= INTEGER (-2097152..2097151) 
-- A range of +- 0.2097151 degrees 
-- In LSB units of 0.1 microdegrees
OffsetLL-B24 ::= INTEGER (-8388608..8388607) 
-- A range of +- 0.8388607 degrees 
-- In LSB units of 0.1 microdegrees

Position-LL-24B ::= SEQUENCE { 
	-- ranges of +- 0.0002047 degrees 
	-- ranges of +- 22.634554 meters at the equator
	lon OffsetLL-B12,
	lat OffsetLL-B12
	}

Position-LL-28B ::= SEQUENCE { 
	-- ranges of +- 0.0008191 degrees 
	-- ranges of +- 90.571389 meters at the equator
	lon OffsetLL-B14,
	lat OffsetLL-B14
	}

Position-LL-32B ::= SEQUENCE { 
	-- ranges of +- 0.0032767 degrees 
	-- ranges of +- 362.31873 meters at the equator
	lon OffsetLL-B16,
	lat OffsetLL-B16
	}

Position-LL-36B ::= SEQUENCE { 
	-- ranges of +- 0.0131071 degrees 
	-- ranges of +- 01.449308 Kmeters at the equator
	lon OffsetLL-B18,
	lat OffsetLL-B18
	}

Position-LL-44B ::= SEQUENCE { 
	-- ranges of +- 0.2097151 degrees 
	-- ranges of +- 23.189096 Kmeters at the equator
	lon OffsetLL-B22,
	lat OffsetLL-B22
	}

Position-LL-48B ::= SEQUENCE { 
	-- ranges of +- 0.8388607 degrees 
	-- ranges of +- 92.756481 Kmeters at the equator
	lon OffsetLL-B24,
	lat OffsetLL-B24
	}

Position-LLmD-64b ::= SEQUENCE {
	-- a full 32b Lat/Lon range
	lon Longitude,
	lat Latitude
	}

PositionOffsetLL ::= CHOICE { 
	-- Locations with LL content Span at the equator when using a zoom of one:
	position-LL1 Position-LL-24B, 
	-- within +- 22.634554 meters of the reference position
	position-LL2 Position-LL-28B, 
	-- within +- 90.571389 meters of the reference position
	position-LL3 Position-LL-32B, 
	-- within +- 362.31873 meters of the reference position
	position-LL4 Position-LL-36B, 
	-- within +- 01.449308 Kmeters of the reference position
	position-LL5 Position-LL-44B, 
	-- within +- 23.189096 Kmeters of the reference position
	position-LL6 Position-LL-48B, 
	-- within +- 92.756481 Kmeters of the reference position
	position-LatLon Position-LLmD-64b 
	-- node is a full 32b Lat/Lon range
}

VerticalOffset ::= CHOICE { 
	-- Vertical Offset 
	-- All below in steps of 10cm above or below the reference ellipsoid
	offset1 VertOffset-B07, -- with a range of +- 6.3 meters vertical
	offset2 VertOffset-B08, -- with a range of +- 12.7 meters vertical
	offset3 VertOffset-B09, -- with a range of +- 25.5 meters vertical
	offset4 VertOffset-B10, -- with a range of +- 51.1 meters vertical
	offset5 VertOffset-B11, -- with a range of +- 102.3 meters vertical
	offset6 VertOffset-B12, -- with a range of +- 204.7 meters vertical
	elevation Elevation -- with a range of -409.5 to + 6143.9 meters
	}

VertOffset-B07 ::= INTEGER (-64..63) 
-- LSB units of of 10 cm 
-- with a range of +- 6.3 meters vertical 
-- value 63 to be used for 63 or greater 
-- value -63 to be used for -63 or greater 
-- value -64 to be unavailable

VertOffset-B08 ::= INTEGER (-128..127) 
-- LSB units of of 10 cm 
-- with a range of +- 12.7 meters vertical 
-- value 127 to be used for 127 or greater 
-- value -127 to be used for -127 or greater 
-- value -128 to be unavailable

VertOffset-B09 ::= INTEGER (-256..255) 
-- LSB units of of 10 cm 
-- with a range of +- 25.5 meters vertical 
-- value 255 to be used for 255 or greater 
-- value -255 to be used for -255 or greater 
-- value -256 to be unavailable

VertOffset-B10 ::= INTEGER (-512..511) 
-- LSB units of of 10 cm 
-- with a range of +- 51.1 meters vertical 
-- value 511 to be used for 511 or greater 
-- value -511 to be used for -511 or greater 
-- value -512 to be unavailable

VertOffset-B11 ::= INTEGER (-1024..1023) 
-- LSB units of of 10 cm 
-- with a range of +- 102.3 meters vertical 
-- value 1023 to be used for 1023 or greater 
-- value -1023 to be used for -1023 or greater 
-- value -1024 to be unavailable

VertOffset-B12 ::= INTEGER (-2048..2047) 
-- LSB units of of 10 cm 
-- with a range of +- 204.7 meters vertical 
-- value 2047 to be used for 2047 or greater 
-- value -2047 to be used for -2047 or greater 
-- value -2048 to be unavailable

END

DefTime DEFINITIONS AUTOMATIC TAGS ::= BEGIN

-- imports and exports

EXPORTS MinuteOfTheYear;
IMPORTS ;

MinuteOfTheYear ::= INTEGER (0..527040) 
-- the value 527040 shall be used for invalid

END

my java Class:

package net.gcdc.asn1.uper.mytest;

import jdk.Exported;
import net.gcdc.asn1.datatypes.*;

import java.util.Collection;

import static net.gcdc.asn1.uper.mytest.MsgFrame.MsgCount;

import static net.gcdc.asn1.uper.mytest.DefPositionOffset.PositionOffsetLLV;

import static net.gcdc.asn1.uper.mytest.DefTime.MinuteOfTheYear;

import static net.gcdc.asn1.uper.mytest.DefPosition.Position3D;

public class RSI {

@Sequence
public static class RoadSideInformation {


    MsgCount msgCnt;

    @Asn1Optional
   MinuteOfTheYear timeStamp;

    Id id;

   RSIId rsiId;

  AlertType alertType;

    @Asn1Optional
  Description description;

    @Asn1Optional
    Priority priority;

  Position3D refPos;

   PathPointList alertPath;

    Radius alertRadius;


    @FixedSize(8)
    @OctetString
    public static class Id extends Asn1SequenceOf<Byte> {
        public Id() {

        }

        public Id(Collection<Byte> coll) {
            super(coll);
        }
    }


    @SizeRange(minValue = 0,maxValue = 32)
    public static class PathPointList extends Asn1SequenceOf<PositionOffsetLLV>{
        public PathPointList() {

        }
        public PathPointList(Collection<PositionOffsetLLV> coll) {
            super(coll);
        }
    }


    @IntRange(minValue = 0,maxValue = 1024)
    public static class Radius extends Asn1Integer{
        public Radius() {
            this(0);
        }

        public Radius(long value) {
            super(value);
        }
    }

    @IntRange(minValue = 0,maxValue = 65535)
    public static class AlertType extends Asn1Integer{
        public AlertType() {
            this(0);
        }

        public AlertType(long value) {
            super(value);
        }
    }

    @FixedSize(1)
    @OctetString
    public static class Priority extends Asn1SequenceOf<Byte>{
        public Priority() {

        }

        public Priority(Collection<Byte> coll) {
            super(coll);
        }
    }


    @IntRange(minValue = 0,maxValue = 255)
    public static class RSIId extends Asn1Integer{
        public RSIId() {
            this(0);
        }

        public RSIId(long value) {
            super(value);
        }
    }

    @Asn1AnonymousType
    @SizeRange(minValue = 1,maxValue = 256)
    @RestrictedString(CharacterRestriction.IA5String)
    public static class Description extends Asn1String{
        public Description() {
        }

        public Description(String value) {
            super(value);
        }
    }}

}

public class DefPosition {

@IntRange(minValue = -900000000,maxValue = 900000001)
public static class Latitude extends Asn1Integer{
    public Latitude() {
        this(0);
    }

    public Latitude(long value) {
        super(value);
    }
}


@IntRange(minValue = -1799999999,maxValue = 1800000001)
public static class Longitude extends Asn1Integer{
    public Longitude() {
        this(0);
    }

    public Longitude(long value) {
        super(value);
    }
}

@IntRange(minValue = -4096,maxValue = 61439)
public static class Elevation extends Asn1Integer{
    public Elevation() {

    }

    public Elevation(long value) {
        super(value);
    }
}

@Sequence
public static class Position3D{
    public Latitude lat;
    public Longitude Long;
}

}

public class DefPositionOffset {

@Sequence
public static class PositionOffsetLLV{
    PositionOffsetLL offsetLL;
    @Asn1Optional
    VerticalOffset offsetV ;
}



@IntRange(minValue = -2048,maxValue = 2047)
public static class  OffsetLL_B12 extends Asn1Integer {
    public OffsetLL_B12() {

    }
    public OffsetLL_B12(long value) {
        super(value);
    }
}

@IntRange(minValue = -8192,maxValue = 8191)
public static class  OffsetLL_B14 extends Asn1Integer {
    public OffsetLL_B14() {

    }
    public OffsetLL_B14(long value) {
        super(value);
    }
}


@IntRange(minValue = -32768,maxValue = 32767)
public static class  OffsetLL_B16 extends Asn1Integer {
    public OffsetLL_B16() {

    }
    public OffsetLL_B16(long value) {
        super(value);
    }
}


@IntRange(minValue = -131072,maxValue = 131071)
public static class  OffsetLL_B18 extends Asn1Integer {
    public OffsetLL_B18() {

    }
    public OffsetLL_B18(long value) {
        super(value);
    }
}


@IntRange(minValue = -2097152,maxValue = 2097151)
public static class  OffsetLL_B22 extends Asn1Integer {
    public OffsetLL_B22() {

    }
    public OffsetLL_B22(long value) {
        super(value);
    }
}


@IntRange(minValue = -8388608,maxValue = 8388607)
public static class  OffsetLL_B24 extends Asn1Integer {
    public OffsetLL_B24() {

    }
    public OffsetLL_B24(long value) {
        super(value);
    }
}


@Sequence
public static class Position_LLmD_64b {
    DefPosition.Longitude lon;
    DefPosition.Latitude lat;
}

@Choice
public static class PositionOffsetLL{
    Position_LL_24B position_LL1;
    Position_LL_28B position_LL2;
    Position_LL_32B position_LL3;
    Position_LL_36B position_LL4;
    Position_LL_44B position_LL5;
    Position_LL_48B position_LL6;
    Position_LLmD_64b position_LatLon;


    public Position_LL_24B getPosition_LL1() {
        return position_LL1;
    }

    public void setPosition_LL1(Position_LL_24B position_LL1) {
        this.position_LL1 = position_LL1;
    }

    public Position_LL_28B getPosition_LL2() {
        return position_LL2;
    }

    public void setPosition_LL2(Position_LL_28B position_LL2) {
        this.position_LL2 = position_LL2;
    }

    public Position_LL_32B getPosition_LL3() {
        return position_LL3;
    }

    public void setPosition_LL3(Position_LL_32B position_LL3) {
        this.position_LL3 = position_LL3;
    }

    public Position_LL_36B getPosition_LL4() {
        return position_LL4;
    }

    public void setPosition_LL4(Position_LL_36B position_LL4) {
        this.position_LL4 = position_LL4;
    }

    public Position_LL_44B getPosition_LL5() {
        return position_LL5;
    }

    public void setPosition_LL5(Position_LL_44B position_LL5) {
        this.position_LL5 = position_LL5;
    }

    public Position_LL_48B getPosition_LL6() {
        return position_LL6;
    }

    public void setPosition_LL6(Position_LL_48B position_LL6) {
        this.position_LL6 = position_LL6;
    }

    public Position_LLmD_64b getPosition_LatLon() {
        return position_LatLon;
    }

    public void setPosition_LatLon(Position_LLmD_64b position_LatLon) {
        this.position_LatLon = position_LatLon;
    }
}




@Choice
public static class VerticalOffset{
    VertOffset_B07 offset1;
    VertOffset_B08 offset2;
    VertOffset_B09 offset3;
    VertOffset_B10 offset4;
    VertOffset_B11 offset5;
    VertOffset_B12 offset6;
    DefPosition.Elevation elevation;


    public VertOffset_B07 getOffset1() {
        return offset1;
    }

    public void setOffset1(VertOffset_B07 offset1) {
        this.offset1 = offset1;
    }

    public VertOffset_B08 getOffset2() {
        return offset2;
    }

    public void setOffset2(VertOffset_B08 offset2) {
        this.offset2 = offset2;
    }

    public VertOffset_B09 getOffset3() {
        return offset3;
    }

    public void setOffset3(VertOffset_B09 offset3) {
        this.offset3 = offset3;
    }

    public VertOffset_B10 getOffset4() {
        return offset4;
    }

    public void setOffset4(VertOffset_B10 offset4) {
        this.offset4 = offset4;
    }

    public VertOffset_B11 getOffset5() {
        return offset5;
    }

    public void setOffset5(VertOffset_B11 offset5) {
        this.offset5 = offset5;
    }

    public VertOffset_B12 getOffset6() {
        return offset6;
    }

    public void setOffset6(VertOffset_B12 offset6) {
        this.offset6 = offset6;
    }

    public DefPosition.Elevation getElevation() {
        return elevation;
    }

    public void setElevation(DefPosition.Elevation elevation) {
        this.elevation = elevation;
    }
}


@Sequence
public static class Position_LL_24B {
    OffsetLL_B12 lon;
    OffsetLL_B12 lat;
}

@Sequence
public static class Position_LL_28B {
    OffsetLL_B14 lon;
    OffsetLL_B14 lat;
}

@Sequence
public static class Position_LL_32B {
    OffsetLL_B16 lon;
    OffsetLL_B16 lat;
}
@Sequence
public static class Position_LL_36B {
    OffsetLL_B18 lon;
    OffsetLL_B18 lat;
}
@Sequence
public static class Position_LL_44B {
    OffsetLL_B22 lon;
    OffsetLL_B22 lat;
}

@Sequence
public static class Position_LL_48B {
    OffsetLL_B24 lon;
    OffsetLL_B24 lat;
}

//=============================================================================

@IntRange(minValue = -64,maxValue = 63)
public static class VertOffset_B07 extends Asn1Integer {
    public VertOffset_B07() {

    }
    public VertOffset_B07(long value) {
        super(value);
    }
}

@IntRange(minValue = -128,maxValue = 127)
public static class VertOffset_B08 extends Asn1Integer {
    public VertOffset_B08() {

    }
    public VertOffset_B08(long value) {
        super(value);
    }
}
@IntRange(minValue = -256,maxValue = 255)
public static class VertOffset_B09 extends Asn1Integer {
    public VertOffset_B09() {

    }
    public VertOffset_B09(long value) {
        super(value);
    }
}

@IntRange(minValue = -512,maxValue = 511)
public static class VertOffset_B10 extends Asn1Integer {
    public VertOffset_B10() {

    }
    public VertOffset_B10(long value) {
        super(value);
    }
}
@IntRange(minValue = -1024,maxValue = 1023)
public static class VertOffset_B11 extends Asn1Integer {
    public VertOffset_B11() {

    }
    public VertOffset_B11(long value) {
        super(value);
    }
}
@IntRange(minValue = -2048,maxValue = 2047)
public static class VertOffset_B12 extends Asn1Integer {
    public VertOffset_B12() {

    }
    public VertOffset_B12(long value) {
        super(value);
    }
}

}

public class DefTime {

@IntRange(minValue = 0,maxValue = 4095)
public static class DYear extends Asn1Integer{
    public DYear() {
       this(0);
    }
    public DYear(long value) {
        super(value);
    }
}


@IntRange(minValue = 0,maxValue = 527040)
public static class MinuteOfTheYear extends Asn1Integer {
    public MinuteOfTheYear() {
        this(0);
    }
    public MinuteOfTheYear(long value) {
        super(value);
    }
}

}

public class MsgFrame {

@IntRange(minValue = 0,maxValue = 127)
public static class MsgCount extends Asn1Integer {
public MsgCount() {
this(0);
}
public MsgCount(long value) {
super(value);
}
}
}

Can you tell me my code where is wrong ?

CAM Decoding

Hey,

I have a problem with CAM message decoding,
when I use the sample uper of a CAM message (taken from the website: https://github.com/bastibl/its-g5-cam) : 01020000000000010006b49d214d693a41400200200030d400000000000000000002840ba9800fffc0
I got the right answer :
capture d ecran 2019-01-08 a 17 58 45
but when I use a uper taken from a real CAM message
capture d ecran 2019-01-08 a 17 40 22
:0102000f6954fb00405a75197750084bcdffffffe00031b51e72000fc0007ebfe7ea8003a9800fffc0009fffc00000
I get this error
capture d ecran 2019-01-08 a 18 06 21
I know that there has no problem with the code but I if I want to be able to decode these messages I may have to get some changes in UperEncoder. Can you help with that please? and tell me where is the probleme coming from?

Thank you
Cuita

int extension are not supported yet

This libary not supprot bit string with extension such as asna file :?

LaneAttributes-Vehicle ::= BIT STRING { 
	-- With bits as defined:
	isVehicleRevocableLane (0),
	-- this lane may be activated or not based
	-- on the current SPAT message contents
	-- if not asserted, the lane is ALWAYS present
	isVehicleFlyOverLane (1),
	-- path of lane is not at grade
	hovLaneUseOnly (2),
	restrictedToBusUse (3),
	restrictedToTaxiUse (4),
	restrictedFromPublicUse (5),
	hasIRbeaconCoverage (6),
	permissionOnRequest (7) -- e.g. to inform about a lane for e-cars
	} (SIZE (8,...))

vehicle-adapter freezes when generating CAM message

When I send an UDP packet containing information for a CAM message to the vehicle-adapter, the corresponding thread of the vehicle-adapter freezes.
It seems that it is stuck at line 304 of vehicle-adapter/src/main/java/net/gcdc/vehicle/
VehicleAdapter.java:

            new LowFrequencyContainer(
                                      new BasicVehicleContainerLowFrequency(
                                                                            VehicleRole.fromCode(vehicleRole),
                                                                            ExteriorLights.builder()
                                                                            .set(false, 
false, false, false, false, false, false, false)
                                                                            .create(),
                                                                            new 
PathHistory()
                                                                            ))
            :
            null;

Do you have an idea what could cause this?

java.lang.UnsupportedOperationException: int extension are not supported yet

ASN.1 Spec:

LaneAttributes ::= BIT STRING {
    isVehicleRevocableLane (0),
    isVehicleFlyOverLane (1),
    hovLaneUseOnly (2),
    restrictedToBusUse (3),
    restrictedToTaxiUse (4),
    restrictedFromPublicUse (5),
    hasIRbeaconCoverage (6),
    permissionOnRequest (7)
} (SIZE (8,...))

Java class produced by ASN Lab:

// The asnlab compiler generated code for LaneAttributes_Vehicle
import java.io.*;
import javax.validation.constraints.*;
import org.asnlab.asndt.runtime.conv.*;
import org.asnlab.asndt.runtime.conv.annotation.*;
import org.asnlab.asndt.runtime.type.AsnType;
import org.asnlab.asndt.runtime.value.*;
import org.asnlab.asndt.runtime.value.BitString;

public class LaneAttributes_Vehicle extends BitString {

	public static final int isVehicleRevocableLane = 0;
	public static final int isVehicleFlyOverLane = 1;
	public static final int hovLaneUseOnly = 2;
	public static final int restrictedToBusUse = 3;
	public static final int restrictedToTaxiUse = 4;
	public static final int restrictedFromPublicUse = 5;
	public static final int hasIRbeaconCoverage = 6;
	public static final int permissionOnRequest = 7;

	public LaneAttributes_Vehicle(byte[] bytes, byte unusedBits) {
		super(bytes, unusedBits);
	}

	public LaneAttributes_Vehicle(int size) {
		super(size);
	}

	public LaneAttributes_Vehicle() {
		super(0);
	}

	public boolean getIsVehicleRevocableLane(){
		return getBit(isVehicleRevocableLane);
	}

	public void setIsVehicleRevocableLane(){
		setBit(isVehicleRevocableLane, true);
	}

	public void clearIsVehicleRevocableLane(){
		setBit(isVehicleRevocableLane, false);
	}

	public boolean getIsVehicleFlyOverLane(){
		return getBit(isVehicleFlyOverLane);
	}

	public void setIsVehicleFlyOverLane(){
		setBit(isVehicleFlyOverLane, true);
	}

	public void clearIsVehicleFlyOverLane(){
		setBit(isVehicleFlyOverLane, false);
	}

	public boolean getHovLaneUseOnly(){
		return getBit(hovLaneUseOnly);
	}

	public void setHovLaneUseOnly(){
		setBit(hovLaneUseOnly, true);
	}

	public void clearHovLaneUseOnly(){
		setBit(hovLaneUseOnly, false);
	}

	public boolean getRestrictedToBusUse(){
		return getBit(restrictedToBusUse);
	}

	public void setRestrictedToBusUse(){
		setBit(restrictedToBusUse, true);
	}

	public void clearRestrictedToBusUse(){
		setBit(restrictedToBusUse, false);
	}

	public boolean getRestrictedToTaxiUse(){
		return getBit(restrictedToTaxiUse);
	}

	public void setRestrictedToTaxiUse(){
		setBit(restrictedToTaxiUse, true);
	}

	public void clearRestrictedToTaxiUse(){
		setBit(restrictedToTaxiUse, false);
	}

	public boolean getRestrictedFromPublicUse(){
		return getBit(restrictedFromPublicUse);
	}

	public void setRestrictedFromPublicUse(){
		setBit(restrictedFromPublicUse, true);
	}

	public void clearRestrictedFromPublicUse(){
		setBit(restrictedFromPublicUse, false);
	}

	public boolean getHasIRbeaconCoverage(){
		return getBit(hasIRbeaconCoverage);
	}

	public void setHasIRbeaconCoverage(){
		setBit(hasIRbeaconCoverage, true);
	}

	public void clearHasIRbeaconCoverage(){
		setBit(hasIRbeaconCoverage, false);
	}

	public boolean getPermissionOnRequest(){
		return getBit(permissionOnRequest);
	}

	public void setPermissionOnRequest(){
		setBit(permissionOnRequest, true);
	}

	public void clearPermissionOnRequest(){
		setBit(permissionOnRequest, false);
	}

	public boolean equals(Object obj) {
		if(!(obj instanceof LaneAttributes_Vehicle)){
			return false;
		}
		return TYPE.equals(this, obj, CONV);
	}

	public void ber_encode(OutputStream out) throws IOException {
		TYPE.encode(this, EncodingRules.BASIC_ENCODING_RULES, CONV, out);
	}

	public static LaneAttributes_Vehicle ber_decode(InputStream in) throws IOException {
		return (LaneAttributes_Vehicle)TYPE.decode(in, EncodingRules.BASIC_ENCODING_RULES, CONV);
	}


	public final static AsnType TYPE = MapLane.type(65539);

	public final static AsnConverter CONV;

	static {
		CONV = new ReflectionBitStringConverter(LaneAttributes_Vehicle.class);
	}

}

Encoding data using ASN Lab:

// I encode the data using the api provided by asn1lab
// org.asnlab.*
private static void testMapLane() {
    LaneAttributes_Vehicle laneAttributes_vehicle = new LaneAttributes_Vehicle();
    laneAttributes_vehicle.setIsVehicleFlyOverLane();
    laneAttributes_vehicle.setIsVehicleRevocableLane();
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    try {
        LaneAttributes_Vehicle.TYPE.encode(laneAttributes_vehicle,
            EncodingRules.UNALIGNED_PACKED_ENCODING_RULES,
            LaneAttributes_Vehicle.CONV,bos);
        byte[] bytes = bos.toByteArray();
        System.out.println(hexStringFromBytes(bytes));
    } catch (IOException e) {
        e.printStackTrace();
    }
}


public static String hexStringFromBytes(byte[] bytes) {
    char[] hexChars = new char[bytes.length * 2];
    for (int j = 0; j < bytes.length; j++) {
        int v = bytes[j] & 0xFF;
        hexChars[j * 2] = hexArray[v >>> 4];
        hexChars[j * 2 + 1] = hexArray[v & 0x0F];
    }
    return new String(hexChars);
}
final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();

//The console print is "8160"

Attempt to decode 0x8160 using this (asn1-datatypes and asn1-uper) library:

    //I use the api you provided to decode
    //but happened error:
    //java.lang.UnsupportedOperationException: int extension are not supported yet
    @SizeRange(minValue = 8, maxValue = 8, hasExtensionMarker = true)
    public static class LaneAttributes extends Asn1SequenceOf<Boolean> {
        public LaneAttributes(Collection<Boolean> coll) { super(coll); }
    }
    @Test
    public void testDecodeBitsring(){
        String hexStr = "8160";
        UperEncoder.decode(UperEncoder.bytesFromHexString(hexStr),LaneAttributes.class);
    }

Lib does not run on Android

Hi, the Lib does not run under Android.
I found the problem on it. It is the Class Asn1ContainerFieldSorter on the constructor in Line 327. There the method “type.getDeclaredFields()” is called. On the normal Java VM you get the fields in Declaration order. But on Android the fields are sorted randomized.

I add a static function to every class in the datatype declaration which get a list of the fields in right order. Now it works for me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.