TuyaOS
类型定义 | 函数
tuya_queue.h 文件参考

tuya common queue module 更多...

#include "tuya_cloud_types.h"
tuya_queue.h 的引用(Include)关系图:

浏览源代码.

类型定义

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

函数说明

◆ tuya_queue_clear()

OPERATE_RET tuya_queue_clear ( TUYA_QUEUE_HANDLE  handle)

clear all items in the queue

参数
[in]handlethe 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_lenthe maximum number of items that the queue can contain.
[in]item_sizethe number of bytes each item in the queue will require.
[out]handlethe 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]handlethe queue handle
[in]numthe 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]handlethe queue handle
[in]startthe start postion
[in]itemsthe item buffer
[in]numthe 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]handlethe 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]handlethe 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]handlethe 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]handlethe queue handle
[in]itempointer 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]handlethe queue handle
[in]itempointer 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]handlethe queue handle
[in]itemthe 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]handlethe queue handle
[out]itempointer 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]handlethe 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]handlethe queue handle
[in]cbthe callback
[in]ctxthe callback context
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h