blob: dfca228b902c5233b94859c6f47ff75e7a57a757 [file] [log] [blame]
aimitakeshid074e302010-07-29 10:12:27 +09001/*
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:
Takeshi Aimidc549d62010-09-20 23:40:41 +090030 /**
31 * The following constant values should be in sync with DrmInfoEvent.java
32 */
aimitakeshid074e302010-07-29 10:12:27 +090033 //! TYPE_ALREADY_REGISTERED_BY_ANOTHER_ACCOUNT, when registration has been
34 //! already done by another account ID.
Takeshi Aimidc549d62010-09-20 23:40:41 +090035 static const int TYPE_ALREADY_REGISTERED_BY_ANOTHER_ACCOUNT = 1;
aimitakeshid074e302010-07-29 10:12:27 +090036 //! TYPE_REMOVE_RIGHTS, when the rights needs to be removed completely.
Takeshi Aimidc549d62010-09-20 23:40:41 +090037 static const int TYPE_REMOVE_RIGHTS = 2;
aimitakeshid074e302010-07-29 10:12:27 +090038 //! TYPE_RIGHTS_INSTALLED, when the rights are downloaded and installed ok.
Takeshi Aimidc549d62010-09-20 23:40:41 +090039 static const int TYPE_RIGHTS_INSTALLED = 3;
aimitakeshid074e302010-07-29 10:12:27 +090040 //! TYPE_WAIT_FOR_RIGHTS, rights object is on it's way to phone,
41 //! wait before calling checkRights again
Takeshi Aimidc549d62010-09-20 23:40:41 +090042 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;
Gloria Wang27b27772011-03-14 12:04:15 -070046 //! TYPE_RIGHTS_REMOVED, when the rights has been removed.
47 static const int TYPE_RIGHTS_REMOVED = 6;
Takeshi Aimidc549d62010-09-20 23:40:41 +090048
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;
aimitakeshid074e302010-07-29 10:12:27 +090058 //! TYPE_OUT_OF_MEMORY, when memory allocation fail during renewal.
59 //! Can in the future perhaps be used to trigger garbage collector
Takeshi Aimidc549d62010-09-20 23:40:41 +090060 static const int TYPE_OUT_OF_MEMORY = 2004;
aimitakeshid074e302010-07-29 10:12:27 +090061 //! TYPE_NO_INTERNET_CONNECTION, when the Internet connection is missing and no attempt
62 //! can be made to renew rights
Takeshi Aimidc549d62010-09-20 23:40:41 +090063 static const int TYPE_NO_INTERNET_CONNECTION = 2005;
Takeshi Aimic7b3ccc2010-10-08 23:05:49 +090064 //! TYPE_PROCESS_DRM_INFO_FAILED, when failed to process DrmInfo.
65 static const int TYPE_PROCESS_DRM_INFO_FAILED = 2006;
Gloria Wang27b27772011-03-14 12:04:15 -070066 //! 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;
aimitakeshid074e302010-07-29 10:12:27 +090071
72public:
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 */
Gloria Wangcfbe4362011-03-17 15:02:34 -070080 DrmInfoEvent(int uniqueId, int infoType, const String8 message);
aimitakeshid074e302010-07-29 10:12:27 +090081
82 /**
83 * Destructor for DrmInfoEvent
84 */
85 virtual ~DrmInfoEvent() {}
86
87public:
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 */
Gloria Wangcfbe4362011-03-17 15:02:34 -0700107 const String8 getMessage() const;
aimitakeshid074e302010-07-29 10:12:27 +0900108
109private:
110 int mUniqueId;
111 int mInfoType;
Gloria Wangcfbe4362011-03-17 15:02:34 -0700112 const String8 mMessage;
aimitakeshid074e302010-07-29 10:12:27 +0900113};
114
115};
116
117#endif /* __DRM_INFO_EVENT_H__ */
118