2015-07-16 22:55:50 -07:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* Copyright (c) FIRST 2015. All Rights Reserved. */
|
|
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#ifndef NT_DISPATCHER_H_
|
|
|
|
|
#define NT_DISPATCHER_H_
|
|
|
|
|
|
|
|
|
|
#include <atomic>
|
2015-07-17 22:39:36 -07:00
|
|
|
#include <chrono>
|
|
|
|
|
#include <condition_variable>
|
2015-07-29 20:33:26 -07:00
|
|
|
#include <functional>
|
2015-07-16 22:55:50 -07:00
|
|
|
#include <memory>
|
|
|
|
|
#include <mutex>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
#include "llvm/StringRef.h"
|
|
|
|
|
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
#include "IDispatcher.h"
|
2015-07-16 22:55:50 -07:00
|
|
|
#include "NetworkConnection.h"
|
|
|
|
|
|
2016-07-27 00:39:38 -07:00
|
|
|
namespace wpi {
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
class Logger;
|
2015-08-02 00:33:41 -07:00
|
|
|
class NetworkAcceptor;
|
|
|
|
|
class NetworkStream;
|
2016-07-27 00:39:38 -07:00
|
|
|
}
|
2015-07-17 22:39:36 -07:00
|
|
|
|
2015-07-17 07:21:07 -07:00
|
|
|
namespace nt {
|
2015-07-16 22:55:50 -07:00
|
|
|
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
class IConnectionNotifier;
|
|
|
|
|
class IStorage;
|
|
|
|
|
|
|
|
|
|
class DispatcherBase : public IDispatcher {
|
2015-08-01 11:15:04 -07:00
|
|
|
friend class DispatcherTest;
|
2016-11-03 21:03:45 -07:00
|
|
|
|
2015-07-16 22:55:50 -07:00
|
|
|
public:
|
2016-07-27 00:39:38 -07:00
|
|
|
typedef std::function<std::unique_ptr<wpi::NetworkStream>()> Connector;
|
2016-04-08 13:31:35 -07:00
|
|
|
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
DispatcherBase(IStorage& storage, IConnectionNotifier& notifier,
|
|
|
|
|
wpi::Logger& logger);
|
2015-08-02 00:33:41 -07:00
|
|
|
virtual ~DispatcherBase();
|
2015-07-16 22:55:50 -07:00
|
|
|
|
2017-06-02 20:25:20 -04:00
|
|
|
unsigned int GetNetworkMode() const;
|
2016-07-27 00:39:38 -07:00
|
|
|
void StartServer(llvm::StringRef persist_filename,
|
|
|
|
|
std::unique_ptr<wpi::NetworkAcceptor> acceptor);
|
2016-11-04 16:01:42 -07:00
|
|
|
void StartClient();
|
2015-07-16 22:55:50 -07:00
|
|
|
void Stop();
|
|
|
|
|
void SetUpdateRate(double interval);
|
|
|
|
|
void SetIdentity(llvm::StringRef name);
|
2015-07-17 22:39:36 -07:00
|
|
|
void Flush();
|
2015-08-02 10:47:05 -07:00
|
|
|
std::vector<ConnectionInfo> GetConnections() const;
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
bool IsConnected() const;
|
2015-07-17 22:39:36 -07:00
|
|
|
|
2016-11-04 16:01:42 -07:00
|
|
|
void SetConnector(Connector connector);
|
|
|
|
|
void SetConnectorOverride(Connector connector);
|
|
|
|
|
void ClearConnectorOverride();
|
|
|
|
|
|
2015-07-17 22:39:36 -07:00
|
|
|
bool active() const { return m_active; }
|
2015-07-16 22:55:50 -07:00
|
|
|
|
2015-08-02 00:33:41 -07:00
|
|
|
DispatcherBase(const DispatcherBase&) = delete;
|
|
|
|
|
DispatcherBase& operator=(const DispatcherBase&) = delete;
|
2015-07-16 22:55:50 -07:00
|
|
|
|
2015-08-02 00:33:41 -07:00
|
|
|
private:
|
2015-07-16 22:55:50 -07:00
|
|
|
void DispatchThreadMain();
|
2015-08-02 00:33:41 -07:00
|
|
|
void ServerThreadMain();
|
2016-04-08 13:31:35 -07:00
|
|
|
void ClientThreadMain();
|
2015-07-16 22:55:50 -07:00
|
|
|
|
2015-07-31 20:32:52 -07:00
|
|
|
bool ClientHandshake(
|
|
|
|
|
NetworkConnection& conn,
|
|
|
|
|
std::function<std::shared_ptr<Message>()> get_msg,
|
|
|
|
|
std::function<void(llvm::ArrayRef<std::shared_ptr<Message>>)> send_msgs);
|
|
|
|
|
bool ServerHandshake(
|
|
|
|
|
NetworkConnection& conn,
|
|
|
|
|
std::function<std::shared_ptr<Message>()> get_msg,
|
|
|
|
|
std::function<void(llvm::ArrayRef<std::shared_ptr<Message>>)> send_msgs);
|
2015-07-29 20:33:26 -07:00
|
|
|
|
2015-07-31 20:32:52 -07:00
|
|
|
void ClientReconnect(unsigned int proto_rev = 0x0300);
|
2015-07-17 22:39:36 -07:00
|
|
|
|
2015-07-29 23:45:04 -07:00
|
|
|
void QueueOutgoing(std::shared_ptr<Message> msg, NetworkConnection* only,
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
NetworkConnection* except) override;
|
2015-07-17 22:39:36 -07:00
|
|
|
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
IStorage& m_storage;
|
|
|
|
|
IConnectionNotifier& m_notifier;
|
2017-06-02 20:25:20 -04:00
|
|
|
unsigned int m_networkMode = NT_NET_MODE_NONE;
|
2015-08-19 19:09:25 -07:00
|
|
|
std::string m_persist_filename;
|
2015-07-16 22:55:50 -07:00
|
|
|
std::thread m_dispatch_thread;
|
|
|
|
|
std::thread m_clientserver_thread;
|
|
|
|
|
|
2016-07-27 00:39:38 -07:00
|
|
|
std::unique_ptr<wpi::NetworkAcceptor> m_server_acceptor;
|
2016-11-04 16:01:42 -07:00
|
|
|
Connector m_client_connector_override;
|
2017-08-13 12:05:29 -07:00
|
|
|
Connector m_client_connector;
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
uint8_t m_connections_uid = 0;
|
2015-07-17 22:39:36 -07:00
|
|
|
|
|
|
|
|
// Mutex for user-accessible items
|
2015-08-02 10:47:05 -07:00
|
|
|
mutable std::mutex m_user_mutex;
|
2015-08-13 13:12:15 -07:00
|
|
|
std::vector<std::shared_ptr<NetworkConnection>> m_connections;
|
2015-07-16 22:55:50 -07:00
|
|
|
std::string m_identity;
|
|
|
|
|
|
2016-11-03 21:03:45 -07:00
|
|
|
std::atomic_bool m_active; // set to false to terminate threads
|
2015-07-17 22:39:36 -07:00
|
|
|
std::atomic_uint m_update_rate; // periodic dispatch update rate, in ms
|
|
|
|
|
|
|
|
|
|
// Condition variable for forced dispatch wakeup (flush)
|
|
|
|
|
std::mutex m_flush_mutex;
|
|
|
|
|
std::condition_variable m_flush_cv;
|
|
|
|
|
std::chrono::steady_clock::time_point m_last_flush;
|
2015-08-19 21:16:44 -07:00
|
|
|
bool m_do_flush = false;
|
2015-07-17 22:39:36 -07:00
|
|
|
|
2015-07-31 23:14:26 -07:00
|
|
|
// Condition variable for client reconnect (uses user mutex)
|
2015-07-17 22:39:36 -07:00
|
|
|
std::condition_variable m_reconnect_cv;
|
2015-08-19 21:16:44 -07:00
|
|
|
unsigned int m_reconnect_proto_rev = 0x0300;
|
|
|
|
|
bool m_do_reconnect = true;
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
wpi::Logger& m_logger;
|
2015-08-02 00:33:41 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class Dispatcher : public DispatcherBase {
|
|
|
|
|
friend class DispatcherTest;
|
2016-11-03 21:03:45 -07:00
|
|
|
|
2015-08-02 00:33:41 -07:00
|
|
|
public:
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
Dispatcher(IStorage& storage, IConnectionNotifier& notifier,
|
|
|
|
|
wpi::Logger& logger)
|
|
|
|
|
: DispatcherBase(storage, notifier, logger) {}
|
2015-08-02 00:33:41 -07:00
|
|
|
|
2015-08-19 19:09:25 -07:00
|
|
|
void StartServer(StringRef persist_filename, const char* listen_address,
|
|
|
|
|
unsigned int port);
|
2016-11-04 16:01:42 -07:00
|
|
|
|
|
|
|
|
void SetServer(const char* server_name, unsigned int port);
|
|
|
|
|
void SetServer(ArrayRef<std::pair<StringRef, unsigned int>> servers);
|
Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.
This change adds an instance handle-based API. In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).
Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.
Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.
And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.
Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
|
|
|
void SetServerTeam(unsigned int team, unsigned int port);
|
2016-11-04 16:01:42 -07:00
|
|
|
|
|
|
|
|
void SetServerOverride(const char* server_name, unsigned int port);
|
|
|
|
|
void ClearServerOverride();
|
2015-07-16 22:55:50 -07:00
|
|
|
};
|
|
|
|
|
|
2015-07-17 07:21:07 -07:00
|
|
|
} // namespace nt
|
2015-07-16 22:55:50 -07:00
|
|
|
|
|
|
|
|
#endif // NT_DISPATCHER_H_
|