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/platform/platform_wwan.h" 18 19 #include <cinttypes> 20 21 #include "chre/core/event_loop_manager.h" 22 #include "chre/platform/shared/pal_system_api.h" 23 #include "chre/platform/log.h" 24 25 namespace chre { 26 PlatformWwan()27PlatformWwan::PlatformWwan() { 28 mWwanApi = chrePalWwanGetApi(CHRE_PAL_WWAN_API_CURRENT_VERSION); 29 if (mWwanApi != nullptr) { 30 mWwanCallbacks.cellInfoResultCallback = 31 PlatformWwanBase::cellInfoResultCallback; 32 if (!mWwanApi->open(&gChrePalSystemApi, &mWwanCallbacks)) { 33 LOGE("WWAN PAL open returned false"); 34 mWwanApi = nullptr; 35 } 36 } else { 37 LOGW("Requested WWAN PAL (version %08" PRIx32 ") not found", 38 CHRE_PAL_WWAN_API_CURRENT_VERSION); 39 } 40 } 41 ~PlatformWwan()42PlatformWwan::~PlatformWwan() { 43 if (mWwanApi != nullptr) { 44 mWwanApi->close(); 45 } 46 } 47 getCapabilities()48uint32_t PlatformWwan::getCapabilities() { 49 if (mWwanApi != nullptr) { 50 return mWwanApi->getCapabilities(); 51 } else { 52 return CHRE_WWAN_CAPABILITIES_NONE; 53 } 54 } 55 cellInfoResultCallback(struct chreWwanCellInfoResult * result)56void PlatformWwanBase::cellInfoResultCallback( 57 struct chreWwanCellInfoResult *result) { 58 // TODO: Implement this. 59 } 60 61 } // namespace chre 62