文件名称:
Consumer.md
所在目录:
Openharmony v1.0 / docs / api / api-SmartVision-Devices
文件大小:
6.36 KB
下载地址:
文本预览:
# Consumer
## **Overview**
**Related Modules:**
[Broadcast](Broadcast.md)
**Description:**
Defines the topic consumer used to receive events and push data. You need to implement this struct for your application.
## **Summary**
## Data Fields
## **Details**
## **Field Documentation**
## Equal
```
BOOL(* Consumer::Equal) (const [Consumer](Consumer.md) *current, const [Consumer](Consumer.md) *other)
```
**Description:**
Checks whether two consumers are equal.
You need to implement this function to prevent repeated topic subscription.
**Parameters:**
**Returns:**
Returns **TRUE** if the two consumers are equal; returns **FALSE** otherwise.
## identity
```
const [Identity](Identity.md)* Consumer::identity
```
**Description:**
[Consumer](Consumer.md) ID
## Notify
```
void(* Consumer::Notify) ([Consumer](Consumer.md) *consumer, const [Topic](Broadcast.md#gaf03f5bc94cad32ab628a6cdee09b0542) *topic, const [Request](Request.md) *origin)
```
**Description:**
Defines how the consumer will process the events or data of a released topic.
You can implement this function for consumers to process topics associated with the them. Note that the passed topic must have been subscribed by the consumer. Otherwise, the function does nothing.
**Parameters:**
## **Overview**
**Related Modules:**
[Broadcast](Broadcast.md)
**Description:**
Defines the topic consumer used to receive events and push data. You need to implement this struct for your application.
## **Summary**
## Data Fields
const Identity * | |
Notify )(Consumer *consumer, const Topic *topic, const Request *origin) | Defines how the consumer will process the events or data of a released topic. |
Equal )(const Consumer *current, const Consumer *other) | Checks whether two consumers are equal. |
## **Details**
## **Field Documentation**
## Equal
```
BOOL(* Consumer::Equal) (const [Consumer](Consumer.md) *current, const [Consumer](Consumer.md) *other)
```
**Description:**
Checks whether two consumers are equal.
You need to implement this function to prevent repeated topic subscription.
**Parameters:**
current | Indicates the pointer to the current consumer. |
other | Indicates the pointer to the target consumer to compare. |
**Returns:**
Returns **TRUE** if the two consumers are equal; returns **FALSE** otherwise.
## identity
```
const [Identity](Identity.md)* Consumer::identity
```
**Description:**
[Consumer](Consumer.md) ID
## Notify
```
void(* Consumer::Notify) ([Consumer](Consumer.md) *consumer, const [Topic](Broadcast.md#gaf03f5bc94cad32ab628a6cdee09b0542) *topic, const [Request](Request.md) *origin)
```
**Description:**
Defines how the consumer will process the events or data of a released topic.
You can implement this function for consumers to process topics associated with the them. Note that the passed topic must have been subscribed by the consumer. Otherwise, the function does nothing.
**Parameters:**
consumer | Indicates this pointer of the consumer. |
topic | Indicates the pointer to the topic to be processed. |
origin | Indicates the pointer to the data to be processed. |
点赞
回复
X