Search in sources :

Example 1 with DeviceInfoPacket

use of me.retrodaredevil.solarthing.type.closed.meta.DeviceInfoPacket in project solarthing by wildmountainfarms.

the class SolarThingGraphQLMetaService method getFragmentDeviceInfo.

@GraphQLQuery(name = "fragmentDeviceInfo")
@Nullable
public DeviceInfoPacket getFragmentDeviceInfo(@GraphQLContext SimplePacketNode packetNode) {
    int fragmentId = packetNode.getFragmentId();
    MetaDatabase metaDatabase = simpleQueryHandler.queryMeta();
    for (TargetedMetaPacket targetedMetaPacket : metaDatabase.getMeta(packetNode.getDateMillis(), fragmentId)) {
        if (targetedMetaPacket instanceof DeviceInfoPacket) {
            return (DeviceInfoPacket) targetedMetaPacket;
        }
    }
    return null;
}
Also used : MetaDatabase(me.retrodaredevil.solarthing.type.closed.meta.MetaDatabase) TargetedMetaPacket(me.retrodaredevil.solarthing.type.closed.meta.TargetedMetaPacket) DeviceInfoPacket(me.retrodaredevil.solarthing.type.closed.meta.DeviceInfoPacket) Nullable(me.retrodaredevil.solarthing.annotations.Nullable) GraphQLQuery(io.leangen.graphql.annotations.GraphQLQuery)

Aggregations

GraphQLQuery (io.leangen.graphql.annotations.GraphQLQuery)1 Nullable (me.retrodaredevil.solarthing.annotations.Nullable)1 DeviceInfoPacket (me.retrodaredevil.solarthing.type.closed.meta.DeviceInfoPacket)1 MetaDatabase (me.retrodaredevil.solarthing.type.closed.meta.MetaDatabase)1 TargetedMetaPacket (me.retrodaredevil.solarthing.type.closed.meta.TargetedMetaPacket)1