1 /****************************************************************************** 2 * 3 * Copyright 2020, 2023 NXP 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19 #ifndef _WEAVER_TRANSPORT_H_ 20 #define _WEAVER_TRANSPORT_H_ 21 22 #include <vector> 23 24 class WeaverTransport { 25 public: 26 /** 27 * \brief virtual Function to initialize Weaver Transport Interface 28 * 29 * \param[in] aid - applet ids to be set to transport interface 30 * 31 * \retval This function return true in case of success 32 * In case of failure returns false. 33 */ 34 virtual bool Init(std::vector<std::vector<uint8_t>> aid) = 0; 35 36 /** 37 * \brief virtual Function to open applet connection 38 * 39 * \param[in] data - command for open applet 40 * \param[out] resp - response from applet 41 * 42 * \retval This function return true in case of success 43 * In case of failure returns false. 44 */ 45 virtual bool OpenApplet(std::vector<uint8_t> data, 46 std::vector<uint8_t> &resp) = 0; 47 48 /** 49 * \brief virtual Function to close applet connection 50 * 51 * \retval This function return true in case of success 52 * In case of failure returns false. 53 */ 54 virtual bool CloseApplet() = 0; 55 56 /** 57 * \brief virtual Function to send commands to applet 58 * 59 * \param[in] data - command to be send to applet 60 * \param[out] resp - response from applet 61 * 62 * \retval This function return true in case of success 63 * In case of failure returns false. 64 */ 65 virtual bool Send(std::vector<uint8_t> data, std::vector<uint8_t> &resp) = 0; 66 67 /** 68 * \brief virtual Function to de-initialize Weaver Transport Interface 69 * 70 * \retval This function return true in case of success 71 * In case of failure returns false. 72 */ 73 virtual bool DeInit() = 0; 74 75 /** 76 * \brief virtual destructor for Weaver Transport Interface 77 */ ~WeaverTransport()78 virtual ~WeaverTransport(){}; 79 }; 80 81 #endif /* _WEAVER_TRANSPORT_H_ */ 82