Compare Revisions

The credentials to download the source code are:
 Username: svnusers
 Password: svnusers

Ignore whitespace Rev 840 → Rev 841

/trunk/javasrc/uppertester/org/etsi/its/uppertester/UpperTesterFactory.java
41,9 → 41,9
upperTesters.put("HitachiDenm", org.etsi.its.uppertester.hitachi.DenmUpperTester.class);
upperTesters.put("HitachiNwt", org.etsi.its.uppertester.hitachi.NwtUpperTester.class);
upperTesters.put("NecNwt", org.etsi.its.uppertester.nec.NwtUpperTester.class);
upperTesters.put("ITriCam", org.etsi.its.uppertester.itri.CamUpperTester.class);
upperTesters.put("ITriDenm", org.etsi.its.uppertester.itri.DenmUpperTester.class);
upperTesters.put("ITriNwt", org.etsi.its.uppertester.itri.NwtUpperTester.class);
upperTesters.put("ITriCam", org.etsi.its.uppertester.generic.CamUpperTester.class);
upperTesters.put("ITriDenm", org.etsi.its.uppertester.generic.DenmUpperTester.class);
upperTesters.put("ITriNwt", org.etsi.its.uppertester.generic.NwtUpperTester.class);
}
 
/**
/trunk/javasrc/uppertester/org/etsi/its/uppertester/generic/CamUpperTester.java
1,4 → 1,4
package org.etsi.its.uppertester.itri;
package org.etsi.its.uppertester.generic;
 
import java.io.ByteArrayOutputStream;
import java.io.IOException;
10,7 → 10,6
 
import org.etsi.common.ByteHelper;
import org.etsi.its.codec.TestAdapterMessageTypeEnum;
import org.etsi.its.codec.adapter.UpperTesterCodecImpl;
import org.etsi.its.network.UdpImpl;
import org.etsi.its.uppertester.ICamUpperTester;
 
36,11 → 35,6
*/
private Pattern _pattern;
/**
* Reference to the TA codec
*/
private UpperTesterCodecImpl _codec;
private UdpImpl _utSendPort;
/**
49,7 → 43,6
public CamUpperTester() {
_logger.entering("CamUpperTester", "Constructor", String.format("version: %s", Version));
_pattern = Pattern.compile("(\\w+)\\:(\\S+)\\:(\\d+)\\:(\\d+)"); // For Java regex test, see http://www.cis.upenn.edu/~matuszek/General/RegexTester/regex-tester.html
_codec = new UpperTesterCodecImpl();
_utSendPort = null;
}
59,7 → 52,7
try {
byte[] buffer = ByteHelper.intToByteArray(curvature, 2);
buffer = _codec.Encode(TestAdapterMessageTypeEnum.changeCurvature, buffer, 0);
buffer = ByteHelper.concat(new byte[] { TestAdapterMessageTypeEnum.changeCurvature.convert() }, buffer);
_utSendPort.send(buffer);
 
return true;
76,7 → 69,7
try {
byte[] buffer = ByteHelper.intToByteArray(direction, 2);
buffer = _codec.Encode(TestAdapterMessageTypeEnum.changeHeading, buffer, 0);
buffer = ByteHelper.concat(new byte[] { TestAdapterMessageTypeEnum.changeHeading.convert() }, buffer);
_utSendPort.send(buffer);
 
return true;
93,7 → 86,7
try {
byte[] buffer = ByteHelper.intToByteArray(distance, 4);
buffer = _codec.Encode(TestAdapterMessageTypeEnum.changePosition, buffer, 0);
buffer = ByteHelper.concat(new byte[] { TestAdapterMessageTypeEnum.changePosition.convert() }, buffer);
_utSendPort.send(buffer);
 
return true;
110,7 → 103,7
try {
byte[] buffer = ByteHelper.intToByteArray(variation, 4);
buffer = _codec.Encode(TestAdapterMessageTypeEnum.changeSpeed, buffer, 0);
buffer = ByteHelper.concat(new byte[] { TestAdapterMessageTypeEnum.changeSpeed.convert() }, buffer);
_utSendPort.send(buffer);
 
return true;
128,7 → 121,7
try {
byte[] buffer = ByteHelper.intToByteArray(camPdu.length, 2);
buffer = ByteHelper.concat(buffer, camPdu);
buffer = _codec.Encode(TestAdapterMessageTypeEnum.checkLdm, buffer, 0);
buffer = ByteHelper.concat(new byte[] { TestAdapterMessageTypeEnum.checkLdm.convert() }, buffer);
// Send PDU
_logger.info("Sending camPdu");
_utSendPort.send(buffer);
153,7 → 146,7
_logger.entering("CamUpperTester", "setCrashSignal", String.format("crashed: %s", new Boolean(crashed)));
try {
byte[] buffer = _codec.Encode(TestAdapterMessageTypeEnum.setCrashSignal, new byte[] { (crashed == true) ? (byte)0x01 : (byte)0x00 }, 0);
byte[] buffer = ByteHelper.concat(new byte[] { TestAdapterMessageTypeEnum.setCrashSignal.convert() }, new byte[] { (crashed == true) ? (byte)0x01 : (byte)0x00 });
_utSendPort.send(buffer);
 
return true;
170,7 → 163,7
try {
byte[] buffer = ByteHelper.intToByteArray(dangerousGoodsStatus, 2);
buffer = _codec.Encode(TestAdapterMessageTypeEnum.setDangerousGoodsStatus, buffer, 0);
buffer = ByteHelper.concat(new byte[] { TestAdapterMessageTypeEnum.setDangerousGoodsStatus.convert() }, buffer);
_utSendPort.send(buffer);
 
return true;
187,7 → 180,7
try {
byte[] buffer = ByteHelper.intToByteArray(distance, 2);
buffer = _codec.Encode(TestAdapterMessageTypeEnum.setDistanceToStopLine, buffer, 0);
buffer = ByteHelper.concat(new byte[] { TestAdapterMessageTypeEnum.setDistanceToStopLine.convert() }, buffer);
_utSendPort.send(buffer);
 
return true;
203,7 → 196,7
_logger.entering("CamUpperTester", "setDoorStatus", String.format("doorStatus: 0x%02x", doorStatus));
try {
byte[] buffer = _codec.Encode(TestAdapterMessageTypeEnum.setDoorStatus, new byte[] { doorStatus }, 0);
byte[] buffer = ByteHelper.concat(new byte[] { TestAdapterMessageTypeEnum.setDoorStatus.convert() }, new byte[] { doorStatus });
_utSendPort.send(buffer);
 
return true;
219,7 → 212,7
_logger.entering("CamUpperTester", "setExteriorLightsStatus", String.format("lightStatus: 0x%02x", lightStatus));
try {
byte[] buffer = _codec.Encode(TestAdapterMessageTypeEnum.setExteriorLightsStatus, new byte[] { lightStatus }, 0);
byte[] buffer = ByteHelper.concat(new byte[] { TestAdapterMessageTypeEnum.setExteriorLightsStatus.convert() }, new byte[] { lightStatus });
_utSendPort.send(buffer);
 
return true;
235,7 → 228,7
_logger.entering("CamUpperTester", "setLengthWidthPrecision", String.format("lengthWidthPrecision: %s", new Boolean(lengthWidthPrecision)));
try {
byte[] buffer = _codec.Encode(TestAdapterMessageTypeEnum.setLengthWidthPrecision, new byte[] { (lengthWidthPrecision == true) ? (byte)0x01 : (byte)0x00 }, 0);
byte[] buffer = ByteHelper.concat(new byte[] { TestAdapterMessageTypeEnum.setLengthWidthPrecision.convert() }, new byte[] { (lengthWidthPrecision == true) ? (byte)0x01 : (byte)0x00 });
_utSendPort.send(buffer);
 
return true;
251,7 → 244,7
_logger.entering("CamUpperTester", "setLightBarStatus", String.format("status: %d", status));
try {
byte[] buffer = _codec.Encode(TestAdapterMessageTypeEnum.setLightBarStatus, new byte[] { (byte)status }, 0);
byte[] buffer = ByteHelper.concat(new byte[] { TestAdapterMessageTypeEnum.setLightBarStatus.convert() }, new byte[] { (byte)status });
_utSendPort.send(buffer);
 
return true;
267,7 → 260,7
_logger.entering("CamUpperTester", "setOccupancy", String.format("occupancy: %d", occupancy));
try {
byte[] buffer = _codec.Encode(TestAdapterMessageTypeEnum.setOccupancy, new byte[] { (byte)occupancy }, 0);
byte[] buffer = ByteHelper.concat(new byte[] { TestAdapterMessageTypeEnum.setOccupancy.convert() }, new byte[] { (byte)occupancy });
_utSendPort.send(buffer);
 
return true;
297,7 → 290,7
datas.write(ByteHelper.intToByteArray(routeRef.length(), 1));
if (routeRef.length() != 0) datas.write(routeRef.getBytes("ASCII"));
buffer = ByteHelper.concat(buffer, datas.toByteArray());
buffer = _codec.Encode(TestAdapterMessageTypeEnum.setPtLineDescription, buffer, 0);
buffer = ByteHelper.concat(new byte[] { TestAdapterMessageTypeEnum.setPtLineDescription.convert() }, buffer);
_utSendPort.send(buffer);
 
return true;
314,7 → 307,7
try {
byte[] buffer = ByteHelper.intToByteArray(delay, 2);
buffer = _codec.Encode(TestAdapterMessageTypeEnum.setScheduleDeviation, buffer, 0);
buffer = ByteHelper.concat(new byte[] { TestAdapterMessageTypeEnum.setScheduleDeviation.convert() }, buffer);
_utSendPort.send(buffer);
 
return true;
330,7 → 323,7
_logger.entering("CamUpperTester", "setSireneStatus", String.format("status: %d", status));
try {
byte[] buffer = _codec.Encode(TestAdapterMessageTypeEnum.setSireneStatus, new byte[] { (byte)status }, 0);
byte[] buffer = ByteHelper.concat(new byte[] { TestAdapterMessageTypeEnum.setSireneStatus.convert() }, new byte[] { (byte)status });
_utSendPort.send(buffer);
 
return true;
346,7 → 339,7
_logger.entering("CamUpperTester", "setTrafficLightPriority", String.format("priority: %d", priority));
try {
byte[] buffer = _codec.Encode(TestAdapterMessageTypeEnum.setTrafficLightPriority, new byte[] { (byte)priority }, 0);
byte[] buffer = ByteHelper.concat(new byte[] { TestAdapterMessageTypeEnum.setTrafficLightPriority.convert() }, new byte[] { (byte)priority });
_utSendPort.send(buffer);
 
return true;
363,7 → 356,7
try {
byte[] buffer = ByteHelper.concat(new byte[] { (byte)new Byte((byte) direction) }, ByteHelper.intToByteArray(distance, 2));
buffer = _codec.Encode(TestAdapterMessageTypeEnum.setTurnAdvice, buffer, 0);
buffer = ByteHelper.concat(new byte[] { TestAdapterMessageTypeEnum.setTurnAdvice.convert() }, buffer);
_utSendPort.send(buffer);
 
return true;