------------------------------------------------------------------------
A poll associated with this post was created, to vote and see the
results, please visit http://forums.slimdevices.com/showthread.php?t=79524
------------------------------------------------------------------------
Question: Are you interested in IR-over-IP?
    
- Yes, I'd like to have IRoIP.
- No, I don't care.
------------------------------------------------------------------------

Dextrosan;575005 Wrote: 
> Well the way I do it is that I use the lua socket to connect to the
> receiver to its IP address on port 80 and then I send the contents of
> an xml file with the command itself. Yamaha provides an excel file,
> that can generate any function as an xml for you. This way you can
> control every thinkable feature of the receiver. For the testing
> purposes I have used an xml file for each command I issue, but I
> believe, that this could be solved more elegantly (like putting all the
> commands in one file and then just read the needed command and send it).
> The code below is quite simple but it works.
> 
> I have also attached the MuteOn.xml file so you can see how the
> commands look - this particular command mutes the "Zone2" of the
> receiver (Of course that it is also possible to issue commands to read
> information from the receiver, like the volume level, if a feature is
> on or off etc.).
> 
> > 
Code:
--------------------
  >   > 
  > -- What I need for my function
  > local socket                = require("socket.core")
  > local io                = require("io")
  > .
  > .
  > .
  > -- Call the function (in the test applet from a button)
  > TestIt('MuteOn.xml')
  > .
  > .
  > .
  > 
  > function TestIt(self, OnOff)
  > log:info("TestIt is running")
  > 
  > -- Set the input file (I am testing on squeezeplay so it's a local file)
  > io.input("C:/Program Files 
(x86)/Squeezebox/SqueezePlay/lua/applets/Doomsnight/" .. OnOff)
  > 
  > -- Read the whole contents of the file to a string
  > local YamahaCommand = io.read("*all")
  > log:info(YamahaCommand)
  > 
  > -- Create a tcp socket to the receiver IP on port 80 and send the command
  > local xml = socket.tcp()
  >     xml:connect("192.168.1.100", "80")
  >     xml:send(YamahaCommand)
  >     xml:close()
  > end 
  > 
--------------------
> > 

OK, I think this will be relatively straightforward (in principle).  My
idea would be to create a new SqueezeIR protocol (called eg tcp).  I
think it would be easiest to have each command in a seperate file and
put the filename into the existing SqueezeIR.xml file as
<command><value> values, otherwise SqueezeIR would have to parse the
xml and extract each command which would be tough.  The ip and port
could be placed in <parameters> and the remote's protocol set as "tcp".
So far so good.  There would need to be a tcpToNative() function called
from ProtocolToNative() that would read the file into SqueezeIR. 
Problem here is that this would be asynchronous so might need callbacks
:(.  The next step would be for StartTimer() and TimerCallback() to run
your code to send the http request instead of ir (using os.execute)
depending on the protocol name. 

The bad news is that currently SqueezeIR doesn't keep the protocol name
once it has converted everything to the Native format so some work would
be needed there.  A better option would be to have an ir/tcp flag for
each protocol to avoid having the protocol name hard-coded.  Again some
work would be needed there.  I don't think it will be beyond the realm
of the possible to implement your code but you'll have to wait until
I've got my system working again (waiting for some bits from eBay).


-- 
indifference_engine
------------------------------------------------------------------------
indifference_engine's Profile: 
http://forums.slimdevices.com/member.php?userid=20698
View this thread: http://forums.slimdevices.com/showthread.php?t=79524

_______________________________________________
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to