1 /******************************************************************************
2  *
3  *  Copyright 2020, 2022 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_COMMON_H_
20 #define _WEAVER_COMMON_H_
21 
22 #include <vector>
23 
24 enum Status_Weaver {
25   WEAVER_STATUS_OK,            // Success
26   WEAVER_STATUS_FAILED,        // any failure
27   WEAVER_STATUS_INCORRECT_KEY, // Specific to read api in case of incorrect key
28   WEAVER_STATUS_THROTTLE,      // Specific to read api while throttle error
29 };
30 
31 typedef struct SlotInfo {
32   /** The number of slots available. */
33   uint32_t slots;
34   /** The number of bytes used for a key. */
35   uint32_t keySize;
36   /** The number of bytes used for a value. */
37   uint32_t valueSize;
38 } SlotInfo;
39 
40 typedef struct ReadRespInfo {
41   /** The time to wait, in milliseconds, before making the next request. */
42   uint32_t timeout;
43   /** The value read from the slot or empty if the value was not read. */
44   std::vector<uint8_t> value;
45 } ReadRespInfo;
46 
47 typedef struct GetDataRespInfo {
48   /** The time to wait, in seconds, before making the next request. */
49   uint32_t timeout;
50   /** The current number of failure count */
51   uint16_t failure_count;
52 } GetDataRespInfo;
53 
54 #endif /* _WEAVER_COMMON_H_ */
55