PDA

View Full Version : Replacement of GIP



kimagure
December 8th, 2015, 03:05 PM
Hi

I'm beginning my migration from Girder 5 to Girder 6 (linux).

I'm struggling with one of my lua scripts that was using the "Generic Internet Protocol plugin" (gip).

It's used to control my Pioneer Receiver through Telnet/TCP commands.
Sending commands is not an issue, but I was using the socket:Callback feature to get all information sent from the receiver to girder, especially feedback from actions done directly on the hardware controles (volume jog, buttons).

I suppose I must rewrite my code based on luasocket.
How can I simulate the "callback" feature of gip, i.e. get all incoming data from the receiver not necessarily following a command sent from lua to the device ?

K.

Ron
December 8th, 2015, 03:19 PM
You'll find the transport classes to mirror the old gip code closer. Check the manual. Also there is a simple transport plugin that might do what you need.

kimagure
December 8th, 2015, 03:45 PM
Ok, thanks. I'll check these classes.

kimagure
December 8th, 2015, 04:28 PM
I just made a quick test of the Simple Transport plugin, and this works great ! I'm able to send commands and feedback is captured correctly.

If I want to keep information in a table about the device state, I suppose this should be done in the "Data Parser" part ?
Can I call any function in this "data parser" block, especially complex functions defined elsewhere (or loaded from an external lua file) ?

Ron
December 8th, 2015, 05:30 PM
Great!

Yes the data parser is where you'd do that. You can call any function available to Lua from there.

kimagure
December 12th, 2015, 07:50 AM
Another question : I can now run an action on a Simple Transport device from the Action tree (in my case, power receiver on, set volume or select input)

Can these predefined or custom actions be triggered through a lua script ? Can I send an arbitrary string as a custom action to the device in a lua script ?

Thanks

K.

kimagure
December 14th, 2015, 02:30 AM
I think I found the answer to my question http://www.promixis.com/forums/showthread.php?22097-Simple-transport-plugin-Import-from-WEB-only-2-devices&p=152107#post152107

Quoting Ron's message below :

Certainly. You'll need to transport ID, on my machine it's "{29810f4c-f89c-4183-a2a8-5f8d0c042624}" and if you open the predefined commands in the transport edit dialog you'll find the ID for the action. Power On is "{89a2fd0c-aadb-40c6-b815-5fd26a40956b}"


simpleTransport.sendPredefined("{29810f4c-f89c-4183-a2a8-5f8d0c042624}","{89a2fd0c-aadb-40c6-b815-5fd26a40956b}")

or if you want to work without predefined actions


simpleTransport.sendData("{29810f4c-f89c-4183-a2a8-5f8d0c042624}","ka 00 01\n")


An additional question though : are the plugin instance ID and command ID dependant on the girder installation or is it a GUID generated at creation time only ? If I want to move my script to another machine running girder 6, do I have to update the ID in my scripts ?

Ron
December 14th, 2015, 06:19 AM
GUID of the commands is generated when you create the commands and should stay fixed. GUID's of the transports are created when you create the transport or import and existing one. So instead of using the literal string use a variable so you can change if you need to.



myTransport = "{29810f4c-f89c-4183-a2a8-5f8d0c042624}"
simpleTransport.sendData(myTransport,"ka 00 01\n")