I did a little work on this very task a couple of years ago, but never
had the time to carry it to completion, so I can give you a few pointers.
Firstly, the best source for the messages exchanged are the files in
libplayerinterface/interfaces/. Each file defines a separate interface.
You can parse them fairly easily to produce binary encoders/decoders in
Erlang. The initial handshake can be found in the TCP code, after that
it's all interface messages. The first ones to be sent will be on
interface #1, the Player interface.
While there are a couple of XDR implementations floating around as parts
of other projects, XDR is trivial to implement in Erlang thanks to its
binaries, so it might be easiest to write your own so you can set up an
interface more suitable to your needs. The only verbose part is the
basic data types.
Regarding the client-side API itself, there were two approaches I
considered, one of which leads into the other:
1. Treat a Player server as a process with an Erlang-style RPC
interface. The RPC API hides the server location, as it should.
2. Treat each device as a process, with an Erlang-style RPC interface.
This method is more flexible, more scalable, and can be combined with
option 1 easily.
On 05/05/11 04:36, G.S. wrote:
> Hello Developers,
> Preface: I've began using Player/Stage a while back for simulations. The
> problem is that I'm developing control programs using the Erlang
> programming language. There is an interface from Erlang to libplayerc
> called Kerl, which is what I'm using. To make the interface simpler, and
> due to the Erlang's excellent ability to parse binaries, I'm starting a
> new project of writing a player client side in pure Erlang. Thus the TCP
> msgs would be parsed, received, and sent by an Erlang process.
> Question: Is using the player.h, libplayerxdr and wireshark the best
> way to figure out the encoding of the TCP msgs exchanged by Player
> server and client? or is there a particular set of documentation you
> guys can point me towards?
> Thanks in advance for any information that you people can provide, I
> will be putting this project on github.