1 /* 2 * Copyright (C) 2021 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 #define LOG_TAG "GnssBatchingCbJni" 18 19 #include "GnssBatchingCallback.h" 20 21 namespace android::gnss { 22 23 namespace { 24 25 jmethodID method_reportLocationBatch; 26 27 } // anonymous namespace 28 29 using android::hardware::hidl_vec; 30 using binder::Status; 31 using hardware::Return; 32 33 using GnssLocationAidl = android::hardware::gnss::GnssLocation; 34 using GnssLocation_V1_0 = android::hardware::gnss::V1_0::GnssLocation; 35 using GnssLocation_V2_0 = android::hardware::gnss::V2_0::GnssLocation; 36 GnssBatching_class_init_once(JNIEnv * env,jclass clazz)37void GnssBatching_class_init_once(JNIEnv* env, jclass clazz) { 38 method_reportLocationBatch = 39 env->GetMethodID(clazz, "reportLocationBatch", "([Landroid/location/Location;)V"); 40 } 41 gnssLocationBatchCb(const std::vector<android::hardware::gnss::GnssLocation> & locations)42Status GnssBatchingCallbackAidl::gnssLocationBatchCb( 43 const std::vector<android::hardware::gnss::GnssLocation>& locations) { 44 GnssBatchingCallbackUtil::gnssLocationBatchCbImpl(hidl_vec<GnssLocationAidl>(locations)); 45 return Status::ok(); 46 } 47 gnssLocationBatchCb(const hidl_vec<GnssLocation_V1_0> & locations)48Return<void> GnssBatchingCallback_V1_0::gnssLocationBatchCb( 49 const hidl_vec<GnssLocation_V1_0>& locations) { 50 return GnssBatchingCallbackUtil::gnssLocationBatchCbImpl(locations); 51 } 52 gnssLocationBatchCb(const hidl_vec<GnssLocation_V2_0> & locations)53Return<void> GnssBatchingCallback_V2_0::gnssLocationBatchCb( 54 const hidl_vec<GnssLocation_V2_0>& locations) { 55 return GnssBatchingCallbackUtil::gnssLocationBatchCbImpl(locations); 56 } 57 58 } // namespace android::gnss 59