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

Automatically set cardboard profile in script #8

Closed
cai-mobfish opened this issue Apr 9, 2020 · 14 comments · Fixed by #32
Closed

Automatically set cardboard profile in script #8

cai-mobfish opened this issue Apr 9, 2020 · 14 comments · Fixed by #32
Assignees
Labels
help wanted Extra attention is needed
Milestone

Comments

@cai-mobfish
Copy link
Contributor

Detail

Some end users/clients want to manually set cardboard profile so that this app can be directly used in exhibition show or showcase meeting.

Technical Detail

Old Cardboard Overview

In old Cardboard, cardboard profile can be manually set using "half decoded" cardbaord url.
But it only sets the default cardboard profile. Once user changed a cardboard profile manually, this won't work any longer, until manually set data are removed.

Old Cardboard urls

This is url redirect chain. No. 2 url can be used to set default profile in script. No. 0, 1, 4 cannot be used. No. 3 is not tested.

Old Cardboard clear data

  • Android: clear "Google VR Service" app data, this will clear manually set cardboard profile.
  • iOS: factory reset. I didn't find any other way to remove cardboard profile.

New Cardboard Overview

The camera scan method can be directly called for camera qr code scan, but there is no "set profile" in written document, so hack is probably necessary to make it work, if google doesn't provide any related apis in future.

@cai-mobfish cai-mobfish added the help wanted Extra attention is needed label Apr 9, 2020
@rohantipare rohantipare self-assigned this Apr 29, 2020
@rohantipare
Copy link
Collaborator

@cai-mobfish
I was able to load a device parameters through the url from Unity.
URL: "https://arvr.google.com/cardboard/download/?p=Cgxtb2JmaXNoIEdtYkgSElZJU0lUIFBMQVlFUjM2MC5ERR2ZuxY9JbbzfT0qEAAASEIAAEhCAABIQgAASEJYADUpXA89OgiCc4Y-MCqJPlAAYAA"

Please check the screenshots and let me know if the parameters loaded are right:
fullsizeoutput_19
fullsizeoutput_18

@cai-mobfish
Copy link
Contributor Author

Yes, the name is correct at least.

It seems that the url is changed. But it doesn't matter, any kind of url will do. Is that just default cardboard profile? or will it override current cardboard profile?

@rohantipare
Copy link
Collaborator

For now it loads the default profile at start, hence overrides the saved profile. I am working on loading the default profile only when there is no saved profile.

@cai-mobfish
Copy link
Contributor Author

Thanks. If possible, provide both possibilities, one is set default profile, another is set current profile.

@rohantipare
Copy link
Collaborator

Will do that. Thanks.

@rohantipare
Copy link
Collaborator

@cai-mobfish
The implementation is complete. Function to load device parameters from URL is 'LoadDeviceParametersFromURL' in 'CardboardQrCode.cs'.

I have created provision to load default device parameters (in 'CardboardMainCamera.cs') when one is not available.
Changes are pushed to branch 'DeviceProfileFromURL'.

@cai-mobfish
Copy link
Contributor Author

@rohantipare Thanks for the implementation. I have yet tested on my side, but I have a question:

I noticed that you added a header file directly in Plugin folder, which already exist in Cardboard SDK. How does it work without implementation file in Unity?

@rohantipare
Copy link
Collaborator

rohantipare commented Apr 30, 2020

@cai-mobfish
I did not found a way to make the 'device_param_helper.h' accessible to the utility native file. It fails to build if that file is not included. I am looking for the solution.

@cai-mobfish
Copy link
Contributor Author

@rohantipare I see. I didn't mean it's not good, it's just a question. It's fine if it works with Build. I'll do some test later today.

@cai-mobfish
Copy link
Contributor Author

@rohantipare I just checked your code and tested, code works. And I have some additional questions:

  • I noticed libsdk.a is modified, please post here which file and what code have changed?
  • I noticed that set this kind of url parameters also works offline, and the paramater in the url is the base64 text of protocol-buffer-encoded parameter. Is the full url needed?
  • If I have a short link like this "https://goo.gl/tcRG0r", is it also able to decode with Internet?

And please do these changes:

  • Merge from public-dev, I did some change today, added feature vr and no-vr camera.
  • With this change, I think the part of logic "scan camera when profile unavailable" will no longer needed. I also noticed that there is a method in object-c, saveCardboardV1Params. It seems that when I skip the camera scan when no profile available, cardboard sdk will set a default value, can we also use that when profile is not available? If not, we should extract default cardboard v1 parameter and do on our own, please post the default cardboard v1 url here if this is the case.
  • Invoke("LoadDefaultProfile", 1f); I noticed you write this. Try to load default profile without any coroutine or delay method. Also, put them in CardboardQrCode. If it's really impossible, please explain here why and leave this part to me if it can be solved in unity c# code.

@rohantipare
Copy link
Collaborator

@cai-mobfish
1: 'libsdk.a' - I was trying to expose the 'device_param_helper.h' file in the libsdk.a to make it accessible for the native code, but it didnt work. I will reset it previous version.
2: 'short url' - It should work with short url. I will confirm it. The Failure case needs to be handled in case of connectivity issues.
3: 'cardboard v1' - I will look into it.
4: Invoke("LoadDefaultProfile", 1f) - I was not able to call this function from Awake or Start, as not all callbacks/listeners for 'parameter change'; would be listening. This leads to incomplete execution of device parameter updation.

@rohantipare
Copy link
Collaborator

@cai-mobfish
I have pushed the merged branch of 'ParmetersFromURL'
I have tested the short URL, it works.

@rohantipare
Copy link
Collaborator

@cai-mobfish
I have found the URL for cardboard v1 parameters.
http://g.co/cardboard

@cai-mobfish
Copy link
Contributor Author

I did some refactor and modification in new branch, and merged into public-dev.

Default cardboard profile will be set when app is initially started. Change profile in script can be done in any time, and will overwrite current profile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants