Package jpigpio.packet
Class Protocol
java.lang.Object
jpigpio.packet.Protocol
public class Protocol
extends java.lang.Object
Class defining properties of RF communication signaling.
-
Field Summary
Fields Modifier and Type Field Description int
DATA_SIZE
datagram data size (in bytes)boolean
DGRM_KEEP_ON_ENCODING_ERROR
Set this to False to discard datagrams where encoding error was detected.int
DGRM_LENGTH
datagram length in bytes (always double of DATA_SIZE because datagrams are constructed out of nibbles (4bit))int
DGRM_REPEAT
int
DGRM_REPEAT_RX
report this many same datagrams as a single datagram (eliminate duplicates)int
DGRM_REPEAT_TX
repeat transmission of each datagram this many times to make sure at least one got throughint
DGRM_RX_TIMEOUT
int
RX_PULSE_MSGGAP
gap between datagrams (microsec)int
RX_PULSE_ONE
short pulse = 1 (one) (microsec)int
RX_PULSE_TOOSHORT
pulse too short to be considered meaningful (microsec)int
RX_PULSE_ZERO
long pulse = 0 (zero) (microsec)int[]
SYMBOL
int
TX_PULSE_HIGH
duration of high pulse (microsec)int
TX_PULSE_LOW
duration of low pulse (microsec)int
TX_PULSE_MSGGAP
gap between two datagrams (microsec) -
Constructor Summary
Constructors Constructor Description Protocol()
-
Method Summary
Modifier and Type Method Description int
nibble2sym(int nibble)
void
setDataSize(int size)
Set maximum transmitted datagram size in bytes.void
setRepeatCount(int repeatCount)
Set transmission repeat count.void
setRxRepeatCount(int rxRepeatCount)
void
setTxRepeatCount(int txRepeatCount)
int
sym2nibble(int symbol)
-
Field Details
-
DATA_SIZE
public int DATA_SIZEdatagram data size (in bytes) -
DGRM_LENGTH
public int DGRM_LENGTHdatagram length in bytes (always double of DATA_SIZE because datagrams are constructed out of nibbles (4bit)) -
DGRM_REPEAT
public int DGRM_REPEAT -
DGRM_REPEAT_TX
public int DGRM_REPEAT_TXrepeat transmission of each datagram this many times to make sure at least one got through -
DGRM_REPEAT_RX
public int DGRM_REPEAT_RXreport this many same datagrams as a single datagram (eliminate duplicates) -
DGRM_RX_TIMEOUT
public int DGRM_RX_TIMEOUT -
DGRM_KEEP_ON_ENCODING_ERROR
public boolean DGRM_KEEP_ON_ENCODING_ERRORSet this to False to discard datagrams where encoding error was detected. Under normal operation it makes no sense to keep such datagrams. -
TX_PULSE_MSGGAP
public int TX_PULSE_MSGGAPgap between two datagrams (microsec) -
TX_PULSE_HIGH
public int TX_PULSE_HIGHduration of high pulse (microsec) -
TX_PULSE_LOW
public int TX_PULSE_LOWduration of low pulse (microsec) -
RX_PULSE_TOOSHORT
public int RX_PULSE_TOOSHORTpulse too short to be considered meaningful (microsec) -
RX_PULSE_ONE
public int RX_PULSE_ONEshort pulse = 1 (one) (microsec) -
RX_PULSE_ZERO
public int RX_PULSE_ZEROlong pulse = 0 (zero) (microsec) -
RX_PULSE_MSGGAP
public int RX_PULSE_MSGGAPgap between datagrams (microsec) -
SYMBOL
public int[] SYMBOL
-
-
Constructor Details
-
Protocol
public Protocol()
-
-
Method Details
-
sym2nibble
public int sym2nibble(int symbol) -
nibble2sym
public int nibble2sym(int nibble) -
setDataSize
public void setDataSize(int size)Set maximum transmitted datagram size in bytes.- Parameters:
size
- size in bytes
-
setRepeatCount
public void setRepeatCount(int repeatCount)Set transmission repeat count. By repeating transmission multiple times you are increasing probability to receive data on the other end. This also sets receiver repeat count - eliminating duplicate datagrams caused by repetitive transmissions.- Parameters:
repeatCount
- Count how many times datagram is going to be transmitted.
-
setRxRepeatCount
public void setRxRepeatCount(int rxRepeatCount) -
setTxRepeatCount
public void setTxRepeatCount(int txRepeatCount)
-