001/* 002 * MIT License 003 * 004 * Copyright (c) PhotonVision 005 * 006 * Permission is hereby granted, free of charge, to any person obtaining a copy 007 * of this software and associated documentation files (the "Software"), to deal 008 * in the Software without restriction, including without limitation the rights 009 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 010 * copies of the Software, and to permit persons to whom the Software is 011 * furnished to do so, subject to the following conditions: 012 * 013 * The above copyright notice and this permission notice shall be included in all 014 * copies or substantial portions of the Software. 015 * 016 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 017 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 018 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 019 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 020 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 021 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 022 * SOFTWARE. 023 */ 024 025// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY 026 027package org.photonvision.struct; 028 029import org.photonvision.common.dataflow.structures.Packet; 030import org.photonvision.common.dataflow.structures.PacketSerde; 031import org.photonvision.utils.PacketUtils; 032 033// Assume that the base class lives here and we can import it 034import org.photonvision.targeting.*; 035 036// WPILib imports (if any) 037import edu.wpi.first.util.struct.Struct; 038 039 040/** 041 * Auto-generated serialization/deserialization helper for PhotonPipelineMetadata 042 */ 043public class PhotonPipelineMetadataSerde implements PacketSerde<PhotonPipelineMetadata> { 044 045 @Override 046 public final String getInterfaceUUID() { return "ac0a45f686457856fb30af77699ea356"; } 047 @Override 048 public final String getSchema() { return "int64 sequenceID;int64 captureTimestampMicros;int64 publishTimestampMicros;int64 timeSinceLastPong;"; } 049 @Override 050 public final String getTypeName() { return "PhotonPipelineMetadata"; } 051 052 @Override 053 public int getMaxByteSize() { 054 // TODO Auto-generated method stub 055 throw new UnsupportedOperationException("Unimplemented method 'getMaxByteSize'"); 056 } 057 058 @Override 059 public void pack(Packet packet, PhotonPipelineMetadata value) { 060 // field sequenceID is of intrinsic type int64 061 packet.encode((long) value.sequenceID); 062 063 // field captureTimestampMicros is of intrinsic type int64 064 packet.encode((long) value.captureTimestampMicros); 065 066 // field publishTimestampMicros is of intrinsic type int64 067 packet.encode((long) value.publishTimestampMicros); 068 069 // field timeSinceLastPong is of intrinsic type int64 070 packet.encode((long) value.timeSinceLastPong); 071 } 072 073 @Override 074 public PhotonPipelineMetadata unpack(Packet packet) { 075 var ret = new PhotonPipelineMetadata(); 076 077 // sequenceID is of intrinsic type int64 078 ret.sequenceID = packet.decodeLong(); 079 080 // captureTimestampMicros is of intrinsic type int64 081 ret.captureTimestampMicros = packet.decodeLong(); 082 083 // publishTimestampMicros is of intrinsic type int64 084 ret.publishTimestampMicros = packet.decodeLong(); 085 086 // timeSinceLastPong is of intrinsic type int64 087 ret.timeSinceLastPong = packet.decodeLong(); 088 089 return ret; 090 } 091 092 @Override 093 public PacketSerde<?>[] getNestedPhotonMessages() { 094 return new PacketSerde<?>[] { 095 096 }; 097 } 098 099 @Override 100 public Struct<?>[] getNestedWpilibMessages() { 101 return new Struct<?>[] { 102 103 }; 104 } 105}