DrmInfoEvent.h revision 2272ee27d9022d173b6eab45c409b3c3f57f30ec
1/* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#ifndef __DRM_INFO_EVENT_H__ 18#define __DRM_INFO_EVENT_H__ 19 20namespace android { 21 22class String8; 23 24/** 25 * This is an entity class which would be passed to caller in 26 * DrmManagerClient::OnInfoListener::onInfo(const DrmInfoEvent&). 27 */ 28class DrmInfoEvent { 29public: 30 /** 31 * The following constant values should be in sync with DrmInfoEvent.java 32 */ 33 //! TYPE_ALREADY_REGISTERED_BY_ANOTHER_ACCOUNT, when registration has been 34 //! already done by another account ID. 35 static const int TYPE_ALREADY_REGISTERED_BY_ANOTHER_ACCOUNT = 1; 36 //! TYPE_REMOVE_RIGHTS, when the rights needs to be removed completely. 37 static const int TYPE_REMOVE_RIGHTS = 2; 38 //! TYPE_RIGHTS_INSTALLED, when the rights are downloaded and installed ok. 39 static const int TYPE_RIGHTS_INSTALLED = 3; 40 //! TYPE_WAIT_FOR_RIGHTS, rights object is on it's way to phone, 41 //! wait before calling checkRights again 42 static const int TYPE_WAIT_FOR_RIGHTS = 4; 43 //! TYPE_ACCOUNT_ALREADY_REGISTERED, when registration has been 44 //! already done for the given account. 45 static const int TYPE_ACCOUNT_ALREADY_REGISTERED = 5; 46 47 /** 48 * The following constant values should be in sync with DrmErrorEvent.java 49 */ 50 //! TYPE_RIGHTS_NOT_INSTALLED, when something went wrong installing the rights 51 static const int TYPE_RIGHTS_NOT_INSTALLED = 2001; 52 //! TYPE_RIGHTS_RENEWAL_NOT_ALLOWED, when the server rejects renewal of rights 53 static const int TYPE_RIGHTS_RENEWAL_NOT_ALLOWED = 2002; 54 //! TYPE_NOT_SUPPORTED, when answer from server can not be handled by the native agent 55 static const int TYPE_NOT_SUPPORTED = 2003; 56 //! TYPE_OUT_OF_MEMORY, when memory allocation fail during renewal. 57 //! Can in the future perhaps be used to trigger garbage collector 58 static const int TYPE_OUT_OF_MEMORY = 2004; 59 //! TYPE_NO_INTERNET_CONNECTION, when the Internet connection is missing and no attempt 60 //! can be made to renew rights 61 static const int TYPE_NO_INTERNET_CONNECTION = 2005; 62 //! TYPE_REGISTRATION_FAILED, when registration with server failed. 63 static const int TYPE_REGISTRATION_FAILED = 2006; 64 65public: 66 /** 67 * Constructor for DrmInfoEvent 68 * 69 * @param[in] uniqueId Unique session identifier 70 * @param[in] infoType Type of information 71 * @param[in] message Message description 72 */ 73 DrmInfoEvent(int uniqueId, int infoType, const String8& message); 74 75 /** 76 * Destructor for DrmInfoEvent 77 */ 78 virtual ~DrmInfoEvent() {} 79 80public: 81 /** 82 * Returns the Unique Id associated with this instance 83 * 84 * @return Unique Id 85 */ 86 int getUniqueId() const; 87 88 /** 89 * Returns the Type of information associated with this object 90 * 91 * @return Type of information 92 */ 93 int getType() const; 94 95 /** 96 * Returns the message description associated with this object 97 * 98 * @return Message description 99 */ 100 const String8& getMessage() const; 101 102private: 103 int mUniqueId; 104 int mInfoType; 105 const String8& mMessage; 106}; 107 108}; 109 110#endif /* __DRM_INFO_EVENT_H__ */ 111 112