For more information, see Sign-in AppControl (Osp::App::APPCONTROL_SIGNIN)
The RemoteContentManager class manages the server content. The contents information for the server content can be created, read, deleted, or updated through RemoteContentInfo.
The following example demonstrates how to use the RemoteContentManager class.
// TestApp.h class UtsContentManagerListener : public IRemoteContentManagerListener { public: UtsContentManagerListener() {} ~UtsContentManagerListener() {} virtual void OnContentInfoReceivedN(RequestId reqId, RemoteContentInfo* pRemoteContentInfo, result r, const Osp::Base::String& errorCode, const Osp::Base::String& errorMessage); virtual void OnContentCreated(RequestId reqId, const Osp::Base::String& contentId, result r, const Osp::Base::String& errorCode, const Osp::Base::String& errorMessage); virtual void OnContentDeleted(RequestId reqId, result r, const Osp::Base::String& errorCode, const Osp::Base::String& errorMessage); virtual void OnContentStatusReceived(RequestId reqId, RemoteContentStatus contentStatus, result r, const Osp::Base::String& errorCode, const Osp::Base::String& errorMessage); virtual void OnContentUpdated(RequestId reqId, result r, const Osp::Base::String& errorCode, const Osp::Base::String& errorMessage); }; // TestApp.cpp void UtsContentManagerListener::OnContentInfoReceivedN(RequestId reqId, RemoteContentInfo* pRemoteContentInfo, result r, const Osp::Base::String& errorCode, const Osp::Base::String& errorMessage) { // Do something } void UtsContentManagerListener::OnContentCreated(RequestId reqId, const Osp::Base::String& contentId, result r, const Osp::Base::String& errorCode, const Osp::Base::String& errorMessage) { // Do something } void UtsContentManagerListener::OnContentDeleted(RequestId reqId, result r, const Osp::Base::String& errorCode, const Osp::Base::String& errorMessage) { // Do something } void UtsContentManagerListener::OnContentStatusReceived(RequestId reqId, RemoteContentStatus contentStatus, result r, const Osp::Base::String& errorCode, const Osp::Base::String& errorMessage) { // Do something } void UtsContentManagerListener::OnContentUpdated(RequestId reqId, result r, const Osp::Base::String& errorCode, const Osp::Base::String& errorMessage) { // Do something } result MyClass::TestRemoteContentManager() { RemoteContentManager remoteContentManager; RemoteContentInfo remoteContentInfo; UtsContentManagerListener managerListener; Osp::Base::String contentId; RequestId reqId; result r = E_SUCCESS; r = remoteContentManager.Construct(managerListener); TryReturn(!IsFailed(r), r, "Construct failed."); Osp::Base::Utility::Uri uri; uri.SetPath(L"Image.jpg"); r = remoteContentInfo.Construct(L"Image", uri, 12345); TryReturn(!IsFailed(r), r, "Construct failed."); r = remoteContentInfo.SetContentName(L"UTcGetContentInfoP01"); TryReturn(!IsFailed(r), r, "SetContentName failed."); r = remoteContentInfo.SetKeyword(L"lee, kyeong, woo"); TryReturn(!IsFailed(r), r, "SetKeyword failed."); // Creates r = remoteContentManager.CreateContent(remoteContentInfo, reqId); TryReturn(!IsFailed(r), r, "CreateContent failed."); // The result will be returned to UtsContentManagerListener::OnContentCreated(). // The result is the content ID. // Gets r = remoteContentManager.GetContentInfo(contentId, reqId); TryReturn(!IsFailed(r), r, "GetContentInfo failed."); // The result will be returned to UtsContentManagerListener::OnContentInfoReceivedN(). // The result is an instance of RemoteContentInfo. // Updates r = remoteContentInfo.SetContentName(L"sample code"); TryReturn(!IsFailed(r), r, "SetContentName failed."); r = remoteContentInfo.SetKeyword(L"lee, kyeong, woo, hi"); TryReturn(!IsFailed(r), r, "SetKeyword failed."); r = remoteContentInfo.SetProvider(L"smybag"); TryReturn(!IsFailed(r), r, "SetProvider failed."); r = remoteContentManager.UpdateContent(remoteContentInfo, reqId); TryReturn(!IsFailed(r), r, "UpdateContent failed."); // The result is returned to UtsContentManagerListener::OnContentUpdated(). // Checks the contents status r = remoteContentManager.GetContentStatus(contentId, reqId); TryReturn(!IsFailed(r), r, "GetContentStatus failed."); // The result is returned to UtsContentManagerListener::OnContentStatusReceived(). // Delete r = remoteContentManager.DeleteContent(contentId, reqId); TryReturn(!IsFailed(r), r, "DeleteContent failed."); // The result is returned to UtsContentManagerListener::OnContentDeleted(). return r; }
Public Member Functions | |
result | Construct (const IRemoteContentManagerListener &listener) |
result | CreateContent (const RemoteContentInfo &remoteContentInfo, RequestId &reqId) |
result | DeleteContent (const Osp::Base::String &serverContentId, RequestId &reqId) |
result | GetContentInfo (const Osp::Base::String &serverContentId, RequestId &reqId) const |
result | GetContentStatus (const Osp::Base::String &serverContentId, RequestId &reqId) |
RemoteContentManager (void) | |
result | UpdateContent (const RemoteContentInfo &remoteContentInfo, RequestId &reqId) |
virtual | ~RemoteContentManager (void) |
Osp::Content::RemoteContentManager::RemoteContentManager | ( | void | ) |
This is the default constructor for this class.
virtual Osp::Content::RemoteContentManager::~RemoteContentManager | ( | void | ) | [virtual] |
This is the destructor for this class.
result Osp::Content::RemoteContentManager::Construct | ( | const IRemoteContentManagerListener & | listener | ) |
Initializes this instance of RemoteContentManager with the specified listener of type IRemoteContentManagerListener.
[in] | listener | A reference to IRemoteContentManagerListener |
E_SUCCESS | The method is successful. |
E_OUT_OF_MEMORY | The memory is insufficient. |
result Osp::Content::RemoteContentManager::CreateContent | ( | const RemoteContentInfo & | remoteContentInfo, |
RequestId & | reqId | ||
) |
Creates the content.
[in] | remoteContentInfo | A reference to the RemoteContentInfo instance |
[out] | reqId | The request ID |
E_SUCCESS | The method is successful. |
E_INVALID_STATE | This instance has not been constructed as yet. |
E_INVALID_ARG | A specified input parameter is invalid. |
E_OUT_OF_MEMORY | The memory is insufficient. |
E_PRIVILEGE_DENIED | The application does not have the privilege to call this method. |
result Osp::Content::RemoteContentManager::DeleteContent | ( | const Osp::Base::String & | serverContentId, |
RequestId & | reqId | ||
) |
Deletes the contents.
[in] | serverContentId | The server content ID |
[out] | reqId | The request ID |
E_SUCCESS | The method is successful. |
E_INVALID_STATE | This instance has not been constructed as yet. |
E_INVALID_ARG | A specified input parameter is invalid. |
E_OUT_OF_MEMORY | The memory is insufficient. |
E_PRIVILEGE_DENIED | The application does not have the privilege to call this method. |
result Osp::Content::RemoteContentManager::GetContentInfo | ( | const Osp::Base::String & | serverContentId, |
RequestId & | reqId | ||
) | const |
Gets the information of the content.
[in] | serverContentId | The server content ID |
[out] | reqId | The request ID |
E_SUCCESS | The method is successful. |
E_INVALID_STATE | This instance has not been constructed as yet. |
E_INVALID_ARG | A specified input parameter is invalid. |
E_OUT_OF_MEMORY | The memory is insufficient. |
E_PRIVILEGE_DENIED | The application does not have the privilege to call this method. |
result Osp::Content::RemoteContentManager::GetContentStatus | ( | const Osp::Base::String & | serverContentId, |
RequestId & | reqId | ||
) |
Gets the contents status.
[in] | serverContentId | The server contents ID |
[out] | reqId | The request ID |
E_SUCCESS | The method is successful. |
E_INVALID_STATE | This instance has not been constructed as yet. |
E_INVALID_ARG | A specified input parameter is invalid. |
E_OUT_OF_MEMORY | The memory is insufficient. |
E_PRIVILEGE_DENIED | The application does not have the privilege to call this method. |
result Osp::Content::RemoteContentManager::UpdateContent | ( | const RemoteContentInfo & | remoteContentInfo, |
RequestId & | reqId | ||
) |
Updates the content.
[in] | remoteContentInfo | A reference to the RemoteContentInfo instance |
[out] | reqId | The request ID |
E_SUCCESS | The method is successful. |
E_INVALID_STATE | This instance has not been constructed as yet. |
E_INVALID_ARG | A specified input parameter is invalid. |
E_OUT_OF_MEMORY | The memory is insufficient. |
E_PRIVILEGE_DENIED | The application does not have the privilege to call this method. |