Tag Archives: home automation

xAP Send

xAPSendConsole.zip

xAPSend sends out pre-canned xAP messages that it can receive from either piping to it, from files, or from the command line.

disclaimer:  I’m a perl / mysql coder by trade, my vb knowledge is more “if it works, it works” so bugs / bad coding are to be expected 🙂  Let me know if there are any problems with it, or if anybody wants the source code to fix / play / make it better / etc!

requirements: It’s written / bodged in the freebie vb.net downloadable from micro$oft so I think that means it needs .net 2?  Uses the xFx Framework.

testing:  I’ve been using it now for a day or so for “xap-enabling” various bits and bobs and it seems to be working fine.  There’s not a great deal of error checking that goes on, so it’s important that the xAP messages are correctly formatted.

Usage:

***************************
myprog.exe  xapsend.exe /p

This accepts “piped” input where myprog.exe will output full “raw” xAP message(s) wrapped in <xAP></xAP> tags. In the case of multiple message, each message should be  wrapped individually in <xAP></xAP> tags.  Eitherline by line or all on one line messages can be accepted.  In the case of all on one line then “\n” should be used to signify where line breaks occur.

eg:

<xAP>
xap-header
{
v=12
hop=1
uid=FF969600
class=next.recording
source=ahs.gbpvr.ahspvr
}
next.recording
{
end=20060822164000
description=Animated adventures with Bob the Builder
title=Bob the Builder: Project Build It
duration=00:10:00
station=CBeebies
start=20060822163000
}
</xAP>

or:

<xAP>\nxap-header\n{\nv=12\nhop=1\nuid=FF969600\nclass=next.recording\nsource=ahs.gbpvr.ahspvr\n}\nnext.recording\n{\nend=20060822164000\ndescription=Animated adventures with Bob the Builder\ntitle=Bob the Builder: Project Build It\nduration=00:10:00\nstation=CBeebies\nstart=20060822163000\n}\n</xAP>\n

***************************
xapsend.exe /f:”c:\myfiles\xapmessage.xap”
xapsend.exe /f:c:\myfiles\xapmessage.xap

This will send any full “raw” xAP messages found in the file specified wrapped in  <xAP></xAP> tags.  In the case of multiple message, each message should be wrapped individually in <xAP></xAP> tags.

eg:

<xAP>
xap-header
{
v=12
hop=1
uid=FF969600
class=next.recording
source=ahs.gbpvr.ahspvr
}
next.recording
{
end=20060822164000
description=Animated adventures with Bob the Builder
title=Bob the Builder: Project Build It
duration=00:10:00
station=CBeebies
start=20060822163000
}
</xAP>
<xAP>
xap-header
{
v=12
hop=1
uid=FF969600
class=next.recording
source=ahs.gbpvr.ahspvr
}
next.recording
{
end=20060822164000
description=Animated adventures with Bob the Builder
title=Bob the Builder: Project Build It
duration=00:10:00
station=CBeebies
start=20060822163000
}
</xAP>

***************************
xapsend.exe /c:”<xAP></xAP>”
xapsend.exe /c:<xAP></xAP>

This accepts command line input of full “raw” xAP message(s) wrapped in <xAP></xAP> tags.  In the case of multiple message, each message should be wrapped individually in  <xAP></xAP> tags. “\n” should be used to signify where line breaks occur.

eg:

xapsend.exe
/c:<xAP>\nxap-header\n{\nv=12\nhop=1\nuid=FF969600\nclass=next.recording\nsource=ahs.gbpvr.ahspvr\n}\nnext.recording\n{\nend=20060822164000\ndescription=Animated
adventures with Bob the Builder\ntitle=Bob the Builder: Project Build It\nduration=00:10:00\nstation=CBeebies\nstart=20060822163000\n}\n</xAP>\n

***************************

An example usage of xAPSend is within GBPVR (http://www.gbpvr.com) using the gbpvrcli utility to send out current tuner status (current recordings/pending recordings):

"c:\program files\devnz\gbpvr\gbpvrcli.exe" /pending 4 /message
"<xAP>\nxap-header\n{{\nv=12\nhop=1\nuid=FF969600\nclass=now.recording\nsource=ahs.gbpvr.ahspvr\n}}\nnow.recording\n{{\nend={EndTime:yyyy}{EndTime:MM}{EndTime:dd}{EndTime:HH}{EndTime:mm}{EndTime:ss}\ndescription={DescriptionNoWrap}\ntitle={TitleSubtitle}\nduration={RecordingLength}\nstation={ChannelName}\nstart={StartTime:yyyy}{StartTime:MM}{StartTime:dd}{StartTime:HH}{StartTime:mm}{StartTime:ss}\n}}\n</xAP>\n" "c:\program files\xap\xapsend\xapsend.exe" /p

The above gbpvrcli command pipes up to 4 raw xAP messages containing details of scheduled recordings to xAPSend which then appear on the xAP network and are picked up by xAP Floorplan which then performs various script actions accordingly.  I run the above  command from the windows task scheduler every hour.  Seems to work ok!

Thanks for reading,

Martyn Wendon