Commit Graph

538 Commits

Author SHA1 Message Date
Peter Johnson
7c1d2f4bc4 Improve client connection synchronization behavior.
The original synchronization behavior was troublesome for two reasons:
- It had unpredictable behavior for updated values
- It brought back to life deleted values

Instead of relying on the server to inform the client regarding reconnections,
the client keeps track of what values have been modified by user code on the
client.  When the client connects to the server, the following occurs.

For entries that have been modified by user code on the client:
- If the entry is not persistent, the server value is overwritten with the
  client value
- If the entry does not exist on the server, the client sends an assignment
  to the server to recreate it on the server

For entries that have not been modified by user code on the client:
- The client value is overwritten with the server value
- If the entry does not exist on the server, the client deletes the entry

Fixes #8.
2017-09-06 20:48:48 -07:00
Peter Johnson
8099d6dbd7 Refactor Storage ProcessIncoming(). 2017-09-06 20:41:53 -07:00
Peter Johnson
8e01b68cf6 Switch Storage save/load to use raw_ostream/raw_istream. 2017-09-06 20:41:53 -07:00
Peter Johnson
d707a07f84 Refactor Storage load and save functionality.
Fixes #191.
2017-09-06 20:41:53 -07:00
Peter Johnson
5ab20bb27c 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-09-06 20:28:35 -07:00
Peter Johnson
8125a179fb Only include .cpp files in testsuite build. 2017-09-06 20:28:35 -07:00
Peter Johnson
12b2efa489 Log.cpp: Use raw_ostream and llvm path functions. (#223) 2017-08-27 12:01:31 -07:00
Thad House
baa8021c79 Force dev java to be built during build task (#227) 2017-08-18 19:51:14 -07:00
Peter Johnson
162ac787b7 Update googletest and googlemock to 1.8.0. (#226) 2017-08-15 23:47:25 -07:00
Tyler Veness
0d76b3f308 Added gradlew.bat to .gitattributes (#225)
The gradle-wrapper.properties file also got committed with CRLF line endings,
which this commit rectifies.
2017-08-14 00:02:38 -07:00
Thad House
92c4c49b01 Removes the custom platform include flag (#224)
Was replaced by #222
2017-08-13 15:41:59 -07:00
Peter Johnson
9e4dc235d7 Connect to server in parallel rather than doing round-robin. (#205)
This substantially speeds up client connection times.
2017-08-13 12:05:29 -07:00
Peter Johnson
4bd8cf6f5c Native tests depend on native sources, so include in exportedHeaders. (#222) 2017-08-13 10:27:06 -07:00
Thad House
d9c754c30f Add a java version of the dev app. (#218) 2017-08-13 08:02:29 -07:00
Thad House
ea028a3822 Add a cpp dev run task. (#219) 2017-08-13 08:01:39 -07:00
Thad House
0782164120 Gradle 4.1 (#220) 2017-08-11 01:10:18 -07:00
Thad House
ccfeab5ac9 Adds an all artifact to the published libraries (#217)
Better then the old desktop zips because it will include all artifacts
built, not just specifically the desktop ones. Also, the individual
artifacts are published as well so users can decide which artifacts they
specifically want, and can help decrease download sizes. The cpp plugin
will continue using the individual artifacts.
2017-08-07 17:42:58 -07:00
Peter Johnson
4b8ef57a99 Remove networktables2.type Java custom container types. (#214) 2017-08-04 20:24:36 -05:00
Peter Johnson
d910b0b2a2 Remove deprecated throwing get functions. (#213) 2017-08-04 14:02:28 -05:00
Thad House
80c8de7d69 Add dependency to jni task to fix 32 bit builds (#216)
Fixes #212
Also forces appveyor to test both 32 and 64 bit correctly.
assemble was removed because it would inadvertently cause a 3rd build.
2017-08-04 13:46:58 -05:00
Peter Johnson
7f776deae2 Fix ntcoreExe build model. (#215) 2017-08-04 13:35:23 -05:00
Peter Johnson
8209ba8a00 Move NetworkTable into nt namespace, with a shim. (#211)
Defining NAMESPACED_NT will disable the shim.
2017-08-04 10:32:33 -05:00
Thad House
5df7463663 Remove wpiutil and update to the new build system (#210) 2017-08-03 16:14:40 -05:00
Sam Carlberg
f43675e2bd Add functionality for getting the current network mode (#202)
Use bit flags to indicate a combination of network mode and status.
2017-06-02 17:25:20 -07:00
Sam Carlberg
417cf33f90 Expose ITable paths (#200)
Closes #196
2017-05-26 21:02:45 -07:00
Thad House
3d2f41d081 Adds a way to get the native handle from SafeThread (#198)
Useful to wpilib to enable easier changing of RT priorities.
2017-05-09 22:04:57 -07:00
Austin Shalit
42facbb07e Make Java "struct" constructors public for testing/simulating (#195) 2017-04-30 08:48:02 -07:00
Joseph Jackson
9f97cd61bf Correct platform path for 32-bit Linux (#179)
Gradle needs to produce a platform path of "Linux/i386" when targeting a Linux 32-bit Intel platform. Otherwise, it doesn't match Java's os.name/os.arch when loading the ntcore library in NetworkTablesJNI.java. Windows uses "x86" but Linux uses "i386". (http://lopica.sourceforge.net/os.html)
2017-04-30 08:47:02 -07:00
Thad House
e6656326a8 Adds field IP to round robin list (#187)
With how many more coprocessors are being added, this is probably needed
to make the field crew sane.
2017-02-09 00:55:01 -08:00
Peter Johnson
13457d1bf4 Update setUpdateRate() documentation to match implementation.
Update rates as fast as 10 ms are now allowed.

Fixes #184.
2017-01-18 21:32:15 -08:00
Thad House
3e2631f49b Fixes Java artifact clasifiers when using custom suffix (#183) 2017-01-05 14:13:57 -08:00
Thad House
ac56b0a33e Adds way to force publishing version from command line (#182)
In case we need to do a recreation of an artifact for some reason, this
makes it possible.
2017-01-04 22:15:23 -08:00
Thad House
27c0405fc9 Reruns gradle wrapper to fully generate 3.3 files (#181) 2017-01-04 19:08:33 -08:00
Thad House
b9e80ecfdc Updates to gradle 3.3, and removes Visual Studio 2015 workaround (#180) 2017-01-04 17:37:02 -08:00
Thad House
5df78c520c Adds support for building separate armhf artifacts (#177)
Currently if using a separate compiler prefix, it would still get published
to the arm classifier. This modifies so a classifier suffix can be used to
disambiguate arm from armhf.
2017-01-03 19:12:47 -08:00
Thad House
78995f5cca Fixes SetIntArrayRegion template for windows builds (#178) 2017-01-02 22:29:56 -08:00
Fred Silberberg
bac4b3d5cb Fixed gradle publish with no flags. (#176) 2017-01-01 00:13:00 -08:00
Peter Johnson
df7d3261c9 JStringRef: ensure string is null terminated so c_str() works correctly. 2016-12-26 14:13:15 -08:00
Peter Johnson
b5b0899226 Revert "Fixes TCPAcceptor able to use an empty string (#172)"
This doesn't actually do anything since the outer if statement checks
for empty m_address already.

This reverts commit 6ad9f45d9a.
2016-12-26 13:55:21 -08:00
Thad House
6ad9f45d9a Fixes TCPAcceptor able to use an empty string (#172) 2016-12-26 12:27:08 -08:00
Fred Silberberg
ed9e837229 Updates the wpilib version plugin (#171) 2016-12-25 22:11:54 -08:00
Fred Silberberg
b9a08e8260 Fixed entry comment (#169) 2016-12-25 22:11:14 -08:00
Peter Johnson
95e5295666 Use InetNtop on Win32 rather than WSAAddressToString. (#170)
Similarly, use InetPton rather than WSAStringToAddress.

The WSAAddressToString function is intended to provide a user-readable
string and thus includes the port number.  This breaks some use cases
on Windows which expect to get just the IP address.

Note: The InetPton and InetNtop functions are available only in Vista or above.
2016-12-25 01:30:12 -08:00
Peter Johnson
4b16999fbc Fix tests that are only built on cmake. (#168)
Fixes #167.
2016-12-24 01:58:12 -06:00
Peter Johnson
459cc65b3f TCPAcceptor: Include port number in error messages. (#166) 2016-12-23 20:36:45 -06:00
Jaci R
94359709a1 Add new ARM Toolchain, add toolchainpath to README (#165) 2016-12-19 23:16:39 -06:00
Peter Johnson
c091d74de4 jni_util: Add JException wrapper class.
This allows more natural C++ Throw semantics (for a variety of string
data types) for any java exception that just takes a String argument.
2016-12-15 21:54:36 -08:00
Peter Johnson
19be09c361 Add null checks on all JNI object parameters. 2016-12-15 00:27:32 -08:00
Peter Johnson
8c2a148ed1 jni_util: Make JStringRef and JArrayRef null-safe.
They return empty string and empty array (to avoid crashes) but also
report an error with backtrace to stderr when called in that manner.
2016-12-14 23:59:06 -08:00
Peter Johnson
6fbaf57b99 jni_util: Add GetJavaStackTrace. 2016-12-14 23:59:02 -08:00