blob: 5e8817c75542f9fcf4c86a169e4363066819c651 [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:
30 //! TYPE_ALREADY_REGISTERED_BY_ANOTHER_ACCOUNT, when registration has been
31 //! already done by another account ID.
32 static const int TYPE_ALREADY_REGISTERED_BY_ANOTHER_ACCOUNT = 0x0000001;
33 //! TYPE_REMOVE_RIGHTS, when the rights needs to be removed completely.
34 static const int TYPE_REMOVE_RIGHTS = 0x0000002;
35 //! TYPE_RIGHTS_INSTALLED, when the rights are downloaded and installed ok.
36 static const int TYPE_RIGHTS_INSTALLED = 0x0000003;
37 //! TYPE_RIGHTS_NOT_INSTALLED, when something went wrong installing the rights
38 static const int TYPE_RIGHTS_NOT_INSTALLED = 0x0000004;
39 //! TYPE_RIGHTS_RENEWAL_NOT_ALLOWED, when the server rejects renewal of rights
40 static const int TYPE_RIGHTS_RENEWAL_NOT_ALLOWED = 0x0000005;
41 //! TYPE_NOT_SUPPORTED, when answer from server can not be handled by the native agent
42 static const int TYPE_NOT_SUPPORTED = 0x0000006;
43 //! TYPE_WAIT_FOR_RIGHTS, rights object is on it's way to phone,
44 //! wait before calling checkRights again
45 static const int TYPE_WAIT_FOR_RIGHTS = 0x0000007;
46 //! TYPE_OUT_OF_MEMORY, when memory allocation fail during renewal.
47 //! Can in the future perhaps be used to trigger garbage collector
48 static const int TYPE_OUT_OF_MEMORY = 0x0000008;
49 //! TYPE_NO_INTERNET_CONNECTION, when the Internet connection is missing and no attempt
50 //! can be made to renew rights
51 static const int TYPE_NO_INTERNET_CONNECTION = 0x0000009;
52
53public:
54 /**
55 * Constructor for DrmInfoEvent
56 *
57 * @param[in] uniqueId Unique session identifier
58 * @param[in] infoType Type of information
59 * @param[in] message Message description
60 */
61 DrmInfoEvent(int uniqueId, int infoType, const String8& message);
62
63 /**
64 * Destructor for DrmInfoEvent
65 */
66 virtual ~DrmInfoEvent() {}
67
68public:
69 /**
70 * Returns the Unique Id associated with this instance
71 *
72 * @return Unique Id
73 */
74 int getUniqueId() const;
75
76 /**
77 * Returns the Type of information associated with this object
78 *
79 * @return Type of information
80 */
81 int getType() const;
82
83 /**
84 * Returns the message description associated with this object
85 *
86 * @return Message description
87 */
88 const String8& getMessage() const;
89
90private:
91 int mUniqueId;
92 int mInfoType;
93 const String8& mMessage;
94};
95
96};
97
98#endif /* __DRM_INFO_EVENT_H__ */
99