Package org.harctoolbox.girr
Class Remote
java.lang.Object
org.harctoolbox.girr.XmlExporter
org.harctoolbox.girr.Remote
- All Implemented Interfaces:
Serializable
,Iterable<CommandSet>
,Named
This class describes a remote in Girr.
A Remote is essentially an abstraction of a hand-held "clicker" for controlling one device.
It has a name for identification, and a number of comment-like text fields. Most importantly,
it has a dictionary of CommandSets, indexed by their names.
The CommandSets contain Commands, having names that are unique within their CommandSet.
Note that Commands with the same name can be present in different CommandSets.
For example, some TVs have both an RC5 and an RC6 Command set, both containing a command "power",
but these are or course different.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
This class bundles different meta data for a remote together.Nested classes/interfaces inherited from interface org.harctoolbox.girr.Named
Named.CompareNameCaseInsensitive, Named.CompareNameCaseSensitive
-
Constructor Summary
ConstructorDescriptionThis constructor is used to read a Reader into a Remote.This constructor is used to read a Girr file into a Remote.Remote
(CommandSet commandSet) Remote
(Remote.MetaData metaData, String source, String comment, Map<String, String> notes, Collection<CommandSet> commandSetsCollection, Map<String, Map<String, String>> applicationParameters) Construct a Remote from its arguments, general case.Remote
(Remote.MetaData metaData, String source, String comment, Map<String, String> notes, Map<String, Command> commands, Map<String, Map<String, String>> applicationParameters, String protocolName, Map<String, Long> parameters) Remote
(Remote.MetaData metaData, String comment, Map<String, String> notes, Collection<CommandSet> commandSetsCollection, Map<String, Map<String, String>> applicationParameters) Remote
(Remote.MetaData metaData, String comment, Map<String, String> notes, Map<String, Command> commands, Map<String, Map<String, String>> applicationParameters) Remote
(Remote.MetaData metaData, String comment, Map<String, String> notes, Map<String, Command> commands, Map<String, Map<String, String>> applicationParameters, String protocolName, Map<String, Long> parameters) Remote
(Remote.MetaData metaData, String comment, Map<String, String> notes, CommandSet commandSet, Map<String, Map<String, String>> applicationParameters) This constructor constructs a Remote from one single IrSignal.This constructor is used to import a Document.XML import function. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFormat
(Command.CommandTextFormat format, int repeatCount) Applies the format argument to all Command's in the Remote.void
boolean
containsThisProtocol
(String protocolName) Returns true if and only if at least one contained commands has the protocol in the argument.(package private) AdminData
getCommand
(String name) Deprecated.Loop the CommandSets instead.getCommand
(String commandSetName, String name) Deprecated.Loop the CommandSets instead.getCommandSet
(String name) getModel()
getName()
Return the name of the object.getNotes()
int
Deprecated.Loop the CommandSets instead.boolean
hasThisProtocol
(String protocolName) Returns true if and only if all contained commands has the protocol in the argument.iterator()
void
Replaces all CommandSets with a single one, containing all the commands of the original CommandSets.(package private) void
setComment
(String comment) void
void
void
void
sort()
void
sort
(Comparator<? super Named> comparator) Apply the sort function to all contained CommandSets.void
void
sortCommands
(Comparator<? super Named> comparator) void
void
void
strip()
Apply the strip function to all the CommandSets.toElement
(Document doc, boolean fatRaw, boolean generateParameters, boolean generateProntoHex, boolean generateRaw) Exports the Object to an Element.Methods inherited from class org.harctoolbox.girr.XmlExporter
getElement, getElement, getElement, getElement, getElement, getElement, getElement, print, print, print, print, print, toDocument
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Remote
This constructor is used to read a Girr file into a Remote.- Parameters:
file
- Girr file; must have "remote" as the root element.- Throws:
GirrException
IOException
SAXException
-
Remote
This constructor is used to read a Reader into a Remote.- Parameters:
reader
- Reader producing a Document with a top level element "remote".- Throws:
GirrException
IOException
SAXException
-
Remote
This constructor is used to import a Document.- Parameters:
doc
- W3C Document with root element of type "remote".- Throws:
GirrException
-
Remote
XML import function.- Parameters:
element
- Element to read from. Must be tag name "remote".source
- Textual representation of the origin of the information.- Throws:
GirrException
-
Remote
public Remote(Remote.MetaData metaData, String source, String comment, Map<String, String> notes, Collection<CommandSet> commandSetsCollection, Map<String, Map<String, String>> applicationParameters) Construct a Remote from its arguments, general case.- Parameters:
metaData
- Remote.MetaData meta datasource
- Textual representation of the origin of the informationcomment
- Textual commentnotes
- Textual notescommandSetsCollection
- Collection<CommandSet>applicationParameters
-
-
Remote
public Remote(Remote.MetaData metaData, String comment, Map<String, String> notes, Collection<CommandSet> commandSetsCollection, Map<String, Map<String, String>> applicationParameters) -
Remote
-
Remote
-
Remote
-
Remote
-
Remote
public Remote(org.harctoolbox.ircore.IrSignal irSignal, String name, String comment, String deviceName) This constructor constructs a Remote from one single IrSignal.- Parameters:
irSignal
-name
- Name of command to be constructed.comment
- Comment for command to be constructed.deviceName
-
-
Remote
-
-
Method Details
-
toElement
public Element toElement(Document doc, boolean fatRaw, boolean generateParameters, boolean generateProntoHex, boolean generateRaw) Description copied from class:XmlExporter
Exports the Object to an Element.- Specified by:
toElement
in classXmlExporter
- Parameters:
doc
- Owner Document.fatRaw
- If generating the raw form, generate it in the so-called fat form, with one element per duration.generateParameters
- If true, generate the parameter form.generateProntoHex
- If true, generate the Pronto Hex form.generateRaw
- If true, generate the raw form.- Returns:
- newly constructed element, belonging to the doc Document.
-
sort
Apply the sort function to all contained CommandSets.- Parameters:
comparator
-
-
sortCommands
-
sortCommands
public void sortCommands() -
sortCommandsIgnoringCase
public void sortCommandsIgnoringCase() -
sort
public void sort() -
sortIgnoringCase
public void sortIgnoringCase() -
normalize
public void normalize()Replaces all CommandSets with a single one, containing all the commands of the original CommandSets. Note that only one commend with a particular name is present after this operation, so information may be lost. -
addFormat
Applies the format argument to all Command's in the Remote.- Parameters:
format
-repeatCount
-
-
hasThisProtocol
public boolean hasThisProtocol(String protocolName) throws org.harctoolbox.irp.IrpException, org.harctoolbox.ircore.IrCoreException Returns true if and only if all contained commands has the protocol in the argument.- Parameters:
protocolName
-- Returns:
- Throws:
org.harctoolbox.irp.IrpException
org.harctoolbox.ircore.IrCoreException
-
containsThisProtocol
public boolean containsThisProtocol(String protocolName) throws org.harctoolbox.irp.IrpException, org.harctoolbox.ircore.IrCoreException Returns true if and only if at least one contained commands has the protocol in the argument.- Parameters:
protocolName
-- Returns:
- Throws:
org.harctoolbox.irp.IrpException
org.harctoolbox.ircore.IrCoreException
-
getMetaData
- Returns:
- the metaData
-
getName
Description copied from interface:Named
Return the name of the object. -
setName
-
getDisplayName
- Returns:
- displayName of the Remote.
-
getComment
- Returns:
- the comment
-
getNumberOfCommands
public int getNumberOfCommands()Deprecated.Loop the CommandSets instead.- Returns:
-
getCommands
Deprecated.Loop the CommandSets instead.Returns all commands contained. If there are several CommandSets, the index names will be two part: commandSet : command.- Returns:
- the commands
-
getCommand
Deprecated.Loop the CommandSets instead.- Parameters:
name
-- Returns:
-
getApplicationParameters
- Returns:
- the applicationParameters
-
getManufacturer
- Returns:
- the manufacturer
-
getModel
- Returns:
- the model
-
getDeviceClass
- Returns:
- the deviceClass
-
getRemoteName
- Returns:
- the remoteName
-
getAdminData
AdminData getAdminData() -
getFormattedAdminData
-
getAllNotes
- Returns:
- the notes
-
getNotes
- Returns:
- the notes
-
getNotes
- Parameters:
lang
-- Returns:
- the notes
-
setNotes
-
setNotes
-
setComment
-
checkForParameters
public void checkForParameters() throws org.harctoolbox.irp.IrpException, org.harctoolbox.ircore.IrCoreException- Throws:
org.harctoolbox.irp.IrpException
org.harctoolbox.ircore.IrCoreException
-
iterator
- Specified by:
iterator
in interfaceIterable<CommandSet>
-
getCommandSets
-
getCommandSet
-
getCommand
-
strip
public void strip()Apply the strip function to all the CommandSets.
-