Skip to content

UOperatingSystemDeviceMessenger

#include <OperatingSystemSimulator/Public/Devices/OperatingSystemDeviceMessenger.h>
class UOperatingSystemDeviceMessenger

Defined in OperatingSystemDeviceMessenger.h:98

Inherits: UObject

---
config:
  class:
    hideEmptyMembersBox: true
---
classDiagram
  class UOperatingSystemDeviceMessenger["UOperatingSystemDeviceMessenger"]
  class UObject["UObject"]
  UObject <|-- UOperatingSystemDeviceMessenger
---
config:
  class:
    hideEmptyMembersBox: true
---
classDiagram
  class UOperatingSystemDeviceMessenger["UOperatingSystemDeviceMessenger"]
  class UOperatingSystemBaseDevice["UOperatingSystemBaseDevice"]
  UOperatingSystemDeviceMessenger *-- UOperatingSystemBaseDevice
---
config:
  class:
    hideEmptyMembersBox: true
---
classDiagram
  class UOperatingSystemDeviceMessenger {
    +UOperatingSystemDeviceMessenger()
    +BeginDestroyMessenger()
    +Broadcast(const FName EventName, UObject *Payload)
    +BeginListening(const FName ListenToEventName, const FOpera
    +StopListening(const FName EventName)
    +CreateMessenger(AOperatingSystemDeviceActor *NewDevice) UOperatingSystemDeviceMessenger() *
    +OnConstructed()
    +GetParentDevice() const TWeakObjectPtr< UOperatingSystemBaseDevi
    +K2_OnConstructed()
    +K2_OnMessengerBeginDestroy()
    +ParentDevice : TWeakObjectPtr< UOperatingSystemBaseDevi
  }

A class that provides messaging functionality for an operating system device.

This class is responsible for broadcasting and listening to events in the operating system device. It allows communication between different components of the device.

A class that creates a messenger for an operating system device.

This method creates a messenger for the specified operating system device. The messenger is responsible for broadcasting and listening to events in the device, allowing communication between different components of the device.

  • NewDevice The operating system device for which to create the messenger.

A pointer to the created messenger, or nullptr if the creation failed or the messenger class is null.

See also: AOperatingSystemDeviceActor, UOperatingSystemDeviceMessenger::BroadcastEvent, UOperatingSystemDeviceMessenger::BeginListening, UOperatingSystemDeviceMessenger::StopListening

ReturnNameDescription
UOperatingSystemDeviceMessenger
voidBeginDestroyMessengerBegins the process of destroying the operating system device messenger.
voidBroadcastBroadcasts an event with a payload. The event name is specified by the EventName parameter, and the payload object is specified by the Payload parameter.
voidBeginListeningStarts listening for a specific event and registers the specified callback to be executed when the event occurs. The event can be triggered by an operating system device, and the registered callback will be notified with the event details.
voidStopListeningStops listening to a specific event identified by its name. Once this method is called, the device messenger will no longer receive events with the specified name.

UOperatingSystemDeviceMessenger()

Defined in OperatingSystemDeviceMessenger.h:115


void BeginDestroyMessenger()

Defined in OperatingSystemDeviceMessenger.h:153 Begins the process of destroying the operating system device messenger.

This method is called when the operating system device is being destroyed. It performs the necessary clean-up tasks to ensure a proper destruction of the messenger.

Example usage:

UOperatingSystemDeviceMessenger* DeviceMessenger; // Assume this variable is already initialized.
DeviceMessenger->BeginDestroyMessenger();

See also: UOperatingSystemDeviceMessenger


void Broadcast(const FName EventName, UObject * Payload)

Defined in OperatingSystemDeviceMessenger.h:162 Broadcasts an event with a payload. The event name is specified by the EventName parameter, and the payload object is specified by the Payload parameter.

  • EventName The name of the event to be broadcasted.

  • Payload The payload object associated with the event.


void BeginListening(const FName ListenToEventName, const FOperatingSystemDeviceMessageDelegate & Callback)

Defined in OperatingSystemDeviceMessenger.h:187 Starts listening for a specific event and registers the specified callback to be executed when the event occurs. The event can be triggered by an operating system device, and the registered callback will be notified with the event details.

  • ListenToEventName The name of the event to listen to.

  • Callback The delegate that will be called when the event occurs.

Example usage:

UOperatingSystemDeviceMessenger* DeviceMessenger; // Assume this variable is already initialized.
FName EventName = "MyEvent";
DeviceMessenger->BeginListening(EventName, [&](const FOperatingSystemDeviceMessage& Message) {
// Process the event details...
});

See also: FOperatingSystemDeviceMessage, FOperatingSystemDeviceMessageDelegate


void StopListening(const FName EventName)

Defined in OperatingSystemDeviceMessenger.h:196 Stops listening to a specific event identified by its name. Once this method is called, the device messenger will no longer receive events with the specified name.

  • EventName The name of the event to stop listening to.
ReturnNameDescription
UOperatingSystemDeviceMessenger *CreateMessenger static

static

static UOperatingSystemDeviceMessenger * CreateMessenger(AOperatingSystemDeviceActor * NewDevice)

Defined in OperatingSystemDeviceMessenger.h:134

  • NEW_SOFT_OBJ
  • OS_LOG_VERBOSE
ReturnNameDescription
voidOnConstructed virtual inlineThis method is called when the operating system device messenger is constructed.
TWeakObjectPtr< UOperatingSystemBaseDevice >GetParentDevice constRetrieves the parent device associated with this operating system device.
voidK2_OnConstructedA method that is called when an object of the OperatingSystemDeviceMessenger class is constructed.
voidK2_OnMessengerBeginDestroyK2_OnMessengerBeginDestroy function.

virtual inline

virtual inline void OnConstructed()

Defined in OperatingSystemDeviceMessenger.h:206 This method is called when the operating system device messenger is constructed.

This method is virtual and can be overridden by subclasses to perform custom initialization tasks when the messenger is constructed. Subclasses should override this method to provide any necessary initialization logic specific to the subclass.


const

TWeakObjectPtr< UOperatingSystemBaseDevice > GetParentDevice() const

Defined in OperatingSystemDeviceMessenger.h:218 Retrieves the parent device associated with this operating system device.

This method returns the parent device actor that is associated with the current operating system device. If no parent device actor is set, it returns nullptr.

The parent device actor, or nullptr if no parent device actor is set.

See also: DeviceActor


void K2_OnConstructed()

Defined in OperatingSystemDeviceMessenger.h:229 A method that is called when an object of the OperatingSystemDeviceMessenger class is constructed.

This method is blueprint implementable, allowing it to be overridden in blueprint subclasses. It is intended to be used for any necessary initialization logic when an object is created.


void K2_OnMessengerBeginDestroy()

Defined in OperatingSystemDeviceMessenger.h:237 K2_OnMessengerBeginDestroy function.

This function is a BlueprintImplementableEvent that is part of the OperatingSystemDeviceMessenger class. It is used to handle the logic when the messenger begins destruction.

ReturnNameDescription
TWeakObjectPtr< UOperatingSystemBaseDevice >ParentDeviceThe device that owns this messenger.

TWeakObjectPtr< UOperatingSystemBaseDevice > ParentDevice

Defined in OperatingSystemDeviceMessenger.h:104 The device that owns this messenger.