Package org.harctoolbox.ircore
Class Pronto
java.lang.Object
org.harctoolbox.ircore.Pronto
- Direct Known Subclasses:
ShortPronto
This class, containing only static functions, allows for the creation of integer arrays
and strings containing Pronto (CCF) form of the signal. It cannot be instantiated,
since there are no "Pronto"s, it is just IrSignals in "another coordinates".
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Number of characters in the hexadecimal digits of Pronto strings.static final double
Constant used for computing the frequency code from the frequencyprotected static final int
static final String
Format code used to format integers in the Pronto Hex.protected static final int
protected static final int
Constant denoting "learned", modulated signals.protected static final int
Constant denoting "learned", non-modulated signals.protected static final int
protected static final int
protected static final int
protected static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
formatInteger
(int n) Formats an integer like seen in CCF strings, in printf-ish, using "%04X".static double
frequency
(int code) Computes the carrier frequency in Hz.static int
frequencyCode
(double frequency) Returns frequency code from frequency in Hz (the second number in the CCF).static void
static IrSignal
parse
(int[] ccf) Creates a new IrSignals by interpreting its argument as CCF signal.static IrSignal
Creates a new IrSignals by interpreting its argument as CCF string.static IrSignal
Creates a new IrSignals by interpreting its argument as CCF string.static IrSignal
Creates a new IrSignals by interpreting its argument as CCF string.static IrSignal
Creates a new IrSignals by interpreting its argument as CCF string.protected static int[]
parseAsInts
(String ccfString) Tries to parse the string as argument.static int[]
parseAsInts
(String[] array, int begin) Tries to parse the strings as argument.protected static int[]
parseAsInts
(List<String> list) static IrSignal
parseLoose
(String ccfString) static int
pulses
(double time, double frequency) Computes number of cycles of the carrier the first argument will require.static int
pulsesMicroSeconds
(double time, double frequency) Computes number of cycles of the carrier the first argument will require.static double
pulseTime
(int code) Computes pulse time in seconds.static int[]
CCF array of complete signal, i.e.static String
toString
(int[] array) Formats a CCF as string.static String
Computes the ("long", raw) CCF string, if possible.
-
Field Details
-
CHARS_IN_DIGIT
public static final int CHARS_IN_DIGITNumber of characters in the hexadecimal digits of Pronto strings.- See Also:
-
FREQUENCY_CONSTANT
public static final double FREQUENCY_CONSTANTConstant used for computing the frequency code from the frequency- See Also:
-
HEX_STRING_FORMAT
Format code used to format integers in the Pronto Hex.- See Also:
-
LEARNED_CODE
protected static final int LEARNED_CODEConstant denoting "learned", modulated signals.- See Also:
-
LEARNED_UNMODULATED_CODE
protected static final int LEARNED_UNMODULATED_CODEConstant denoting "learned", non-modulated signals.- See Also:
-
TYPE_INDEX
protected static final int TYPE_INDEX- See Also:
-
FREQUENCY_INDEX
protected static final int FREQUENCY_INDEX- See Also:
-
INTRO_LENGTH_INDEX
protected static final int INTRO_LENGTH_INDEX- See Also:
-
REPEAT_LENGTH_INDEX
protected static final int REPEAT_LENGTH_INDEX- See Also:
-
NUMBER_METADATA
protected static final int NUMBER_METADATA- See Also:
-
MIN_CCF_LENGTH
protected static final int MIN_CCF_LENGTH- See Also:
-
-
Constructor Details
-
Pronto
protected Pronto()
-
-
Method Details
-
formatInteger
Formats an integer like seen in CCF strings, in printf-ish, using "%04X".- Parameters:
n
- Integer to be formatted.- Returns:
- Formatted string
-
frequencyCode
public static int frequencyCode(double frequency) Returns frequency code from frequency in Hz (the second number in the CCF).- Parameters:
frequency
- Frequency in Hz.- Returns:
- code for the frequency.
-
frequency
Computes the carrier frequency in Hz.- Parameters:
code
- Pronto frequency code- Returns:
- Frequency in Hz.
- Throws:
InvalidArgumentException
-
pulseTime
Computes pulse time in seconds.- Parameters:
code
- Pronto frequency code.- Returns:
- Duration of one pulse of the carrier in seconds.
- Throws:
InvalidArgumentException
-
pulses
Computes number of cycles of the carrier the first argument will require. For frequency == 0, use 414514 as substitute.- Parameters:
time
- duration in secondsfrequency
-- Returns:
- number of pulses
- Throws:
InvalidArgumentException
- if frequency <= 0.
-
pulsesMicroSeconds
Computes number of cycles of the carrier the first argument will require.- Parameters:
time
- duration in micro secondsfrequency
-- Returns:
- number of pulses
- Throws:
InvalidArgumentException
- if frequency <= 0.
-
parse
Creates a new IrSignals by interpreting its argument as CCF signal.- Parameters:
ccf
- CCF signal- Returns:
- IrSignal
- Throws:
OddSequenceLengthException
InvalidArgumentException
-
parse
public static IrSignal parse(String ccfString) throws Pronto.NonProntoFormatException, InvalidArgumentException Creates a new IrSignals by interpreting its argument as CCF string.- Parameters:
ccfString
- CCF signal- Returns:
- IrSignal
- Throws:
InvalidArgumentException
Pronto.NonProntoFormatException
-
parseLoose
public static IrSignal parseLoose(String ccfString) throws Pronto.NonProntoFormatException, InvalidArgumentException -
parse
public static IrSignal parse(String[] array, int begin) throws Pronto.NonProntoFormatException, InvalidArgumentException Creates a new IrSignals by interpreting its argument as CCF string.- Parameters:
array
- Strings representing hexadecimal numbersbegin
- Starting index- Returns:
- IrSignal
- Throws:
Pronto.NonProntoFormatException
InvalidArgumentException
-
parse
public static IrSignal parse(String[] array) throws InvalidArgumentException, Pronto.NonProntoFormatException Creates a new IrSignals by interpreting its argument as CCF string.- Parameters:
array
- Strings representing hexadecimal numbers- Returns:
- IrSignal
- Throws:
InvalidArgumentException
Pronto.NonProntoFormatException
-
parse
public static IrSignal parse(List<String> list) throws InvalidArgumentException, Pronto.NonProntoFormatException Creates a new IrSignals by interpreting its argument as CCF string.- Parameters:
list
- Strings representing hexadecimal numbers- Returns:
- IrSignal
- Throws:
InvalidArgumentException
Pronto.NonProntoFormatException
-
parseAsInts
Tries to parse the string as argument. Can be used to test "Proto-ness" of an unknown string.- Parameters:
ccfString
- Input string, to be parsed/tested.- Returns:
- Integer array of numbers if successful, null if unsuccessful.
- Throws:
Pronto.NonProntoFormatException
-
parseAsInts
Tries to parse the strings as argument. Can be used to test "Proto-ness" of an unknown array of strings.- Parameters:
array
- Input strings, to be parsed/tested.begin
- Starting index- Returns:
- Integer array of numbers if successful, null if unsuccessful (e.g. by NumberFormatException).
- Throws:
Pronto.NonProntoFormatException
-
parseAsInts
- Throws:
Pronto.NonProntoFormatException
-
toArray
public static int[] toArray(IrSignal irSignal) throws OddSequenceLengthException, InvalidArgumentException CCF array of complete signal, i.e. the CCF string before formatting, including the header.- Parameters:
irSignal
-- Returns:
- CCF array
- Throws:
OddSequenceLengthException
InvalidArgumentException
-
toString
Computes the ("long", raw) CCF string, if possible. Since a CCF does not have an ending sequence, a nonempty ending sequence will be ignored.- Parameters:
irSignal
-- Returns:
- CCF string
-
toString
Formats a CCF as string.- Parameters:
array
- CCF in form of an integer array.- Returns:
- CCF string.
-
main
- Parameters:
args
-
-