1 /* 2 * Copyright (C) 2020 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 CHRE_TEST_SHARED_SEND_MESSAGE_H_ 18 #define CHRE_TEST_SHARED_SEND_MESSAGE_H_ 19 20 #include <cinttypes> 21 22 namespace chre { 23 24 namespace test_shared { 25 26 /** 27 * Same as sendTestResultWithMsgToHost, but doesn't accept an error message and 28 * uses the free callback specified in chre/util/nanoapp/callbacks.h 29 */ 30 void sendTestResultToHost(uint16_t hostEndpointId, uint32_t messageType, 31 bool success); 32 33 /** 34 * Sends a test result to the host using the chre_test_common.TestResult 35 * message. 36 * 37 * @param hostEndpointId The endpoint ID of the host to send the result to. 38 * @param messageType The message type to associate with the test result. 39 * @param success True if the test succeeded. 40 * @param errMessage Nullable error message to send to the host. Error message 41 * will only be sent if success is false. 42 */ 43 void sendTestResultWithMsgToHost(uint16_t hostEndpointId, uint32_t messageType, 44 bool success, const char *errMessage); 45 46 /** 47 * Sends a message to the host with an empty payload. 48 * 49 * @param hostEndpointId The endpoint Id of the host to send the message to. 50 * @param messageType The message type. 51 */ 52 void sendEmptyMessageToHost(uint16_t hostEndpointId, uint32_t messageType); 53 54 } // namespace test_shared 55 56 } // namespace chre 57 58 #endif // CHRE_TEST_SHARED_SEND_MESSAGE_H_ 59