+ public:
+
+ /**
+ * Constructor
+ */
+ CloudProp()
+ {
+ m_cloudID = "";
+ m_credID = 0;
+ }
+
+ CloudProp(const CloudProp& cloudProp) :
+ m_rep(cloudProp.toOCRepresentation()),
+ m_cloudID(cloudProp.getCloudID()),
+ m_credID(cloudProp.getCredID())
+ {
+ }
+
+ CloudProp(const CloudProp&& cloudProp) :
+ m_rep(std::move(cloudProp.toOCRepresentation())),
+ m_cloudID(cloudProp.getCloudID()),
+ m_credID(cloudProp.getCredID())
+ {
+ }
+
+ /**
+ * Constructor with OCRepresentation object. This is used for JNI communication.
+ */
+ CloudProp(const OCRepresentation &rep)
+ {
+ m_rep = rep;
+ m_cloudID = "";
+ m_credID = 0;
+ }
+
+ /**
+ * Set CoapCloudConf resource properties to be delivered to Enrollee
+ *
+ * @param authCode Auth code issued by OAuth2.0-compatible account server
+ * @param authProvider Auth provider ID
+ * @param ciServer Cloud interface server URL which an Enrollee is going to registered
+ */
+ void setCloudProp(string authCode, string authProvider, string ciServer)
+ {
+ m_rep.setValue(OC_RSRVD_ES_AUTHCODE, authCode);
+ m_rep.setValue(OC_RSRVD_ES_AUTHPROVIDER, authProvider);
+ m_rep.setValue(OC_RSRVD_ES_CISERVER, ciServer);
+ }
+
+ /**
+ * Set CoapCloudConf resource properties with Access token to be delivered to Enrollee
+ *
+ * @param accessToken Access token which is given in a return of auth code issued by
+ * OAuth2.0-compatible account server
+ * @param tokenType Access token type, i.e. "bearer"
+ * @param authProvider Auth provider ID
+ * @param ciServer Cloud interface server URL which an Enrollee is going to registered
+ *
+ * @see OAUTH_TOKENTYPE
+ */
+ void setCloudPropWithAccessToken(string accessToken, OAUTH_TOKENTYPE tokenType,
+ string authProvider, string ciServer)
+ {
+ m_rep.setValue(OC_RSRVD_ES_ACCESSTOKEN, accessToken);
+ m_rep.setValue(OC_RSRVD_ES_ACCESSTOKEN_TYPE, tokenType);
+ m_rep.setValue(OC_RSRVD_ES_AUTHPROVIDER, authProvider);
+ m_rep.setValue(OC_RSRVD_ES_CISERVER, ciServer);
+ }
+
+ /**
+ * Set CloudServer's UUID
+ *
+ * @param cloudID Cloud Interface server's UUID
+ */
+ void setCloudID(string cloudID)
+ {
+ m_cloudID = cloudID;
+ }
+
+ /**
+ * Set CloudServer's credential ID of certificate
+ *
+ * @param credID Cloud Interface server's credential ID of certificate
+ */
+ void setCredID(int credID)
+ {
+ m_credID = credID;
+ }
+
+ /**
+ * Get an auth code to be delivered.
+ *
+ * @return an auth code to be delivered.
+ */
+ std::string getAuthCode() const
+ {
+ if(m_rep.hasAttribute(OC_RSRVD_ES_AUTHCODE))
+ {
+ return m_rep.getValue<std::string>(OC_RSRVD_ES_AUTHCODE);
+ }
+ return std::string("");
+ }
+
+ /**
+ * Get an auth provider which issued an auth code
+ *
+ * @return an auth provider which issued an auth code
+ */
+ std::string getAuthProvider() const
+ {
+ if(m_rep.hasAttribute(OC_RSRVD_ES_AUTHPROVIDER))
+ {
+ return m_rep.getValue<std::string>(OC_RSRVD_ES_AUTHPROVIDER);
+ }
+ return std::string("");
+ }
+
+ /**
+ * Get a CI server to be delivered
+ *
+ * @return a CI server to be delivered
+ */
+ std::string getCiServer() const
+ {
+ if(m_rep.hasAttribute(OC_RSRVD_ES_CISERVER))
+ {
+ return m_rep.getValue<std::string>(OC_RSRVD_ES_CISERVER);
+ }
+ return std::string("");
+ }
+
+ /**
+ * Get a CI server's Uuid to be delivered
+ *
+ * @return a CI server's Uuid to be delivered
+ */
+ std::string getCloudID() const
+ {
+ return m_cloudID;
+ }
+
+ /**
+ * Get a CI server's credential ID of certificate
+ *
+ * @return a CI server's credential ID of certificated
+ */
+ int getCredID() const
+ {
+ return m_credID;
+ }
+
+ /**
+ * Get an access token to be delivered.
+ *
+ * @return an access token to be delivered.
+ */
+ std::string getAccessToken() const
+ {
+ if(m_rep.hasAttribute(OC_RSRVD_ES_ACCESSTOKEN))
+ {
+ return m_rep.getValue<std::string>(OC_RSRVD_ES_ACCESSTOKEN);
+ }
+ return std::string("");
+ }
+
+ /**
+ * Get an access token type to be delivered.
+ *
+ * @return an access token type to be delivered.
+ */
+ OAUTH_TOKENTYPE getAccessTokenType() const
+ {
+
+ if(m_rep.hasAttribute(OC_RSRVD_ES_ACCESSTOKEN_TYPE))
+ {
+ return static_cast<OAUTH_TOKENTYPE>(
+ m_rep.getValue<int>(OC_RSRVD_ES_ACCESSTOKEN_TYPE));
+ }
+ return NONE_OAUTH_TOKENTYPE;
+ }
+
+ /**
+ * Get OCRepresentation object
+ *
+ * @return OCRepresentation object
+ */
+ const OCRepresentation &toOCRepresentation() const
+ {
+ return m_rep;
+ }
+ protected:
+ OCRepresentation m_rep;
+ std::string m_cloudID;
+ int m_credID;
+ };