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 20 namespace android { 21 22 class String8; 23 24 /** 25 * This is an entity class which would be passed to caller in 26 * DrmManagerClient::OnInfoListener::onInfo(const DrmInfoEvent&). 27 */ 28 class DrmInfoEvent { 29 public: 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 //! TYPE_RIGHTS_REMOVED, when the rights has been removed. 47 static const int TYPE_RIGHTS_REMOVED = 6; 48 49 /** 50 * The following constant values should be in sync with DrmErrorEvent.java 51 */ 52 //! TYPE_RIGHTS_NOT_INSTALLED, when something went wrong installing the rights 53 static const int TYPE_RIGHTS_NOT_INSTALLED = 2001; 54 //! TYPE_RIGHTS_RENEWAL_NOT_ALLOWED, when the server rejects renewal of rights 55 static const int TYPE_RIGHTS_RENEWAL_NOT_ALLOWED = 2002; 56 //! TYPE_NOT_SUPPORTED, when answer from server can not be handled by the native agent 57 static const int TYPE_NOT_SUPPORTED = 2003; 58 //! TYPE_OUT_OF_MEMORY, when memory allocation fail during renewal. 59 //! Can in the future perhaps be used to trigger garbage collector 60 static const int TYPE_OUT_OF_MEMORY = 2004; 61 //! TYPE_NO_INTERNET_CONNECTION, when the Internet connection is missing and no attempt 62 //! can be made to renew rights 63 static const int TYPE_NO_INTERNET_CONNECTION = 2005; 64 //! TYPE_PROCESS_DRM_INFO_FAILED, when failed to process DrmInfo. 65 static const int TYPE_PROCESS_DRM_INFO_FAILED = 2006; 66 //! TYPE_REMOVE_ALL_RIGHTS_FAILED, when failed to remove all the rights objects 67 //! associated with all DRM schemes. 68 static const int TYPE_REMOVE_ALL_RIGHTS_FAILED = 2007; 69 //! TYPE_ACQUIRE_DRM_INFO_FAILED, when failed to acquire DrmInfo. 70 static const int TYPE_ACQUIRE_DRM_INFO_FAILED = 2008; 71 72 public: 73 /** 74 * Constructor for DrmInfoEvent 75 * 76 * @param[in] uniqueId Unique session identifier 77 * @param[in] infoType Type of information 78 * @param[in] message Message description 79 */ 80 DrmInfoEvent(int uniqueId, int infoType, const String8& message); 81 82 /** 83 * Destructor for DrmInfoEvent 84 */ ~DrmInfoEvent()85 virtual ~DrmInfoEvent() {} 86 87 public: 88 /** 89 * Returns the Unique Id associated with this instance 90 * 91 * @return Unique Id 92 */ 93 int getUniqueId() const; 94 95 /** 96 * Returns the Type of information associated with this object 97 * 98 * @return Type of information 99 */ 100 int getType() const; 101 102 /** 103 * Returns the message description associated with this object 104 * 105 * @return Message description 106 */ 107 const String8 getMessage() const; 108 109 private: 110 int mUniqueId; 111 int mInfoType; 112 const String8 mMessage; 113 }; 114 115 }; 116 117 #endif /* __DRM_INFO_EVENT_H__ */ 118 119