@desklink/host 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,6 +30,8 @@ mod input;
30
30
  #[path = "input_mac.rs"]
31
31
  mod input;
32
32
  #[cfg(target_os = "linux")]
33
+ mod keeper;
34
+ #[cfg(target_os = "linux")]
33
35
  mod keymap;
34
36
  #[cfg(target_os = "macos")]
35
37
  #[path = "keymap_mac.rs"]
@@ -115,6 +117,7 @@ fn main() {
115
117
  0
116
118
  }
117
119
  "serve" => report(runtime.block_on(serve())),
120
+ "keep" => keeper::command(&args[1..]),
118
121
  "capture-probe" => report(runtime.block_on(probe(
119
122
  args.get(1).and_then(|value| value.parse().ok()),
120
123
  args.get(2).map(String::as_str),
@@ -154,6 +157,9 @@ fn print_help() {
154
157
 
155
158
  USAGE:
156
159
  desklink-host serve speak the local control protocol on stdin/stdout
160
+ desklink-host keep --display :N
161
+ keep one private X screen: kiosk geometry, focus,
162
+ and a JSON-lines window report on stdout
157
163
  desklink-host capabilities print what this machine can do right now
158
164
  desklink-host capture-probe [seconds] [display]
159
165
  capture frames and report the stream; with a
@@ -452,6 +458,14 @@ fn render_event(notice: session::Notice) -> Option<String> {
452
458
  "session.frame.changed",
453
459
  serde_json::json!({ "sessionId": session_id, "seq": seq, "damage": damage }),
454
460
  ),
461
+ session::SessionEvent::Input { input } => (
462
+ "session.input",
463
+ serde_json::json!({ "sessionId": session_id, "input": input }),
464
+ ),
465
+ session::SessionEvent::KeyframeRequest { generation } => (
466
+ "session.keyframeRequest",
467
+ serde_json::json!({ "sessionId": session_id, "generation": generation }),
468
+ ),
455
469
  session::SessionEvent::RestoreToken(token) => (
456
470
  "session.restoreToken",
457
471
  serde_json::json!({ "sessionId": session_id, "token": token }),
@@ -581,6 +595,21 @@ async fn dispatch(
581
595
  .map_err(|error| ErrorBody::new("transport", format!("{error:#}")))?;
582
596
  Ok(serde_json::json!({ "accepted": true }))
583
597
  }
598
+ "session.restart_ice" => {
599
+ // The client asks; the engine offers. The fresh offer travels as a
600
+ // new `session.description` event and the client answers it as
601
+ // usual, so no new event shape is needed and the session,
602
+ // generation and control channel survive.
603
+ let session = require_session(current)?;
604
+ let params: protocol::SessionRef = serde_json::from_value(request.params.clone())
605
+ .map_err(|error| ErrorBody::new("malformed", error.to_string()))?;
606
+ check_session(session, &params.session_id, params.generation)?;
607
+ session
608
+ .restart_ice()
609
+ .await
610
+ .map_err(|error| ErrorBody::new("transport", format!("{error:#}")))?;
611
+ Ok(serde_json::json!({ "accepted": true }))
612
+ }
584
613
  "session.clipboard.read" => {
585
614
  let session = require_session(current)?;
586
615
  let params: protocol::ClipboardParams = serde_json::from_value(request.params.clone())
@@ -625,6 +654,19 @@ async fn dispatch(
625
654
  .frame(params.since, &params.path, params.region)
626
655
  .map_err(|error| ErrorBody::new(error.code, error.message))
627
656
  }
657
+ "session.feed" => {
658
+ let session = require_session(current)?;
659
+ let params: protocol::FeedParams = serde_json::from_value(request.params.clone())
660
+ .map_err(|error| ErrorBody::new("malformed", error.to_string()))?;
661
+ check_session(session, &params.session_id, None)?;
662
+ let data = params
663
+ .access_unit()
664
+ .map_err(|message| ErrorBody::new("malformed", message))?;
665
+ session
666
+ .feed(params.keyframe, data)
667
+ .map_err(|error| ErrorBody::new(error.code, error.message))?;
668
+ Ok(serde_json::json!({ "accepted": true }))
669
+ }
628
670
  "session.metrics" => {
629
671
  let session = require_session(current)?;
630
672
  Ok(serde_json::to_value(session.metrics()).unwrap_or(serde_json::Value::Null))