IOT Dash
Public Member Functions | Protected Member Functions | Properties | List of all members
IotDash.Services.Mqtt.Implementation.MqttNet_Mediator Class Reference
Inheritance diagram for IotDash.Services.Mqtt.Implementation.MqttNet_Mediator:
Inheritance graph
[legend]
Collaboration diagram for IotDash.Services.Mqtt.Implementation.MqttNet_Mediator:
Collaboration graph
[legend]

Public Member Functions

 MqttNet_Mediator (HostedMqttService serviceRoot, IServiceProvider provider)
 
override int TargetCountOnChannel (string key)
 
override bool HasSubscribersOnTopic (string topic)
 
override IEnumerable< ITarget< string, MqttApplicationMessage > > GetChannelCopy (string key)
 
override void Subscribe (string topic, ITarget< string, MqttApplicationMessage > target, out ISubscription subscription)
 
override void Subscribe (string topic, ITarget< string, MqttApplicationMessage > target, SubscriptionGuard guard)
 
override void Unsubscribe (ISubscription< string, MqttApplicationMessage > subscription)
 
- Public Member Functions inherited from IotDash.Services.Mqtt.MqttMediator
abstract bool HasSubscribersOnTopic (string topic)
 
MqttApplicationMessage? GetRetained (string topic)
 
override Task Send (string channel, object sender, MqttApplicationMessage msg)
 
Task Send (string topic, object sender, string content)
 
- Public Member Functions inherited from IotDash.Domain.Mediator.AbstractMediator< string, MqttApplicationMessage >
virtual void Subscribe (TChannelKey msgChannel, ITarget< TChannelKey, TMsg > target, out ISubscription subscription)
 
virtual void Subscribe (TChannelKey msgChannel, ITarget< TChannelKey, TMsg > target, SubscriptionGuard guard)
 
abstract int TargetCountOnChannel (TChannelKey key)
 
abstract IEnumerable< ITarget< TChannelKey, TMsg > > GetChannelCopy (TChannelKey key)
 
abstract void Unsubscribe (ISubscription< TChannelKey, TMsg > subscription)
 
abstract Task Send (TChannelKey msgChannel, object sender, TMsg msg)
 

Protected Member Functions

override async Task MqttSend (string msgChannel, object sender, MqttApplicationMessage msg)
 
override void SubscribeInternal (string topic, ITarget< string, MqttApplicationMessage > target)
 
abstract Task MqttSend (string channel, object sender, MqttApplicationMessage msg)
 
- Protected Member Functions inherited from IotDash.Domain.Mediator.AbstractMediator< string, MqttApplicationMessage >
abstract void SubscribeInternal (TChannelKey msgChannel, ITarget< TChannelKey, TMsg > target)
 

Properties

override int TargetCount [get]
 
override IEnumerable< string > Keys [get]
 
- Properties inherited from IotDash.Domain.Mediator.AbstractMediator< string, MqttApplicationMessage >
abstract int TargetCount [get]
 
abstract IEnumerable< TChannelKey > Keys [get]
 

Detailed Description

A component of the HostedMqttService. Specialisation of MqttMediator designed to work with the MQTTnet.Client.MqttClient.

Member Function Documentation

◆ HasSubscribersOnTopic()

override bool IotDash.Services.Mqtt.Implementation.MqttNet_Mediator.HasSubscribersOnTopic ( string  topic)
virtual

Check if there are any subscribers on given topic .

Parameters
topicThe topic to check.
Returns
true if there are any subscribers.

Implements IotDash.Services.Mqtt.MqttMediator.

◆ MqttSend()

override async Task IotDash.Services.Mqtt.Implementation.MqttNet_Mediator.MqttSend ( string  msgChannel,
object  sender,
MqttApplicationMessage  msg 
)
inlineprotectedvirtual

Send or receive a message. If the sender is the associated HostedMqttService, then the message is broadcasted to in-application listeners. Otherwise the sender is from inside the application, so the message is sent to the broker.

Parameters
msgChannelThe MQTT topic.
senderSender of the message.
msgMessage to send.
Returns

Implements IotDash.Services.Mqtt.MqttMediator.

◆ Subscribe() [1/2]

override void IotDash.Services.Mqtt.Implementation.MqttNet_Mediator.Subscribe ( string  topic,
ITarget< string, MqttApplicationMessage >  target,
out ISubscription  subscription 
)
inline

Subscribe target to all messages on given MQTT topic producing a subscription .

Parameters
topicThe topic to subscribe to.
targetThe target of the events.
subscriptionSubscription object.

◆ Subscribe() [2/2]

override void IotDash.Services.Mqtt.Implementation.MqttNet_Mediator.Subscribe ( string  topic,
ITarget< string, MqttApplicationMessage >  target,
SubscriptionGuard  guard 
)
inline

Subscribe target to all messages on given MQTT topic registering the produced subscription under a given guard .

Parameters
topicThe topic to subscribe to.
targetThe target of the events.
guardSubscription guard under which to register produced ISubscription.

◆ Unsubscribe()

override void IotDash.Services.Mqtt.Implementation.MqttNet_Mediator.Unsubscribe ( ISubscription< string, MqttApplicationMessage >  subscription)
inline

Cancel the given subscription .

Parameters
subscriptionThe subscription to cancel.

The documentation for this class was generated from the following file: