X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=service%2Fthings-manager%2Fsampleapp%2Flinux%2Fconfiguration%2FFactorySetCollection.h;h=15b5f3f6b258b0a56b948991b97b73b189361041;hb=935fdb9b67b6c10d007e652e9e2e028fd6ccfe09;hp=bc20a71a78902be76dbfdbfc44fe60f5c71c457b;hpb=00b3660e45c56cb3db35dc2596a054f801b5591a;p=platform%2Fupstream%2Fiotivity.git diff --git a/service/things-manager/sampleapp/linux/configuration/FactorySetCollection.h b/service/things-manager/sampleapp/linux/configuration/FactorySetCollection.h index bc20a71..15b5f3f 100644 --- a/service/things-manager/sampleapp/linux/configuration/FactorySetCollection.h +++ b/service/things-manager/sampleapp/linux/configuration/FactorySetCollection.h @@ -34,87 +34,22 @@ using namespace OC; -typedef std::function< OCEntityHandlerResult(std::shared_ptr< OCResourceRequest > request) > ResourceEntityHandler; +typedef std::function< + OCEntityHandlerResult(std::shared_ptr< OCResourceRequest > request) > ResourceEntityHandler; -extern std::string defaultFactorySetValue; -static std::string defaultConfigurationCollectionLink = "/factorySet/oic/con"; - -static std::string defaultConfigurationURIPrefix = "/factorySet/oic/con"; -static std::string defaultConfigurationResourceTypePrefix = "factorySet.oic.con"; - -class FactorySetCollection +class FactorySetResource : public ConfigurationResource { public: - - ConfigurationCollection *defaultConfigurationCollection; - -public: - - // diagnostics members - std::string m_factorySetUri; - std::string m_factorySetValue; - std::vector< std::string > m_factorySetTypes; - std::vector< std::string > m_factorySetInterfaces; - OCResourceHandle m_factorySetHandle; - OCRepresentation m_factorySetRep; - - // Configuration members - std::string m_configurationCollectionUri; - std::string m_configurationCollectionLink; - std::vector< std::string > m_configurationCollectionTypes; - std::vector< std::string > m_configurationCollectionInterfaces; - OCResourceHandle m_configurationCollectionHandle; - OCRepresentation m_configurationCollectionRep; - -public: /// Constructor - FactorySetCollection() : - m_factorySetValue(defaultFactorySetValue), m_configurationCollectionLink( - defaultConfigurationCollectionLink) - { - m_configurationCollectionUri = "/factorySet/0/con"; // URI of the resource - m_configurationCollectionTypes.push_back("factorySet.con"); // resource type name. - m_configurationCollectionInterfaces.push_back(DEFAULT_INTERFACE); // resource interface. - - m_configurationCollectionRep.setUri(m_configurationCollectionUri); - m_configurationCollectionRep.setResourceTypes(m_configurationCollectionTypes); - m_configurationCollectionRep.setResourceInterfaces(m_configurationCollectionInterfaces); - m_configurationCollectionRep.setValue("link", m_configurationCollectionLink); - m_configurationCollectionHandle = NULL; - - m_factorySetUri = "/factorySet"; // URI of the resource - m_factorySetTypes.push_back("factorySet"); // resource type name. - m_factorySetInterfaces.push_back(DEFAULT_INTERFACE); // resource interface. - m_factorySetInterfaces.push_back(BATCH_INTERFACE); // resource interface. - m_factorySetInterfaces.push_back(LINK_INTERFACE); // resource interface. - m_factorySetRep.setValue("value", m_factorySetValue); - m_factorySetRep.setUri(m_factorySetUri); - m_factorySetRep.setResourceTypes(m_factorySetTypes); - m_factorySetRep.setResourceInterfaces(m_factorySetInterfaces); - m_factorySetHandle = NULL; - - defaultConfigurationCollection = NULL; - } - ; + FactorySetResource(); - ~FactorySetCollection() - { - if (defaultConfigurationCollection != NULL) - free(defaultConfigurationCollection); - } - ; + ~FactorySetResource(); /// This function internally calls registerResource API. void createResources(ResourceEntityHandler callback); - void setFactorySetRepresentation(OCRepresentation& rep); - void setConfigurationCollectionRepresentation(OCRepresentation& rep); - OCRepresentation getFactorySetRepresentation(); - OCRepresentation getConfigurationCollectionRepresentation(); - - std::string getFactorySetUri(); - std::string getConfigurationCollectionUri(); + std::string getUri(); };