Skip to content

HttpClientWrapper to use switch between using Java Http and Ok Http for android#335

Open
kalynstricklin wants to merge 11 commits into
opensensorhub:masterfrom
kalynstricklin:http-client-wrapper
Open

HttpClientWrapper to use switch between using Java Http and Ok Http for android#335
kalynstricklin wants to merge 11 commits into
opensensorhub:masterfrom
kalynstricklin:http-client-wrapper

Conversation

@kalynstricklin
Copy link
Copy Markdown

  • Added httpclientwrapper to use java or okhttp during runtime based on httpclient availability
  • Added oauth
  • Added register system datastreams to update existing datastreams instead of creating new ones

@kalynstricklin kalynstricklin marked this pull request as draft February 18, 2026 20:39
@kalynstricklin kalynstricklin marked this pull request as ready for review February 19, 2026 21:52
import org.sensorhub.impl.service.consys.client.ConSysApiClientConfig;
import org.sensorhub.impl.service.consys.resource.ResourceFormat;

public interface IHttpClient
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably make this more generic for a range of uses. For example, a driver could use this to send GET requests for sensor data and be compatible with Android by default. It also may be a good idea to have the client API and implementation live in sensorhub-core, but I'm not 100% sure

We cannot guarantee that the foi id on the local observations are the same as the ones registered on the remote node
@kalynstricklin
Copy link
Copy Markdown
Author

@earocorn Can you leave input on the foi id additions

@earocorn
Copy link
Copy Markdown

This re-adds logic to use FOI IDs that are created on the remote node, since we can't guarantee that both nodes use the same ID encoders / encoding mechanism (db vs no db).

Copy link
Copy Markdown
Member

@alexrobin alexrobin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the approach for allowing different IHttpClient implementations. However, this new code would break some existing functionality so please try to address my comments to avoid this. Thx, good job!

- changed text case of DataStream to match
- Updated getDataStreams to return all dataStreams without systemId argument and added unit test
- Added ITokenHandler interface and implemented it with Nick's OAuthTokenHandler
- Removed client config from builder and added builder code back with changes to auth
@alexrobin
Copy link
Copy Markdown
Member

@kalynstricklin Sorry but I cannot merge this until it is fully backward compatible with the previous version because it is used in production. Please address the remaining comments

@kalynstricklin kalynstricklin requested a review from earocorn April 1, 2026 20:06
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.

3 participants