Consumer

Overview

Related Modules:

Broadcast

Description:

Defines the topic consumer used to receive events and push data. You need to implement this struct for your application.

Summary

Data Fields

Variable Name

Description

identity

const Identity 

Notify )(Consumer consumer, const Topictopic, const Requestorigin)

void( 

Defines how the consumer will process the events or data of a released topic.

Equal )(const Consumer current, const Consumerother)

BOOL( 

Checks whether two consumers are equal.

Details

Field Documentation

Equal

  1. BOOL(*Consumer::Equal)(const[Consumer]($api-api-LinkIoT-Consumer.md)*current,const[Consumer]($api-api-LinkIoT-Consumer.md)*other)

Description:

Checks whether two consumers are equal.

You need to implement this function to prevent repeated topic subscription.

Parameters:

Name

Description

currentIndicates the pointer to the current consumer.
otherIndicates the pointer to the target consumer to compare.

Returns:

Returns TRUE if the two consumers are equal; returns FALSE otherwise.

identity

  1. const[Identity]($api-api-LinkIoT-Identity.md)*Consumer::identity

Description:

Consumer ID

Notify

  1. void(*Consumer::Notify)([Consumer]($api-api-LinkIoT-Consumer.md)*consumer,const[Topic]($api-api-LinkIoT-Broadcast.md#gaf03f5bc94cad32ab628a6cdee09b0542) *topic, const [Request]($api-api-LinkIoT-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:

Name

Description

consumerIndicates this pointer of the consumer.
topicIndicates the pointer to the topic to be processed.
originIndicates the pointer to the data to be processed.