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 ClassesNested classes/interfaces inherited from class org.harctoolbox.irp.Protocol
Protocol.ProtocolNotDecodableException, Protocol.ProtocolNotRenderableException -
Constructor Summary
ConstructorsConstructorDescriptionNamedProtocol(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 voidcheckFrequency(Double frequency, Decoder.DecoderParameters params) intcompareTo(NamedProtocol namedProtocol) voidvoiddumpPreferOvers(PrintStream out, IrpDatabase irpDatabase) voiddumpPreferOvers(PrintStream out, IrpDatabase irpDatabase, int level) booleandoubledoubledoublegetName()Returns the prefer-overs.Returns the parameters relativeTolerance, or null if not assigned.doubleReturns the parameters relativeTolerance, or the default value if not assigned.inthashCode()booleanbooleanpreferredOvers(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 DocumenttoDocument(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
addDefaulteds, 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, weightMethods 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:
recognizein classProtocol- Parameters:
irSignal-strict-- Returns:
- Throws:
SignalRecognitionExceptionProtocol.ProtocolNotDecodableException
-
recognize
public Map<String,Long> recognize(IrSignal irSignal, Decoder.DecoderParameters params) throws Protocol.ProtocolNotDecodableException, SignalRecognitionException - Overrides:
recognizein classProtocol- Throws:
Protocol.ProtocolNotDecodableExceptionSignalRecognitionException
-
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:
SignalRecognitionExceptionProtocol.ProtocolNotDecodableException
-
checkFrequency
protected void checkFrequency(Double frequency, Decoder.DecoderParameters params) throws SignalRecognitionException - Overrides:
checkFrequencyin classProtocol- Throws:
SignalRecognitionException
-
warningsString
Description copied from class:ProtocolThis is sort-of a version of classificationString, but for another audience.- Overrides:
warningsStringin 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:
toStringin interfaceHasPreferOvers
-
getName
- Specified by:
getNamein 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:HasPreferOversReturns the prefer-overs.- Specified by:
getPreferOverNamesin interfaceHasPreferOvers- Returns:
- Set<String> of the names of protocols that are prefer-overs.
-
toDocument
- Specified by:
toDocumentin interfaceXmlExport- Overrides:
toDocumentin classIrpObject
-
toElement
-
compareTo
- Specified by:
compareToin interfaceComparable<NamedProtocol>
-