Friendly LWM2M client
wpp::InstSubject Class Reference

The InstSubject class represents a subject that allows subscribers to be notified about various events related to instance resources. More...

#include <InstSubject.h>

+ Inheritance diagram for wpp::InstSubject:
+ Collaboration diagram for wpp::InstSubject:

Public Member Functions

void opSubscribe (InstOpObserver *observer)
 Subscribes an observer to receive notifications about instance resource operations. More...
 
void opUnsubscribe (InstOpObserver *observer)
 Unsubscribes an observer from receiving notifications about instance resource operations. More...
 
void eventSubscribe (InstEventObserver *observer)
 Subscribes an observer to receive notifications about custom instance events. More...
 
void eventUnsubscribe (InstEventObserver *observer)
 Unsubscribes an observer from receiving notifications about custom instance events. More...
 

Protected Member Functions

void operationNotify (Instance &inst, const ResLink &resLink, ItemOp::TYPE type)
 Notifies the observers about an operation on an instance resource. More...
 
void eventNotify (Instance &inst, EVENT_ID_T eventId)
 Notifies the observers about a custom instance event. More...
 

Detailed Description

The InstSubject class represents a subject that allows subscribers to be notified about various events related to instance resources.

This class provides functionality for subscribing and unsubscribing observers to receive notifications about operations, block operations, and custom events. The observers will be notified when there are write, delete, replace, and execute operations on instance resources initiated by the server. Custom instance events can also be subscribed to and unsubscribed from.

The InstSubject class is designed to be inherited by other classes that need to provide observer functionality for instance resources.

Definition at line 21 of file InstSubject.h.

Member Function Documentation

◆ eventNotify()

void wpp::InstSubject::eventNotify ( Instance inst,
EVENT_ID_T  eventId 
)
inlineprotected

Notifies the observers about a custom instance event.

This function is called internally to notify the subscribed observers about a custom instance event.

Parameters
instThe instance object on which the event occurred.
eventIdThe ID of the event.

Definition at line 100 of file InstSubject.h.

◆ eventSubscribe()

void wpp::InstSubject::eventSubscribe ( InstEventObserver observer)
inline

Subscribes an observer to receive notifications about custom instance events.

The observer will be notified when there are custom events related to the instance.

Parameters
observerA pointer to the observer object.

Definition at line 52 of file InstSubject.h.

◆ eventUnsubscribe()

void wpp::InstSubject::eventUnsubscribe ( InstEventObserver observer)
inline

Unsubscribes an observer from receiving notifications about custom instance events.

Parameters
observerA pointer to the observer object.

Definition at line 63 of file InstSubject.h.

◆ operationNotify()

void wpp::InstSubject::operationNotify ( Instance inst,
const ResLink resLink,
ItemOp::TYPE  type 
)
inlineprotected

Notifies the observers about an operation on an instance resource.

This function is called internally to notify the subscribed observers about an operation on an instance resource. The type of operation (read, write, replace, execute) is specified by the 'type' parameter.

Parameters
instThe instance object on which the operation is performed.
resIdThe resource link of the instance resource.
typeThe type of operation.

Definition at line 78 of file InstSubject.h.

+ Here is the caller graph for this function:

◆ opSubscribe()

void wpp::InstSubject::opSubscribe ( InstOpObserver observer)
inline

Subscribes an observer to receive notifications about instance resource operations.

The observer will be notified when there are write, delete, replace, and execute operations on instance resources initiated by the server.

Parameters
observerA pointer to the observer object.

Definition at line 30 of file InstSubject.h.

◆ opUnsubscribe()

void wpp::InstSubject::opUnsubscribe ( InstOpObserver observer)
inline

Unsubscribes an observer from receiving notifications about instance resource operations.

Parameters
observerA pointer to the observer object.

Definition at line 41 of file InstSubject.h.