|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.openuat.channel.oob.ButtonChannel
public abstract class ButtonChannel
This class is a common ancestor for all button related
oob channels. It provides much of the functionality which
is needed in the capture and transmit
methods but does not depend on a specific underlying platform.
All platform dependent calls are delegated to an appropriate instance
of a subclass of ButtonChannelImpl.
ButtonChannelImpl| Field Summary | |
|---|---|
static int |
BITS_PER_INTERVAL
From each interval between two button events, 3 bits of random data can be extracted. |
protected java.lang.String |
captureDisplayText
Some text that is displayed while waiting for user input (button events). |
protected boolean |
doRoundDown
Used for intervalsToBytes(org.openuat.util.IntervalList, int, int, boolean, boolean). |
protected ButtonChannelImpl |
impl
Delegate platform dependent method calls to a ButtonChannelImpl instance. |
protected int |
inputMode
The current input mode. |
protected Log |
logger
Logger instance. |
static int |
MESSAGE_LENGTH
Length of an oob message that can be sent over a button channel: 24 bit = 3 byte. |
protected OOBMessageHandler |
messageHandler
oob message handler |
protected int |
minTimeUnit
The smallest considered time unit in ms. |
protected int |
minTimeUnit2
The smallest considered time unit for a second verification run. |
static int |
MODE_PRESS
Input mode: Press. |
static int |
MODE_PRESS_RELEASE
Input mode: Press/Release. |
protected java.lang.String |
shortDescription
A short description (one to two words) of the channel, suitable to print on a gui element e.g. to list several channels to choose from. |
protected boolean |
showFeedback
Should additional user feedback be output? |
protected Log |
statisticsLogger
Logger instance for statistics data. |
static int |
TOTAL_SIGNAL_COUNT
The total number of signals needed to transfer a given message is given as the number of needed intervals plus one (n intervals are defined by n+1 signals). |
protected java.lang.String |
transmitDisplayText
Some text that is displayed before (and, if the channels doesn't use the display itself to transmit, while) transmitting data. |
protected boolean |
useCarry
Used for intervalsToBytes(org.openuat.util.IntervalList, int, int, boolean, boolean). |
| Fields inherited from interface org.openuat.authentication.OOBChannel |
|---|
AUDIO_CHANNEL, BUTTON_CHANNEL, VIDEO_CHANNEL |
| Constructor Summary | |
|---|---|
ButtonChannel()
|
|
| Method Summary | |
|---|---|
void |
buttonPressed(long eventTime)
Handles button press events. |
void |
buttonReleased(long eventTime)
Handles button release events. |
protected IntervalList |
bytesToIntervals(byte[] bytes,
int minInterval,
int bitsPerInterval,
int intervalCount)
Converts a byte[] to an IntervalList, which is
suitable to transmit data over a button channel. |
void |
capture()
Receives out of band inputs. |
protected byte[] |
intervalsToBytes(IntervalList intervals,
int minInterval,
int bitsPerInterval,
boolean roundDown,
boolean useCarry)
Converts an IntervalList to a byte[]. |
void |
setOOBMessageHandler(OOBMessageHandler handler)
Registers a handler for oob messages. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.openuat.authentication.OOBChannel |
|---|
transmit |
| Field Detail |
|---|
public static final int MESSAGE_LENGTH
BITS_PER_INTERVAL.
public static final int BITS_PER_INTERVAL
public static final int TOTAL_SIGNAL_COUNT
TOTAL_SIGNAL_COUNT = (MESSAGE_LENGTH / BITS_PER_INTERVAL) + 1.
public static final int MODE_PRESS
public static final int MODE_PRESS_RELEASE
protected ButtonChannelImpl impl
ButtonChannelImpl instance.
protected int minTimeUnit
minTimeUnit / 2
corresponds to the maximum reaction delay.
protected int minTimeUnit2
protected int inputMode
MODE_PRESS or MODE_PRESS_RELEASE.
protected boolean doRoundDown
intervalsToBytes(org.openuat.util.IntervalList, int, int, boolean, boolean).true: round downfalse: round nearest
protected boolean useCarry
intervalsToBytes(org.openuat.util.IntervalList, int, int, boolean, boolean).
protected boolean showFeedback
protected OOBMessageHandler messageHandler
setOOBMessageHandler(org.openuat.authentication.OOBMessageHandler)protected java.lang.String captureDisplayText
protected java.lang.String transmitDisplayText
protected java.lang.String shortDescription
toString method is overridden and will output this value.
protected Log logger
protected Log statisticsLogger
| Constructor Detail |
|---|
public ButtonChannel()
| Method Detail |
|---|
public void capture()
capture in interface OOBChannelpublic void setOOBMessageHandler(OOBMessageHandler handler)
capture method.
setOOBMessageHandler in interface OOBChannelhandler - oob message handlerpublic void buttonPressed(long eventTime)
ButtonInputHandler
buttonPressed in interface ButtonInputHandlereventTime - Exact time of the event in milliseconds.
Provided by the underlying platform.public void buttonReleased(long eventTime)
ButtonInputHandler
buttonReleased in interface ButtonInputHandlereventTime - Exact time of the event in milliseconds.
Provided by the underlying platform.public java.lang.String toString()
toString in class java.lang.Object
protected byte[] intervalsToBytes(IntervalList intervals,
int minInterval,
int bitsPerInterval,
boolean roundDown,
boolean useCarry)
IntervalList to a byte[].
bitsPerInterval should not exceed 31, it is truncated to 31 if it's larger.
The result is at most 64 bit = 8 byte long.
If intervals.size() * max(bitsPerInterval, 31) exceeds 64 bit, only
the first 64 bits will be returned.
If the returned number of bits is not a multiple of 8, the remaining
bits in the last byte are set to zero.
intervals - The list of intervals to be converted.minInterval - Smallest considered interval or time unit in ms.bitsPerInterval - How many bits per interval should be extracted?roundDown - Rounding mode: If true, each interval will be
rounded down to the next multiple of minInterval. If false,
each interval will be rounded to the nearest multiple of minInterval.useCarry - Should rounding losses be added to the next interval?
byte[].IntervalList
protected IntervalList bytesToIntervals(byte[] bytes,
int minInterval,
int bitsPerInterval,
int intervalCount)
byte[] to an IntervalList, which is
suitable to transmit data over a button channel.
bytes should not exceed 8 bytes, only the first 8 bytes
will be considered.
bitsPerInterval should not exceed 31, it is truncated to 31 if it's larger.
bytes - The input to be converted to an IntervalList.minInterval - Minimum length of a generated interval.bitsPerInterval - How many bits are encoded in a generated interval?intervalCount - How many intervals will be generated? This parameter must
be consistent with the length of bytes and bitsPerInterval.
It is useful, if the message doesn't align with 1 byte, this is, if there are
'unused' bits in the last byte.
IntervalList.IntervalList
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||