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 #include <chre.h>
18 #include <cinttypes>
19
20 #include "chre/util/nanoapp/log.h"
21
22 #define LOG_TAG "[WwanWorld]"
23
24 #ifdef CHRE_NANOAPP_INTERNAL
25 namespace chre {
26 namespace {
27 #endif // CHRE_NANOAPP_INTERNAL
28
nanoappStart()29 bool nanoappStart() {
30 LOGI("App started as instance %" PRIu32, chreGetInstanceId());
31
32 const char *wwanCapabilitiesStr;
33 uint32_t wwanCapabilities = chreWwanGetCapabilities();
34 switch (wwanCapabilities) {
35 case CHRE_WWAN_GET_CELL_INFO:
36 wwanCapabilitiesStr = "GET_CELL_INFO";
37 break;
38 case CHRE_WWAN_CAPABILITIES_NONE:
39 wwanCapabilitiesStr = "NONE";
40 break;
41 default:
42 wwanCapabilitiesStr = "INVALID";
43 }
44
45 LOGI("Detected WWAN support as: %s (%" PRIu32 ")",
46 wwanCapabilitiesStr, wwanCapabilities);
47 return true;
48 }
49
nanoappHandleEvent(uint32_t senderInstanceId,uint16_t eventType,const void * eventData)50 void nanoappHandleEvent(uint32_t senderInstanceId,
51 uint16_t eventType,
52 const void *eventData) {
53 // TODO: Implement this.
54 }
55
nanoappEnd()56 void nanoappEnd() {
57 LOGI("Stopped");
58 }
59
60 #ifdef CHRE_NANOAPP_INTERNAL
61 } // anonymous namespace
62 } // namespace chre
63
64 #include "chre/util/nanoapp/app_id.h"
65 #include "chre/platform/static_nanoapp_init.h"
66
67 CHRE_STATIC_NANOAPP_INIT(WwanWorld, chre::kWwanWorldAppId, 0);
68 #endif // CHRE_NANOAPP_INTERNAL
69