xref: /aosp_15_r20/external/openscreen/osp/demo/README.md (revision 3f982cf4871df8771c9d4abe6e9a6f8d829b2736)
1*3f982cf4SFabien Sanglard# Presentation API Demo
2*3f982cf4SFabien Sanglard
3*3f982cf4SFabien SanglardThis directory contains a demo of a Presentation API controller and receiver.
4*3f982cf4SFabien SanglardThe demo supports flinging a URL to start a presentation and stopping the
5*3f982cf4SFabien Sanglardpresentation.
6*3f982cf4SFabien Sanglard
7*3f982cf4SFabien Sanglard## Command line options
8*3f982cf4SFabien Sanglard
9*3f982cf4SFabien SanglardThe same executable is run for the controller and receiver; only the command
10*3f982cf4SFabien Sanglardline options affect the behavior.  The command line options are:
11*3f982cf4SFabien Sanglard
12*3f982cf4SFabien Sanglard``` bash
13*3f982cf4SFabien Sanglard    $ osp_demo [-v] [friendly_name]
14*3f982cf4SFabien Sanglard```
15*3f982cf4SFabien Sanglard
16*3f982cf4SFabien Sanglard - `-v` enables verbose logging.
17*3f982cf4SFabien Sanglard - Specifying `friendly_name` puts the demo in receiver mode and sets its name
18*3f982cf4SFabien Sanglard   to `friendly_name`.  Currently, `friendly_name` won't appear in any of the
19*3f982cf4SFabien Sanglard   controller-side output related to this screen though.  If no friendly name is
20*3f982cf4SFabien Sanglard   given, the demo runs as a controller.
21*3f982cf4SFabien Sanglard
22*3f982cf4SFabien Sanglard## Log output
23*3f982cf4SFabien Sanglard
24*3f982cf4SFabien SanglardBecause the demo acts like a shell and accepts commands on `stdin`, the logging
25*3f982cf4SFabien Sanglardoutput is redirected to a separate file so it doesn't flood the same display.
26*3f982cf4SFabien SanglardYou have to create these files on your machine before running the demo.  For the
27*3f982cf4SFabien Sanglardcontroller, this file should be named `_cntl_fifo` and for the receiver, it
28*3f982cf4SFabien Sanglardshould be named `_recv_fifo`.  The simplest way to do this is so you can see the
29*3f982cf4SFabien Sanglardoutput while the demo is running is to make these named pipes like so:
30*3f982cf4SFabien Sanglard
31*3f982cf4SFabien Sanglard``` bash
32*3f982cf4SFabien Sanglard    $ mkfifo _cntl_fifo _recv_fifo
33*3f982cf4SFabien Sanglard```
34*3f982cf4SFabien Sanglard
35*3f982cf4SFabien SanglardThen `cat` them in separate terminals while the demo is running.
36*3f982cf4SFabien Sanglard
37*3f982cf4SFabien Sanglard## Listener commands
38*3f982cf4SFabien Sanglard
39*3f982cf4SFabien Sanglard - `avail <url>`: Begin listening for receivers that support the presentation of
40*3f982cf4SFabien Sanglard   `url`.
41*3f982cf4SFabien Sanglard - `start <url> <service_id>`: Start a presentation of `url` on the receiver
42*3f982cf4SFabien Sanglard   specified by the ID `service_id`.  `service_id` will be printed in the output
43*3f982cf4SFabien Sanglard   log once `avail` has been run.  The demo only supports starting one
44*3f982cf4SFabien Sanglard   presentation at a time.
45*3f982cf4SFabien Sanglard - `msg <string>`: Sends a string message on the open presentation connection.
46*3f982cf4SFabien Sanglard - `close`: Close the open presentation connection without terminating the
47*3f982cf4SFabien Sanglard   presentation.
48*3f982cf4SFabien Sanglard - `reconnect`: Reconnect the previously-connected presentation connection.
49*3f982cf4SFabien Sanglard   This allows using the `msg` command again.
50*3f982cf4SFabien Sanglard - `term`: Terminate the previously started presentation.
51*3f982cf4SFabien Sanglard
52*3f982cf4SFabien Sanglard## Publisher commands
53*3f982cf4SFabien Sanglard
54*3f982cf4SFabien Sanglard - `avail`: Toggle whether the receiver is publishing itself as an available
55*3f982cf4SFabien Sanglard   screen.  The receiver starts in the publishing state.
56*3f982cf4SFabien Sanglard - `close`: Close the open presentation connection without terminating the
57*3f982cf4SFabien Sanglard   presentation.
58*3f982cf4SFabien Sanglard - `msg <string>`: Sends a string message on the open presentation connection.
59*3f982cf4SFabien Sanglard - `term`: Terminate the running presentation.
60