wwan_world.cc revision e969b9be8eca27ffc875167879ab0ec093b3e313
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#include "chre/platform/platform_static_nanoapp_init.h" 26 27namespace chre { 28namespace { 29#endif // CHRE_NANOAPP_INTERNAL 30 31bool nanoappStart() { 32 LOGI("App started as instance %" PRIu32, chreGetInstanceId()); 33 34 const char *wwanCapabilitiesStr; 35 uint32_t wwanCapabilities = chreWwanGetCapabilities(); 36 switch (wwanCapabilities) { 37 case CHRE_WWAN_GET_CELL_INFO: 38 wwanCapabilitiesStr = "GET_CELL_INFO"; 39 break; 40 case CHRE_WWAN_CAPABILITIES_NONE: 41 wwanCapabilitiesStr = "NONE"; 42 break; 43 default: 44 wwanCapabilitiesStr = "INVALID"; 45 } 46 47 LOGI("Detected WWAN support as: %s (%" PRIu32 ")", 48 wwanCapabilitiesStr, wwanCapabilities); 49 return true; 50} 51 52void nanoappHandleEvent(uint32_t senderInstanceId, 53 uint16_t eventType, 54 const void *eventData) { 55 // TODO: Implement this. 56} 57 58void nanoappStop() { 59 LOGI("Stopped"); 60} 61 62#ifdef CHRE_NANOAPP_INTERNAL 63} // namespace 64 65PLATFORM_STATIC_NANOAPP_INIT(WwanWorld); 66 67} // namespace chre 68#endif // CHRE_NANOAPP_INTERNAL 69