internal ShuffleboardInstance(NetworkTableInstance ntInstance) { m_rootTable = ntInstance.GetTable(Shuffleboard.kBaseTableName); m_rootMetaTable = m_rootTable.GetSubTable(".metadata"); m_selectedTabEntry = m_rootMetaTable.GetEntry("Selected"); UsageReporting.Report(ResourceType.Shuffleboard, 0); }
public NetworkTableConnectionHandler(NetworkTableInstance instance) { this.instance = instance; instance.AddConnectionListener((in ConnectionNotification notification) => { ConnectionChanged?.Invoke(this, EventArgs.Empty); }, false);
// Start is called before the first frame update void Start() { NetworkTableInstance inst = NetworkTableInstance.Default; inst.StartClientTeam(2903); inst.StartDSClient(); orbSlamTable = inst.GetTable("orbslam2"); tensorTable = inst.GetTable("tensorflow"); sensorTable = inst.GetTable("sensortable"); }
static void Main(string[] args) { NtCore.Initialize(); NetworkTableInstance instance = NetworkTableInstance.Default; GC.KeepAlive(instance); //var i = SendableRegistry.Instance; //var map = new ConditionalWeakTable<HolderMethod, Container>(); //var holder = new HolderMethod(); //map.Add(holder, new Container(holder)); ////holder = null; ////while (map.Any()) ////{ //// //Console.WriteLine(map.Count()); //// GC.Collect(); ////} //RobotBase.StartRobot<Robot>(); }
public MatchDataSender(NetworkTableInstance inst) { table = inst.GetTable("FMSInfo"); typeMetadata = table.GetEntry(".type"); typeMetadata.ForceSetString("FMSInfo"); gameSpecificMessage = table.GetEntry("GameSpecificMessage"); gameSpecificMessage.ForceSetString(""); eventName = table.GetEntry("EventName"); eventName.ForceSetString(""); matchNumber = table.GetEntry("MatchNumber"); matchNumber.ForceSetDouble(0); replayNumber = table.GetEntry("ReplayNumber"); replayNumber.ForceSetDouble(0); matchType = table.GetEntry("MatchType"); matchType.ForceSetDouble(0); alliance = table.GetEntry("IsRedAlliance"); alliance.ForceSetBoolean(true); station = table.GetEntry("StationNumber"); station.ForceSetDouble(1); controlWord = table.GetEntry("FMSControlData"); controlWord.ForceSetDouble(0); }
public NetworkTableServerClientManager(NetworkTableInstance instance) { this.instance = instance; }
public NetworkTableEntryHandler(NetworkTableInstance instance) { this.instance = instance; }
internal RecordingController(NetworkTableInstance ntInstance) { m_recordingControlEntry = ntInstance.GetEntry(RecordingControlKey); m_recordingFileNameFormatEntry = ntInstance.GetEntry(RecordingFileNameFormatKey); m_eventsTable = ntInstance.GetTable(EventMarkerTableName); }
private static void ConfigureLogging(LogType logType, bool separate, object rootContainer, IShuffleboardWrapper shuffleboard, NetworkTableInstance nt) { IShuffleboardContainerWrapper bin; if (rootContainer is ILoggable loggable) { bin = shuffleboard.GetTab(loggable.ConfigureLogName()); } else { bin = shuffleboard.GetTab(rootContainer.GetType().Name); } switch (logType) { case LogType.LOG: LogFieldsPropertiesAndMethods(rootContainer, rootContainer.GetType(), bin, new HashSet <FieldInfo>(), new HashSet <MethodInfo>(), new HashSet <PropertyInfo>()); break; case LogType.CONFIG: //ConfigFieldsPropertiesAndMethods(rootContainer, rootContainer.GetType(), bin, new HashSet<FieldInfo>(), new HashSet<MethodInfo>(), new HashSet<PropertyInfo>()); break; } Action <ILoggable> log = (toLog) => { }; }
private static void HandleMethodNameAttribute(object loggable, IShuffleboardContainerWrapper bin, NetworkTableInstance nt, FieldInfo field, Attribute attribute) { if (methodHandler.ContainsKey(attribute.GetType())) { return; } }
private static void ConfigFieldsPropertiesAndMethods( object loggable, Type loggableType, IShuffleboardContainerWrapper bin, NetworkTableInstance nt, ISet <FieldInfo> registeredFields, ISet <MethodInfo> registeredMethods, ISet <PropertyInfo> registeredProperties) { var fields = loggableType.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); var methods = loggableType.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); var properties = loggableType.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); // Process fields foreach (var field in fields) { if (IsNull(field, loggable) || registeredFields.Contains(field)) { continue; } registeredFields.Add(field); foreach (var type in logHandler.Keys) { foreach (var attribute in field.GetCustomAttributes(type)) { HandleMethodNameAttribute(loggable, bin, nt, field, attribute); } } } foreach (var method in methods) { // Only look at getters if (method.ReturnType == typeof(void) || method.GetParameters().Length > 0 || registeredMethods.Contains(method)) { continue; } registeredMethods.Add(method); foreach (var type in logHandler.Keys) { foreach (var attribute in method.GetCustomAttributes(type)) { if (!logHandler.TryGetValue(attribute.GetType(), out var process)) { continue; } process.ProcessField(() => method.Invoke(loggable, null), attribute, bin, method.Name); } } } foreach (var property in properties) { // Only look at getters if (!property.CanRead || registeredProperties.Contains(property)) { continue; } registeredProperties.Add(property); foreach (var type in logHandler.Keys) { foreach (var attribute in property.GetCustomAttributes(type)) { if (!logHandler.TryGetValue(attribute.GetType(), out var process)) { continue; } process.ProcessField(() => property.GetValue(loggable), attribute, bin, property.Name); } } } }