libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
Ship::ControllerLED Class Reference

Aggregates LED output mappings and drives controller lighting hardware. More...

#include <ControllerLED.h>

Public Member Functions

void SetControlDeck (std::shared_ptr< ControlDeck > controlDeck)
 Injects the owning ControlDeck.
 
 ControllerLED (uint8_t portIndex, std::shared_ptr< ConsoleVariable > consoleVariable=nullptr, std::shared_ptr< ControlDeck > controlDeck=nullptr)
 Constructs a ControllerLED for the given port.
 
 ~ControllerLED ()
 
std::unordered_map< std::string, std::shared_ptr< ControllerLEDMapping > > GetAllLEDMappings ()
 Returns a copy of the full id → mapping map.
 
void AddLEDMapping (std::shared_ptr< ControllerLEDMapping > mapping)
 Adds an LED mapping to the collection.
 
void ClearLEDMappingId (std::string id)
 Removes the mapping ID from Config without destroying the in-memory object.
 
void ClearLEDMapping (std::string id)
 Removes the mapping with id from both in-memory and Config.
 
void SaveLEDMappingIdsToConfig ()
 Writes the current set of mapping IDs to Config.
 
void ClearAllMappings ()
 Removes all in-memory LED mappings.
 
void ClearAllMappingsForDeviceType (PhysicalDeviceType physicalDeviceType)
 Removes all mappings that target the given device type.
 
void LoadLEDMappingFromConfig (std::string id)
 Loads the mapping with id from Config and adds it to the collection.
 
void ReloadAllMappingsFromConfig ()
 Clears all in-memory mappings and reloads them from Config.
 
bool AddLEDMappingFromRawPress ()
 Listens for the next raw physical input and creates an LED mapping from it.
 
void SetLEDColor (Color_RGB8 color)
 Sends color to all mapped physical devices.
 
bool HasMappingsForPhysicalDeviceType (PhysicalDeviceType physicalDeviceType)
 Returns true if any mapping targets the given device type.
 

Detailed Description

Aggregates LED output mappings and drives controller lighting hardware.

ControllerLED holds a collection of ControllerLEDMapping instances and fans out SetLEDColor() calls to each one so that a single logical colour change activates the LED on every mapped physical device simultaneously.

Mappings are persisted in Config and applied via the standard load/save helpers.

Constructor & Destructor Documentation

◆ ControllerLED()

Ship::ControllerLED::ControllerLED ( uint8_t  portIndex,
std::shared_ptr< ConsoleVariable consoleVariable = nullptr,
std::shared_ptr< ControlDeck controlDeck = nullptr 
)

Constructs a ControllerLED for the given port.

Parameters
portIndexZero-based port index.

◆ ~ControllerLED()

Ship::ControllerLED::~ControllerLED ( )

Member Function Documentation

◆ AddLEDMapping()

void Ship::ControllerLED::AddLEDMapping ( std::shared_ptr< ControllerLEDMapping mapping)

Adds an LED mapping to the collection.

Parameters
mappingMapping to add. Its ID must be unique.

◆ AddLEDMappingFromRawPress()

bool Ship::ControllerLED::AddLEDMappingFromRawPress ( )

Listens for the next raw physical input and creates an LED mapping from it.

Returns
true if a mapping was successfully created.

◆ ClearAllMappings()

void Ship::ControllerLED::ClearAllMappings ( )

Removes all in-memory LED mappings.

◆ ClearAllMappingsForDeviceType()

void Ship::ControllerLED::ClearAllMappingsForDeviceType ( PhysicalDeviceType  physicalDeviceType)

Removes all mappings that target the given device type.

Parameters
physicalDeviceTypeDevice type whose mappings should be cleared.

◆ ClearLEDMapping()

void Ship::ControllerLED::ClearLEDMapping ( std::string  id)

Removes the mapping with id from both in-memory and Config.

Parameters
idMapping UUID.

◆ ClearLEDMappingId()

void Ship::ControllerLED::ClearLEDMappingId ( std::string  id)

Removes the mapping ID from Config without destroying the in-memory object.

Parameters
idMapping UUID.

◆ GetAllLEDMappings()

std::unordered_map< std::string, std::shared_ptr< ControllerLEDMapping > > Ship::ControllerLED::GetAllLEDMappings ( )

Returns a copy of the full id → mapping map.

◆ HasMappingsForPhysicalDeviceType()

bool Ship::ControllerLED::HasMappingsForPhysicalDeviceType ( PhysicalDeviceType  physicalDeviceType)

Returns true if any mapping targets the given device type.

Parameters
physicalDeviceTypeDevice type to query.

◆ LoadLEDMappingFromConfig()

void Ship::ControllerLED::LoadLEDMappingFromConfig ( std::string  id)

Loads the mapping with id from Config and adds it to the collection.

Parameters
idMapping UUID stored in Config.

◆ ReloadAllMappingsFromConfig()

void Ship::ControllerLED::ReloadAllMappingsFromConfig ( )

Clears all in-memory mappings and reloads them from Config.

◆ SaveLEDMappingIdsToConfig()

void Ship::ControllerLED::SaveLEDMappingIdsToConfig ( )

Writes the current set of mapping IDs to Config.

◆ SetControlDeck()

void Ship::ControllerLED::SetControlDeck ( std::shared_ptr< ControlDeck controlDeck)
inline

Injects the owning ControlDeck.

◆ SetLEDColor()

void Ship::ControllerLED::SetLEDColor ( Color_RGB8  color)

Sends color to all mapped physical devices.

Parameters
colorRGB colour to apply to the controller LED(s).

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