louis49 / androidtv-remote

MIT License
68 stars 23 forks source link

Need Help #10

Closed piyush2greedy closed 2 years ago

piyush2greedy commented 2 years ago

Hey @louis49

Really need ur help. I want to integrate Android TV Remote in Android and IOS App using React Native. I have given all my energy to it. Can u please help me guide how to achieve the same.

Any sort of guidance from u would be helpful.

louis49 commented 2 years ago

First, you need to fork my work and adapt the socket layer with this package or an other that do the same things : https://www.npmjs.com/package/react-native-tcp-socket Then, with this fork, adapt protobuf layer with this example : https://medium.com/@singhandresh09/using-protobuf-in-react-native-7cc8286389f5

piyush2greedy commented 2 years ago

Thanks @louis49. Working on it.

piyush2greedy commented 2 years ago

@louis49 Should i convert the pairingmessage.proto and remotemessage.proto in JS files using protoc compiler and use for message passing.

piyush2greedy commented 2 years ago

@louis49 Thanks. Was able to solve the .proto thing using google-protobuf.

I used the react-native-tcp-socket as suggested Now i am stuck at TLS connection between client and server. Below is the screenshot attached.

Screen Shot 2022-01-29 at 5 12 02 PM
piyush2greedy commented 2 years ago

@louis49 The issue is that in PairingManager.js in this.client.on('data') function, the data coming is not satisfying thhe if condition. this.chunks.length > 0 && this.chunks.readInt8(0) === this.chunks.length - 1.

Due to which Pairing code is not coming on TV

@louis49 Can u please help me solve the same.

louis49 commented 2 years ago

For .proto files you can transform them in pure json : https://github.com/protobufjs/protobuf.js/#using-json-descriptors

piyush2greedy commented 2 years ago

@louis49 Proto thing is solved by transforming in pure json. The last thing in which i am stuck is

The issue is that in PairingManager.js in this.client.on('data') function, the data coming is not satisfying thhe if condition. this.chunks.length > 0 && this.chunks.readInt8(0) === this.chunks.length - 1.

Due to which Pairing code is not coming on TV

@louis49 With ur guidance almost achieved the end goal. the above issue is creating a issue

piyush2greedy commented 2 years ago

@louis49 Can u please help on above issue mentioned

louis49 commented 2 years ago

This line means that we are waiting enough data to analyze the received frame : the first byte say how many byte we are waiting. What’s the size of the chunk you receive ?

piyush2greedy commented 2 years ago

@louis49 We just receive this much data {"data": [21, 3, 1, 0, 2, 2, 70], "type": "Buffer"} and after that no data. We only get this 7 bits of data.

No Idea why its happening. Can u please help

Want to share an observation. After deeply analysing, I saw that object var options = { key: this.certs.key, cert: this.certs.cert, port: this.port, host: this.host, rejectUnauthorized: false, }

we pass in TcpSocket.createConnection is same as we pass in tls.connect.

Connection option in react-native-tcp-socket does not have key and cert .export ConnectionOptions = { port: number; host?: string | undefined; timeout?: number | undefined; localAddress?: string | undefined; localPort?: number | undefined; interface?: "wifi" | "cellular" | "ethernet" | undefined; reuseAddress?: boolean | undefined; tls?: boolean | undefined; tlsCheckValidity?: boolean | undefined; tlsCert?: any; };

louis49 commented 2 years ago

To go more deep in that problem I need to observe it : can you publish your code ?

piyush2cloud commented 2 years ago

Yes Sure @louis49. U must have got the invite email. Can u please confirm? I have published the code there. Thanks Again @louis49

Github Repo Link

In the meantime, Any idea which part of the code should i look to get it fixed.

SodaSurfer commented 2 years ago

Hi @piyush2cloud I'm also trying to implement this on iOS if you want to team up on this or share some insights. what's your email or Skype so I can contact you?

piyush2cloud commented 2 years ago

Hi @SodaSurfer

Sure. U can join me on below skype link.

https://join.skype.com/invite/w3bZKQNQ3GpY

piyush2cloud commented 2 years ago

Yes Sure @louis49. U must have got the invite email. Can u please confirm? I have published the code there. Thanks Again @louis49

Github Repo Link

In the meantime, Any idea which part of the code should i look to get it fixed.

@louis49 Can u also tell what timezone u r based of

piyush2cloud commented 2 years ago

Yes Sure @louis49. U must have got the invite email. Can u please confirm? I have published the code there. Thanks Again @louis49 Github Repo Link In the meantime, Any idea which part of the code should i look to get it fixed.

@louis49 Can u also tell what timezone u r based of

@louis49 Did u got some bandwidth to check

louis49 commented 2 years ago

I’m in UTC+1 but i’ve a real life too : let me fews days to analyze it

piyush2cloud commented 2 years ago

I’m in UTC+1 but i’ve a real life too : let me fews days to analyze it

Sorry @louis49. Actually i was stuck in it and ur inputs were really helpful. I was really getting frustated on this part and with no option just messaged u. Sorry Again @louis49.

louis49 commented 2 years ago

HI! I watched your code but I didn't succeeded to run it on my Mac M1 : cocoa pods config seems not well configured for it