device module parse function

Begonnen von Guest, 06 Juni 2010, 00:00:54

Vorheriges Thema - Nächstes Thema

Guest

Originally posted by: <email address deleted>

Hi guys,
I'm already back with some questions:
I was looking into the device modules such as the simple dummy, the weather
and the X10.

The parse function that is present in the modules which reads data from the
serial,
it takes 2 arguments the hash and the message.
How this 2 arguments are passed to the object and filtered from the USB
serial?

If I don't want to use the serial interface directly, like the weather
module what is the best way of doing it?
The modules for Os4HA are being written in python,C\C++  and we have a jsp
service.
My actual worry is not the webservice that can be implemented as the weather
but rather the local communication.

Thanks in advance.

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

rudolfkoenig

                                                   

> How this 2 arguments are passed to the object and filtered from the USB
> serial?

Could you please elaborate on that? -> I dont get the question :)


> The modules for Os4HA are being written in python,C\C++  and we have a jsp
> service.

What is a "jsp service" ?


> My actual worry is not the webservice

...it would be mine after 5 years of webservice experience, as everybody is
compatible only with its own webservice. At least think twice before trying to
use SOAP::Lite, else you will have to guess a lot of Perl magic.


> but rather the local communication.

Either offer a server port (see 01_FHEMWEB.pm/FW_Read() for an example), or
connect as client to the server. Put your instance $hash (in which FD is the
socket filedescriptor) into the global %selectlist, and your ReadFn will be
called with your $hash if there is network data.
This is the way you go even if you use webservice.

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

Guest

Originally posted by: <email address deleted>

Oky for the first question, if I draw a little ASCII diagram

|||| A device |||<----\/\/\/\/----> | USB |-----[/dev/ttyUSB0]<----->|
serial.pl   FHEM |------ Perl module

Which module is passing the incoming stream from the device to the
appropriate per module?
I have found that for example 00_CUL.pm read and write USB data, but also
other modules.
I was trying to browse the Wiki but I cannot find a sort of class diagram
description, that's why I got confused.

For the second one, my mistake I was referring to AJAX Comet and there's
another developer working on that.

My actual worry, I was meaning my actual focus and yes I'm not a webservice
expert. RESPECT RUDOLF!
I'm using JSON to "objectify" sensor networks and mongodb to store JSON
objects and classes derived from the physical sensors.

I will probably go for the second option, to connect the client to the
server but I need to study some more.

You guys have done a lot of QUALITY job, it's a very nice project!

On 6 June 2010 07:34, Rudolf Koenig wrote:

> > How this 2 arguments are passed to the object and filtered from the USB
> > serial?
>
> Could you please elaborate on that? -> I dont get the question :)
>
>

>
> > The modules for Os4HA are being written in python,C\C++  and we have a
> jsp
> > service.
>
> What is a "jsp service" ?
>
>
> > My actual worry is not the webservice
>
> ...it would be mine after 5 years of webservice experience, as everybody is
> compatible only with its own webservice. At least think twice before trying
> to
> use SOAP::Lite, else you will have to guess a lot of Perl magic.
>
>
> > but rather the local communication.
>
> Either offer a server port (see 01_FHEMWEB.pm/FW_Read() for an example), or
> connect as client to the server. Put your instance $hash (in which FD is
> the
> socket filedescriptor) into the global %selectlist, and your ReadFn will be
> called with your $hash if there is network data.
> This is the way you go even if you use webservice.
>
> --
> Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM
> users beigetreten sind.
> Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine
> E-Mail an fhem-users@googlegroups.com.
> Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an
> fhem-users+unsubscribe@googlegroups.com
> .
> Besuchen Sie die Gruppe unter
> http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu
> erhalten.
>
>

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

rudolfkoenig

                                                   

> Which module is passing the incoming stream from the device to the
> appropriate per module?

For Unix (Linux/OSX) a serial device is like a network connection: the FD entry
of the device hash contains the USB filedescriptor, the $hash ist entered into
the global %selectlist, and the ReadFn function of the module is notified, if
there is some data from the USB.

Windows only supports select for network connections (the first network stack
was the BSD one, this is why Windows still has a select call), we have to poll:
the module inserts its $hash into the global %readyfnlist, and the ReadyFn
function of the module will be called periodically.


> I was trying to browse the Wiki but I cannot find a sort of class diagram
> description, that's why I got confused.

The module opens the device in its DefineFn function, puts the filedescriptor
into the selectlist/readyfnlist, and the readfn is called if there is data.
Note: ReadFn may be called many times until a message is complete.  Some
modules (X10/CUL/FHZ) call the Dispatch function after they received a message.
This function will search for the appropriate logical module (e.g.  FS20/FHT),
and call the modules ParseFn with the message. With the answer string or array
Dispatch triggers the notify chain.

Now you draw a class diagram for the Wiki :)

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.