Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mihini-dev] Greenhouse Demo access via m3da using the java api

Hi Benjamin

Demo works again, thanks for that.

I'm a bit confused, how does the rest api retrieves the data? I thought it gets it through the m3da interface?

At the moment I just want to try out the m3da interface, REST is to easy :-) (by the way, why are there multiple entries for the values in the json response?)

How would I retrieve it via the M3DA java api, can you make a simple example?

What happens if somebody pulls the plug on the arduino? Is there any indication within the values that the underlying connection is lost?



best regards
Jürgen


On 23.07.2013 16:20, Benjamin Cabé wrote:
Hey Jürgen!

Sorry the demo was stuck indeed, I just restarted it.

The mihini app is indeed pushing M3DA tcp messages to m2m.eclipse.org on
port 44900, using an efficient serialization model and stuff. But, as
opposed to MQTT, M3DA is not really a publish/subscribe protocol which
means that for reading the data of a given client, you'll usually want to
use a different API, in our case we have a REST API on
http://m2m.eclipse.org/m3da for doing this.
The details on how to interact with the greenhouse (get data / send
commands) via this very API are available on
http://wiki.eclipse.org/Machine-to-Machine/M2MIWG/Demonstrator#REST_API
(which is actually *the* page where you're supposed to find all the doc, Š
I guess it wouldn't hurt to reference it from the m2m.eclipse.org web page
:) )

Please let me know if you need more info, I'd be happy to help!

Benjamin--






Le 23/07/13 16:14, « Jürgen Rose » <juergen.rose@xxxxxxxxxxxxxxx> a écrit :

Hi,

I want to try to access the greenhouse demo via m3da. I actually have no
idea how.

By the way, if you look at
http://m2m.eclipse.org/portalTest/webapp/app/#/devices/RPI000000006f257df2
,
the values seem to be stuck, all dates are not changing from July 23rd
00:35:29

Ok, just to explain what I tried:

As far as I understand, there is a M3DA server running on
m2m.eclipse.org at port 44900

This is the same server which is the base for the web GUI, correct?

What I try to do, is to get the greenhouse temperature.

There I'm starting to become confused, the java client doesn't offer any
way to subscribe to a tag.

Is it then always request/response driven? So I would have to poll for
value changes?

I tried something like this:

public class Application
{
     public static void main ( final String[] args ) throws Exception
     {
         final M3daTcpClient client = new M3daTcpClient (
"m2m.eclipse.org", 44900, "openscada.org#1" );
         client.connect ();
         final M3daBodyMessage[] x = client.sendEnvelope (
createMessages () );
         System.out.println ( x );
         System.out.println ( x.length );
         client.close ();
     }

     private static M3daMessage[] createMessages ()
     {
         final Map<Object, Object> map = new HashMap<> ();
         map.put ( "A1", "ON" );
         return new M3daMessage[] { new M3daMessage ( "greenhouse",
Math.abs ( new Random ().nextLong () ), map ) };
     }
}

This maybe total nonsense but I just dont find any documentation for the
greenhouse demo, even the source code parts I managed to find, seem
incomplete to me.

What is the path?

What is the name of the tags?

Is there a way to query/browse the server for existing tags?



Best regards
Jürgen

--
IBH SYSTEMS GmbH
D 85235 Pfaffenhofen an der Glonn
Läutenring 43
Geschäftsführer / CEO: Dr. Thomas Heitzig

Amtsgericht München
Handelsregister Nummer  HRB 197959
USt ID: DE267945175

Office Munich
D 80992 München
Agnes-Pockels-Bogen 1
T +49 89 18 9 17 49 0

The information transmitted is intended only for the person or entity
to which it is addressed and may contain confidential and/or pivileged
material. Any review, retransmission, dissemination or other use of,
or taking of any action in reliance upon, this information by persons
or entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender and delete the
material from any computer.

_______________________________________________
mihini-dev mailing list
mihini-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/mihini-dev

_______________________________________________
mihini-dev mailing list
mihini-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/mihini-dev


--
IBH SYSTEMS GmbH
D 85235 Pfaffenhofen an der Glonn
Läutenring 43
Geschäftsführer / CEO: Dr. Thomas Heitzig

Amtsgericht München
Handelsregister Nummer  HRB 197959
USt ID: DE267945175

Office Munich
D 80992 München
Agnes-Pockels-Bogen 1
T +49 89 18 9 17 49 0

The information transmitted is intended only for the person or entity
to which it is addressed and may contain confidential and/or pivileged
material. Any review, retransmission, dissemination or other use of,
or taking of any action in reliance upon, this information by persons
or entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender and delete the
material from any computer.



Back to the top