Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ITS - Intelligent Transport Systems
ITS
Commits
6ec3bb99
Commit
6ec3bb99
authored
Sep 09, 2016
by
garciay
Browse files
Add external function to compute TimeMark
parent
dcd8c821
Changes
6
Show whitespace changes
Inline
Side-by-side
javasrc/extfunc/org/etsi/its/extfunc/IItsExternalFunctionsProvider.java
View file @
6ec3bb99
...
...
@@ -28,6 +28,15 @@ public interface IItsExternalFunctionsProvider {
*/
public
IntegerValue
fx_getCurrentTime
();
/**
* This external function gets the current time
* @return The current time in tenths of a second in the current or next hour in units of 1/10th second from UTC time
*
* TTCN-3 signature:
* external function fx_getCurrentTimeMark() return TimeMark;
*/
public
IntegerValue
fx_getCurrentTimeMark
();
/**
* This external function gets the current time
* @param p_latitudeA Latitude of node A
...
...
javasrc/extfunc/org/etsi/its/extfunc/ItsExternalFunctionsProvider.java
View file @
6ec3bb99
...
...
@@ -13,6 +13,8 @@ import java.net.UnknownHostException;
import
java.text.DateFormat
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.time.ZoneOffset
;
import
java.time.ZonedDateTime
;
import
java.util.ArrayList
;
import
java.util.logging.Logger
;
...
...
@@ -134,6 +136,18 @@ public class ItsExternalFunctionsProvider implements IItsExternalFunctionsProvid
return
now
;
}
// End of method fx_getCurrentTime
@Override
public
IntegerValue
fx_getCurrentTimeMark
()
{
IntegerValue
now
=
null
;
//_logger.entering("ItsExternalFunctionsProvider", "fx_getCurrentTimeMark");
ZonedDateTime
t
=
ZonedDateTime
.
now
(
ZoneOffset
.
UTC
);
now
=
_tcicdWrapper
.
setInteger
(
new
Integer
((
t
.
getMinute
()
*
60
+
t
.
getSecond
())
*
10
));
//_logger.exiting("ItsExternalFunctionsProvider", "fx_getCurrentTimeMark", String.format("%4d", _tcicdWrapper.getBigInteger(now)));
return
now
;
}
/**
* This external function gets the current time
*
...
...
javasrc/tool/org/etsi/its/tool/elvior/LibItsContainer_asn1.java
View file @
6ec3bb99
...
...
@@ -32,6 +32,10 @@ public class LibItsContainer_asn1 extends LibIts_asn1 {
TriMessage
msg
=
TriProvider
.
getInstance
().
getTriFactory
().
createMessage
();
msg
.
setEncodedMessage
(
ByteHelper
.
longToByteArray
(
lval
,
6
));
value
=
super
.
decode
(
msg
,
decodingHypothesis
);
}
else
if
(
decodingHypothesis
.
getName
().
equals
(
"TimeMark"
))
{
TriMessage
msg1
=
TriProvider
.
getInstance
().
getTriFactory
().
createMessage
();
msg1
.
setEncodedMessage
(
message
.
getEncodedMessage
());
value
=
super
.
decode
(
msg1
,
decodingHypothesis
);
}
else
{
value
=
super
.
decode
(
message
,
decodingHypothesis
);
}
...
...
javasrc/tool/org/etsi/its/tool/elvior/PluginAdapter.java
View file @
6ec3bb99
...
...
@@ -248,7 +248,7 @@ public class PluginAdapter implements TriCommunicationSA, TriCommunicationTE, xT
}
public
TriStatus
triExternalFunction
(
TriFunctionId
functionId
,
TriParameterList
parameterList
,
TriParameter
returnValue
)
{
_logger
.
entering
(
"
PluginAdapter
"
,
"
triExternalFunction
"
,
functionId
.
getFunctionName
());
// + " - " + parameterList + " - " + returnValue.getParameterName() + " - " + returnValue.getParameterPassingMode());
//TERFactory.getInstance().logDebug(">>>
PluginAdapter
.
triExternalFunction
: " +
functionId.getFunctionName()); // + " - " + parameterList + " - " + returnValue.getParameterName() + " - " + returnValue.getParameterPassingMode());
TriStatus
result
=
m_triOK
;
if
(
...
...
@@ -275,6 +275,9 @@ public class PluginAdapter implements TriCommunicationSA, TriCommunicationTE, xT
}
else
if
(
functionId
.
getFunctionName
().
endsWith
(
"fx_getCurrentTime"
))
{
// Gets the current time
exec_getCurrentTime
(
returnValue
);
}
else
if
(
functionId
.
getFunctionName
().
endsWith
(
"fx_getCurrentTimeMark"
))
{
// Gets the current time
exec_getCurrentTimeMark
(
returnValue
);
}
else
if
(
functionId
.
getFunctionName
().
endsWith
(
"xf_parseIpv6Address"
))
{
exec_parseIpv6Address
(
parameterList
,
returnValue
);
}
else
if
(
functionId
.
getFunctionName
().
endsWith
(
"fx_hashWithSha256"
)
&&
(
parameterList
.
size
()
==
1
))
{
...
...
@@ -315,7 +318,7 @@ public class PluginAdapter implements TriCommunicationSA, TriCommunicationTE, xT
_logger
.
severe
(
"Unprocessed external function"
);
result
=
m_triKO
;
}
_logger
.
exiting
(
"
PluginAdapter
"
,
"
triExternalFunction
"
,
ByteHelper
.
byteArrayToString
(
returnValue
.
getEncodedParameter
()));
//TERFactory.getInstance().logDebug("<<<
PluginAdapter
.
triExternalFunction
: " +
ByteHelper.byteArrayToString(returnValue.getEncodedParameter()));
return
result
;
}
...
...
@@ -645,6 +648,23 @@ public class PluginAdapter implements TriCommunicationSA, TriCommunicationTE, xT
_logger
.
exiting
(
"PluginAdapter"
,
"exec_getCurrentTime"
,
ByteHelper
.
byteArrayToString
(
returnValue
.
getEncodedParameter
()));
}
// End of method exec_getCurrentTime
private
void
exec_getCurrentTimeMark
(
TriParameter
returnValue
)
{
//_logger.entering("PluginAdapter", "exec_getCurrentTimeMark");
// Execute the function
IntegerValue
time
=
_extfuncsImpl
.
fx_getCurrentTimeMark
();
//_logger.info(String.format("exec_getCurrentTimeMark returns %d", ((IntegerValueEx)time).getInt64()));
returnValue
.
setParameterPassingMode
(
TriParameterPassingMode
.
TRI_OUT
);
returnValue
.
setNumberOfBits
(
Long
.
SIZE
);
returnValue
.
setEncodedParameter
(
ByteHelper
.
longToByteArray
(
((
IntegerValueEx
)
time
).
getInt64
(),
4
/*Integer.SIZE / Byte.SIZE*/
// Encoding on 32 bits
));
//_logger.exiting("PluginAdapter", "exec_getCurrentTimeMark: ", ByteHelper.byteArrayToString(returnValue.getEncodedParameter()));
}
// End of method exec_getCurrentTimeMark
private
void
exec_generateKeyPair
(
TriParameterList
parameterList
,
TriParameter
returnValue
)
{
_logger
.
entering
(
"PluginAdapter"
,
"exec_generateKeyPair"
);
...
...
javasrc/tool/org/etsi/its/tool/elvior/res/ta.properties
View file @
6ec3bb99
...
...
@@ -5,16 +5,21 @@ camPort=BTP/GN/ETH
#camPort=BTP/GN/CSG
# Define the port/layer configuration for DENM
denmPort
=
BTP/GN/ETH
#denmPort=BTP/GN/CSG
# Define the port/layer configuration for MAPEM-SPATEM
mapemSpatemPort
=
BTP/GN/ETH
#mapemSpatemPort=BTP/GN/CSG
# Define the port/layer configuration for IVIM
ivimPort
=
BTP/GN/ETH
#ivimPort=BTP/GN/CSG
# Define the port/layer configuration for SREM-SSEM
sremSsemPort
=
BTP/GN/ETH
#sremSsemPort=BTP/GN/CSG
# Define the port/layer configuration for BTP
btpPort
=
GN/ETH
# Define the port/layer configuration for GeoNetworking
geoNetworkingPort
=
ETH
#geoNetworkingPort=ETH
geoNetworkingPort
=
CSG
# Define the port/layer configuration for GeoNetworking over IPv6
ipv6OverGeoNetworkingPort
=
Debug
# Define the port/layer configuration for CALM FNTP
...
...
@@ -42,7 +47,9 @@ ConfigTesterSettings=172.17.15.39:12346
LocalEthernetMAC
=
00E08F008855
# Post-mortem ATS execution mode
OfflineMode
=
false
PcapFile
=
PcapFile
=
pcap/vendor/uc1.pcappng
OffsetTime
=
30 # Start at +30 seconds
OffsetFrame
=
# Define the Ethernet type value used by the IUT
IutEthernetTypeValue=0x8947
# Node Ethernet addresses
...
...
javasrc/tool/org/etsi/its/tool/testingtech/ExternalFunctionsPluginProvider.java
View file @
6ec3bb99
...
...
@@ -114,6 +114,18 @@ public class ExternalFunctionsPluginProvider implements ExternalFunctionsProvide
return
_externalFunctionsPluginProvider
.
fx_getCurrentTime
();
}
/**
* This external function gets the current time
* @return The current time in tenths of a second in the current or next hour in units of 1/10th second from UTC time
*
* TTCN-3 signature:
* external function fx_getCurrentTimeMark() return TimeMark;
*/
@Override
public
IntegerValue
fx_getCurrentTimeMark
()
{
return
_externalFunctionsPluginProvider
.
fx_getCurrentTimeMark
();
}
/**
* External function to compute timestamp based on current time
* @return Unix-Epoch-Time mod 2^32
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment