-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The IoTDisplay is a network enabled E-Paper + Raspberry Pi device that can display a variety of information. It sets on your network waiting for commands passed to it via the OpenAPI web API. Although fully OpenAPI compliant, you do not need an OpenAPI enabled client to communicate with the device. Any commands can be sent via the HTTP posting of JSON documents. The displayed screen is kept as a bitmap canvas in memory and its state is stored on the SD card in case of a restart. Commands are sent to the display to update specific areas of the canvas with drawings, images and text. Clock commands are also available. They are automatically rendered on the canvas in memory once a minute.
Any command sent with delay: false (the default) will be rendered on the canvas immediately, then a five-second timer is set to allow for additional commands. At the end of the timer, a bitmap of the canvas is sent to the E-Paper display for viewing. Any command sent with delay: true, such as all clock commands, will be rendered on the canvas immediately but will only be sent to the E-Paper display at five minute intervals. If a non-delayed command is sent during the five minute wait time, the updated canvas, including anything rendered with delay, will be sent to the display at the end of the five-second timer.
This gives you the flexibility to get a near real time display of some information while having the ability to show other information in a less timely manner. Since E-Paper displays have a limited lifetime of display updates, delaying commands that frequently update help extend the life of the display. Also, as most E-Paper displays take several seconds to update, these delays help group changes together, so the display spends less time updating and is viewable more of the time.
This project utilizes eXoCooLd's Waveshare.EPaperDisplay drivers. Any display supported by that project is also supported by this project. The display can be used in portrait or landscape mode. The driver name and rotation (0°, 90°, 180°, 270°) are set in the appsettings.json file with 0° being landscape and 180° being landscape flipped.
Since this is written to use an E-Paper display attached to an SPI interface, it will only work on a Raspberry Pi. However, if the driver is omitted from the appsettings.json file, you can run it on any machine that can run .NET 5 for testing and debugging purposes. The following paragraph covers another option. The web UI is available regardless of platform, and the current canvas can be viewed within the UI at any time.
There is also an included socket server for GUI clients that can be used in conjunction with the E-Paper driver or used standalone. The socket server supports Graphic and Command clients through a custom protocol. Graphic clients receive PNG data of screen changes and Command clients receive commands processed by the renderer to be rendered by the client. This server does not use the same delays as the E-Paper service. For graphic clients, it will wait for one second of no render activity before sending the affected screen area to the client and five seconds if the command is delayed. For command clients, the commands are sent immediately.
The accepted hosts and ports for the web API by default is "http://*:5000;http://localhost:5001" but can be configured using the appsettings.json file, hostsettings.json or by a command line argument including HTTPS URLs if you include a certificate. Commands are to be sent to this URL and the full UI can be seen by navigating a browser to (URL)/swagger/index.html. The UI will list every command, its json schema (where applicable), an example, and the option to try them.
Commands can also be sent using the console app. A json document is built using command line arguments and sent to the web API via HTTP. Help is available within this app.
This is a GUI client that can connect to the socket server and view near real time display changes. It is written using Avalonia, so it can be compiled to run on Windows, Linux and macOS. At the heart of this app is a standalone Avalonia control that communicates with the server and renders a duplicate of the display image. This control can easily be included in your own Avalonia app for custom purposes. More information can be found here.