Skip to content

Commit 94d0286

Browse files
authored
Rename RangedPlayback capability to PlaybackControl (#879)
### Changelog None ### Docs None ### Description Coming out of launch review, we got consensus that `PlaybackControl` is a more descriptive name than `RangedPlayback`, given that the new callbacks and core functionality relate to controlling playback from the Foxglove UI. This PR implements that renaming in the SDK. Tested building and running an example with the `PlaybackControl` capability against a Foxglove app build that had the renaming implemented.
1 parent ccdd12a commit 94d0286

File tree

19 files changed

+54
-54
lines changed

19 files changed

+54
-54
lines changed

c/include/foxglove-c/foxglove-c.h

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

c/src/server.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub const FOXGLOVE_SERVER_CAPABILITY_ASSETS: u8 = 1 << 5;
4343
/// Indicates that the server is sending data within a fixed time range. This requires the
4444
/// server to specify the `data_start_time` and `data_end_time` fields in
4545
/// `foxglove_server_options`.
46-
pub const FOXGLOVE_SERVER_CAPABILITY_RANGED_PLAYBACK: u8 = 1 << 6;
46+
pub const FOXGLOVE_SERVER_CAPABILITY_PLAYBACK_CONTROL: u8 = 1 << 6;
4747

4848
bitflags! {
4949
#[derive(Clone, Copy, PartialEq, Eq)]
@@ -54,7 +54,7 @@ bitflags! {
5454
const Time = FOXGLOVE_SERVER_CAPABILITY_TIME;
5555
const Services = FOXGLOVE_SERVER_CAPABILITY_SERVICES;
5656
const Assets = FOXGLOVE_SERVER_CAPABILITY_ASSETS;
57-
const RangedPlayback = FOXGLOVE_SERVER_CAPABILITY_RANGED_PLAYBACK;
57+
const PlaybackControl = FOXGLOVE_SERVER_CAPABILITY_PLAYBACK_CONTROL;
5858
}
5959
}
6060

@@ -77,8 +77,8 @@ impl FoxgloveServerCapabilityBitFlags {
7777
FoxgloveServerCapabilityBitFlags::Assets => {
7878
Some(foxglove::websocket::Capability::Assets)
7979
}
80-
FoxgloveServerCapabilityBitFlags::RangedPlayback => {
81-
Some(foxglove::websocket::Capability::RangedPlayback)
80+
FoxgloveServerCapabilityBitFlags::PlaybackControl => {
81+
Some(foxglove::websocket::Capability::PlaybackControl)
8282
}
8383
_ => None,
8484
})
@@ -170,10 +170,10 @@ pub struct FoxgloveServerOptions<'a> {
170170
) -> bool,
171171
>,
172172

173-
/// If the server is sending data from a fixed time range, and has the RangedPlayback capability,
173+
/// If the server is sending data from a fixed time range, and has the PlaybackControl capability,
174174
/// the start time of the data range.
175175
pub playback_start_time: Option<&'a u64>,
176-
/// If the server is sending data from a fixed time range, and has the RangedPlayback capability,
176+
/// If the server is sending data from a fixed time range, and has the PlaybackControl capability,
177177
/// the end time of the data range.
178178
pub playback_end_time: Option<&'a u64>,
179179

@@ -326,7 +326,7 @@ pub struct FoxgloveServerCallbacks {
326326

327327
/// Callback invoked when a client sends a playback control request message.
328328
///
329-
/// Requires `FOXGLOVE_CAPABILITY_RANGED_PLAYBACK`.
329+
/// Requires `FOXGLOVE_CAPABILITY_PLAYBACK_CONTROL`.
330330
///
331331
/// `playback_control_request` is an input parameter and guaranteed to be non-NULL.
332332
/// `playback_state` is a non-NULL output pointer to a struct that has already been allocated.
@@ -531,7 +531,7 @@ pub extern "C" fn foxglove_server_broadcast_time(
531531

532532
/// Publishes the current playback state to all clients.
533533
///
534-
/// Requires the `FOXGLOVE_CAPABILITY_RANGED_PLAYBACK` capability.
534+
/// Requires the `FOXGLOVE_CAPABILITY_PLAYBACK_CONTROL` capability.
535535
///
536536
/// # Safety
537537
/// - `playback_state` must be a valid pointer to a playback state that lives for the duration of the call.

cpp/foxglove/include/foxglove/playback_control_request.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ enum class PlaybackCommand : uint8_t {
1717

1818
/// @brief A request to control playback from the Foxglove app
1919
///
20-
/// Only relevant if the `RangedPlayback` capability is enabled.
20+
/// Only relevant if the `PlaybackControl` capability is enabled.
2121
struct PlaybackControlRequest {
2222
public:
2323
/// @brief The playback command.

cpp/foxglove/include/foxglove/playback_state.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ enum class PlaybackStatus : uint8_t {
2626
/// state of playback has changed; for example, reaching the end of data, or an external mechanism
2727
/// causes playback to pause.
2828
///
29-
/// Only relevant if the `RangedPlayback` capability is enabled.
29+
/// Only relevant if the `PlaybackControl` capability is enabled.
3030
struct PlaybackState {
3131
public:
3232
/// @brief The status of server data playback

cpp/foxglove/include/foxglove/server.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ enum class WebSocketServerCapabilities : uint8_t {
7474
/// @cond foxglove_internal
7575
/// Indicates that the server is sending data within a fixed time range. This requires the
7676
/// server to specify the `playback_time_range` field in its `WebSocketServerOptions`.
77-
RangedPlayback = 1 << 6,
77+
PlaybackControl = 1 << 6,
7878
/// @endcond
7979
};
8080

@@ -200,7 +200,7 @@ struct WebSocketServerCallbacks {
200200
/// @cond foxglove_internal
201201
/// @brief Callback invoked when a playback control request is sent from the client.
202202
///
203-
/// Requires the capability WebSocketServerCapabilities::RangedPlayback
203+
/// Requires the capability WebSocketServerCapabilities::PlaybackControl
204204
///
205205
/// @param playback_control_request The playback control request.
206206
/// @return The playback state to send back to the client.
@@ -268,7 +268,7 @@ struct WebSocketServerOptions {
268268
/// @brief The time range for playback. This applies if the server is playing back a fixed time
269269
/// range of data.
270270
///
271-
/// @note Setting this option imples the RangedPlayback capability
271+
/// @note Setting this option imples the PlaybackControl capability
272272
std::optional<std::pair<uint64_t, uint64_t>> playback_time_range = std::nullopt;
273273
/// @endcond
274274
};
@@ -306,7 +306,7 @@ class WebSocketServer final {
306306
/// @cond foxglove_internal
307307
/// @brief Publishes the current playback state to all clients.
308308
///
309-
/// Requires the capability WebSocketServerCapabilities::RangedPlayback.
309+
/// Requires the capability WebSocketServerCapabilities::PlaybackControl.
310310
///
311311
/// @param playback_state The playback state to publish.
312312
void broadcastPlaybackState(const PlaybackState& playback_state) const noexcept;

cpp/foxglove/tests/test_server.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,7 @@ TEST_CASE("Playback control request callback") {
16001600

16011601
foxglove::WebSocketServerOptions ws_options;
16021602
ws_options.context = context;
1603-
ws_options.capabilities = foxglove::WebSocketServerCapabilities::RangedPlayback;
1603+
ws_options.capabilities = foxglove::WebSocketServerCapabilities::PlaybackControl;
16041604
ws_options.playback_time_range = std::make_pair(0, 1000);
16051605
ws_options.callbacks.onPlaybackControlRequest =
16061606
[&]([[maybe_unused]] const foxglove::PlaybackControlRequest& playback_control_request
@@ -1673,7 +1673,7 @@ TEST_CASE("Broadcast playback state") {
16731673
auto context = foxglove::Context::create();
16741674
foxglove::WebSocketServerOptions ws_options;
16751675
ws_options.context = context;
1676-
ws_options.capabilities = foxglove::WebSocketServerCapabilities::RangedPlayback;
1676+
ws_options.capabilities = foxglove::WebSocketServerCapabilities::PlaybackControl;
16771677
ws_options.playback_time_range = std::make_pair(0, 1000);
16781678
auto server = startServer(std::move(ws_options));
16791679

@@ -1708,7 +1708,7 @@ TEST_CASE("Broadcast playback state") {
17081708
REQUIRE(server.stop() == foxglove::FoxgloveError::Ok);
17091709
}
17101710

1711-
TEST_CASE("RangedPlayback capability") {
1711+
TEST_CASE("PlaybackControl capability") {
17121712
auto context = foxglove::Context::create();
17131713

17141714
const uint64_t start_time = 100000000000ULL;
@@ -1728,12 +1728,12 @@ TEST_CASE("RangedPlayback capability") {
17281728
REQUIRE(parsed.contains("op"));
17291729
REQUIRE(parsed["op"] == "serverInfo");
17301730

1731-
// Ensure that the rangedPlayback capability is enabled, since opt.playback_time_range is
1731+
// Ensure that the playbackControl capability is enabled, since opt.playback_time_range is
17321732
// specified
17331733
REQUIRE(parsed.contains("capabilities"));
17341734
const auto& capabilities = parsed["capabilities"];
17351735
REQUIRE(std::count_if(capabilities.begin(), capabilities.end(), [](const auto& capability) {
1736-
return capability == "rangedPlayback";
1736+
return capability == "playbackControl";
17371737
}) == 1);
17381738

17391739
REQUIRE(parsed.contains("dataStartTime"));

python/foxglove-sdk/python/foxglove/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def start_server(
7777
Return `True` to log the channel, or `False` to skip it. By default, all channels
7878
will be logged.
7979
:param playback_time_range: Time range of data being played back, in absolute nanoseconds.
80-
Implies `Capability.RangedPlayback` if set.
80+
Implies `Capability.PlaybackControl` if set.
8181
"""
8282
return _foxglove.start_server(
8383
name=name,

python/foxglove-sdk/python/foxglove/_foxglove_py/websocket.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Capability(Enum):
2727
Time = ...
2828
"""Inform clients about the latest server time."""
2929

30-
RangedPlayback = ...
30+
PlaybackControl = ...
3131
"""Indicates that the server is sending data within a fixed time range."""
3232

3333
class Client:

python/foxglove-sdk/python/foxglove/websocket.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def on_playback_control_request(
184184
"""
185185
Called by the server when it receives an updated player state from the client.
186186
187-
Requires :py:data:`Capability.RangedPlayback`.
187+
Requires :py:data:`Capability.PlaybackControl`.
188188
189189
:meta private:
190190
:param playback_control_request: The playback control request sent from the client

python/foxglove-sdk/src/websocket.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ pub enum PyCapability {
763763
Services,
764764
/// Indicates that the server is sending data within a fixed time range. This requires the
765765
/// server to specify the `data_start_time` and `data_end_time` fields in its `ServerInfo` message.
766-
RangedPlayback,
766+
PlaybackControl,
767767
}
768768

769769
impl From<PyCapability> for foxglove::websocket::Capability {
@@ -774,7 +774,7 @@ impl From<PyCapability> for foxglove::websocket::Capability {
774774
PyCapability::Parameters => foxglove::websocket::Capability::Parameters,
775775
PyCapability::Time => foxglove::websocket::Capability::Time,
776776
PyCapability::Services => foxglove::websocket::Capability::Services,
777-
PyCapability::RangedPlayback => foxglove::websocket::Capability::RangedPlayback,
777+
PyCapability::PlaybackControl => foxglove::websocket::Capability::PlaybackControl,
778778
}
779779
}
780780
}

0 commit comments

Comments
 (0)