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

onUglyTxtRecord not working properly #8

Open
whiskeY11 opened this issue Nov 5, 2019 · 1 comment
Open

onUglyTxtRecord not working properly #8

whiskeY11 opened this issue Nov 5, 2019 · 1 comment

Comments

@whiskeY11
Copy link

whiskeY11 commented Nov 5, 2019

Output from log:

11-05 23:42:04.554 16464 16464 I UnityWifiDirect: device found with text record, formatted string: /v8AMABlADoAOQA2ADoAYgBmADoAZQAzADoANQBhADoAZQA4
11-05 23:42:04.554 16464 16464 I UnityWifiDirect: _/v8AZABlAG0Abw==
11-05 23:42:04.554 16464 16464 I UnityWifiDirect: ?/v8AdQBuAGkAdAB5
11-05 23:42:04.554 16464 16464 I UnityWifiDirect: _
11-05 23:42:04.555 16464 16464 I UnityWifiDirect: device found @ address 0e:96:bf:e3:5a:e8
11-05 23:42:04.596 16464 16488 I Unity : ´┐żŠÉÇŠöÇŠ┤ÇŠ╝Ç value: ´┐żšöÇŠŞÇŠĄÇšÉÇšĄÇ

Last line shows encoded txt record where the first value is the key (´┐żŠÉÇŠöÇŠ┤ÇŠ╝Ç) and second is the value. I'm pretty sure this is not how its supposed to be, but I cannot get it to work properly. Any ideas of what might be wrong?

//Edit : after modifying the plugin to show more logs I managed to get these:
11-05 23:59:59.335 17106 17106 I UnityWifiDirect: txt-rec addr: 0e:96:bf:e3:5a:e8
11-05 23:59:59.335 17106 17106 I UnityWifiDirect: txt-rec key: demo
11-05 23:59:59.335 17106 17106 I UnityWifiDirect: txt-rec value: unity

So the problem is clearly bad encoding.

@Enozone3D
Copy link

Enozone3D commented Aug 27, 2020

For anyone who comes across this issue in the future...

As you can see from the logs, the different components are logged in seperate lines, indicating the string contains CR after each string component, which are not taken into account in the decoding process. So this issue can be easily solved by removing CR from the original string, before processing through the decoder in onUglyTxtRecord method of WifiDirectBase.cs.

uglyRecord = uglyRecord.Replace("\n", "");

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

No branches or pull requests

2 participants