Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rest api doser #2181

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Rest api doser #2181

wants to merge 8 commits into from

Conversation

telenkov88
Copy link

This pull request introduces enhancements to the Doser UI by integrating support for the REST API. The changes aim to provide users with the ability to interact with the Doser subsystem via RESTful endpoints, enabling flexible control and management of dosing operations:

  1. Added REST API Integration: Implemented support for REST API endpoints to facilitate communication with the Doser subsystem.
  2. Localization for new Parameters

Dependencies - standard build-in go libraries:
"bytes"
"fmt"
"text/template"
"net/http"

Testing:

  1. Tested locally to ensure the proper functioning of REST API endpoints.
  2. Verified the user interface changes across different browsers and screen sizes.
  3. Conducted unit tests to validate the behavior of the integrated features.

How it's works:
1)In UI was added new type of Doser "REST API"
2)New Doser is totally network-based and do not require any Jack/Outlet sockets
3)In UI Added two URL with different functions:

  • URL - link that used for dosing by schedule.
  • Calibration URL - link used for Calibration window.

Both links are working as universal template for the REST API URL where placeholders like {{ volume }} and {{ duration }} are replaced with actual values, utilizing Go's text/template package.

Currently templates support parameters:

  • Volume
  • Duration
  • Speed

Examples of URL for UI:
http://192.168.254.146/dose?volume={{.Volume}}&time={{.Duration}}
http://192.168.254.146/calibration?direction=1&rpm={{.Speed}}&time={{.Duration}}

Screenshot 2024-03-23 at 23 26 53
Screenshot 2024-03-23 at 23 26 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant