001/*
002 * Copyright (C) Photon Vision.
003 *
004 * This program is free software: you can redistribute it and/or modify
005 * it under the terms of the GNU General Public License as published by
006 * the Free Software Foundation, either version 3 of the License, or
007 * (at your option) any later version.
008 *
009 * This program is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012 * GNU General Public License for more details.
013 *
014 * You should have received a copy of the GNU General Public License
015 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
016 */
017
018package org.photonvision.server;
019
020import java.util.EnumSet;
021import java.util.HashMap;
022import java.util.Map;
023
024@SuppressWarnings("unused")
025public enum DataSocketMessageType {
026    SMT_DRIVERMODE("driverMode"),
027    SMT_CHANGECAMERANAME("changeCameraName"),
028    SMT_CHANGEPIPELINENAME("changePipelineName"),
029    SMT_ADDNEWPIPELINE("addNewPipeline"),
030    SMT_DELETECURRENTPIPELINE("deleteCurrentPipeline"),
031    SMT_CURRENTCAMERA("currentCamera"),
032    SMT_PIPELINESETTINGCHANGE("changePipelineSetting"),
033    SMT_CURRENTPIPELINE("currentPipeline"),
034    SMT_STARTPNPCALIBRATION("startPnpCalibration"),
035    SMT_SAVEINPUTSNAPSHOT("saveInputSnapshot"),
036    SMT_SAVEOUTPUTSNAPSHOT("saveOutputSnapshot"),
037    SMT_TAKECALIBRATIONSNAPSHOT("takeCalibrationSnapshot"),
038    SMT_DUPLICATEPIPELINE("duplicatePipeline"),
039    SMT_CHANGEBRIGHTNESS("enabledLEDPercentage"),
040    SMT_ROBOTOFFSETPOINT("robotOffsetPoint"),
041    SMT_CHANGEPIPELINETYPE("pipelineType");
042
043    public final String entryKey;
044
045    DataSocketMessageType(String entryKey) {
046        this.entryKey = entryKey;
047    }
048
049    private static final Map<String, DataSocketMessageType> entryKeyToValueMap = new HashMap<>();
050
051    static {
052        for (var value : EnumSet.allOf(DataSocketMessageType.class)) {
053            entryKeyToValueMap.put(value.entryKey, value);
054        }
055    }
056
057    public static DataSocketMessageType fromEntryKey(String entryKey) {
058        return entryKeyToValueMap.get(entryKey);
059    }
060}