Hi Jihun,

I think, Class Diagram snap shot will help us understood.

Anyway, I have a two questions On step6.
   allOffScene->execute() looks like more OOP style. Anyway, Is there any
benefit for ?newSceneCollection->executeScene("AllOff")?
   After post request action, SceneCollectionObject will aggregate the
execution result?
   After Setp5, Can we open this scene execution to the remote device? If
yes can you propose the API or code snippet for scene execution?

BR, Uze Choi

From: iotivity-dev-boun...@lists.iotivity.org [mailto:iotivity-dev-
bounces at lists.iotivity.org] On Behalf Of ???
Sent: Thursday, January 07, 2016 3:53 PM
To: iotivity-dev at lists.iotivity.org
Subject: [dev] [Scene Manager] Share a way how to form a Scene Collection
resource



Hi. 



Previously, I shared a brief introduction of a new service, Scene Manager,
which I'm currently working on. 

Now, I'm going to tell you more detailed flows in forming a Scene
Collection resource from the perspective of developers.



As I mentioned before, there are two scene-releated resources except
SceneList resource: SceneCollection resource and SceneMember resource. 

And steps which developers have to follow are like below:

 - Create SceneCollection Resource

 - (Discover desired resources in a network)

 - Add SceneMember resource to SceneCollection resource

 - Add Scene to SceneCollection resource

 - Set SceneMapping information to SceneMember resource



Additionally, I've introduced two classes to manage these resources so that
developers can easily add and update a set of attribute values to these
resources for scene management by exploiting these class's methods:

    SceneCollectionObject class - SceneCollection resource

    SceneMemberObject class - SceneMember resource



Example:

1. Create SceneCollection resource

 - We create a new SceneCollection resource, which has a human-friendly
name, "AllBulbs"


SceneCollectionObject * newSceneCollection = SceneManager-
>createSceneCollectionObject("AllBulbs");



2. Discovery resources in a network (It is not covered by Scene Manager)

 - Resource Encapsulation provides a Discovery Manager service to discover
resources easily.


RCSDiscoveryManager->discoverResourceByType(MULTICAST, "core.light",
&onResourceDiscovered);

...

void onResourceDiscovered(std::shared_ptr<RCSRemoteResourceObject>
discoveredResource)

{

   // add scene member

}



3. Add SceneMember resource to SceneCollection resource

 - Once a light resource is discovered, we need to add it to
SceneCollection resource as SceneMember resource




void onResourceDiscovered(std::shared_ptr<RCSRemoteResourceObject>
discoveredResource)

{

    SceneMemberObject *newSceneMember = newSceneCollection-
>addSceneMember(discoveredResource);

}



4. Add Scene to SceneCollection resource

 - After adding several SceneMember resources(light resources in this
example) to SceneCollection resource,

   We add a scene, e.g., "AllOff", to SceneCollection resource


 Scene *allOffScene = newSceneCollection->addScene("AllOff");



5. Set SceneMapping information to SceneMember resource

 - After defining a new scene, e.g. "AllOff", in SceneCollection resource, 

   we need to describe a detailed information for scene execution to each
SceneMember resource


// setSceneMappingItem(scene, attribute_key, attribute_value);

newSceneMember->setSceneMappingItem(allOffScene, "power", false);



6. Execute the scene

 - Now, we provide an API to execute a scene to SceneCollection resource
which is locally hosted. Note that later, I will share a way how to execute
a scene to other SceneCollection resource which has been discovered in a
network before (By sending a POST request)


Two ways:

 newSceneCollection->executeScene("AllOff");

or

 allOffScene->execute();



After then, all discoverd light resources are going to turn off immediately.



Again, I want to hear your opinions for this design and implementation. 

So please feel free to share your comments with me if you have.



?????. ??? ??.



Best Regards,



Jihun Ha (???/???, Ph.D.)

IoT, IoTivity, OIC | IoT Lab

Software R&D Center | Samsung Electronics Co., Ltd

Mobile +82 10 2533 7947 

jihun.ha at samsung.com | jhha85 at gmail.com 

-------------- next part --------------
HTML ?????? ??????????????...
URL: 
<http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20160107/20666648/attachment.html>

Reply via email to