1 /******************************************************************************
2  *
3  *  Copyright 2020 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_INTERFACE_H_
20 #define _WEAVER_INTERFACE_H_
21 
22 #include <weaver_common.h>
23 
24 class WeaverInterface {
25 public:
26   /**
27    * \brief virtual Function to initialize Weaver Interface
28    *
29    * \retval This function return Weaver_STATUS_OK (0) in case of success
30    *         In case of failure returns other Status_Weaver.
31    */
32   virtual Status_Weaver Init() = 0;
33 
34   /**
35    * \brief virtual Function to read slot information
36    * \param[out]   slotInfo - slot information values read out
37    *
38    * \retval This function return Weaver_STATUS_OK (0) in case of success
39    *         In case of failure returns other Status_Weaver errorcodes.
40    */
41   virtual Status_Weaver GetSlots(SlotInfo &slotInfo) = 0;
42 
43   /**
44    * \brief virtual Function to read value of specific key & slotId
45    * \param[in]    slotId -       input slotId which's information to be read
46    * \param[in]    key -          input key which's information to be read
47    * \param[out]   readRespInfo - read information values to be read out
48    *
49    * \retval This function return Weaver_STATUS_OK (0) in case of success
50    *         In case of failure returns other Status_Weaver errorcodes.
51    */
52   virtual Status_Weaver Read(uint32_t slotId, const std::vector<uint8_t> &key,
53                              ReadRespInfo &readRespInfo) = 0;
54 
55   /**
56    * \brief virtual Function to write value to specific key & slotId
57    * \param[in]    slotId -       input slotId where value to be write
58    * \param[in]    key -          input key where value to be write
59    * \param[in]   value -        input value which will be written
60    *
61    * \retval This function return Weaver_STATUS_OK (0) in case of success
62    *         In case of failure returns other Status_Weaver.
63    */
64   virtual Status_Weaver Write(uint32_t slotId, const std::vector<uint8_t> &key,
65                               const std::vector<uint8_t> &value) = 0;
66 
67   /**
68    * \brief virtual Function to de-initialize Weaver Interface
69    *
70    * \retval This function return Weaver_STATUS_OK (0) in case of success
71    *         In case of failure returns other Status_Weaver.
72    */
73   virtual Status_Weaver DeInit() = 0;
74 
75   /**
76    * \brief virtual destructor for Weaver Interface
77    */
~WeaverInterface()78   virtual ~WeaverInterface(){};
79 };
80 
81 #endif /* _WEAVER_INTERFACE_H_ */
82