Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » OM2M » Subscriptions(How To Subscribe to GSCL resources)  () 1 Vote
Subscriptions [message #1393947] Fri, 04 July 2014 14:27 Go to next message
Prem Vaithilingam is currently offline Prem VaithilingamFriend
Messages: 4
Registered: July 2014
Junior Member
How can the Network Application subscribe to GA resources ? Is this supported in the current implementation ? Can you please share code level details.

Also, what is the use of SubscriptionController in the Router and what functionality does it provide ?
Re: Subscriptions [message #1396457 is a reply to message #1393947] Tue, 08 July 2014 10:22 Go to previous messageGo to next message
Mahdi Ben Alaya is currently offline Mahdi Ben AlayaFriend
Messages: 108
Registered: November 2013
Senior Member
Hello Prem,

OM2M implements two subscription/notification scenarios:

Scenario 1: Notify a server-capable application:
A detailed example is available on our wiki here: https://wiki.eclipse.org/OM2M/REST_API

Scenario 2: Notify a non-server-capable application by redirecting notifications to one of its container.

Let's keep working on the same example described on the first scenario.
We have the "MY_SENSOR" application with its corresponding "DATA" containers deployed on the GSCL.
Now, create on the NSCL a new application "MONITOR" with its corresponding container "NOTIFICATION".
Then, subscribe the "MONITOR/containers/NOTIFICATION/contentInstances" resource to "MY_SENSOR/containers/DATA/contentInstances" resource using the following request:

POST 127.0.0.1:8080/om2m/gscl/applications/MY_SENSOR/containers/DATA/contentInstances/subscriptions

<?xml version="1.0" encoding="UTF-8"?>
<om2m:subscription xmlns:tns="http://uri.etsi.org/m2m" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<om2m:contact>nscl/applications/MONITOR/containers/NOTIFICATION/contentInstances</om2m:contact>
</om2m:subscription>

To check this, you can create a new contentInstance event on the GSCL on "MY_SENSOR/containers/DATA/contentInstances". The new event should be automatically forwarded to to the NSCL and stored on "MONITOR/containers/NOTIFICATION/contentInstances".


The ETSI M2M specification defines a third subscription/notification based for non-server-capable application based on the long polling mechanism (Not yet implemented in OM2M).

Don't hesitate to contact us if you have any question or remark.
Re: Subscriptions [message #1403941 is a reply to message #1396457] Mon, 28 July 2014 16:25 Go to previous messageGo to next message
Mahdi Ben Alaya is currently offline Mahdi Ben AlayaFriend
Messages: 108
Registered: November 2013
Senior Member
The source code of the monitor server and more details related to the Notify resource representation are now availables on the wiki:
https://wiki.eclipse.org/OM2M/REST_API#Subscribe_to_MY_SENSOR_data

[Updated on: Mon, 28 July 2014 16:25]

Report message to a moderator

Re: Subscriptions [message #1593363 is a reply to message #1403941] Fri, 30 January 2015 15:36 Go to previous messageGo to next message
daniel ebanja is currently offline daniel ebanjaFriend
Messages: 7
Registered: November 2014
Junior Member
Hi, just wanted to get somethings clear.
The monitor server application described on the REST_API page
is a "server-capable application" right?
This does not appear in the resource tree, as it is not created on neither the NSCL nor on the GSCL.
The other type of application is the one you create on the NSCL in your response. Is this what you call scenario 2?
Re: Subscriptions [message #1597840 is a reply to message #1593363] Mon, 02 February 2015 15:46 Go to previous messageGo to next message
Mahdi Ben Alaya is currently offline Mahdi Ben AlayaFriend
Messages: 108
Registered: November 2013
Senior Member
Hello Daniel,

1) Yes, the monitor server application described on the REST_API page is a "server-capable application".
You can create an application resource for it if you want to use a specific requesting entity or to create some container sub resources.
We did not created an application resource for the monitor in the tutorial in order to make it simple.

2) Yes, the other type of application is created on the NSCL. A specific container of this applications is used as CotnactURI for the subscription.
And, this is what I called scenario 2 in my response.

Hope this can help.
Re: Subscriptions [message #1599904 is a reply to message #1597840] Tue, 03 February 2015 23:58 Go to previous messageGo to next message
daniel ebanja is currently offline daniel ebanjaFriend
Messages: 7
Registered: November 2014
Junior Member
Hi, thanks for the response. It helped me.
Somethingelse!
Just wanted to say that i think something is wrong with the setState function in the Sensor class.
First the comment "Gets SensorState" and secondly the parameter passed to the function is not used.
This function is not used as I expected in the doRetrieve method of the IpuController class.
Could it be that the method should be called "getState" with the following signature " int getState(String appId) ", with the integer returned beeing Sensor.state?
Re: Subscriptions [message #1600706 is a reply to message #1599904] Wed, 04 February 2015 12:29 Go to previous messageGo to next message
Ghada Gharbi is currently offline Ghada GharbiFriend
Messages: 4
Registered: July 2014
Junior Member
Hello,

You are right. Indeed, the "setState" method of the Sensor class is not correct.
I made the following changes on the wiki:
- In Sensor class: the setState(String appId) method was removed and replaced with the getState() that returns a random value to simulate a sensor measurement. The appId parameter is useless here.
- In Lamp class: the appId parameter is also removed from the getState(String appId) method like this: boolean getState().
- In IpuControlor class: Now, in the doRetrieve() method we get the value of the sensor from Sensor.getState(), then it is converted to an oBIX represented.

Thank you,
Ghada

[Updated on: Wed, 04 February 2015 12:43]

Report message to a moderator

Re: Subscriptions [message #1700437 is a reply to message #1600706] Thu, 02 July 2015 14:50 Go to previous messageGo to next message
Mariem CH is currently offline Mariem CHFriend
Messages: 2
Registered: July 2015
Junior Member
Hello
How can i Create a new event content instance resource under the "DATA" container?
Re: Subscriptions [message #1701261 is a reply to message #1700437] Fri, 10 July 2015 10:26 Go to previous messageGo to next message
Mahdi Ben Alaya is currently offline Mahdi Ben AlayaFriend
Messages: 108
Registered: November 2013
Senior Member
Hello Mariem,

Please check the following tutorial http://wiki.eclipse.org/OM2M/REST_API section "Create a data contentInstance"



Re: Subscriptions [message #1702412 is a reply to message #1701261] Wed, 22 July 2015 08:31 Go to previous messageGo to next message
Mariem CH is currently offline Mariem CHFriend
Messages: 2
Registered: July 2015
Junior Member
Thank you Mahdi.
Re: Subscriptions [message #1703547 is a reply to message #1702412] Mon, 03 August 2015 00:27 Go to previous message
Mahdi Ben Alaya is currently offline Mahdi Ben AlayaFriend
Messages: 108
Registered: November 2013
Senior Member
You are welcome !
Previous Topic:Porting OM2M hardware requirement
Next Topic:Usage of om2m middleware
Goto Forum:
  


Current Time: Fri Aug 28 05:18:32 GMT 2015

Powered by FUDForum. Page generated in 0.12611 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software