write to the server

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

write to the server

Henry
Hello.

I need to put some data to my server with a owserver proto by
the OWNet module from owfs client and use the data by server
applications.

Is it possible to use fake|tester memory device for it?
If it possible, so I would like to owwrite a data to the fake
memory device and owread the data on a localhost.

By another world, I need to make transfer some data from a client
to the owserver and read it on the owserver host for other apps.

Can you give me a direction?

Thanks.

--

== Henry Pootel ==

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: write to the server

Jan Kandziora
Am 08.10.2016 um 12:06 schrieb Henry Pootel:
>
> By another world, I need to make transfer some data from a client
> to the owserver and read it on the owserver host for other apps.
>
You have to employ the "external" mechanism. First, update to 3.1p1
or newer as "external" was heavily broken before it. Then see this

        http://owfs.org/index.php?page=external-sensor-design

Example
=======
In my setups, I want to control GPIOs on a Raspberry Pi through
owserver, along with accessing some ownewire sensors connected to
the Pi through a DS2482.

My /etc/owfs.conf reads as this:
---------------------------------------------------------------------
i2c=/dev/i2c-1:ALL
external
SENSOR: "mysensor@$(hostname)", "myfamily", "myname", "myparameters",
SCRIPT: "indicator",    "myfamily", y, 1, v, /opt/ow/bin/owgpio, /opt/ow/bin/owgpio, "gpio4", "unused",
SCRIPT: "switch0",      "myfamily", y, 1, v, /opt/ow/bin/owgpio, /opt/ow/bin/owgpio, "gpio17", "unused",
SCRIPT: "switch1",      "myfamily", y, 1, v, /opt/ow/bin/owgpio, /opt/ow/bin/owgpio, "gpio18", "unused",
---------------------------------------------------------------------

Obviously, the "i2c=/dev/i2c-1:ALL" line is for the local onewire
sensors. Below "external", things get interesting.


SENSOR: defines a single "sensor" within the onewire network.

First parameter is a unique id of that "sensor". As I have multiple
Pis in my setup, I included the hostname there to keep the name
unique.

Second parameter is the "sensor" family, that is, which "chip type"
it has. As you may have multiple "sensor"s of that type.

Third parameter is a name or comment which isn't used by owfs but
only displayed at some places.

Fourth parameter are additional parameters passed to the access
programs when that specific sensor is accessed. It can be used have
the same family scripts access different underlying devices
depending on the "sensor". Typically, a filename, device node name,
or some enumerator is placed here


SCRIPT: defines an access script for a single property within all
"sensor"s of a family.

First parameter is the property name as displayed in the owfs
directories.

Second parameter is the family ("chip type") that line belongs to.

Third parameter is the type of the property. In my case, "yes-no"
(boolean).

Fourth parameter is the array type of the property. In my case,
scalar (single value).

Fifth parameter is the cache policy, Should be v for volatile for
parameters which my change without owserver may notice, and s for
stable for things which usually stay as written by owserver. It is
debateable whether write-only properties should be "v" at all.

Sixth and seventh parameter is a program or script called when the
property is accessed. More on this below.

Eighth parameter is a parameter passed to the script.

Ninth parameter is (IIRC, can't find the documentatuion) an alias
associated with the property.


And now my magic /opt/ow/bin/owgpio:
---------------------------------------------------------------------
#!/bin/sh
RW=$4
GPIO=$8

case "$RW" in
        read)  cat /sys/class/gpio/$GPIO/value ;;
        write) cat >/sys/class/gpio/$GPIO/value ;;
esac
---------------------------------------------------------------------
Simple, isn't it?


Feel free to ask if you have more questions.

Kind regards

        Jan

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: write to the server

Henry

Thank you very much.  I'll try it!

Henry Pootel

На 8 окт 2016 г., в 13:56, Jan Kandziora <[hidden email]> написал:п
Am 08.10.2016 um 12:06 schrieb Henry Pootel:

By another world, I need to make transfer some data from a client
to the owserver and read it on the owserver host for other apps.

You have to employ the "external" mechanism. First, update to 3.1p1
or newer as "external" was heavily broken before it. Then see this

http://owfs.org/index.php?page=external-sensor-design

Example
=======
In my setups, I want to control GPIOs on a Raspberry Pi through
owserver, along with accessing some ownewire sensors connected to
the Pi through a DS2482.

My /etc/owfs.conf reads as this:


i2c=/dev/i2c-1:ALL
external
SENSOR: "mysensor@$(hostname)", "myfamily", "myname", "myparameters",
SCRIPT: "indicator", "myfamily", y, 1, v, /opt/ow/bin/owgpio, /opt/ow/bin/owgpio, "gpio4", "unused",
SCRIPT: "switch0", "myfamily", y, 1, v, /opt/ow/bin/owgpio, /opt/ow/bin/owgpio, "gpio17", "unused",
SCRIPT: "switch1", "myfamily", y, 1, v, /opt/ow/bin/owgpio, /opt/ow/bin/owgpio, "gpio18", "unused",



Obviously, the "i2c=/dev/i2c-1:ALL" line is for the local onewire
sensors. Below "external", things get interesting.


SENSOR: defines a single "sensor" within the onewire network.

First parameter is a unique id of that "sensor". As I have multiple
Pis in my setup, I included the hostname there to keep the name
unique.

Second parameter is the "sensor" family, that is, which "chip type"
it has. As you may have multiple "sensor"s of that type.

Third parameter is a name or comment which isn't used by owfs but
only displayed at some places.

Fourth parameter are additional parameters passed to the access
programs when that specific sensor is accessed. It can be used have
the same family scripts access different underlying devices
depending on the "sensor". Typically, a filename, device node name,
or some enumerator is placed here


SCRIPT: defines an access script for a single property within all
"sensor"s of a family.

First parameter is the property name as displayed in the owfs
directories.

Second parameter is the family ("chip type") that line belongs to.

Third parameter is the type of the property. In my case, "yes-no"
(boolean).

Fourth parameter is the array type of the property. In my case,
scalar (single value).

Fifth parameter is the cache policy, Should be v for volatile for
parameters which my change without owserver may notice, and s for
stable for things which usually stay as written by owserver. It is
debateable whether write-only properties should be "v" at all.

Sixth and seventh parameter is a program or script called when the
property is accessed. More on this below.

Eighth parameter is a parameter passed to the script.

Ninth parameter is (IIRC, can't find the documentatuion) an alias
associated with the property.


And now my magic /opt/ow/bin/owgpio:


#!/bin/sh
RW=$4
GPIO=$8

case "$RW" in
read) cat /sys/class/gpio/$GPIO/value ;;
write) cat >/sys/class/gpio/$GPIO/value ;;
esac


Simple, isn't it?


Feel free to ask if you have more questions.

Kind regards

Jan



Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot


Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers