Commit Graph

360 Commits

Author SHA1 Message Date
PJ Reiniger
b85a0d5cf3 [build] Add missing sources to published zip files (#8055)
Gradle publishing does not capture all of the source files that are used during a build. This should get most of them, and get it equivalent to what bazel pushes out.
2025-07-15 21:20:28 -07:00
PJ Reiniger
1ccafdc13f [bazel] Simple shared library implementation (#8044) 2025-07-01 22:53:34 -07:00
Peter Johnson
82ce317083 Merge branch 'main' into 2027 2025-06-30 20:21:11 -07:00
PJ Reiniger
e13d237390 [bazel] Create better static libraries and add basic publishing (#8029) 2025-06-27 16:36:12 -07:00
Peter Johnson
676f2f84d7 [ntcore] Check id ranges in control messages (#7726) 2025-06-18 21:03:24 -07:00
PJ Reiniger
fbbc4bc53c [bazel] Clean up bazel scripts (#7984) 2025-06-13 20:53:09 -07:00
Ryan Blue
89b97a21d8 [ntcore] Change 'null' to 'empty string' in NT StartServer docs (NFC) (#8017) 2025-06-10 21:55:51 -07:00
Peter Johnson
f99692f287 [ntcore] Minimize latency on localhost connections (#7997) 2025-06-02 16:43:18 -07:00
Peter Johnson
6c16e846fa Merge branch 'main' into 2027 2025-05-29 21:41:50 -07:00
PJ Reiniger
6e3f48daeb [bazel] Add scripts to validate pregeneration tools (#7690) 2025-05-13 22:01:47 -07:00
Gold856
ca3137b291 [build] Remove statically linked JNI artifacts (#7553) 2025-05-05 22:10:07 -07:00
Peter Johnson
36811211be Merge branch 'main' into 2027 2025-04-25 23:45:43 -07:00
Tyler Veness
92010c175f Fix more emscripten compiler errors (#7895)
I ran the CMake configure with:
```bash
emcmake cmake -B build-wasm -S . \
  -DCMAKE_BUILD_TYPE=Release \
  -DBUILD_SHARED_LIBS=OFF \
  -DWITH_SIMULATION_MODULES=OFF \
  -DWITH_PROTOBUF=OFF \
  -DWITH_GUI=OFF \
  -DWITH_CSCORE=OFF
```

* Turned off simulation modules because they require shared libraries
* Turned off GUI because glfw requires libssh
* Turned off cscore because it requires OpenCV

I still get the following compiler errors:

```
/home/tav/frc/wpilib/allwpilib/wpinet/src/main/native/thirdparty/libuv/src/unix/linux.cpp:43:10: fatal error: 'sys/epoll.h' file not found
   43 | #include <sys/epoll.h>
      |          ^~~~~~~~~~~~~
```
```
/home/tav/frc/wpilib/allwpilib/wpinet/src/main/native/thirdparty/libuv/src/unix/stream.cpp:991:56: error: comparison of integers of different signs: 'unsigned long' and 'long' [-Werror,-Wsign-compare]
  991 |   for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) {
      |                                                        ^~~~~~~~~~~~~~~~~~~~~~
/home/tav/.cache/emscripten/sysroot/include/sys/socket.h:358:44: note: expanded from macro 'CMSG_NXTHDR'
  358 |         __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
```
/home/tav/frc/wpilib/allwpilib/wpinet/src/main/native/thirdparty/libuv/src/unix/core.cpp:748:56: error: comparison of integers of different signs: 'unsigned long' and 'long' [-Werror,-Wsign-compare]
  748 |   for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg))
      |                                                        ^~~~~~~~~~~~~~~~~~~~~~
/home/tav/.cache/emscripten/sysroot/include/sys/socket.h:358:44: note: expanded from macro 'CMSG_NXTHDR'
  358 |         __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
2025-04-25 21:56:26 -07:00
DeltaDizzy
da47f06d70 [datalog] Move all DataLog functionality to new datalog library (#7641)
Currently the major DataLog backend API (reading and writing) is split between wpiutil and glass. In the interest of allowing code that wants to use these APIs to not need to link to glass and declutter wpiutil, all of those APIs are moved to a new library named "datalog".

Signed-off-by: Jade Turner <spacey-sooty@proton.me>
Co-authored-by: Jade Turner <spacey-sooty@proton.me>
Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com>
2025-02-19 21:08:17 -08:00
PJ Reiniger
3b345fe218 [bazel] Add macros to build jni code and java tests (#7693) 2025-01-26 16:52:33 -08:00
Thad House
1cad4f64a4 [hal] Add high level way of getting systemserver NT instance (#7683) 2025-01-16 10:49:40 -07:00
Thad House
afbaa43539 [wpiutil] Remove roboRIO-specific timestamp code (#7669) 2025-01-13 15:59:11 -07:00
Peter Johnson
03d9e96877 [wpiutil] Change StringExtras split() to template (#7636)
It now calls back a function for each part rather than creating a SmallVector.
2025-01-05 20:53:43 -08:00
Peter Johnson
1240ee1bf4 [ntcore] Remove NT3 support (#7625)
- Remove StartClient3
- Rename StartClient4 to StartClient
- Remove port3 parameter from StartServer
- Remove 3-suffix constants
- Remove 4 suffix from constants

Also remove Shuffleboard build from CI.
2025-01-02 23:05:13 -08:00
Carl Hauser
eef1bf33de [wpilib] Fix SmartDashboard.setDefault* docs (NFC) (#6490)
Fix incorrect comments related to NT SetDefault* methods across multiple components
2024-12-29 18:41:29 -06:00
Ryan Blue
0c99073b94 Use std::bit_cast (#7567)
Backport #7492

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-12-22 13:34:16 -08:00
Tyler Veness
a04c40f589 Replace std::make_pair with std::pair CTAD (#7405) 2024-11-17 20:29:23 -08:00
Peter Johnson
b040059108 [ntcore] Properly clean up time sync listeners (#7398) 2024-11-16 22:15:40 -08:00
Tyler Veness
c58be2580d [ntcore] Suppress warning false positive (#7370)
```
In copy constructor ‘std::function<_Res(_ArgTypes ...)>::function(const std::function<_Res(_ArgTypes ...)>&) [with _Res = void; _ArgTypes = {unsigned int}]’,
    inlined from ‘nt::server::ServerClient4Base::ServerClient4Base(std::string_view, std::string_view, bool, nt::server::SetPeriodicFunc, nt::server::ServerStorage&, int, wpi::Logger&)’ at /home/tav/frc/wpilib/allwpilib/ntcore/src/main/native/cpp/server/ServerClient4Base.h:24:77,
    inlined from ‘nt::server::ServerClientLocal::ServerClientLocal(nt::server::ServerStorage&, int, wpi::Logger&)’ at /home/tav/frc/wpilib/allwpilib/ntcore/src/main/native/cpp/server/ServerClientLocal.cpp:18:75:
/usr/include/c++/14.2.1/bits/std_function.h:391:17: error: ‘<anonymous>’ may be used uninitialized [-Werror=maybe-uninitialized]
  391 |             __x._M_manager(_M_functor, __x._M_functor, __clone_functor);
      |             ~~~~^~~~~~~~~~
/usr/include/c++/14.2.1/bits/std_function.h: In constructor ‘nt::server::ServerClientLocal::ServerClientLocal(nt::server::ServerStorage&, int, wpi::Logger&)’:
/usr/include/c++/14.2.1/bits/std_function.h:267:7: note: by argument 2 of type ‘const std::_Any_data&’ to ‘static bool std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_manager(std::_Any_data&, const std::_Any_data&, std::_Manager_operation) [with _Res = void; _Functor = nt::server::ServerClientLocal::ServerClientLocal(nt::server::ServerStorage&, int, wpi::Logger&)::<lambda(uint32_t)>; _ArgTypes = {unsigned int}]’ declared here
  267 |       _M_manager(_Any_data& __dest, const _Any_data& __source,
      |       ^~~~~~~~~~
/home/tav/frc/wpilib/allwpilib/ntcore/src/main/native/cpp/server/ServerClientLocal.cpp:18:75: note: ‘<anonymous>’ declared here
   18 |     : ServerClient4Base{"", "", true, [](uint32_t) {}, storage, id, logger} {
      |                                                                           ^
```
2024-11-08 20:22:47 -08:00
Peter Johnson
01f85abcfe [ntcore] Use Endian.h in WireEncoder3 2024-11-08 00:46:27 -07:00
Peter Johnson
396f8203ac [ntcore] HandleMap: Use concepts for T 2024-11-08 00:46:27 -07:00
Peter Johnson
4a43ddbacf [ntcore] Split LocalStorage implementation into separate files 2024-11-08 00:46:27 -07:00
Peter Johnson
0921054a28 [ntcore] Split ServerImpl implementation into separate files 2024-11-08 00:46:27 -07:00
Peter Johnson
f738fc92f0 [ntcore] Move ServerImpl to nt::server namespace 2024-11-08 00:46:27 -07:00
Peter Johnson
a0f38f83f9 [ntcore] NetworkOutgoingQueue: Move function defs inside class 2024-11-08 00:46:27 -07:00
Peter Johnson
876be30724 [ntcore] Value: Inline constructors 2024-11-08 00:46:27 -07:00
Peter Johnson
de318fab91 [ntcore] LocalStorage: Move template functions inside class definition 2024-11-08 00:46:27 -07:00
truher
ad09d73dd6 [ntcore] Replace "ValueListenerPoller" with "NetworkTableListenerPoller" in docs (#7328) 2024-11-05 09:49:03 -07:00
Tyler Veness
a48f3c35f4 Remove argv usage from Python scripts (#7311)
argparse will automatically read sys.argv, so we don't need to pass it
in manually. Furthermore, none of our scripts customize argv.
2024-11-02 19:09:32 -07:00
Peter Johnson
27e07d6787 [ntcore] ClientImpl3: Store Entry by value 2024-10-31 22:04:13 -07:00
Ryan Blue
412c042c6c Use LF in generated files (#7305) 2024-10-28 19:28:58 -07:00
sciencewhiz
2c857cd82a [ntcore] Use NT3 client identity in front of unique id (#7293)
This way all NT3 clients are not identified as just NT3.
2024-10-26 18:56:04 -07:00
PJ Reiniger
36e0c9d6db [build] MVP for building with bazel (#6994) 2024-10-19 09:54:49 -07:00
Gold856
0424e5ba36 [build] Remove unnecessary symbol exclusions (#7221)
The symbol exporter in native-utils was updated and stopped exporting the excluded symbols.
2024-10-17 16:19:19 -07:00
Peter Johnson
0bada2e102 [ntcore] Merge .inc files into headers (#7210) 2024-10-14 22:42:58 -07:00
Peter Johnson
bedfc09268 [ntcore] Add missing multi-subscribe C API functions (#7203)
Also export recently added C API functions.
2024-10-14 09:55:36 -06:00
Peter Johnson
4023cdc80a [ntcore] Fix EALREADY errors by tracking read state (#7202) 2024-10-13 00:14:16 -07:00
Peter Johnson
25c2e26ef8 [ntcore] Fix UID collisions between subscribers and multi-sub (#7198)
The changes in #7189 caused an ambiguity between multi-subscribers and
normal subscribers, because the handle type no longer is sent to the network.

Multi-subscribers now go to the network with negative UIDs, normal
subscribers are positive UIDs.  UID 0 is never used.
2024-10-11 21:39:55 -07:00
Peter Johnson
77ee9bdd30 [ntcore] Client: only connect to IPv4 addresses (#7195)
The server only binds to IPv6, so connection attempts to that are useless.
2024-10-11 17:05:09 -07:00
Peter Johnson
a621cebbd6 [ntcore] Server round robin message processing (#7191)
Each client has an incoming queue of ClientMessage.

In the read callback:
- Parse and process only ping messages and a limited number of messages;
  anything else will get put into the queue and not processed
- If we queued some messages, we tell the network we stopped reading; this will
  result in back-pressure if we are reading too slowly.  We also start an idle
  handle to process the queued messages.

In the idle handle callback:
- For each client, process just a few pending messages.  This is performed in
  round-robin fashion across all clients with pending messages
- When a client's queue becomes empty, we re-enable the network read
- When all client queues are empty, we stop the idle handle (so we don't spin)

For local client processing, we use round-robin processing for most cases (including FlushLocal),
but still do batch processing of all local changes for explicit network Flush() calls.
2024-10-11 16:26:56 -07:00
Peter Johnson
96f0b2482c [ntcore] Unify NetworkInterface and MessageHandler (#7190) 2024-10-11 14:38:02 -07:00
Peter Johnson
8ca99c7cb7 [ntcore] Change internal interfaces and messages to use UIDs (#7189)
Also make Handle functions constexpr.
2024-10-11 10:57:36 -07:00
Peter Johnson
59bc53b9b8 [ntcore] Add StopRead/StartRead to WireConnection (#7188) 2024-10-11 10:51:12 -07:00
Peter Johnson
0cfff31439 [ntcore] Fix use-after-free on connection termination (#7177)
The stream can close (e.g. due to an error) while in the middle of writing. The close callback would immediately destroy the connection object, resulting in the writing code having a use-after-free. Fix this by deferring the deletion to the loop main using a single-shot timer.
2024-10-10 22:03:55 -07:00
Tyler Veness
554024767e Fix errors from new cpplint.py (#7105) 2024-09-20 17:43:39 -07:00