use of me.retrodaredevil.solarthing.config.options.CommandOption in project solarthing by wildmountainfarms.
the class PacketListReceiverHandlerBundle method createFrom.
public static <T extends PacketHandlingOption & CommandOption> PacketListReceiverHandlerBundle createFrom(T options, PacketHandlerBundle packetHandlerBundle, List<PacketHandler> statusPacketHandlers) {
PacketListReceiver sourceAndFragmentUpdater = SolarMain.getSourceAndFragmentUpdater(options);
PacketListReceiverHandler eventPacketListReceiverHandler = createEventPacketListReceiverHandler(sourceAndFragmentUpdater, options.getZoneId(), packetHandlerBundle);
PacketListReceiverHandler statusPacketListReceiverHandler = new PacketListReceiverHandler(new PacketListReceiverMultiplexer(sourceAndFragmentUpdater, (packets) -> {
LOGGER.debug("Debugging all packets");
try {
LOGGER.debug(MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(packets));
} catch (JsonProcessingException e) {
LOGGER.debug("Never mind about that...", e);
}
}), new PacketHandlerMultiplexer(statusPacketHandlers), SolarMain.createIdGenerator(options.getUniqueIdsInOneHour(), options.isDocumentIdShort()), options.getZoneId());
return new PacketListReceiverHandlerBundle(statusPacketListReceiverHandler, eventPacketListReceiverHandler);
}
Aggregations