Пример #1
0
        public void SetUp()
        {
            NetworkTable.Shutdown();
            /*
            //We can't run NT or File based tests on the simulator. Just auto pass them.
            if (RobotBase.IsSimulation)
            {
                return;
            }
            */
            try
            {
                string file = "networktables.ini";
                if (File.Exists(file))
                {
                    File.Delete(file);
                }

                using (StreamWriter writer = new StreamWriter(file))
                {
                    writer.Write("[NetworkTables Storage 3.0]\ndouble \"/Preferences/checkedValueInt\"=2\ndouble \"/Preferences/checkedValueDouble\"=.2\ndouble \"/Preferences/checkedValueFloat\"=3.14\ndouble \"/Preferences/checkedValueLong\"=172\nstring \"/Preferences/checkedValueString\"=\"hello \\nHow are you ?\"\nboolean \"/Preferences/checkedValueBoolean\"=false\n");
                }

            }
            catch (IOException exception)
            {
                Console.WriteLine(exception);
            }

            NetworkTable.Initialize();

            pref = Preferences.Instance;
            prefTable = NetworkTable.GetTable("Preferences");
            check = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
        }
 public static void ClassSetup()
 {
     if (RobotBase.IsReal)
     {
         table = NetworkTable.GetTable("_RELAY_CROSS_CONNECT_TEST_");
     }
 }
Пример #3
0
 public void Setup()
 {
     s_me.Setup();
     m_table = NetworkTable.GetTable("TEST_PID");
     m_controller = new PIDController(m_kP, m_kI, m_kD, s_me.GetEncoder(), s_me.GetMotor());
     m_controller.InitTable(m_table);
 }
        public void SetUp()
        {
            //We can't run NT or File based tests on the simulator. Just auto pass them.
            if (RobotBase.IsSimulation)
            {
                return;
            }
            try
            {
                string file = "/home/lvuser/wpilib-preferences.ini";
                if (File.Exists(file))
                {
                    File.Delete(file);
                }

                using (StreamWriter writer = new StreamWriter(file))
                {
                    writer.Write("checkedValueInt = 2\ncheckedValueDouble = .2\ncheckedValueFloat = 3.14\ncheckedValueLong = 172\ncheckedValueString =\"hello \nHow are you ?\"\ncheckedValueBoolean = false");
                }

            }
            catch (IOException exception)
            {
                Console.WriteLine(exception);
            }

            pref = Preferences.Instance;
            prefTable = NetworkTable.GetTable("Preferences");
            check = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
        }
Пример #5
0
 public static void SetUpBeforeClass()
 {
     if (RobotBase.IsReal)
     {
         s_table = NetworkTable.GetTable("SmartDashboard");
     }
 }
Пример #6
0
        // GetTable obtains the requested table.  Note that the leading '/'s are required, while
        // the trailing '/' is not be specified.  So, it's "/LiveWindow/DriveBase/Front".
        // Either retrieves an existing table, or makes a new one and returns that.
        public NetworkTable GetTable(string tablepath)
        {
            lock (this) {
                NetworkTable nt;

                // see if there's an existing table, or if we need a new table.
                if (_tables.ContainsKey(tablepath))
                {
                    nt = _tables[tablepath];
                }
                else
                {
                    nt = new NetworkTable(this, tablepath);
                    _tables[tablepath] = nt;
                }

                return(nt);
            }
        }
Пример #7
0
        // readEntityAssignment implements the ENTRY_ASSIGNMENT_MESSAGE.
        // Field Name Field Type
        // 0x10                  - Entry Assignment Message 1 byte, unsigned
        // Entry Name            - string (actually the fully qulified "path)
        // Entry Type            - 1 byte, unsigned
        // Entry ID              - 2 byte, unsigned
        // Entry Sequence Number - 2 bytes, unsigned
        // Entry Value           - N bytes, length depends on Entry Type
        void readEntityAssignment()
        {
            string fullname = readString();

            Entity e = new Entity(fullname);

            e.type     = (EntityType)_nstream.ReadByte();
            e.id       = readushort();
            e.sequence = readushort();
            e.value    = readValue(e.type);

            Console.WriteLine("{0} id {1} - {2}", e.fullpath, e.id, e.value);

            _entities[e.id] = e;

            NetworkTable nt = GetTable(e.tablepath);

            nt._entities[e.name] = e;
        }
Пример #8
0
        public NetworkTable GetTable(string key)
        {
            string theKey;

            if (string.IsNullOrWhiteSpace(key))
            {
                theKey = "";
            }
            else if (key[0] == NetworkTable.PathSeparator)
            {
                theKey = key;
            }
            else
            {
                theKey = NetworkTable.PathSeparator + key;
            }

            NetworkTable table = m_tables.GetOrAdd(theKey, (s) =>
            {
                return(new NetworkTable(this, s.AsSpan()));
            });

            return(table);
        }
        // GetTable obtains the requested table.  Note that the leading '/'s are required, while
        // the trailing '/' is not be specified.  So, it's "/LiveWindow/DriveBase/Front".
        // Either retrieves an existing table, or makes a new one and returns that.
        public NetworkTable GetTable(string tablepath)
        {
            lock (this) {
                NetworkTable nt;

                // see if there's an existing table, or if we need a new table.
                if (_tables.ContainsKey(tablepath))
                    nt = _tables[tablepath];
                else {
                    nt = new NetworkTable(this, tablepath);
                    _tables[tablepath] = nt;
                }

                return nt;
            }
        }
 public void TestSetup()
 {
     CoreMethods.DeleteAllEntries();
     m_table = NetworkTable.GetTable("Table");
 }
 public void SetUp()
 {
     CoreMethods.DeleteAllEntries();
     m_nt = NetworkTable.GetTable("");
 }
Пример #12
0
 public void Setup()
 {
     me.Setup();
     table = NetworkTable.GetTable("TEST_PID");
     controller = new PIDController(k_p, k_i, k_d, me.GetEncoder(), me.GetMotor());
     controller.InitTable(table);
 }
Пример #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NetworkButton"/> class
 /// </summary>
 /// <param name="table">The <see cref="NetworkTable"/> to locate the button on</param>
 /// <param name="field">The name of the button</param>
 public NetworkButton(NetworkTable table, string field)
 {
     m_table = table;
     m_field = field;
 }
Пример #14
0
 private Preferences()
 {
     m_table = NetworkTable.GetTable(TableName);
     m_table.AddTableListenerEx(this, NotifyFlags.NotifyNew | NotifyFlags.NotifyImmediate);
     HAL.Base.HAL.Report(ResourceType.kResourceType_Preferences, (byte)0);
 }
Пример #15
0
 public void RemoveConnectionListener(IRemoteConnectionListener listener)
 {
     NetworkTable.RemoveGlobalConnectionListener(listener);
 }
Пример #16
0
 public void RemoveConnectionListener(Action <IRemote, ConnectionInfo, bool> listener)
 {
     NetworkTable.RemoveGlobalConnectionListener(listener);
 }
Пример #17
0
 public void AddConnectionListener(IRemoteConnectionListener listener, bool immediateNotify)
 {
     NetworkTable.AddGlobalConnectionListener(listener, immediateNotify);
 }
Пример #18
0
 public void AddConnectionListener(Action <IRemote, ConnectionInfo, bool> listener, bool immediateNotify)
 {
     NetworkTable.AddGlobalConnectionListener(listener, immediateNotify);
 }
 public void SetUp()
 {
     m_nt = NetworkTable.GetTable("");
 }
Пример #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NetworkButton"/> class
 /// </summary>
 /// <param name="table">The <see cref="NetworkTable"/> to locate the button on</param>
 /// <param name="field">The name of the button</param>
 public NetworkButton(NetworkTable table, string field)
 {
     SourceTable = table;
     Field = field;
 }