Updates alias list to provide a list of aliases for an identifier so that (#474)

we can account for multi-alias identifiers like patch groups and ensure
that patch group alias intentions are carried throughout the system for
recording, streaming, etc.

Updates all consumers of alias list data to ensure it can operate with
a list of aliases versus an assumed single alias.

Refactors APCO25 unit/user status identifiers from a base status class
so that alias list can support status identifiers.
This commit is contained in:
Denny Sheirer
2018-12-31 07:24:25 -05:00
committed by GitHub
parent 08ea5ab7cb
commit 3a39ae76ba
23 changed files with 484 additions and 189 deletions

View File

@@ -19,6 +19,7 @@
*/
package io.github.dsheirer.module.decode.event;
import com.google.common.base.Joiner;
import com.google.common.eventbus.Subscribe;
import io.github.dsheirer.alias.Alias;
import io.github.dsheirer.alias.AliasList;
@@ -260,18 +261,17 @@ public class DecodeEventPanel extends JPanel implements Listener<ProcessingChain
for(Identifier identifier: identifiers)
{
Alias alias = aliasList.getAlias(identifier);
List<Alias> aliases = aliasList.getAliases(identifier);
if(alias != null)
if(!aliases.isEmpty())
{
if(sb.length() > 0)
{
sb.append(",");
}
sb.append(alias.getName());
color = alias.getDisplayColor();
icon = mIconManager.getIcon(alias.getIconName(), IconManager.DEFAULT_ICON_SIZE);
sb.append(Joiner.on(", ").skipNulls().join(aliases));
color = aliases.get(0).getDisplayColor();
icon = mIconManager.getIcon(aliases.get(0).getIconName(), IconManager.DEFAULT_ICON_SIZE);
}
}

View File

@@ -19,51 +19,30 @@
*/
package io.github.dsheirer.module.decode.p25.identifier.status;
import io.github.dsheirer.identifier.Form;
import io.github.dsheirer.identifier.IdentifierClass;
import io.github.dsheirer.identifier.Role;
import io.github.dsheirer.identifier.integer.IntegerIdentifier;
import io.github.dsheirer.identifier.status.UnitStatusIdentifier;
import io.github.dsheirer.protocol.Protocol;
/**
* APCO-25 Unit or User status
* APCO-25 Unit status
*/
public class APCO25Status extends IntegerIdentifier
public class APCO25UnitStatus extends UnitStatusIdentifier
{
private Role mRole;
/**
* Constructs an APCO-25 status
* Constructs an APCO-25 unit status
*
* @param status value
* @param role of the user/unit that the status applies to
*/
public APCO25Status(int status, IdentifierClass identifierClass, Form form, Role role)
public APCO25UnitStatus(int status)
{
super(status, identifierClass, form, role);
mRole = role;
}
@Override
public Protocol getProtocol()
{
return Protocol.APCO25;
super(status, Role.STATUS, Protocol.APCO25);
}
/**
* Creates a unit status
* @param status
* @return
*/
public static APCO25Status createUnitStatus(int status)
public static APCO25UnitStatus create(int status)
{
return new APCO25Status(status, IdentifierClass.USER, Form.UNIT_STATUS, Role.STATUS);
}
/**
* Creates a User status
*/
public static APCO25Status createUserStatus(int status)
{
return new APCO25Status(status, IdentifierClass.USER, Form.USER_STATUS, Role.STATUS);
return new APCO25UnitStatus(status);
}
}

View File

@@ -0,0 +1,48 @@
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
* *****************************************************************************
*/
package io.github.dsheirer.module.decode.p25.identifier.status;
import io.github.dsheirer.identifier.Role;
import io.github.dsheirer.identifier.status.UserStatusIdentifier;
import io.github.dsheirer.protocol.Protocol;
/**
* APCO-25 User status
*/
public class APCO25UserStatus extends UserStatusIdentifier
{
/**
* Constructs an APCO-25 unit status
*
* @param status value
*/
public APCO25UserStatus(int status)
{
super(status, Role.STATUS, Protocol.APCO25);
}
/**
* Creates a unit status
*/
public static APCO25UserStatus create(int status)
{
return new APCO25UserStatus(status);
}
}

View File

@@ -22,7 +22,8 @@ package io.github.dsheirer.module.decode.p25.message.lc.standard;
import io.github.dsheirer.bits.BinaryMessage;
import io.github.dsheirer.identifier.Identifier;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25Status;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25UnitStatus;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25UserStatus;
import io.github.dsheirer.module.decode.p25.identifier.talkgroup.APCO25FromTalkgroup;
import io.github.dsheirer.module.decode.p25.identifier.talkgroup.APCO25ToTalkgroup;
import io.github.dsheirer.module.decode.p25.message.lc.LinkControlWord;
@@ -73,7 +74,7 @@ public class LCStatusUpdate extends LinkControlWord
{
if(mUnitStatus == null)
{
mUnitStatus = APCO25Status.createUnitStatus(getMessage().getInt(UNIT_STATUS));
mUnitStatus = APCO25UnitStatus.create(getMessage().getInt(UNIT_STATUS));
}
return mUnitStatus;
@@ -83,7 +84,7 @@ public class LCStatusUpdate extends LinkControlWord
{
if(mUserStatus == null)
{
mUserStatus = APCO25Status.createUserStatus(getMessage().getInt(USER_STATUS));
mUserStatus = APCO25UserStatus.create(getMessage().getInt(USER_STATUS));
}
return mUserStatus;

View File

@@ -23,7 +23,8 @@ package io.github.dsheirer.module.decode.p25.message.pdu.ambtc.isp;
import io.github.dsheirer.identifier.Identifier;
import io.github.dsheirer.module.decode.p25.identifier.APCO25System;
import io.github.dsheirer.module.decode.p25.identifier.APCO25Wacn;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25Status;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25UnitStatus;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25UserStatus;
import io.github.dsheirer.module.decode.p25.identifier.talkgroup.APCO25FromTalkgroup;
import io.github.dsheirer.module.decode.p25.identifier.talkgroup.APCO25ToTalkgroup;
import io.github.dsheirer.module.decode.p25.message.pdu.PDUSequence;
@@ -90,7 +91,7 @@ public class AMBTCStatusQueryResponse extends AMBTCMessage
{
if(mUnitStatus == null)
{
mUnitStatus = APCO25Status.createUnitStatus(getHeader().getMessage().getInt(HEADER_UNIT_STATUS));
mUnitStatus = APCO25UnitStatus.create(getHeader().getMessage().getInt(HEADER_UNIT_STATUS));
}
return mUnitStatus;
@@ -100,7 +101,7 @@ public class AMBTCStatusQueryResponse extends AMBTCMessage
{
if(mUserStatus == null)
{
mUserStatus = APCO25Status.createUserStatus(getHeader().getMessage().getInt(HEADER_USER_STATUS));
mUserStatus = APCO25UserStatus.create(getHeader().getMessage().getInt(HEADER_USER_STATUS));
}
return mUserStatus;

View File

@@ -23,7 +23,8 @@ package io.github.dsheirer.module.decode.p25.message.pdu.ambtc.isp;
import io.github.dsheirer.identifier.Identifier;
import io.github.dsheirer.module.decode.p25.identifier.APCO25System;
import io.github.dsheirer.module.decode.p25.identifier.APCO25Wacn;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25Status;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25UnitStatus;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25UserStatus;
import io.github.dsheirer.module.decode.p25.identifier.talkgroup.APCO25FromTalkgroup;
import io.github.dsheirer.module.decode.p25.identifier.talkgroup.APCO25ToTalkgroup;
import io.github.dsheirer.module.decode.p25.message.pdu.PDUSequence;
@@ -90,7 +91,7 @@ public class AMBTCStatusUpdateRequest extends AMBTCMessage
{
if(mUnitStatus == null)
{
mUnitStatus = APCO25Status.createUnitStatus(getHeader().getMessage().getInt(HEADER_UNIT_STATUS));
mUnitStatus = APCO25UnitStatus.create(getHeader().getMessage().getInt(HEADER_UNIT_STATUS));
}
return mUnitStatus;
@@ -100,7 +101,7 @@ public class AMBTCStatusUpdateRequest extends AMBTCMessage
{
if(mUserStatus == null)
{
mUserStatus = APCO25Status.createUserStatus(getHeader().getMessage().getInt(HEADER_USER_STATUS));
mUserStatus = APCO25UserStatus.create(getHeader().getMessage().getInt(HEADER_USER_STATUS));
}
return mUserStatus;

View File

@@ -23,7 +23,8 @@ package io.github.dsheirer.module.decode.p25.message.pdu.ambtc.osp;
import io.github.dsheirer.identifier.Identifier;
import io.github.dsheirer.module.decode.p25.identifier.APCO25System;
import io.github.dsheirer.module.decode.p25.identifier.APCO25Wacn;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25Status;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25UnitStatus;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25UserStatus;
import io.github.dsheirer.module.decode.p25.identifier.talkgroup.APCO25FromTalkgroup;
import io.github.dsheirer.module.decode.p25.identifier.talkgroup.APCO25ToTalkgroup;
import io.github.dsheirer.module.decode.p25.message.pdu.PDUSequence;
@@ -137,7 +138,7 @@ public class AMBTCStatusUpdate extends AMBTCMessage
{
if(mUnitStatus == null && hasDataBlock(0))
{
mUnitStatus = APCO25Status.createUnitStatus(getDataBlock(0).getMessage().getInt(BLOCK_0_UNIT_STATUS));
mUnitStatus = APCO25UnitStatus.create(getDataBlock(0).getMessage().getInt(BLOCK_0_UNIT_STATUS));
}
return mUnitStatus;
@@ -147,7 +148,7 @@ public class AMBTCStatusUpdate extends AMBTCMessage
{
if(mUserStatus == null && hasDataBlock(0))
{
mUserStatus = APCO25Status.createUserStatus(getDataBlock(0).getMessage().getInt(BLOCK_0_USER_STATUS));
mUserStatus = APCO25UserStatus.create(getDataBlock(0).getMessage().getInt(BLOCK_0_USER_STATUS));
}
return mUserStatus;

View File

@@ -1,8 +1,29 @@
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
* *****************************************************************************
*/
package io.github.dsheirer.module.decode.p25.message.tsbk.standard.isp;
import io.github.dsheirer.bits.CorrectedBinaryMessage;
import io.github.dsheirer.identifier.Identifier;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25Status;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25UnitStatus;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25UserStatus;
import io.github.dsheirer.module.decode.p25.identifier.talkgroup.APCO25FromTalkgroup;
import io.github.dsheirer.module.decode.p25.identifier.talkgroup.APCO25ToTalkgroup;
import io.github.dsheirer.module.decode.p25.message.tsbk.ISPMessage;
@@ -52,7 +73,7 @@ public class StatusQueryResponse extends ISPMessage
{
if(mUnitStatus == null)
{
mUnitStatus = APCO25Status.createUnitStatus(getMessage().getInt(UNIT_STATUS));
mUnitStatus = APCO25UnitStatus.create(getMessage().getInt(UNIT_STATUS));
}
return mUnitStatus;
@@ -62,7 +83,7 @@ public class StatusQueryResponse extends ISPMessage
{
if(mUserStatus == null)
{
mUserStatus = APCO25Status.createUserStatus(getMessage().getInt(USER_STATUS));
mUserStatus = APCO25UserStatus.create(getMessage().getInt(USER_STATUS));
}
return mUserStatus;

View File

@@ -1,8 +1,29 @@
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
* *****************************************************************************
*/
package io.github.dsheirer.module.decode.p25.message.tsbk.standard.isp;
import io.github.dsheirer.bits.CorrectedBinaryMessage;
import io.github.dsheirer.identifier.Identifier;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25Status;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25UnitStatus;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25UserStatus;
import io.github.dsheirer.module.decode.p25.identifier.talkgroup.APCO25FromTalkgroup;
import io.github.dsheirer.module.decode.p25.identifier.talkgroup.APCO25ToTalkgroup;
import io.github.dsheirer.module.decode.p25.message.tsbk.ISPMessage;
@@ -52,7 +73,7 @@ public class StatusUpdateRequest extends ISPMessage
{
if(mUnitStatus == null)
{
mUnitStatus = APCO25Status.createUnitStatus(getMessage().getInt(UNIT_STATUS));
mUnitStatus = APCO25UnitStatus.create(getMessage().getInt(UNIT_STATUS));
}
return mUnitStatus;
@@ -62,7 +83,7 @@ public class StatusUpdateRequest extends ISPMessage
{
if(mUserStatus == null)
{
mUserStatus = APCO25Status.createUserStatus(getMessage().getInt(USER_STATUS));
mUserStatus = APCO25UserStatus.create(getMessage().getInt(USER_STATUS));
}
return mUserStatus;

View File

@@ -22,7 +22,8 @@ package io.github.dsheirer.module.decode.p25.message.tsbk.standard.osp;
import io.github.dsheirer.bits.CorrectedBinaryMessage;
import io.github.dsheirer.identifier.Identifier;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25Status;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25UnitStatus;
import io.github.dsheirer.module.decode.p25.identifier.status.APCO25UserStatus;
import io.github.dsheirer.module.decode.p25.identifier.talkgroup.APCO25FromTalkgroup;
import io.github.dsheirer.module.decode.p25.identifier.talkgroup.APCO25ToTalkgroup;
import io.github.dsheirer.module.decode.p25.message.tsbk.OSPMessage;
@@ -72,7 +73,7 @@ public class StatusUpdate extends OSPMessage
{
if(mUnitStatus == null)
{
mUnitStatus = APCO25Status.createUnitStatus(getMessage().getInt(UNIT_STATUS));
mUnitStatus = APCO25UnitStatus.create(getMessage().getInt(UNIT_STATUS));
}
return mUnitStatus;
@@ -82,7 +83,7 @@ public class StatusUpdate extends OSPMessage
{
if(mUserStatus == null)
{
mUserStatus = APCO25Status.createUserStatus(getMessage().getInt(USER_STATUS));
mUserStatus = APCO25UserStatus.create(getMessage().getInt(USER_STATUS));
}
return mUserStatus;