Developers/Extensions
Hello fellow developers!
In the latest version of TexdroDesktop PRO, I've opened it up a bit for you guys to create some awesome user interfaces of your own!
How it works
(Note: For now on, when I say Texdro, I mean TexdroDesktop Pro.)
When Texdro is running in Extmode, it opens a local socket at TCP port 4145 and acts as a proxy between the phone app and your app. The data sent/received is XML serialized objects.
How to run Texdro in Extmode
By providing the argument "extmode" to either TexdroDesktopPro.jar or the .exe, Texdro will run in extmode.
How you execute Texdro with the "extmode" argument is up to you. You can do it programmatically when you application is started, or bundle it with your .exe.
How to establish a connection with Texdro
First of all connect to TCP port 4145 at localhost (127.0.0.1).
Before you can do anything, you'll need to identify your application by sending a PIdentify packet (more on packets later).
When Texdro receives a PIdentify packet, it checks if the provided API-key is valid by making a HTTP request.
If the API-key is valid, it notifies the user that an extension app wants access to Texdro (this only happens once for each application).
If the user accept the request your app is successfully authed, and Texdro will send a PIdentifyResponse packet to your application.
Communication
As mentioned, packets is objects serialized to XML. For example, the PIdentify packet.
Object representation (Java)
1 2 3 4 5 | public class PIdentify extends PBase{ public String apiKey; public String devEmail; public String appName; } |
Serialized into XML
1 2 3 4 5 | <PIdentify> <apiKey>[Your API-key]</apiKey> <devEmail>[Your registered email]</devEmail> <appName>[Name of your app]</appName> </PIdentify> |
I guess XML serializers is available in every programming language. Just google "[your language] + xml serialize".
In my code, every packet inherits the PBase class. PBase is actually empty and I only do this to achieve polymorphism.
For example in my send function:
1 2 3 4 | public function send(PBase packet){ String xml = XStream.toXML(packet); // Packet can be ANY packet socket.send(xml).... } |
Documentation
All packets and related classes is documented here.
If you have any opinions or need help, just contact me!
Example
I've made a quick example using C#.
You can find it here: https://github.com/henrikpersson/TexdroSharpExample
And the most important of all
Don't forget to tell me when your application is ready for use! :D