001package edu.wpi.first.wpilibj;
002
003import edu.wpi.first.wpilibj.util.BaseSystemNotInitializedException;
004
005/**
006 * Support for high level usage reporting.
007 *
008 * @author alex
009 */
010public class HLUsageReporting {
011        private static Interface impl;
012
013        public static void SetImplementation(Interface i) {
014                impl = i;
015        }
016
017        public static void reportScheduler() {
018                if (impl != null) {
019                        impl.reportScheduler();
020                } else {
021                        throw new BaseSystemNotInitializedException(Interface.class, HLUsageReporting.class);
022                }
023        }
024
025        public static void reportPIDController(int num) {
026                if (impl != null) {
027                        impl.reportPIDController(num);
028                } else {
029                        throw new BaseSystemNotInitializedException(Interface.class, HLUsageReporting.class);
030                }
031        }
032
033        public static void reportSmartDashboard() {
034                if(impl != null) {
035                        impl.reportSmartDashboard();
036                } else {
037                        throw new BaseSystemNotInitializedException(Interface.class, HLUsageReporting.class);
038                }
039        }
040
041        public interface Interface {
042                void reportScheduler();
043                void reportPIDController(int num);
044                void reportSmartDashboard();
045        }
046
047    public static class Null implements Interface {
048        public void reportScheduler() {}
049                public void reportPIDController(int num) {}
050                public void reportSmartDashboard() {}
051        }
052}