2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file ns_resource_controler.h
18 * @brief \~english This file provides api for operating Resource
21 /** @addtogroup BaseSystem
24 /** @addtogroup native_service
28 /** @addtogroup framework_unified
29 * @ingroup native_service
32 /** @addtogroup native
33 * @ingroup framework_unified
36 #ifndef _ns_resource_controler_h_ // NOLINT (build/header_guard)
37 #define _ns_resource_controler_h_
39 #define FRAMEWORKUNIFIED_RES_ABNMLMON "FRAMEWORKUNIFIED_RES_ABNMLMON"
40 #define FRAMEWORKUNIFIED_RES_TIMER "FRAMEWORKUNIFIED_RES_TIMER"
45 /////////////////////////////////////////////////////////////////////////////////////
46 /// \ingroup BaseSystem
47 /// \~english @par Summary
48 /// This function is used to get the resourceid associated with the mod and the key.
49 /// \~english @param [IN] mod
50 /// const char * - the mod of resource
51 /// \~english @param [IN] key
52 /// const char * - the key of resource
53 /// \~english @param [OUT] resource
54 /// long * - resource ID
55 /// \~english @retval -1 fail
56 /// \~english @retval 0 success
57 /// \~english @par Preconditions
59 /// \~english @par Change of the internal state
60 /// - Change of internal state according to the API does not occur.
61 /// \~english @par Causes of failures
63 /// \~english @par Classification
65 /// \~english @par Type
67 /// \~english @par Detail
68 /// This function is used to get the resourceid associated with the mod and the key.
70 ////////////////////////////////////////////////////////////////////////////////////
71 int frameworkunifiedGetResource(const char *mod, const char *key, long *resource); // NOLINT (readability/nolint)
73 /////////////////////////////////////////////////////////////////////////////////////
74 /// \ingroup BaseSystem
75 /// \~english @par Summary
76 /// This function is used to acquire the resourceid associated with the mod and the key.
77 /// \~english @param [IN] mod
78 /// const char * - the mod of resource
79 /// \~english @param [IN] key
80 /// const char * - the key of resource
81 /// \~english @param [OUT] resource
82 /// long * - resource ID
83 /// \~english @retval ref_counter the counter of user
84 /// \~english @par Preconditions
86 /// \~english @par Change of the internal state
87 /// - Change of internal state according to the API does not occur.
88 /// \~english @par Causes of failures
90 /// \~english @par Classification
92 /// \~english @par Type
94 /// \~english @par Detail
95 /// This function is used to acquire the resourceid associated with the mod and the key.
97 ////////////////////////////////////////////////////////////////////////////////////
98 int frameworkunifiedAcquireResouce(const char *mod, const char *key, long *resource); // NOLINT (readability/nolint)
100 /////////////////////////////////////////////////////////////////////////////////////
101 /// \ingroup BaseSystem
102 /// \~english @par Summary
103 /// This function is used to release the resourceid associated with the mod and the key.
104 /// \~english @param [IN] mod
105 /// const char * - the mod of resource
106 /// \~english @param [IN] key
107 /// const char * - the key of resource
108 /// \~english @retval ref_counter the counter of user
109 /// \~english @par Preconditions
111 /// \~english @par Change of the internal state
112 /// - Change of internal state according to the API does not occur.
113 /// \~english @par Causes of failures
115 /// \~english @par Classification
117 /// \~english @par Type
119 /// \~english @par Detail
120 /// This function is used to release the resourceid associated with the mod and the key.
122 ////////////////////////////////////////////////////////////////////////////////////
123 int frameworkunifiedReleaseResouce(const char *mod, const char *key);
125 /////////////////////////////////////////////////////////////////////////////////////
126 /// \ingroup BaseSystem
127 /// \~english @par Summary
128 /// This function is used to get the key associated with the mod and the resourceid.
129 /// \~english @param [IN] mod
130 /// const char * - the mod of resource
131 /// \~english @param [IN] resource
132 /// long - resource ID
133 /// \~english @param [OUT] key
134 /// const char * - the key of resource
135 /// \~english @retval -1 fail
136 /// \~english @retval 0 success
137 /// \~english @par Preconditions
139 /// \~english @par Change of the internal state
140 /// - Change of internal state according to the API does not occur.
141 /// \~english @par Causes of failures
143 /// \~english @par Classification
145 /// \~english @par Type
147 /// \~english @par Detail
148 /// This function is used to get the key associated with the mod and the resourceid.
150 ////////////////////////////////////////////////////////////////////////////////////
151 int frameworkunifiedSearchResourseKey(const char *mod, long resource, const char **key); // NOLINT (readability/nolint)
153 /////////////////////////////////////////////////////////////////////////////////////
154 /// \ingroup BaseSystem
155 /// \~english @par Summary
156 /// This function is used to register the resource associated with the mod and the key.
157 /// \~english @param [IN] mod
158 /// const char * - the mod of resource
159 /// \~english @param [IN] key
160 /// const char * - the key of resource
161 /// \~english @param [IN] resource
162 /// const char * - resource ID
163 /// \~english @param [IN] init_counter
164 /// long - resource user counter
165 /// \~english @retval -1 fail
166 /// \~english @retval 0 success
167 /// \~english @par Preconditions
169 /// \~english @par Change of the internal state
170 /// - Change of internal state according to the API does not occur.
171 /// \~english @par Causes of failures
173 /// \~english @par Classification
175 /// \~english @par Type
177 /// \~english @par Detail
178 /// This function is used to register the resource associated with the mod and the key.init counter.
180 ////////////////////////////////////////////////////////////////////////////////////
182 int frameworkunifiedRegistResouce(const char *mod, const char *key, long resource, int init_counter); // NOLINT (readability/nolint)
183 /////////////////////////////////////////////////////////////////////////////////////
184 /// \ingroup BaseSystem
185 /// \~english @par Summary
186 /// This function is used to unregister the resource associated with the mod and the key.
187 /// \~english @param [IN] mod
188 /// const char * - the mod of resource
189 /// \~english @param [IN] key
190 /// const char * - the key of resource
191 /// \~english @retval 0 success
192 /// \~english @par Preconditions
194 /// \~english @par Change of the internal state
195 /// - Change of internal state according to the API does not occur.
196 /// \~english @par Causes of failures
198 /// \~english @par Classification
200 /// \~english @par Type
202 /// \~english @par Detail
203 /// This function is used to unregister the resource associated with the mod and the key.init counter.
205 ////////////////////////////////////////////////////////////////////////////////////
206 int frameworkunifiedUnregistResouce(const char *mod, const char *key);
212 #endif // _ns_resource_controler_h_ NOLINT (build/header_guard)