mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
Co-authored-by: Denny <denny@denny-desktop>
This commit is contained in:
@@ -34,7 +34,7 @@ import io.github.dsheirer.protocol.Protocol;
|
||||
public class DecodeEvent implements IDecodeEvent
|
||||
{
|
||||
private long mTimeStart;
|
||||
private long mDuration;
|
||||
private long mTimeEnd;
|
||||
private String mEventDescription;
|
||||
private IdentifierCollection mIdentifierCollection;
|
||||
private IChannelDescriptor mChannelDescriptor;
|
||||
@@ -66,7 +66,7 @@ public class DecodeEvent implements IDecodeEvent
|
||||
{
|
||||
if(timestamp > mTimeStart)
|
||||
{
|
||||
mDuration = timestamp - mTimeStart;
|
||||
mTimeEnd = timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,13 +87,26 @@ public class DecodeEvent implements IDecodeEvent
|
||||
return mTimeStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event end in milliseconds
|
||||
*/
|
||||
public long getTimeEnd()
|
||||
{
|
||||
return mTimeEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event duration in milliseconds
|
||||
*/
|
||||
@Override
|
||||
public long getDuration()
|
||||
{
|
||||
return mDuration;
|
||||
if(mTimeEnd < mTimeStart)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mTimeEnd - mTimeStart;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,7 +114,7 @@ public class DecodeEvent implements IDecodeEvent
|
||||
*/
|
||||
public void setDuration(long duration)
|
||||
{
|
||||
mDuration = duration;
|
||||
mTimeEnd = mTimeStart + duration;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -229,7 +242,7 @@ public class DecodeEvent implements IDecodeEvent
|
||||
{
|
||||
sb.append(" IDS:").append(Joiner.on(",").join(mIdentifierCollection.getIdentifiers()));
|
||||
}
|
||||
sb.append(" DURATION:").append(mDuration);
|
||||
sb.append(" DURATION:").append(getDuration());
|
||||
sb.append(" CHANNEL:").append(mChannelDescriptor);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -38,6 +38,12 @@ public interface IDecodeEvent
|
||||
*/
|
||||
long getTimeStart();
|
||||
|
||||
/**
|
||||
* Event end time
|
||||
* @return timestamp in milliseconds
|
||||
*/
|
||||
long getTimeEnd();
|
||||
|
||||
/**
|
||||
* Event duration.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user