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.configs; 008 009import com.ctre.phoenix6.StatusCode; 010import com.ctre.phoenix6.configs.jni.ConfigJNI; 011import com.ctre.phoenix6.spns.*; 012 013/** 014 * Custom Params. 015 * <p> 016 * Custom paramaters that have no real impact on controller. 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 /** 046 * Modifies this configuration's CustomParam0 parameter and returns itself for 047 * method-chaining and easier to use config API. 048 * <p> 049 * Custom parameter 0. This is provided to allow end-applications to 050 * store persistent information in the device. 051 * 052 * <ul> 053 * <li> <b>Minimum Value:</b> -32768 054 * <li> <b>Maximum Value:</b> 32767 055 * <li> <b>Default Value:</b> 0 056 * <li> <b>Units:</b> 057 * </ul> 058 * 059 * @param newCustomParam0 Parameter to modify 060 * @return Itself 061 */ 062 public CustomParamsConfigs withCustomParam0(int newCustomParam0) 063 { 064 CustomParam0 = newCustomParam0; 065 return this; 066 } 067 /** 068 * Modifies this configuration's CustomParam1 parameter and returns itself for 069 * method-chaining and easier to use config API. 070 * <p> 071 * Custom parameter 1. This is provided to allow end-applications to 072 * store persistent information in the device. 073 * 074 * <ul> 075 * <li> <b>Minimum Value:</b> -32768 076 * <li> <b>Maximum Value:</b> 32767 077 * <li> <b>Default Value:</b> 0 078 * <li> <b>Units:</b> 079 * </ul> 080 * 081 * @param newCustomParam1 Parameter to modify 082 * @return Itself 083 */ 084 public CustomParamsConfigs withCustomParam1(int newCustomParam1) 085 { 086 CustomParam1 = newCustomParam1; 087 return this; 088 } 089 090 091 092 @Override 093 public String toString() 094 { 095 String ss = "Config Group: CustomParams\n"; 096 ss += "Name: \"CustomParam0\" Value: \"" + CustomParam0 + "\"" + "\n"; 097 ss += "Name: \"CustomParam1\" Value: \"" + CustomParam1 + "\"" + "\n"; 098 return ss; 099 } 100 101 /** 102 * 103 */ 104 public StatusCode deserialize(String to_deserialize) 105 { 106 CustomParam0 = ConfigJNI.Deserializeint(SpnValue.CustomParam0.value, to_deserialize); 107 CustomParam1 = ConfigJNI.Deserializeint(SpnValue.CustomParam1.value, to_deserialize); 108 return StatusCode.OK; 109 } 110 111 /** 112 * 113 */ 114 public String serialize() 115 { 116 String ss = ""; 117 ss += ConfigJNI.Serializeint(SpnValue.CustomParam0.value, CustomParam0); 118 ss += ConfigJNI.Serializeint(SpnValue.CustomParam1.value, CustomParam1); 119 return ss; 120 } 121} 122