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: XPL CM12 Service


  • Subject: RE: XPL CM12 Service
  • From: John B
  • Date: Tue, 01 Apr 2003 21:51:00 +0000

Hi Tony,

> > The XPL CM12 service code is now complete - however it
> > doesn't work :-(
>
> Don't you just hate it when that happens ;-)

Yeah, and I spent hours debugging thinking it was my code at fault, until I
decided to turn it back into a Windows app, and it all started working!

> > If you try and compile it as a service, you end up with
> > strange errors at runtime, relating to the use of the
> > CM11a.ocx component.
>
> This is probably like my problems trying to use the winsock ocx in an
asp
> dll?

Very probably - I think it's a case of if it's an OCX, then forget it
unless
it's sitting on a form.

> > So as far as I can tell, the only way to go is to investigate
> > talking to the serial port directly from .NET, removing the
> > need for the cm11a ActiveX completely.
>
> This might help, but I havent tried it...
<snip>
> Receiving data from COM Port
>
> Just invoke the Rx method passing it the number of bytes you want to
read
> from COM port, then read the Rxdata property.
>
> example:
>
> moRS232.Rx(10) '// Gets 10 bytes from serial
> communication buffer
> Dim sRead as String=moRs232.RxData
>
> Please note that thread is blocked for the period of time set by
Timeout
> property and that in case the class cannot read all required bytes
from COM
> buffer a Timeout exception is raised.
> If the number of bytes to read is omitted, the class assumes 512 bytes
have
> to be read from buffer.

I came across this code during my search on the Web, however it was the
receive
routine above that gave me cause for concern.
The reception of data from the serial port needs to be entirely event
driven. We
can't have the thread blocked waiting for data, otherwise it will not
be able to do anything else (like send out XPL hbeat messages, or send X10
events in response to XPL messages).

> This is from <a href="http://66.216.11.86/cc/VBNetRs232.htm";>http://66.216.11.86/cc/VBNetRs232.htm</a>

I'll take another look - maybe it can be enhanced to be event driven.

Ever had the impression that what you thought was going to be a relatively
straight-forward project could end up being
a complete pain :-) However, IMO well worth it if we can get it going as a
service - especially if we can come up with a .NET template for XPL
serial communications stuff similar to the one TOny has now in VB6.

Regards,

John






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