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: Re: Developing Embedded xAP Devices



------=_NextPart_000_003A_01CA29C0.5336F250
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi K (ukusaconsulting)?



Thanks for the response.



I will have to do some work on the wild carding.



The programming language I'm using is Pascal.



Neil.







_____

From: xap_automation@xxxxxxx [mailto:xap_automation@xxxxxxx]
On Behalf Of ukusaconsulting
Sent: Sunday, 30 August 2009 8:37 PM
To: xap_automation@xxxxxxx
Subject: [xap_automation] Re: Developing Embedded xAP Devices





Sorry Neill - it looks like your original message got clogged up somewhere,
anyway here's some thoughts related to how I do this within the embedded
xAP
gateway.

--- In xap_automation@ <mailto:xap_automation%40yahoogroups.com>
yahoogroups.com, "nwemail27" <nwemail27@...> wrote:
>
> Hi All,
>
> I'm developing some hardware that I would like to make xAP compatible.
> So from an embedded perspective, what are people typically decoding in
a
xAP message.
> I.e.
> 1. Do you look for and validate the "xAP-header" line of the
message?

Yes

> 2. By the way, how many different header lines are there? I.e. I think
the
"xAP-Heartbeat" is one.

Just those two, be aware that case can vary however and some xAP messages
have a preceeding CHR(10) and some don't

> 3. Actually, what is this line called? Header of the Header :-)

Header name

> 4. What part of the header message do you normally pay attention too?

That depends on the role of your hardware. What messages do you need to
recognise and what do you respond to ? Specifically do you only listen to
certain other devices or schema, and do you only respond to messages
targeted at yourself or all messages.

> 5. Do you normally just use the UID field as an address or do you also
attempt to validate the target.

Bear in mind that in messages being sent TO another device the UID of the
recipient is not present so UID recognition can only be used for an
originating device. So the 'target' you mention above can't be validated.
You cannot send target=<UID> as that breaks wildcarding. If you can
validate
on the source address I strongly recommend you do.

I do however use UID's for identification because I am so short of memory
space and also because the HomeVision hardware that I attach to can only
hold 16 character names for its devices. Hence to support xAP devices they
are entered by UID in the HomeVision software. This is sufficient for me to
identify messages from the devices however if I want to send messages to
them (target=) then I need to use the full address. I do this (for BSC) by
a
reverse lookup type arrangement by listening for heartbeats and then
querying all the I/O on that device for the full name. This allows all
addresses to be known within one minute of startup.

> 6. What about wild cards? Do you handle them?

I fully resolve wildcards for any messages targeted at me. I do not need to
resolve wildcards for devices I am listening to because I perform no
'eavesdropping' function in my gateway. I only need to listen to messages
from other devices, not messages sent TO other devices.

> 7. What about the class field? If the address/target is correct do you
then ignore the class?

No - you definitely need to validate the class.

There's a couple of approaches here, based on what you're listening to and
what messages might be targeted at you - eg do you respond to a xAPBSC.cmd
message targeted at yourself ?

If you are tracking devices say via BSC then you can immediately filter
based on UID and class=xapbsc.event and class=xapbsc.info which is all
pretty fast as there are no wildcards. If you are eavesdropping and
therefore need to validate a target= then it could be wildcarded and
therefore I would recommend filtering on class= first as wildcarding is
more
processor intensive and requires long strings.

To validate messages targeted at you - again I would pre filter based on
class (and maybe the presence of a target line) and then if these match you
need to validate the target=line against your address. This maybe
wildcarded
of course. Wildcarding support is not essential but is strongly
recommended.

I also validate the body header but that is less necessary. One thing about
BSC is that there can be several bodies within one xapbsc.cmd message - ie
several coincident commands. The easiest way to handle this is to loop
through the bodies treating each one as a separate subsequent message with
the same xAP header.

Also bear in mind that if you are implementing BSC and supporting
xapbsc.cmd
that there is an ID= field within each body that needs to be validated
against the sub address portion of the UID. IT is effectively another part
of the wildcard matching . It is simple however in that it is either ID=*
and therefore can be ignored or it is ID=XX and will be an exact match.

>
> I know in an ideal world, we would decode and validate every response
but
in an embedded device there is only so much programming space and static
memory space.

Tell me about it :-)
UID's help substantially especially if you are implementing BSC.

I have found that the speed of embedded is well able to process xAP
messages
- indeed the PIC based xAP Netiom can process messages faster than almost
any xAP device/application I know.
When sending messages do be considerate and pace outgoing messages say
100mS
apart to avoid flooding other devices. UDP buffer space is very sparse for
embedded designs.

What language are you coding in btw ?

K

> Regards,
>
> Neil Wrightson.
> Skype : Neil_Wrightson
>




------=_NextPart_000_003A_01CA29C0.5336F250
Content-Type: text/html; charset=US-ASCII
Content-Transfer-Encoding: 7bit





<head>

<style type="text/css">
<!--

/* start of attachment style */
.ygrp-photo-title{
clear: both;
font-size: smaller;
height: 15px;
overflow: hidden;
text-align: center;
width: 75px;
}
div.ygrp-photo{
background-position: center;
background-repeat: no-repeat;
background-color: white;
border: 1px solid black;
height: 62px;
width: 62px;
}

div.photo-title
a,
div.photo-title a:active,
div.photo-title a:hover,
div.photo-title a:visited {
text-decoration: none;
}

div.attach-table div.attach-row {
clear: both;
}

div.attach-table div.attach-row div {
float: left;
/* margin: 2px;*/
}

p {
clear: both;
padding: 15px 0 3px 0;
overflow: hidden;
}

div.ygrp-file {
width: 30px;
valign: middle;
}
div.attach-table div.attach-row div div a {
text-decoration: none;
}

div.attach-table div.attach-row div div span {
font-weight: normal;
}

div.ygrp-file-title {
font-weight: bold;
}
/* end of attachment style */
-->
</style>
</head>
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40";>

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered
medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--#YGRP-MLMSG
{*font-size:small;
*font:x-small;}
#YGRP-MLMSG table
{font-size:inherit;}
#YGRP-MLMSG pre
{*font-size:100%;}
code
{*font-size:100%;}
#ygrp-mlmsg * {line-height:1.22em;}
#ygrp-vital a:hover{
text-decoration: underline;
}
#ygrp-sponsor .ad a:hover{
text-decoration: underline;
}
o{font-size: 0; }
div.photo-title a,
div.photo-title a:active,
div.photo-title a:hover,
div.photo-title a:visited {
text-decoration: none;
}
div.file-title a,
div.file-title a:active,
div.file-title a:hover,
div.file-title a:visited {
text-decoration: none;
}
#YGRP-MSG p#ATTACH-COUNT
{overflow:hidden;}

/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:blue;
text-decoration:underline;}
p
{mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman";}
code
{font-family:"Courier New";}
pre
{margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
tt
{font-family:"Courier New";}
p.ad, li.ad, div.ad
{mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman";}
p.ad1, li.ad1, div.ad1
{mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman";}
p.ad2, li.ad2, div.ad2
{mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman";}
p.ad3, li.ad3, div.ad3
{mso-margin-top-alt:auto;
margin-right:0cm;
margin-bottom:7.5pt;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman";}
p.replbq, li.replbq, div.replbq
{margin:3.0pt;
font-size:12.0pt;
font-family:"Times New Roman";}
p.ad4, li.ad4, div.ad4
{mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman";}
p.ad5, li.ad5, div.ad5
{mso-margin-top-alt:auto;
margin-right:0cm;
margin-bottom:7.5pt;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman";}
p.ad6, li.ad6, div.ad6
{mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman";}
span.yshortcuts1
{font-family:Verdana;
font-weight:bold;}
span.yshortcuts2
{font-family:Verdana;
font-weight:normal;}
span.EmailStyle34
{mso-style-type:personal-reply;
font-family:Arial;
color:navy;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
{page:Section1;}
/* List Definitions */
@list l0
{mso-list-id:1198159652;
mso-list-template-ids:-2000632674;}
@list l0:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>

<body bgcolor=white lang=EN-US link=blue vlink=blue>


<!-- **begin egp html banner** -->

<br><br>

<!-- **end egp html banner** -->




<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span
style='font-size:
10.0pt;font-family:Arial;color:navy'>Hi K
(</span></font><font size=2
face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>ukusaconsulting)</span></font><font
size=2 color=navy face=Arial><span
style='font-size:10.0pt;font-family:Arial;
color:navy'>?<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span
style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span
style='font-size:
10.0pt;font-family:Arial;color:navy'>Thanks for the
response.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span
style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span
style='font-size:
10.0pt;font-family:Arial;color:navy'>I will have to do some work on the
wild
carding.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span
style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span
style='font-size:
10.0pt;font-family:Arial;color:navy'>The programming language
I&#8217;m using
is Pascal.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span
style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span
style='font-size:
10.0pt;font-family:Arial;color:navy'>Neil.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span
style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span
style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span
style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font
size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span
style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font
size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
xap_automation@xxxxxxx [mailto:xap_automation@xxxxxxx]
<b><span
style='font-weight:bold'>On Behalf Of
</span></b>ukusaconsulting<br>
<b><span style='font-weight:bold'>Sent:</span></b>
Sunday, 30 August 2009 8:37
PM<br>
<b><span style='font-weight:bold'>To:</span></b>
xap_automation@xxxxxxx<br>
<b><span
style='font-weight:bold'>Subject:</span></b>
[xap_automation] Re:
Developing Embedded xAP
Devices</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New
Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New
Roman"><span style='font-size:
12.0pt'>&nbsp;
<o:p></o:p></span></font></p>



<div id=ygrp-mlmsg>

<div style='float:left;z-index:1' id=ygrp-msg>

<div id=ygrp-text>

<p style='margin-bottom:12.0pt'><font size=3 face="Times New
Roman"><span
style='font-size:12.0pt'>Sorry Neill - it looks like your original
message got
clogged up somewhere, anyway here's some thoughts related to how I do this
within the embedded xAP gateway.<br>
<br>
--- In <a href="mailto:xap_automation%40yahoogroups.com";>xap_automation@<wbr>yahoogroups.<wbr>com</a>,
&quot;nwemail27&quot; &lt;nwemail27@.<wbr>..&gt;
wrote:<br>
&gt;<br>
&gt; Hi All,<br>
&gt; <br>
&gt; I'm developing some hardware that I would like to make xAP
compatible.<br>
&gt; So from an embedded perspective, what are people typically
decoding in a
xAP message.<br>
&gt; I.e.<br>
&gt; 1. Do you look for and validate the &quot;xAP-header&quot;
line of the
message?<br>
<br>
Yes<br>
<br>
&gt; 2. By the way, how many different header lines are there? I.e. I
think the
&quot;xAP-Heartbeat&quot; is one.<br>
<br>
Just those two, be aware that case can vary however and some xAP messages
have
a preceeding CHR(10) and some don't<br>
<br>
&gt; 3. Actually, what is this line called? Header of the Header
:-)<br>
<br>
Header name<br>
<br>
&gt; 4. What part of the header message do you normally pay attention
too?<br>
<br>
That depends on the role of your hardware. What messages do you need to
recognise and what do you respond to ? Specifically do you only listen to
certain other devices or schema, and do you only respond to messages
targeted
at yourself or all messages.<br>
<br>
&gt; 5. Do you normally just use the UID field as an address or do you
also
attempt to validate the target.<br>
<br>
Bear in mind that in messages being sent TO another device the UID of the
recipient is not present so UID recognition can only be used for an
originating
device. So the 'target' you mention above can't be validated. You cannot
send
target=&lt;UID&gt; as that breaks wildcarding. If you can validate
on the
source address I strongly recommend you do.<br>
<br>
I do however use UID's for identification because I am so short of memory
space
and also because the HomeVision hardware that I attach to can only hold 16
character
names for its devices. Hence to support xAP devices they are entered by UID
in
the HomeVision software. This is sufficient for me to identify messages
from
the devices however if I want to send messages to them (target=) then I
need to
use the full address. I do this (for BSC) by a reverse lookup type
arrangement
by listening for heartbeats and then querying all the I/O on that device
for
the full name. This allows all addresses to be known within one minute of
startup.<br>
<br>
&gt; 6. What about wild cards? Do you handle them?<br>
<br>
I fully resolve wildcards for any messages targeted at me. I do not need to
resolve wildcards for devices I am listening to because I perform no
'eavesdropping' function in my gateway. I only need to listen to messages
from
other devices, not messages sent TO other devices.<br>
<br>
&gt; 7. What about the class field? If the address/target is correct do
you
then ignore the class?<br>
<br>
No - you definitely need to validate the class. <br>
<br>
There's a couple of approaches here, based on what you're listening to and
what
messages might be targeted at you - eg do you respond to a xAPBSC.cmd
message
targeted at yourself ?<br>
<br>
If you are tracking devices say via BSC then you can immediately filter
based
on UID and class=xapbsc.<wbr>event and class=xapbsc.<wbr>info
which is all pretty
fast as there are no wildcards. If you are eavesdropping and therefore need
to
validate a target= then it could be wildcarded and therefore I would
recommend
filtering on class= first as wildcarding is more processor intensive and
requires long strings.<br>
<br>
To validate messages targeted at you - again I would pre filter based on
class
(and maybe the presence of a target line) and then if these match you need
to
validate the target=line against your address. This maybe wildcarded of
course.
Wildcarding support is not essential but is strongly recommended.<br>
<br>
I also validate the body header but that is less necessary. One thing about
BSC
is that there can be several bodies within one xapbsc.cmd message - ie
several
coincident commands. The easiest way to handle this is to loop through the
bodies treating each one as a separate subsequent message with the same xAP
header.<br>
<br>
Also bear in mind that if you are implementing BSC and supporting
xapbsc.cmd
that there is an ID= field within each body that needs to be validated
against
the sub address portion of the UID. IT is effectively another part of the
wildcard matching . It is simple however in that it is either ID=* and
therefore can be ignored or it is ID=XX and will be an exact
match.<br>
<br>
&gt; <br>
&gt; I know in an ideal world, we would decode and validate every
response but
in an embedded device there is only so much programming space and static
memory
space.<br>
<br>
Tell me about it :-) <br>
UID's help substantially especially if you are implementing BSC.<br>
<br>
I have found that the speed of embedded is well able to process xAP
messages -
indeed the PIC based xAP Netiom can process messages faster than almost any
xAP
device/application I know. <br>
When sending messages do be considerate and pace outgoing messages say
100mS
apart to avoid flooding other devices. UDP buffer space is very sparse for
embedded designs.<br>
<br>
What language are you coding in btw ?<br>
<br>
K<br>
<br>
&gt; Regards, <br>
&gt; <br>
&gt; Neil Wrightson. <br>
&gt; Skype : Neil_Wrightson<br>
&gt;<o:p></o:p></span></font></p>

</div>






<!-- **begin egp html banner** -->

<br>



<br>

<!-- **end egp html banner** -->


<div width="1" style="color: white; clear:
both;"/>__._,_.___</div>

<!-- Start Recommendations -->
<!-- End Recommendations -->



<!-- **begin egp html banner** -->

<img src="http://geo.yahoo.com/serv?s=97476590/grpId=9674343/grpspId=1705007709/msgId=4465/stime=1251642040";
width="1" height="1"> <br>

<!-- **end egp html banner** -->


<!-- **begin egp html banner** -->

<br>
<div style="font-family: verdana; font-size: 77%; border-top: 1px
solid #666; padding: 5px 0;" >
Your email settings: Individual EmailTraditional <br>
<a href="http://groups.yahoo.com/group/xap_automation/join;_ylc=X3oDMTJmdDNjcmU3BF9TAzk3NDc2NTkwBGdycElkAzk2NzQzNDMEZ3Jwc3BJZAMxNzA1MDA3NzA5BHNlYwNmdHIEc2xrA3N0bmdzBHN0aW1lAzEyNTE2NDIwNDA-";>Change
settings via the Web</a> (Yahoo! ID required) <br>
Change settings via email: <a href="mailto:xap_automation-digest@xxxxxxx?subject=Email
Delivery: Digest">Switch delivery to Daily Digest</a>  <a
href = "mailto:xap_automation-fullfeatured@xxxxxxx?subject=Change
Delivery Format: Fully Featured">Switch to Fully Featured</a>
<br>
<a href="http://groups.yahoo.com/group/xap_automation;_ylc=X3oDMTJkNzNidGFtBF9TAzk3NDc2NTkwBGdycElkAzk2NzQzNDMEZ3Jwc3BJZAMxNzA1MDA3NzA5BHNlYwNmdHIEc2xrA2hwZgRzdGltZQMxMjUxNjQyMDQw";>
Visit Your Group
</a>
<a href="http://docs.yahoo.com/info/terms/";>
Yahoo! Groups Terms of Use
</a>
<a href="mailto:xap_automation-unsubscribe@xxxxxxx?subject=Unsubscribe";>
Unsubscribe
</a>
<br>
</div>
<br>

<!-- **end egp html banner** -->


<div style="color: white; clear:
both;"/>__,_._,___</div>
</body>



</html>
<!--End group email -->
------=_NextPart_000_003A_01CA29C0.5336F250--


xAP_Automation Main Index | xAP_Automation Thread Index | xAP_Automation 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.