001/*
002 * Copyright (C) Cross The Road Electronics.  All rights reserved.
003 * License information can be found in CTRE_LICENSE.txt
004 * For support and suggestions contact support@ctr-electronics.com or file
005 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases
006 */
007package com.ctre.phoenix6.controls;
008
009import java.util.HashMap;
010import java.util.Map;
011
012import com.ctre.phoenix6.StatusCode;
013import com.ctre.phoenix6.controls.jni.ControlJNI;
014
015/**
016 * Generic Empty Control class used to do nothing.
017 */
018public class EmptyControl extends ControlRequest implements Cloneable {
019    /**
020     * Constructs an empty control request.
021     */
022    public EmptyControl() {
023        super("EmptyControl");
024    }
025
026    @Override
027    public String toString() {
028        String ss = "class: EmptyControl\n";
029        return ss;
030    }
031
032    public StatusCode sendRequest(String network, int deviceHash, boolean cancelOtherRequests) {
033        return StatusCode.valueOf(ControlJNI.JNI_RequestControlEmpty(
034                network, deviceHash, 0, cancelOtherRequests));
035    }
036
037    /**
038     * Gets information about this control request.
039     *
040     * @return Map of control parameter names and corresponding applied values
041     */
042    @Override
043    public Map<String, String> getControlInfo() {
044        var controlInfo = new HashMap<String,String>();
045        controlInfo.put("Name", getName());
046        return controlInfo;
047    }
048
049    @Override
050    public EmptyControl clone() {
051        return new EmptyControl();
052    }
053};