PDA

View Full Version : Control to iTunes from a SERIAL Port on the PC



gugi
March 13th, 2005, 02:53 AM
Hi there,

I have an AMX based home control system and I am trying to control iTunes from
a serial port. iTunes is installed on a PC and the dedicated serial port for controlling
iTunes on this PC is COM3.

I have set all the AMX stuff and verified it using a terminal window that it is working
correctly. The serial port which I want girder to listen to is as mentioined COM3.
When I press a button on the remote, a string is sent to this COM3. Play sends
the string PLAY, stop sends the string STOP and so on... I am currently usind 0d
string terminators which are stripped in the serial plugin driver in girder (but this
can be adjusted).

I am using the following plugins installed with Girder 3.3.1c
- iTunes v1.0.GML
- Generic Serial Support plugin 3.0.17 by Mark Fiechtner

The settings for COM3 in the Generic Serial Support plugin are
- 38400, 8-n-1, no handshaking
and they are the same on the controlling COM port on the AMX controller.

The Receive settings of the Serial plugin are
- enable character events
- variable length with 0d as terminator and "striip terminator" checked
- translate bin->hex is enabled too.



but I just can't get iTunes to play when I send a PLAY string over COM3,
can anyone help? Mark, are you out there?

The General Serial Support plugin is enabled for that PLAY command in the
GML File (and I am attaching my GML file).

Thanks a lot in advance!

PS: please let me know if you need any additional information

gugi
March 13th, 2005, 03:11 AM
I have tried with 9600 bauds both on the sender and receiver COM ports,
without luck. I have also exported the settings from the Gernal Serial Support
module for reference.

Thanks for any help!

gugi
March 13th, 2005, 03:15 AM
Here the settings from the Gernal Serial Support module for reference.

-- serial.ini:

[Device]
UserName=AMX
Description=AMX Axcent2 RS232 port #4
[Properties]
BaudRate=6
Handshaking=0
ParityBits=0
WordSize=4
StopBits=0
EnableScript=0
EnableScriptVal=
DisableScript=0
DisableScriptVal=
[InputMessage]
Timeout=10
TimeoutValid=0
Timeout2=1
Timeout2Valid=0
ShowEvents=0
TermVal=13
TermSize=1
TerminatorProcessing=0
PrefixProcessing=0
Length=1
Translate=0
Type=2
BufferLength=201
UseName=0
NoCharEvents=0
CharEventScript=0
CharEventScriptString=
ModemEventScript=0
ModemEventScriptString=
RawChar=0
SilentErrors=0
[OutputMessage]
Timeout=10
TimeoutValid=0
Timeout2=1
Timeout2Valid=0
ShowEvents=0
TermVal=13
TermSize=1
TerminatorProcessing=0
PrefixProcessing=0
Length=1
Translate=1
Type=1
BufferLength=201
UseName=0
NoCharEvents=0
CharEventScript=0
CharEventScriptString=
ModemEventScript=0
ModemEventScriptString=
RawChar=0
SilentErrors=0

gugi
March 13th, 2005, 04:43 AM
Forgot to mention that I already got Girder to recognize the commands
coming from the remote. When I press the buttons, the associated commands
is printed in the lower right corner of the girder window and the green girder
status LED flashes.

But nothing more happens...

Any hints?

Promixis
March 13th, 2005, 09:23 AM
Can you install the logger plugin and show us what the events coming in from the serial plugin look like?

Mark F
March 13th, 2005, 03:03 PM
You need to associate an EventString with the command you want that event string to execute. This is called "learning the event string".

Find the command that presses PLAY on iTunes. Highlight it in the tree. Press the learn event button on the right side of the Girder interface. Press the play button on the AMX. That should do it. :)

gugi
March 17th, 2005, 12:17 PM
I have done it thanks! The problem now is that each time I restart the
pc, the learned command are lost. I have saved the working GML and
I am using the same GML in the settings...

Each time I should re-learn the buttons and then girder works again!

Any hints? Mucho thanks!

Mark F
March 17th, 2005, 01:15 PM
That is weird. After you learn the event strings to the commands, you should be able to save the command tree file (the .gml) using the file menu (save entry). The next time you load that file, the event strings should still be there. After all, that is what the save command is for.

Are you SURE you are saving the file to the same place you are later loading it from? ;)

Do you have write permission for the drive/directory where you are trying to save?

gugi
March 17th, 2005, 02:53 PM
Hi Mark,

I tried one more time and it worked now fine. I haven't changed anything
though, only saved again.. I am saving the same file and I also checked
the place and directory permissions.

Do you know of a iTunes GML file which is based on the COM interface
of iTunes? It was on the original rider.nl page, now I can't find it anywhere.

Thanks, Mark, again!!

Promixis
March 17th, 2005, 03:17 PM
It should be in the download are under girder/program definitions..

gugi
March 17th, 2005, 03:34 PM
Thanks Mike!!

gugi
March 20th, 2005, 05:54 AM
Hi there again,

got that same strange situation again. Veryfied that the serial port is working
fine and receiving the text strings. This is ok, but Girder won't do anything again,
the receive icon flashes, configuration is loaded, there are events associated,
but no actions are performed by control skipping/playing tracks with iTunes...

This is getting really weird, any ideas? Where can I enable the logger module?

Thanks!

gugi
March 20th, 2005, 06:06 AM
Hi there again,

got that same strange situation again. Veryfied that the serial port is working
fine and receiving the text strings. This is ok, but Girder won't do anything again,
the receive icon flashes, configuration is loaded, there are events associated,
but no actions are performed by control skipping/playing tracks with iTunes...

This is getting really weird, any ideas? Where can I enable the logger module?

Thanks!

Mark F
March 20th, 2005, 09:10 AM
The logger is a separate plugin. Take a look in the download section of this site.

gugi
March 31st, 2005, 05:22 AM
Hi there,

I have installed the new version of the logger plugin and this is the output
of it. There are the proper strings sent but iTunes can't get under control.

Many thanks in advance for all the help!!

Mark F
March 31st, 2005, 05:38 AM
Could you .zip and post your .gml file?

gugi
March 31st, 2005, 05:49 AM
Here is the ziped .gml file. When I start girder it doesn't work unless
I relearn all events. Then it works. If I save it and then restart girder
again, it doesn't work until I re-learn the events, again, and again :-(

Thanks Mark!

Mark F
March 31st, 2005, 07:02 AM
If I learn the events and save them, I have no problem the next time I open the file. It may be your version of Girder.


I am using the following plugins installed with Girder 3.3.1c


Try upgrading to the latest Girder (3.3.8). You will probably need to learn the events one more time but they might work from then on. I am using 3.3.5, by the way.

gugi
March 31st, 2005, 08:08 AM
I have upgraded to the newest version 3.3.8 without luck - same effect
when re-learn, everything works. As soon as I quit girder and start it
again - the GML file is loaded correctly, girder receives all the commands
but doesn't command anything!! Same as before...

Is it possible that the target is set wrong? I am basically selecting the
iTunes process in the Running Tasks/Windows window and then
checking "match invisible tasks", "substring matching", "use variable"
and then "name = iTunes", "class name = iTunes",
"executable = iTunes.exe" and then clicking on apply and save GML.

gugi
March 31st, 2005, 08:34 AM
I have tried with the following GML file too, which is basically controlling
iTunes through the COM interface .. same result: learning the events and
everything is working. Quiting and starting girder again - nothing works
anymore although the GML is the same! If I re-learn then it works. I am
attaching this one second GML file.

Mark F
March 31st, 2005, 09:09 AM
I am stumped. This appears to be a Girder problem. (Ron? Mike?)

gugi
March 31st, 2005, 09:19 AM
Your help is much appreciated!!! Thanks!

Ron
March 31st, 2005, 09:22 AM
When you say 'learn events' can you specifiy EXACTLY what you are doing?

gugi
March 31st, 2005, 10:32 AM
Hi,

When I learn commands I do the following:
- click on the command, for instance "play" on the left, then
- click on "learn event" on the button in the upper right corner
left below I see a status display "waiting for IR code", then
- I press the PLAY button on the remote touchpanel which
triggers sending the string "play" terminated with $0d
through the main AMX control processor to COM3 on the
PC -- this is also seen by girder and remembered correctly.
Then girder goes out of the learning mode and the command
for "play" is learned" (and works from now on).

Next time I press PLAY on the remote, I see girder flashes
green in the lower right corner and the string "play" is being
displayed in the corner and iTunes starts playing. Same for
NEXT, PREVIOUS, etc.

All this works. Then I save the GML file and make sure that
it is the same file which gets loaded automatically each time
girder starts. It IS the same file.

Now, everything works, until I quit girder (exit in the file menu)
and restart it again. It loads the same GML file, everything looks
the same and I see girder flashing green and receiving the
commands, but it do not command iTunes anymore. All the
EventStrings on the left are there and there is actually no
changes in the config itself, only that girder do not send
commands to iTunes anymore (or iTunes is a different target
windows, etc, don't know, maybe a bug).

Now, I do not have to quit girder, I know, but this happens
when I power off the mp3 server and power it on later, girders
gets started the same way with the proper GML file, receiving
commands but not controlling anything anymore...

That it is, basically!

I have tried playing with selecting the TARGET properties of
the commands, without effect.

gugi
March 31st, 2005, 10:51 AM
Also, when I re-learn the commands, I remove all the old
EventString and do it from scratch - clicking on PLAY,
clicking on "learn event" and learn the command. This then
creates again an EventString below the "play" command.

As it should be?!

Ron
March 31st, 2005, 11:12 AM
Mark could that %0d be the problem, I can see that the XML file might loose it....

gugi
March 31st, 2005, 11:19 AM
I can reprogram the AMX controller and skip sending
the $0d for terminating the variable length string. It can
also be striped in Mark's general serial plugin in girder?

I also can try sending fixed length strings, if you say I
should try this out?

I am including the settings of the serial plugin.

Ron
March 31st, 2005, 11:20 AM
Give it a try.

gugi
March 31st, 2005, 11:28 AM
Tryed stripping the $0d terminator in Mark's serial plugin - girder do
not work at all, since the plugin do not know when the command
terminates since it is of type "variable length". I will try the other
way round - defining the command to be fixed length say 4 chars
and make the controller not send anything but PLAY, NEXT, PREV,
i.e. without the $0d for termination.

Will post result shortly...

gugi
March 31st, 2005, 12:02 PM
Ron,

Something different -

This is the GML file I am using now. I have included the ID3 plugin and
the plugin test GML, but don't know how to extract the actual info from
the currently playing track - may I ask you to show me in the GML?
I would like to see the artist/album/title on OSD when the track changes.

Thank you!

Ron
March 31st, 2005, 12:07 PM
I'll leave that question for someone else who actually used that plugin :-)

gugi
March 31st, 2005, 12:38 PM
Hi Ron,

I now tryed sending fixed lenght commands to the serial plugin and
girder now works fine, even after closing and starting again, as it
should be. So the problem is obviously in the $0d terminating string
when using variable lenght commands through the serial. Maybe it
is gernerally a good idea to fix this as the $0d technique is quite
common in device communication over serial interfaces.

Thank you all!


Greetings

Mark F
March 31st, 2005, 01:42 PM
Let the AMX send the 0d at the end of each command and have the plugin strip it. I'm sorry. I thought this was how you had the serial plugin set up originally.

:oops: My mistake.

gugi
April 1st, 2005, 03:05 AM
Thanks Mark, again!!