001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package org.wpilib.commands3.proto;
006
007import edu.wpi.first.util.protobuf.Protobuf;
008import org.wpilib.commands3.Mechanism;
009import org.wpilib.commands3.proto.ProtobufCommands.ProtobufMechanism;
010import us.hebi.quickbuf.Descriptors;
011
012public class MechanismProto implements Protobuf<Mechanism, ProtobufMechanism> {
013  @Override
014  public Class<Mechanism> getTypeClass() {
015    return Mechanism.class;
016  }
017
018  @Override
019  public Descriptors.Descriptor getDescriptor() {
020    return ProtobufMechanism.getDescriptor();
021  }
022
023  @Override
024  public ProtobufMechanism createMessage() {
025    return ProtobufMechanism.newInstance();
026  }
027
028  @Override
029  public Mechanism unpack(ProtobufMechanism msg) {
030    throw new UnsupportedOperationException("Deserialization not supported");
031  }
032
033  @Override
034  public void pack(ProtobufMechanism msg, Mechanism value) {
035    msg.clear();
036    msg.setName(value.getName());
037  }
038}