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 #ifndef CPP_TELEMETRY_SCRIPT_EXECUTOR_SRC_SCRIPTEXECUTORLISTENER_H_ 18 #define CPP_TELEMETRY_SCRIPT_EXECUTOR_SRC_SCRIPTEXECUTORLISTENER_H_ 19 20 #include "jni.h" 21 22 #include <string> 23 24 namespace android { 25 namespace automotive { 26 namespace telemetry { 27 namespace script_executor { 28 29 // Wrapper class for IScriptExecutorListener.aidl. 30 class ScriptExecutorListener { 31 public: 32 ScriptExecutorListener(JNIEnv* jni, jobject script_executor_listener); 33 34 virtual ~ScriptExecutorListener(); 35 onScriptFinished()36 void onScriptFinished() {} 37 onSuccess()38 void onSuccess() {} 39 40 void onError(const int errorType, const std::string& message, const std::string& stackTrace); 41 42 private: 43 // Stores a jni global reference to Java Script Executor listener object. 44 jobject mScriptExecutorListener; 45 }; 46 47 } // namespace script_executor 48 } // namespace telemetry 49 } // namespace automotive 50 } // namespace android 51 52 #endif // CPP_TELEMETRY_SCRIPT_EXECUTOR_SRC_SCRIPTEXECUTORLISTENER_H_ 53