Subscriber

Overview

Related Modules:

Broadcast

Description:

Defines the subscriber for external interfaces to subsribe to events and data of a topic.

Summary

Data Fields

Variable Name

Description

AddTopic )(IUnknowniUnknown, const Topictopic)

int( 

Adds a specified topic to the Broadcast service.

Subscribe )(IUnknown iUnknown, const Topictopic, Consumerconsumer)

int( 

Subscribes to a specified topic for consumers.

ModifyConsumer )(IUnknown iUnknown, const Topictopic, Consumerold, Consumercurrent)

Consumer ( 

Modifies the consumer of a specified topic.

Unsubscribe )(IUnknown iUnknown, const Topictopic, const Consumerconsumer)

Consumer( 

Unsubscribes from a specified topic.

Details

Field Documentation

AddTopic

  1. int(*Subscriber::AddTopic)([IUnknown]($api-api-SmartVision-Devices-IUnknown.md)*iUnknown,const[Topic]($api-api-SmartVision-Devices-Broadcast.md#gaf03f5bc94cad32ab628a6cdee09b0542) *topic)

Description:

Adds a specified topic to the Broadcast service.

The specified topic is added by the subscriber. A topic can be subscribed to only after being added.

Parameters:

Name

Description

iUnknownIndicates external interface of the pub/sub feature.
topicIndicates the topic to be subscribed to.

Returns:

Returns EC_SUCCESS if the topic is successfully added; returns other error codes if the topic fails to be added.

ModifyConsumer

  1. [Consumer]($api-api-SmartVision-Devices-Consumer.md)*(*Subscriber::ModifyConsumer)([IUnknown]($api-api-SmartVision-Devices-IUnknown.md)*iUnknown,const[Topic]($api-api-SmartVision-Devices-Broadcast.md#gaf03f5bc94cad32ab628a6cdee09b0542) *topic, [Consumer]($api-api-SmartVision-Devices-Consumer.md) *old, [Consumer]($api-api-SmartVision-Devices-Consumer.md) *current)

Description:

Modifies the consumer of a specified topic.

Parameters:

Name

Description

iUnknownIndicates the pointer to the external interface of the pub/sub feature.
topicIndicates the pointer to the topic whose consumer will be modified.
oldIndicates the pointer to the original consumer of the topic.
currentIndicates the pointer to the new consumer of the topic.

Returns:

Returns the pointer of the original consumer if the modification is successful; returns NULL otherwise.

Subscribe

  1. int(*Subscriber::Subscribe)([IUnknown]($api-api-SmartVision-Devices-IUnknown.md)*iUnknown,const[Topic]($api-api-SmartVision-Devices-Broadcast.md#gaf03f5bc94cad32ab628a6cdee09b0542) *topic, [Consumer]($api-api-SmartVision-Devices-Consumer.md) *consumer)

Description:

Subscribes to a specified topic for consumers.

Call this function on the subscriber. The topic to be subscribed to must have been added to the Broadcast service.

Parameters:

Name

Description

iUnknownIndicates external interface of the pub/sub feature.
topicIndicates the topic to be subscribed to.
consumerIndicates the consumer who subscribes to the topic.

Returns:

Returns EC_SUCCESS if the subscription is successful; returns other error codes if the subscription fails.

Unsubscribe

  1. [Consumer]($api-api-SmartVision-Devices-Consumer.md)*(*Subscriber::Unsubscribe)([IUnknown]($api-api-SmartVision-Devices-IUnknown.md)*iUnknown,const[Topic]($api-api-SmartVision-Devices-Broadcast.md#gaf03f5bc94cad32ab628a6cdee09b0542) *topic, const [Consumer]($api-api-SmartVision-Devices-Consumer.md) *consumer)

Description:

Unsubscribes from a specified topic.

This function cancels the subscription relationship between the specified topic and consumer.

Parameters:

Name

Description

iUnknownIndicates external interface of the pub/sub feature. This parameter is used to obtain subscription relationships.
topicIndicates the pointer to the topic to unsubscribe from.
consumerIndicates the pointer to the consumer.

Returns:

Returns the pointer of the consumer if the unsubscription is successful; returns NULL otherwise.