00001 // Copyright 2016 Intermodalics All Rights Reserved. 00002 // 00003 // Licensed under the Apache License, Version 2.0 (the "License"); 00004 // you may not use this file except in compliance with the License. 00005 // You may obtain a copy of the License at 00006 // 00007 // http://www.apache.org/licenses/LICENSE-2.0 00008 // 00009 // Unless required by applicable law or agreed to in writing, software 00010 // distributed under the License is distributed on an "AS IS" BASIS, 00011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00012 // See the License for the specific language governing permissions and 00013 // limitations under the License. 00014 #include "tango_helper.h" 00015 00016 #include <glog/logging.h> 00017 #include <tango_client_api/tango_client_api.h> 00018 #include <tango_support/tango_support.h> 00019 00020 namespace tango_helper { 00021 bool IsTangoVersionOk(JNIEnv* env, jobject activity) { 00022 int version; 00023 TangoErrorType result = TangoSupport_getTangoVersion(env, activity, &version); 00024 if (result != TANGO_SUCCESS || version < TANGO_CORE_MINIMUM_VERSION) { 00025 LOG(ERROR) << "Tango Core version is out of " 00026 "date, minimum version required: " << TANGO_CORE_MINIMUM_VERSION << 00027 ", version used: " << version; 00028 return false; 00029 } 00030 return true; 00031 } 00032 00033 bool SetBinder(JNIEnv* env, jobject binder) { 00034 TangoErrorType result = TangoService_setBinder(env, binder); 00035 if (result != TANGO_SUCCESS) { 00036 LOG(ERROR) << "Failed to bind Tango service with error code: " << result; 00037 return false; 00038 } 00039 return true; 00040 } 00041 } // tango_helper