Search in sources :

Example 6 with Identifier

use of me.retrodaredevil.solarthing.packets.identification.Identifier in project solarthing by wildmountainfarms.

the class PointUtil method getTags.

public static Map<String, String> getTags(Packet packet) {
    Map<String, String> r = new HashMap<>();
    if (packet instanceof Identifiable) {
        Identifier identifier = ((Identifiable) packet).getIdentifier();
        r.put("identifier", identifier.getRepresentation());
        if (identifier instanceof SupplementaryIdentifier) {
            SupplementaryIdentifier supplementaryIdentifier = (SupplementaryIdentifier) identifier;
            r.put("identifier_supplementaryTo", supplementaryIdentifier.getSupplementaryTo().getRepresentation());
        }
    }
    if (packet instanceof DocumentedPacket) {
        DocumentedPacket documentedPacket = (DocumentedPacket) packet;
        DocumentedPacketType type = documentedPacket.getPacketType();
        r.put("packetType", type.toString());
    }
    return r;
}
Also used : Identifier(me.retrodaredevil.solarthing.packets.identification.Identifier) SupplementaryIdentifier(me.retrodaredevil.solarthing.packets.identification.SupplementaryIdentifier) DocumentedPacket(me.retrodaredevil.solarthing.packets.DocumentedPacket) SupplementaryIdentifier(me.retrodaredevil.solarthing.packets.identification.SupplementaryIdentifier) DocumentedPacketType(me.retrodaredevil.solarthing.packets.DocumentedPacketType) Identifiable(me.retrodaredevil.solarthing.packets.identification.Identifiable)

Aggregations

Identifier (me.retrodaredevil.solarthing.packets.identification.Identifier)6 Packet (me.retrodaredevil.solarthing.packets.Packet)3 Identifiable (me.retrodaredevil.solarthing.packets.identification.Identifiable)3 DocumentedPacket (me.retrodaredevil.solarthing.packets.DocumentedPacket)2 DocumentedPacketType (me.retrodaredevil.solarthing.packets.DocumentedPacketType)2 SupplementaryIdentifier (me.retrodaredevil.solarthing.packets.identification.SupplementaryIdentifier)2 OutbackIdentifier (me.retrodaredevil.solarthing.solar.outback.OutbackIdentifier)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Duration (java.time.Duration)1 Instant (java.time.Instant)1 java.util (java.util)1 List (java.util.List)1 Map (java.util.Map)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1 TimestampedPacket (me.retrodaredevil.solarthing.packets.TimestampedPacket)1 FragmentedPacketGroup (me.retrodaredevil.solarthing.packets.collection.FragmentedPacketGroup)1 InstancePacketGroup (me.retrodaredevil.solarthing.packets.collection.InstancePacketGroup)1 IdentifierFragment (me.retrodaredevil.solarthing.packets.identification.IdentifierFragment)1 FXStatusPacket (me.retrodaredevil.solarthing.solar.outback.fx.FXStatusPacket)1 DailyFXPacket (me.retrodaredevil.solarthing.solar.outback.fx.extra.DailyFXPacket)1