IPU Lamp Sample Plugin [message #1705303] |
Thu, 13 August 2015 11:29  |
Eclipse User |
|
|
|
Hello,
I'm interesting about IPU LAMP sample plugin. Currently, when we switched on or off a lamp, it creates a new Content Instance resource in Data/contentInstances/ with the new state. I would like to update the Content instance resource instead of creating a new one.
Do you think that it simple to change the lamp state management ?
I've take a look in the controller class and i saw that the doUpdate method is not implemented, i tried to implement it but i don't understand how does it work. Did I have to act on /gscl/applications/LAMP_0/lamps/true resource or on gscl/applications/LAMP_0/containers/DATA/contentInstances/CI_xxxxxxxxx resource ?
Could you give me more explanations about the way to take for doing that ?
Thank you !
Bests.
|
|
|
Re: IPU Lamp Sample Plugin [message #1705502 is a reply to message #1705303] |
Mon, 17 August 2015 04:44  |
Eclipse User |
|
|
|
Hello,
Concerning the update of a ContentInstance resource, this operation is not planned by the SmartM2M specifications. The content instance shall be created, retrieved or deleted. This resource represents an instance of data at a precise moment. The normal behavior is to create a new content instance every time your state or whatever data changes. (This allows to keep an historic of the state changes for example.)
Also, if you want only one content instance at the same time in the container, what you can do is set the max number of content instances to 1 and the platform will automatically delete the old content instance and store the new one.
Finally, to retrieve this content instance, you can use the following uri « gscl/applications/LAMP_0/containers/DATA/contentInstances/latest »
to retrieve the latest content stored in the DATA container without knowing its id.
I hope this will help you understand this process.
Regards,
Guillaume
|
|
|
Powered by
FUDForum. Page generated in 0.03448 seconds