Class that controls mapping remote state to actions. All the remote mappings will be handled here. One passes a RemoteMapState and a set of Commands for which the RemoteMapState is mapped to a CommandMapping sub-object. Once a command mapping is created, pass this command mapping to the CommandMapper's addMap function. This will register the mapping such that the CommandMapping's executeCommandMapping function will be called each time new remote information is received.
For example, given the command coolCommand, to map a hold mapping to the left switch in the up position, we define a HoldCommandMapping and then add it to the CommandMapper as follows (where drivers is assumed to be a global drivers object that has a CommandMapper object):
drivers,
{&coolCommand},
RemoteMapState(Remote::Switch::LEFT_SWITCH, Remote::SwitchState::UP));
control::CommandMapper commandMapper
Definition drivers.hpp:135
mockable void addMap(CommandMapping *mapping)
Definition command_mapper.cpp:67
Definition hold_command_mapping.hpp:45
Definition remote_map_state.hpp:56
- Note
- Only unique RemoteMapStates can be added to the CommandMapper. This ensures a user will not accidently map two
Commands to the same RemoteMapState without knowing they did so. Instead, the user must explicitly add Commands to a common vector that maps to a single RemoteMapState.