Search in sources :

Example 1 with SupplementaryIdentifier

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

the class FXAccumulationDataCache method createFromIdentifier.

public static FXAccumulationDataCache createFromIdentifier(Identifier supplementaryIdentifier, Data mainData, Long firstDateMillis, Long lastDateMillis, Data unknownData, Long unknownStartDateMillis) {
    if (!(supplementaryIdentifier instanceof SupplementaryIdentifier)) {
        throw new IllegalArgumentException("The passed identifier is not a SupplementaryIdentifier! It is: " + supplementaryIdentifier.getClass() + " and its value is: " + supplementaryIdentifier.getRepresentation());
    }
    Identifier identifier = ((SupplementaryIdentifier) supplementaryIdentifier).getSupplementaryTo();
    if (!(identifier instanceof OutbackIdentifier)) {
        throw new IllegalArgumentException("identifier should be an OutbackIdentifier! It is: " + identifier.getClass() + " and its value is: " + identifier.getRepresentation());
    }
    OutbackIdentifier outbackIdentifier = (OutbackIdentifier) identifier;
    return new FXAccumulationDataCache(outbackIdentifier.getAddress(), mainData, firstDateMillis, lastDateMillis, unknownData, unknownStartDateMillis);
}
Also used : OutbackIdentifier(me.retrodaredevil.solarthing.solar.outback.OutbackIdentifier) Identifier(me.retrodaredevil.solarthing.packets.identification.Identifier) SupplementaryIdentifier(me.retrodaredevil.solarthing.packets.identification.SupplementaryIdentifier) OutbackIdentifier(me.retrodaredevil.solarthing.solar.outback.OutbackIdentifier) SupplementaryIdentifier(me.retrodaredevil.solarthing.packets.identification.SupplementaryIdentifier)

Example 2 with SupplementaryIdentifier

use of me.retrodaredevil.solarthing.packets.identification.SupplementaryIdentifier 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)2 SupplementaryIdentifier (me.retrodaredevil.solarthing.packets.identification.SupplementaryIdentifier)2 DocumentedPacket (me.retrodaredevil.solarthing.packets.DocumentedPacket)1 DocumentedPacketType (me.retrodaredevil.solarthing.packets.DocumentedPacketType)1 Identifiable (me.retrodaredevil.solarthing.packets.identification.Identifiable)1 OutbackIdentifier (me.retrodaredevil.solarthing.solar.outback.OutbackIdentifier)1