The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: Xlobby and xAP




Heya Steve,

On Sun, 03 Oct 2004 03:06:29 -0000, "hiller131"
<hiller131@xxxxxxx>
wrote:

>What I need now is a list of accessable fields for the received
>message. It's of the form (xAPMessageEventArgs event_args) as in all
>the examples. I know it contains the whole message and has the
>message properties but what can I access?

Oh, lots and lots of stuff. There are several ways of doing things
given the entire message. I've often done things in different ways in
different xFx-based xAPps to suit the problem.

For instance, I quite often take the generic xAPMessage object you
have received and make a strongly typed version that encapsulates the
schema I have recognised. This means I can access the message body
contents 'natively' using appropriate data types as opposed to 'raw'.

As a high-level overview, in xFx, a xAPMessage object contains a
Header and a Body. The Body contains any number of message blocks. You
can access these by name:

xAPMessage msg ...
xAPMessageBlock zone_open_block = msg.Body["Zone.Open"];

Then given that block you can retrieve the parameters you want. Is
that kind of what you meant? If not, just shout up and I'll provide
some samples and/or point you at some apps that do similar.

Here's something I do to check whether the message is addressed to me.
I've chopped out stuff to shrink it down:

protected override void MessageReceived (object sender,
xAPMessageEventArgs event_args)
{
try
{
if (event_args.Message.Header.Target != null &&
event_args.Message.Header.Target.CompareAddressTo(Heartbeat.Source))
{
}
}
catch (Exception exc)
{
}
}

HTH, for now.

S
--
Stuart Booth <stuart@xxxxxxx>
xAPFramework.NET - a xAP software development framework for .NET

http://www.xapautomation.org/ 
     http://www.xapframework.net/



xAP_Development Main Index | xAP_Development Thread Index | xAP_Development Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.