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

consolidate API-like interfaces #2131

Open
tolot27 opened this issue May 17, 2022 · 3 comments
Open

consolidate API-like interfaces #2131

tolot27 opened this issue May 17, 2022 · 3 comments
Labels
code:quality code and repository related sync related to share and sync data

Comments

@tolot27
Copy link
Collaborator

tolot27 commented May 17, 2022

So from what I can tell, we have several API-like interfaces in Xdrip atm:


  1. SendXdripBroadcast class - sends intent bundles from VehicleMode.java and BroadcastGlucose.java to another app, including things like collector status, glucose values, noise level, battery level, etc.
    "Identify receiver" field supports multiple package names separated by spaces.
    image

  1. NSClientReceiver class - handles incoming intents. Supports 3 different actions, corresponding to the first 3 ON/OFF switches in the photo.
    ExternalStatusBroadcastReceiver class - Allows external apps to set the status line string via intent (4th switch in photo). It also acts as an (unofficial) way to send xDrip the temp-basal rate (xDrip attempts to parse it from the string).
    image

  1. XdripWebService - HTTP(s) server with different modules for interactions with various devices.
    This constructor method appears to enumerate the implemented urls/modules
    Examples:
  • Desert Sync (see "xDrip+ Sync settings")
  • Glucose values and treatments
  • HR monitor
  • Tasker
  • Libre2

image


I'll offer to rework/streamline the preferences hierarchy so they're all more user-friendly, but if we can consolidate down to one "intent broadcast" service, that would be much less chaotic.

Originally posted by @Lupum1001 in #2004 (comment)

@tolot27 tolot27 added sync related to share and sync data code:quality code and repository related labels May 17, 2022
@tolot27
Copy link
Collaborator Author

tolot27 commented May 17, 2022

I'll offer to rework/streamline the preferences hierarchy so they're all more user-friendly, but if we can consolidate down to one "intent broadcast" service, that would be much less chaotic.

@Lupum1001 Thanks for investigating this. Having a centralized API would be a great step forward. We will discuss this further in our internal dev group before we proceed here.

@tolot27
Copy link
Collaborator Author

tolot27 commented May 24, 2022

We should start writing unit tests for a potential new API. These tests can be generalized from the existing APIs and can help verify the implementation of #2004.

@SimonPhilpott
Copy link

It would need a review too. Endpoints that have been in place for a while only semi work.
E.g. this works.
http://127.0.0.1:17580/tasker/snooze
But this doesn't
http://127.0.0.1:17580/tasker/restart%20collector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code:quality code and repository related sync related to share and sync data
Projects
None yet
Development

No branches or pull requests

2 participants