Skip to content

Commit

Permalink
#190t P25 Phase 1 encrypted call status (#1906)
Browse files Browse the repository at this point in the history
Co-authored-by: Dennis Sheirer <dsheirer@github.com>
  • Loading branch information
DSheirer and Dennis Sheirer committed May 4, 2024
1 parent 2f0419f commit 5f08297
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import io.github.dsheirer.module.decode.ip.mototrbo.ars.ARSPacket;
import io.github.dsheirer.module.decode.ip.mototrbo.lrrp.LRRPPacket;
import io.github.dsheirer.module.decode.ip.udp.UDPPacket;
import io.github.dsheirer.module.decode.p25.IServiceOptionsProvider;
import io.github.dsheirer.module.decode.p25.P25DecodeEvent;
import io.github.dsheirer.module.decode.p25.P25TrafficChannelManager;
import io.github.dsheirer.module.decode.p25.identifier.channel.APCO25Channel;
Expand Down Expand Up @@ -382,10 +383,34 @@ private void processLCChannelUser(LinkControlWord lcw, long timestamp)
List<Identifier> updated = mPatchGroupManager.update(lcw.getIdentifiers(), timestamp);
getIdentifierCollection().update(updated);
DecodeEventType decodeEventType = getLCDecodeEventType(lcw);
ServiceOptions serviceOptions = lcw.isEncrypted() ? VoiceServiceOptions.createEncrypted() :
VoiceServiceOptions.createUnencrypted();


ServiceOptions serviceOptions = null;

if(lcw instanceof IServiceOptionsProvider sop)
{
serviceOptions = sop.getServiceOptions();
}
else if(lcw.isEncrypted())
{
serviceOptions = VoiceServiceOptions.createEncrypted();
}
else
{
serviceOptions = VoiceServiceOptions.createUnencrypted();
}

mTrafficChannelManager.processP1CurrentUser(getCurrentFrequency(), getCurrentChannel(), decodeEventType,
serviceOptions, getIdentifierCollection(), timestamp, null );

if(serviceOptions.isEncrypted())
{
broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.ENCRYPTED));
}
else
{
broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.CALL));
}
}

/**
Expand Down Expand Up @@ -776,9 +801,16 @@ private void processHDU(IMessage message)
DecodeEventType type = headerData.isEncryptedAudio() ? DecodeEventType.CALL_ENCRYPTED : DecodeEventType.CALL;
mTrafficChannelManager.processP1CurrentUser(getCurrentFrequency(), getCurrentChannel(), type,
serviceOptions, mic, message.getTimestamp(), details);
}

broadcast(new DecoderStateEvent(this, Event.START, State.CALL));
if(headerData.isEncryptedAudio())
{
broadcast(new DecoderStateEvent(this, Event.START, State.ENCRYPTED));
}
else
{
broadcast(new DecoderStateEvent(this, Event.START, State.CALL));
}
}
}


Expand Down Expand Up @@ -810,12 +842,14 @@ else if(message instanceof LDU2Message ldu2)
getIdentifierCollection().update(esp.getIdentifiers());
mTrafficChannelManager.processP1CurrentUser(getCurrentFrequency(), esp.getEncryptionKey(),
message.getTimestamp());
broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.ENCRYPTED));
}
else
{
getIdentifierCollection().remove(Form.ENCRYPTION_KEY);
mTrafficChannelManager.processP1CurrentUser(getCurrentFrequency(), null,
message.getTimestamp());
broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.CALL));
}
}
else
Expand All @@ -824,7 +858,6 @@ else if(message instanceof LDU2Message ldu2)
}
}

broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.CALL));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ public String toString()
*/
public static VoiceServiceOptions createEncrypted()
{
return new VoiceServiceOptions(ENCRYPTION_FLAG);
return new VoiceServiceOptions(ENCRYPTION_FLAG + 4);
}

/**
* Creates an instance where the encryption flag is not set.
*/
public static VoiceServiceOptions createUnencrypted()
{
return new VoiceServiceOptions(0);
return new VoiceServiceOptions(4);
}
}

0 comments on commit 5f08297

Please sign in to comment.