Package org.harctoolbox.irp
Class NamedProtocol
java.lang.Object
org.harctoolbox.irp.IrpObject
org.harctoolbox.irp.Protocol
org.harctoolbox.irp.NamedProtocol
- All Implemented Interfaces:
Serializable
,Comparable<NamedProtocol>
,AggregateLister
,HasPreferOvers
,XmlExport
public final class NamedProtocol
extends Protocol
implements HasPreferOvers, Comparable<NamedProtocol>
This class extends the Protocol class
Protocol
class with a few more
properties, in particular a name. It corresponds to an entry in the protocol data
base IrpProtocols.xml
.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.harctoolbox.irp.Protocol
Protocol.ProtocolNotDecodableException, Protocol.ProtocolNotRenderableException
-
Constructor Summary
ConstructorDescriptionNamedProtocol
(String name, String irp, DocumentFragment documentation) NamedProtocol
(String name, String irp, DocumentFragment htmlDocumentation, String frequencyTolerance, String frequencyLower, String frequencyUpper, String absoluteTolerance, String relativeTolerance, String minimumLeadout, String decodable, String rejectRepeatless, List<String> preferOver, Map<String, List<String>> map) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkFrequency
(Double frequency, Decoder.DecoderParameters params) int
compareTo
(NamedProtocol namedProtocol) void
void
dumpPreferOvers
(PrintStream out, IrpDatabase irpDatabase) void
dumpPreferOvers
(PrintStream out, IrpDatabase irpDatabase, int level) boolean
double
double
double
getName()
Returns the prefer-overs.Returns the parameters relativeTolerance, or null if not assigned.double
Returns the parameters relativeTolerance, or the default value if not assigned.int
hashCode()
boolean
boolean
preferredOvers
(Map<String, Long> params) preferredOvers
(IrpDatabase irpDatabase) preferredOvers
(IrpDatabase irpDatabase, int level) This version overrides a version inProtocol
.recognize
(IrSignal irSignal, Decoder.DecoderParameters params) recognize
(ModulatedIrSequence irSequence, int beginPos, Decoder.DecoderParameters userSuppliedDecoderParameters) Tries to match the ModulatedIrSequence in the argument, if match, return the matching parameters.render
(NameEngine nameEngine) static Document
toDocument
(Iterable<NamedProtocol> protocols) toString()
toString
(int radix) This is sort-of a version of classificationString, but for another audience.Methods inherited from class org.harctoolbox.irp.Protocol
allDurationsInMicros, classificationString, constantNonEmptySequence, constantSequence, createParameterSpecsIfPossible, fillInDefaults, getBitDirection, getBitspecIrstream, getDecoderName, getDefinitions, getDutyCycle, getFrequency, getFrequencyWithDefault, getGeneralSpec, getIrp, getParameterDefault, getParameterMax, getParameterMin, getParameterSpecs, getUnit, guessParameterLength, hasExtent, hasNonStandardParameters, hasParameter, hasParameterDefault, hasParameterMemory, hasVariation, interleavingFlashOk, interleavingGapOk, interleavingOk, isBiphase, isEmpty, isPWM2, isPWM4, isRPlus, isSonyType, isTrivial, isTrivial, minDurationDiff, nonConstantBitFieldLength, nonEmptySequence, normalBareIrStream, normalForm, normalFormElement, normalFormIrpString, normalFormProtocol, numberOfBits, numberOfInfiniteRepeats, propertiesMap, randomParameters, randomParameters, recognize, recognize, recognize, recognize, removeDefaulteds, sort, startsWithFlash, substituteConstantVariables, toIrpString, toIrpString, toIrpString, toIrpString, toIrSignal, toIrSignal, toModulatedIrSequence, toStringTree, toTreeViewer, warningFrequency, warningNonConstantLengthBitFields, warningNoParameterSpecs, warningRepeatPlus, warningsInterleaving, warningStartsWithFlash, warningTrivialBitspec, weight
Methods inherited from class org.harctoolbox.irp.IrpObject
createParameterSpecs, getParseTree, numberOfBitSpecs, prerender, propertiesMap, toIrpString, toStringTree, toStringTree, toTreeViewer, toTreeViewer, toTreeViewer, updateStateWhenEntering, updateStateWhenExiting
-
Constructor Details
-
NamedProtocol
public NamedProtocol(String name, String irp, DocumentFragment htmlDocumentation, String frequencyTolerance, String frequencyLower, String frequencyUpper, String absoluteTolerance, String relativeTolerance, String minimumLeadout, String decodable, String rejectRepeatless, List<String> preferOver, Map<String, List<String>> map) throws InvalidNameException, UnsupportedRepeatException, NameUnassignedException, IrpInvalidArgumentException -
NamedProtocol
public NamedProtocol(String name, String irp, DocumentFragment documentation) throws InvalidNameException, UnsupportedRepeatException, NameUnassignedException, IrpInvalidArgumentException
-
-
Method Details
-
toDocument
-
preferredOvers
-
preferredOvers
-
preferredOvers
public Set<String> preferredOvers(IrpDatabase irpDatabase) throws InvalidNameException, UnsupportedRepeatException, IrpInvalidArgumentException, NameUnassignedException, NamedProtocol.TooDeepPreferOversException -
preferredOvers
public Set<String> preferredOvers(IrpDatabase irpDatabase, int level) throws UnsupportedRepeatException, IrpInvalidArgumentException, NameUnassignedException, NamedProtocol.TooDeepPreferOversException -
dumpPreferOvers
-
dumpPreferOvers
public void dumpPreferOvers(PrintStream out, IrpDatabase irpDatabase) throws NamedProtocol.TooDeepPreferOversException -
dumpPreferOvers
public void dumpPreferOvers(PrintStream out, IrpDatabase irpDatabase, int level) throws NamedProtocol.TooDeepPreferOversException -
recognize
public Map<String,Long> recognize(IrSignal irSignal, boolean strict) throws SignalRecognitionException, Protocol.ProtocolNotDecodableException This version overrides a version inProtocol
. It uses protocol specific parameter values forfrequencyTolerance, absoluteTolerance, relativeTolerance
, andminimumLeadout
, if defined.- Overrides:
recognize
in classProtocol
- Parameters:
irSignal
-strict
-- Returns:
- Throws:
SignalRecognitionException
Protocol.ProtocolNotDecodableException
-
recognize
public Map<String,Long> recognize(IrSignal irSignal, Decoder.DecoderParameters params) throws Protocol.ProtocolNotDecodableException, SignalRecognitionException - Overrides:
recognize
in classProtocol
- Throws:
Protocol.ProtocolNotDecodableException
SignalRecognitionException
-
recognize
public Decoder.Decode recognize(ModulatedIrSequence irSequence, int beginPos, Decoder.DecoderParameters userSuppliedDecoderParameters) throws SignalRecognitionException, Protocol.ProtocolNotDecodableException Tries to match the ModulatedIrSequence in the argument, if match, return the matching parameters. If no match, throws exception. The ModulatedIrSequence should contain intro or (one or many) repeat sequences, and possibly an ending sequence.- Parameters:
irSequence
- ModulatedIrSequence to be matchedbeginPos
- Where the match is effectively started, normally 0.userSuppliedDecoderParameters
-- Returns:
- Decoder.Decode object, containing matching data.
- Throws:
SignalRecognitionException
Protocol.ProtocolNotDecodableException
-
checkFrequency
protected void checkFrequency(Double frequency, Decoder.DecoderParameters params) throws SignalRecognitionException - Overrides:
checkFrequency
in classProtocol
- Throws:
SignalRecognitionException
-
warningsString
Description copied from class:Protocol
This is sort-of a version of classificationString, but for another audience.- Overrides:
warningsString
in classProtocol
- Returns:
-
hashCode
public int hashCode() -
equals
-
render
public IrSignal render(NameEngine nameEngine) throws DomainViolationException, NameUnassignedException, IrpInvalidArgumentException, InvalidNameException, Protocol.ProtocolNotRenderableException, OddSequenceLengthException -
toString
-
toString
-
toString
- Specified by:
toString
in interfaceHasPreferOvers
-
getName
- Specified by:
getName
in interfaceHasPreferOvers
- Returns:
- the name
-
getDocumentation
-
isDecodeable
public boolean isDecodeable() -
isRejectRepeats
public boolean isRejectRepeats() -
getRelativeTolerance
Returns the parameters relativeTolerance, or null if not assigned.- Returns:
-
getRelativeToleranceWithDefault
public double getRelativeToleranceWithDefault()Returns the parameters relativeTolerance, or the default value if not assigned.- Returns:
-
getAbsoluteTolerance
-
getAbsoluteToleranceWithDefault
public double getAbsoluteToleranceWithDefault() -
getFrequencyTolerance
-
getFrequencyToleranceWithDefault
public double getFrequencyToleranceWithDefault() -
getFrequencyUpper
-
getFrequencyLower
-
getMinimumLeadout
-
getMinimumLeadoutWithDefault
public double getMinimumLeadoutWithDefault() -
getPreferOverNames
Description copied from interface:HasPreferOvers
Returns the prefer-overs.- Specified by:
getPreferOverNames
in interfaceHasPreferOvers
- Returns:
- Set<String> of the names of protocols that are prefer-overs.
-
toDocument
- Specified by:
toDocument
in interfaceXmlExport
- Overrides:
toDocument
in classIrpObject
-
toElement
-
compareTo
- Specified by:
compareTo
in interfaceComparable<NamedProtocol>
-