Hi Jihoon,
I added my comments inlined. Thank you. Jay. From: iotivity-dev-boun...@lists.iotivity.org [mailto:iotivity-dev- bounces at lists.iotivity.org] On Behalf Of ???(Uze Choi) Sent: Friday, January 08, 2016 1:46 PM To: jihun.ha at samsung.com; iotivity-dev at lists.iotivity.org Subject: Re: [dev] [Scene Manager] Share a way how to form a Scene Collection resource Hi Jihun, Rather than providing two options, I recommend to use(select) a single API to achieve a specific purpose. Regarding the API selection between them please think about the each class role coverage by considering how much level of operation this API will be engaged and what result this API report back as return or callback. When we think about the remote client call for this collection resource with ?resource->POST(rep, QueryParamsMap(), &onPost)?, onPost will return some result I guess, you need to align this sequence regardless of internal call or remote client call. Please design the remote resource call by POST with resource encapsulation API, and align the your API design (newSceneCollection- >executeScene("AllOff") or allOffScene->execute(),) into there. BR, Uze Choi From: ??? [mailto:jihun...@samsung.com] Sent: Friday, January 08, 2016 10:56 AM To: ???; iotivity-dev at lists.iotivity.org <mailto:iotivity- dev at lists.iotivity.org> Subject: Re: RE: [dev] [Scene Manager] Share a way how to form a Scene Collection resource Hi Uze, Please find my comment below: 1. allOffScene->execute() looks like more OOP style. Anyway, Is there any benefit for ?newSceneCollection->executeScene("AllOff")? [JH] It might depend on developers' preferences. Some developers may want to hold only a pointer of SceneCollectionObject class and easily execute multiple scenes with a name of scenes (string type). In this case, they don't need to hold all Scene class instances indivisully. 2. After post request action, SceneCollectionObject will aggregate the execution result? [JH] At this time, I think SceneCollectionObject won't make an aggregated response. The reason is that sending a response after receiving a POST request is fully up to a server, not a client. That means, a client hosting SceneCollection resource can not guarantee all terminal resource servers would give response back, in turn, the client can not aggreagate a response. [JH] However, the client hosing SceneCollection resource can send a response to a requester which is kind of confirmation that the request of scene execution has been received successfuly at the client. Because, it can be handled by our SceneCollectionObject class. 3. 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? [JH] After forming a SceneCollection resource, it is one of OIC resources which can be discovered in a network as a normal OIC resource. So users can discover the SceneCollection resource with a dedicated resource type of "oic.wk.scenecollection" and send a POST request to the discovered resource to update an "listSceneName" attribute value. For example, using RI API // Find a SceneCollection resource in a network OCPlatform::findResource("", "/oic/res?rt=oic.wk.scenecollection", CT_DEFAULT, &foundResource); // On discovered the resource void foundResource(std::shared_ptr<OCResource> resource) { OCRepresentation rep; // suppose that "AllOff" is one of scenes supported by the discovered SceneCollection resource rep.setValue("lastSceneName", "AllOff") resource->POST(rep, QueryParamsMap(), &onPost); } [JH] At this time, I've not thought an API to discover a SceneCollection resource by Scene Manager class. So later, I will let you know that if the API is made. Thank you for your valuable comments BR, Jihun Ha. ------- Original Message ------- Sender : ???<uzchoi at samsung.com <mailto:uzchoi at samsung.com> > S6(??)/??/IoT Lab(S/W??)/???? Date : 2016-01-07 17:32 (GMT+09:00) Title : RE: [dev] [Scene Manager] Share a way how to form a Scene Collection resource 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> [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 <mailto: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. [Jay] Before we start with discussing about the manager of the?Scene?type of resource, I think we may discuss about the common requirements and APIs for the ?Collection? resources. And then make them reusable(inherit, adapt or whatever if useful) for utilizing the?Scene Collection types...? In this way, we (or anyone) could utilize collection resource not only for ?Scene Collection? but also any other Collections for lots of brilliant applications. (Are we replacing the previous GroupManager or making new type of Manager??) 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); [Jay] What is the ?power? stands for? Is it ?A attribute name of specific type of resource??. Share us more information. Personally, it would be better to design this API to receive these information to make more clear & general.. newSceneMember->setSeneMappingItem(allOffScene, ?resource type name?, ?attributes name?, ?target value?); 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 ?????. ??? ?????. ?????. ??? ??. 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 -------------- An HTML attachment was scrubbed... URL: <http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20160108/c94040ae/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.gif Type: image/gif Size: 13168 bytes Desc: not available URL: <http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20160108/c94040ae/attachment.gif>