tuya common queue module
更多...
#include "tuya_cloud_types.h"
浏览源代码.
|
|
typedef BOOL_T(* | TRAVERSE_CB) (void *item, void *ctx) |
| |
|
typedef void * | TUYA_QUEUE_HANDLE |
| |
|
| OPERATE_RET | tuya_queue_clear (TUYA_QUEUE_HANDLE handle) |
| | clear all items in the queue 更多...
|
| |
| OPERATE_RET | tuya_queue_create (const UINT32_T queue_len, const UINT32_T item_size, TUYA_QUEUE_HANDLE *handle) |
| | create and initialize a queue (FIFO) 更多...
|
| |
| OPERATE_RET | tuya_queue_delete_batch (TUYA_QUEUE_HANDLE handle, const UINT32_T num) |
| | delete the item from the queue position 更多...
|
| |
| OPERATE_RET | tuya_queue_get_batch (TUYA_QUEUE_HANDLE handle, const UINT32_T start, void *items, const UINT32_T num) |
| | get items from start postion, not dequeue 更多...
|
| |
| UINT32_T | tuya_queue_get_free_num (TUYA_QUEUE_HANDLE handle) |
| | get the free queue item number 更多...
|
| |
| UINT32_T | tuya_queue_get_max_num (TUYA_QUEUE_HANDLE handle) |
| | get the queue item number 更多...
|
| |
| UINT32_T | tuya_queue_get_used_num (TUYA_QUEUE_HANDLE handle) |
| | get the queue item number 更多...
|
| |
| OPERATE_RET | tuya_queue_input (TUYA_QUEUE_HANDLE handle, const void *item) |
| | enqueue, append to the tail 更多...
|
| |
| OPERATE_RET | tuya_queue_input_instant (TUYA_QUEUE_HANDLE handle, const void *item) |
| | enqueue, insert to the head 更多...
|
| |
| OPERATE_RET | tuya_queue_output (TUYA_QUEUE_HANDLE handle, const void *item) |
| | dequeue 更多...
|
| |
| OPERATE_RET | tuya_queue_peek (TUYA_QUEUE_HANDLE handle, const void *item) |
| | get the peek item(not dequeue) 更多...
|
| |
| OPERATE_RET | tuya_queue_release (TUYA_QUEUE_HANDLE handle) |
| | release the queue 更多...
|
| |
| OPERATE_RET | tuya_queue_traverse (TUYA_QUEUE_HANDLE handle, TRAVERSE_CB cb, void *ctx) |
| | traverse the queue with specific callback 更多...
|
| |
tuya common queue module
- 版本
- 1.0
- 日期
- 2019-10-30
- 版权所有
- Copyright 2021-2025 Tuya Inc. All Rights Reserved.
◆ tuya_queue_clear()
| OPERATE_RET tuya_queue_clear |
( |
TUYA_QUEUE_HANDLE |
handle | ) |
|
clear all items in the queue
- 参数
-
| [in] | handle | the queue handle |
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h
◆ tuya_queue_create()
| OPERATE_RET tuya_queue_create |
( |
const UINT32_T |
queue_len, |
|
|
const UINT32_T |
item_size, |
|
|
TUYA_QUEUE_HANDLE * |
handle |
|
) |
| |
create and initialize a queue (FIFO)
- 参数
-
| [in] | queue_len | the maximum number of items that the queue can contain. |
| [in] | item_size | the number of bytes each item in the queue will require. |
| [out] | handle | the queue handle |
- 注解
- items are queued by copy, not by reference. Each item on the queue must be the same size.
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h
◆ tuya_queue_delete_batch()
| OPERATE_RET tuya_queue_delete_batch |
( |
TUYA_QUEUE_HANDLE |
handle, |
|
|
const UINT32_T |
num |
|
) |
| |
delete the item from the queue position
- 参数
-
| [in] | handle | the queue handle |
| [in] | num | the item count to be deleted from the queue |
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h
◆ tuya_queue_get_batch()
| OPERATE_RET tuya_queue_get_batch |
( |
TUYA_QUEUE_HANDLE |
handle, |
|
|
const UINT32_T |
start, |
|
|
void * |
items, |
|
|
const UINT32_T |
num |
|
) |
| |
get items from start postion, not dequeue
- 参数
-
| [in] | handle | the queue handle |
| [in] | start | the start postion |
| [in] | items | the item buffer |
| [in] | num | the item counts |
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h
◆ tuya_queue_get_free_num()
| UINT32_T tuya_queue_get_free_num |
( |
TUYA_QUEUE_HANDLE |
handle | ) |
|
get the free queue item number
- 参数
-
| [in] | handle | the queue handle |
- 返回
- the current free item counts
◆ tuya_queue_get_max_num()
| UINT32_T tuya_queue_get_max_num |
( |
TUYA_QUEUE_HANDLE |
handle | ) |
|
get the queue item number
- 参数
-
| [in] | handle | the queue handle |
- 返回
- the current item counts
◆ tuya_queue_get_used_num()
| UINT32_T tuya_queue_get_used_num |
( |
TUYA_QUEUE_HANDLE |
handle | ) |
|
get the queue item number
- 参数
-
| [in] | handle | the queue handle |
- 返回
- the current item counts
◆ tuya_queue_input()
| OPERATE_RET tuya_queue_input |
( |
TUYA_QUEUE_HANDLE |
handle, |
|
|
const void * |
item |
|
) |
| |
enqueue, append to the tail
- 参数
-
| [in] | handle | the queue handle |
| [in] | item | pointer to the item that is to be placed on the queue. |
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h
◆ tuya_queue_input_instant()
| OPERATE_RET tuya_queue_input_instant |
( |
TUYA_QUEUE_HANDLE |
handle, |
|
|
const void * |
item |
|
) |
| |
enqueue, insert to the head
- 参数
-
| [in] | handle | the queue handle |
| [in] | item | pointer to the item that is to be placed on the queue. |
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h
◆ tuya_queue_output()
| OPERATE_RET tuya_queue_output |
( |
TUYA_QUEUE_HANDLE |
handle, |
|
|
const void * |
item |
|
) |
| |
dequeue
- 参数
-
| [in] | handle | the queue handle |
| [in] | item | the dequeue item buffer, NULL indicates discard the item |
- 返回
- OPRT_OK on success, others on failed, please refer to tuya_error_code.h
◆ tuya_queue_peek()
| OPERATE_RET tuya_queue_peek |
( |
TUYA_QUEUE_HANDLE |
handle, |
|
|
const void * |
item |
|
) |
| |
get the peek item(not dequeue)
- 参数
-
| [in] | handle | the queue handle |
| [out] | item | pointer to the buffer into which the received item will be copied. |
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h
◆ tuya_queue_release()
| OPERATE_RET tuya_queue_release |
( |
TUYA_QUEUE_HANDLE |
handle | ) |
|
release the queue
- 参数
-
| [in] | handle | the queue handle |
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h
◆ tuya_queue_traverse()
| OPERATE_RET tuya_queue_traverse |
( |
TUYA_QUEUE_HANDLE |
handle, |
|
|
TRAVERSE_CB |
cb, |
|
|
void * |
ctx |
|
) |
| |
traverse the queue with specific callback
- 参数
-
| [in] | handle | the queue handle |
| [in] | cb | the callback |
| [in] | ctx | the callback context |
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h