mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
Move DS caching from user level to the HAL (#1143)
Also switch eventName and gameSpecificData to fixed 64-byte arrays to avoid mallocs and extra NetComm calls. This behavior matches 2018 LabView. The DS caching is kept in Java to avoid JNI and/or massive amounts of allocations. This does not increase latency because Java still only hits NetComm once. Moving the DS caching benefits all languages other than Java, because it avoids the need for individual implementations. If caching is ever added to NetComm, it will then only be necessary to remove it from the HAL and Java rather than all languages.
This commit is contained in:
committed by
Peter Johnson
parent
0b5df467e1
commit
fe5d7dd6ba
@@ -92,11 +92,12 @@ struct HAL_JoystickDescriptor {
|
||||
typedef struct HAL_JoystickDescriptor HAL_JoystickDescriptor;
|
||||
|
||||
struct HAL_MatchInfo {
|
||||
char* eventName;
|
||||
char eventName[64];
|
||||
HAL_MatchType matchType;
|
||||
uint16_t matchNumber;
|
||||
uint8_t replayNumber;
|
||||
char* gameSpecificMessage;
|
||||
uint8_t gameSpecificMessage[64];
|
||||
uint16_t gameSpecificMessageSize;
|
||||
};
|
||||
typedef struct HAL_MatchInfo HAL_MatchInfo;
|
||||
|
||||
@@ -264,20 +265,11 @@ double HAL_GetMatchTime(int32_t* status);
|
||||
/**
|
||||
* Gets info about a specific match.
|
||||
*
|
||||
* Note that the match info must be freed with HAL_FreeMatchInfo
|
||||
*
|
||||
* @param info the match info (output)
|
||||
* @return the error code, or 0 for success
|
||||
*/
|
||||
int32_t HAL_GetMatchInfo(HAL_MatchInfo* info);
|
||||
|
||||
/**
|
||||
* Frees a match info structure allocated with HAL_GetMatchInfo.
|
||||
*
|
||||
* @param info the match info
|
||||
*/
|
||||
void HAL_FreeMatchInfo(HAL_MatchInfo* info);
|
||||
|
||||
#ifndef HAL_USE_LABVIEW
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user