mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +00:00
cscore: Add connection strategy to sources (#1252)
By default, sources automatically manage their connection based on whether any sinks are connected. This change allows the user to keep a connection open or force it closed regardless of the number of connected sinks.
This commit is contained in:
@@ -599,6 +599,21 @@ Java_edu_wpi_cscore_CameraServerJNI_getSourceLastFrameTime
|
||||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cscore_CameraServerJNI
|
||||
* Method: setSourceConnectionStrategy
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_cscore_CameraServerJNI_setSourceConnectionStrategy
|
||||
(JNIEnv* env, jclass, jint source, jint strategy)
|
||||
{
|
||||
CS_Status status = 0;
|
||||
cs::SetSourceConnectionStrategy(
|
||||
source, static_cast<CS_ConnectionStrategy>(strategy), &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cscore_CameraServerJNI
|
||||
* Method: isSourceConnected
|
||||
@@ -614,6 +629,21 @@ Java_edu_wpi_cscore_CameraServerJNI_isSourceConnected
|
||||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cscore_CameraServerJNI
|
||||
* Method: isSourceEnabled
|
||||
* Signature: (I)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_edu_wpi_cscore_CameraServerJNI_isSourceEnabled
|
||||
(JNIEnv* env, jclass, jint source)
|
||||
{
|
||||
CS_Status status = 0;
|
||||
auto val = cs::IsSourceEnabled(source, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cscore_CameraServerJNI
|
||||
* Method: getSourceProperty
|
||||
|
||||
Reference in New Issue
Block a user