blob: 7b409ff5c314cf3e0d5f9268b655b6e2d20a5c84 [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;
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;
aimitakeshid074e302010-07-29 10:12:27 +090056 //! TYPE_OUT_OF_MEMORY, when memory allocation fail during renewal.
57 //! Can in the future perhaps be used to trigger garbage collector
Takeshi Aimidc549d62010-09-20 23:40:41 +090058 static const int TYPE_OUT_OF_MEMORY = 2004;
aimitakeshid074e302010-07-29 10:12:27 +090059 //! TYPE_NO_INTERNET_CONNECTION, when the Internet connection is missing and no attempt
60 //! can be made to renew rights
Takeshi Aimidc549d62010-09-20 23:40:41 +090061 static const int TYPE_NO_INTERNET_CONNECTION = 2005;
Takeshi Aimic7b3ccc2010-10-08 23:05:49 +090062 //! TYPE_PROCESS_DRM_INFO_FAILED, when failed to process DrmInfo.
63 static const int TYPE_PROCESS_DRM_INFO_FAILED = 2006;
aimitakeshid074e302010-07-29 10:12:27 +090064
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