• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 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 _GTS_NANOAPPS_GENERAL_TEST_NANOAPP_INFO_H_
18 #define _GTS_NANOAPPS_GENERAL_TEST_NANOAPP_INFO_H_
19 
20 #include <cstdint>
21 
22 #include <chre.h>
23 
24 namespace general_test {
25 
26 class NanoappInfo {
27  public:
28   NanoappInfo();
29 
30   /**
31    * Send the nanoapp information to the host
32    */
33   void sendToHost();
34 
35   /**
36    * Validate that provided values match gathered data.
37    *
38    * @param appId The app ID to validate against
39    * @param instanceId The instance ID to validate against
40    * @return true if provided values match data, false otherwise
41    */
42   bool validate(uint64_t appId, uint32_t instanceId);
43 
44   /**
45    * Query system for running nanoapp information by gathered application Id
46    *
47    * @param info The chreNanoappInfo to populate with query results
48    * @return true If nanoapp with application id is running on system
49    */
50   bool queryByAppId(struct chreNanoappInfo *info);
51 
52   /**
53    * Query system for running nanoapp information by gathered instance Id
54    *
55    * @param info The chreNanoappInfo to populate with query results
56    * @return true If nanoapp with instance id is running on system
57    */
58   bool queryByInstanceId(struct chreNanoappInfo *info);
59 
60  private:
61   uint64_t mAppId;
62   uint32_t mInstanceId;
63 };
64 
65 } // namespace general_test
66 
67 #endif // _GTS_NANOAPPS_GENERAL_TEST_NANOAPP_INFO_H_
68