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.phoenixpro.configs;
008
009import com.ctre.phoenixpro.StatusCode;
010import com.ctre.phoenixpro.configs.jni.ConfigJNI;
011import com.ctre.phoenixpro.spns.*;
012
013/**
014 *  Configs that directly affect motor-output.
015 * <p>
016 *  Includes Motor Invert and various limit features.
017 */
018public class CustomParamsConfigs implements ParentConfiguration
019{
020    /**
021     * Custom parameter 0.  This is provided to allow end-applications to
022     * store persistent information in the device.
023     *
024     *  <ul>
025     *  <li> <b>Minimum Value:</b> -32768
026     *  <li> <b>Maximum Value:</b> 32767
027     *  <li> <b>Default Value:</b> 0
028     *  <li> <b>Units:</b> 
029     *  </ul>
030     */
031    public int CustomParam0 = 0;
032    /**
033     * Custom parameter 1.  This is provided to allow end-applications to
034     * store persistent information in the device.
035     *
036     *  <ul>
037     *  <li> <b>Minimum Value:</b> -32768
038     *  <li> <b>Maximum Value:</b> 32767
039     *  <li> <b>Default Value:</b> 0
040     *  <li> <b>Units:</b> 
041     *  </ul>
042     */
043    public int CustomParam1 = 0;
044
045    @Override
046    public String toString()
047    {
048        String ss = "Config Group: CustomParams\n";
049        ss += "Name: \"CustomParam0\" Value: \"" + CustomParam0 + "\"" + "\n";
050        ss += "Name: \"CustomParam1\" Value: \"" + CustomParam1 + "\"" + "\n";
051        return ss;
052    }
053
054    /**
055     *
056     */
057    public StatusCode deserialize(String string)
058    {
059        CustomParam0 = ConfigJNI.Deserializeint(SpnValue.CustomParam0.value, string);
060        CustomParam1 = ConfigJNI.Deserializeint(SpnValue.CustomParam1.value, string);
061        return  StatusCode.OK;
062    }
063
064    /**
065     *
066     */
067    public String serialize()
068    {
069        String ss = "";
070        ss += ConfigJNI.Serializeint(816, CustomParam0);
071        ss += ConfigJNI.Serializeint(817, CustomParam1);
072        return ss;
073    }
074}
075