|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.dalsemi.onewire.container.JibComm
JibComm - an object that implements the necessary communication protocol
to access the Java iButtons. Note that many methods are now synchronized
because they access global byte arrays. This should not affect performance,
however, since applications should be using the DSPortAdapter
methods beginExclusive(boolean)
and endExclusive()
to synchronize their 1-Wire operations.
OneWireContainer16
OneWireContainer16
Field Summary | |
static boolean |
doDebugMessages
enable/disable debug messages |
int |
min_read_runtime
|
Constructor Summary | |
JibComm(OneWireContainer16 owc,
DSPortAdapter newAdapter,
byte[] newAddress)
Constructs a JibComm object to communicate with
this Java iButton. |
Method Summary | |
void |
checkStatus(int runTime,
int dir,
byte[] status,
int start)
Checks the status of this Java iButton. |
void |
correctPOR()
Corrects the device from a Power-On-Reset (POR) error. |
byte[] |
getData(int length)
Gets data from this Java iButton. |
void |
getHeader(byte[] header,
int start)
Gets header from this Java iButton. |
void |
getStatus(byte[] status,
int start)
Gets the status from this Java iButton. |
void |
interrupt(int runTime)
Interrupts the Micro in this Java iButton. |
void |
reset()
Resets the Micro in this Java iButton. |
void |
run(int runTime)
Runs the Micro in this Java iButton. |
void |
sendCommand(byte[] commandBuffer,
byte[] releaseBuffer,
boolean powerMode,
long sleepTime)
Sends command to this Java iButton. |
void |
setData(byte[] data)
Sets data to be written to this Java iButton. |
void |
setHeader(byte[] header)
Sets header to be written to this Java iButton. |
static void |
setMinRuntime(int runtime)
Sets the time given by a host for the Java Powered iButton to perform its task. |
static void |
setRuntimeMultiplier(int multiplier)
Sets the incremental increase in runtime a host will give a Java Powered iButton to perform its task. |
void |
setStatus(int runTime)
Sets status register of this Java iButton. |
byte[] |
transferJibData(byte[] data,
int runTime)
Transfers data to and from this Java iButton. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static boolean doDebugMessages
public int min_read_runtime
Constructor Detail |
public JibComm(OneWireContainer16 owc, DSPortAdapter newAdapter, byte[] newAddress) throws IllegalArgumentException
JibComm
object to communicate with
this Java iButton.newAdapter
- adapter used to communicate with this Java iButtonnewAddress
- address of this Java iButtonIllegalArgumentException
- Invalid Java iButton addressAddress
Method Detail |
public static void setMinRuntime(int runtime)
runtime
- minimum runtime the host gives a Java iButton to perform its task (in ms)IllegalArgumentException
- on illegal run time values (must be at least 63)public static void setRuntimeMultiplier(int multiplier)
multiplier
- new incremental runtime increase value to be used
for this Java iButton to perform its task (in ms)IllegalArgumentException
- on illegal multiplier values (must be at least 250)public byte[] transferJibData(byte[] data, int runTime) throws OneWireException, OneWireIOException, IllegalArgumentException
data
- byte array with data to be written to this Java iButtonrunTime
- a 4
bit value (0 -15)
that represents the expected run time of the device.
Actual run time is calculated as followed:
runTime * 250 + 62.5 mS
Therefore, 0 -> 0 * 250 + 62.5 = 62.5 mS
1 -> 1 * 250 + 62.5 = 312.5 mS
and so on.IllegalArgumentException
- Invalid run time valueOneWireException
- Part could not be found [ fatal ]OneWireIOException
- Data wasn't transferred properly [ recoverable ]public void correctPOR() throws OneWireException, OneWireIOException
OneWireException
- Part could not be found [ fatal ]OneWireIOException
- Data wasn't transferred properly [ recoverable ]public void getStatus(byte[] status, int start) throws OneWireException, OneWireIOException
Byte 0 - number of free bytes in the Input Buffer. Byte 1 - number of used bytes in the Output Buffer. Byte 2 - contents of the OWMS Register. Byte 3 - contents of the CPST register.
OneWireException
- Part could not be found [ fatal ]OneWireIOException
- Data wasn't transferred properly [ recoverable ]checkStatus(int, int, byte[], int)
,
setStatus(int)
public void checkStatus(int runTime, int dir, byte[] status, int start) throws OneWireIOException, OneWireException
runTime
- a 4
bit value (0 -15)
that represents the expected run time of the device.
Actual run time is calculated as followed:
runTime * 250 + 62.5 mS
Therefore, 0 -> 0 * 250 + 62.5 = 62.5 mS
1 -> 1 * 250 + 62.5 = 312.5 mS
and so on.dir
- SEND
if sending data to this Java iButton,
RECEIVE
if receivingOneWireException
- Part could not be found [ fatal ]OneWireIOException
- Data wasn't transferred properly [ recoverable ]getStatus(byte[], int)
,
setStatus(int)
public void setStatus(int runTime) throws OneWireException, OneWireIOException
runTime
- a 4
bit value (0 -15)
that represents the expected run time of the device
Actual run time is calculated as followed:
runTime * 250 + 62.5 mS
Therefore, 0 -> 0 * 250 + 62.5 = 62.5 mS
1 -> 1 * 250 + 62.5 = 312.5 mS
and so on.OneWireException
- Part could not be found [ fatal ]OneWireIOException
- Data wasn't transferred properly [ recoverable ]checkStatus(int, int, byte[], int)
,
getStatus(byte[], int)
public void setHeader(byte[] header) throws OneWireException, OneWireIOException, IllegalArgumentException
header
- byte array with the header informationIllegalArgumentException
- Invalid header lengthOneWireException
- Part could not be found [ fatal ]OneWireIOException
- Data wasn't transferred properly [ recoverable ]checkStatus(int, int, byte[], int)
,
getHeader(byte[], int)
public void getHeader(byte[] header, int start) throws OneWireException, OneWireIOException
OneWireException
- Part could not be found [ fatal ]OneWireIOException
- Data wasn't transferred properly [ recoverable ]checkStatus(int, int, byte[], int)
,
setHeader(byte[])
public void setData(byte[] data) throws OneWireException, OneWireIOException
data
- data to be written to this Java iButtonOneWireException
- Part could not be found [ fatal ]OneWireIOException
- Data wasn't transferred properly [ recoverable ]checkStatus(int, int, byte[], int)
,
getData(int)
public byte[] getData(int length) throws OneWireException, OneWireIOException
length
- expected number of bytes of data to be read from the IPROneWireException
- Part could not be found [ fatal ]OneWireIOException
- Data wasn't transferred properly [ recoverable ]checkStatus(int, int, byte[], int)
,
setData(byte[])
public void run(int runTime) throws OneWireException, OneWireIOException
runTime
- a 4
bit value (0 -15)
that represents the expected run time of the device
Actual run time is calculated as followed:
runTime * 250 + 62.5 mS
Therefore, 0 -> 0 * 250 + 62.5 = 62.5 mS
1 -> 1 * 250 + 62.5 = 312.5 mS
and so on.OneWireException
- Part could not be found [ fatal ]OneWireIOException
- Data wasn't transferred properly [ recoverable ]public void interrupt(int runTime) throws OneWireException, OneWireIOException
runTime
- a 4
bit value (0 -15)
that represents the expected run time of the device
Actual run time is calculated as followed:
runTime * 250 + 62.5 mS
Therefore, 0 -> 0 * 250 + 62.5 = 62.5 mS
1 -> 1 * 250 + 62.5 = 312.5 mS
and so on.OneWireException
- Part could not be found [ fatal ]OneWireIOException
- Data wasn't transferred properly [ recoverable ]public void reset() throws OneWireException, OneWireIOException
OneWireException
- Part could not be found [ fatal ]OneWireIOException
- Data wasn't transferred properly [ recoverable ]public void sendCommand(byte[] commandBuffer, byte[] releaseBuffer, boolean powerMode, long sleepTime) throws OneWireException, OneWireIOException
commandBuffer
- byte array containing the commandreleaseBuffer
- byte array containing the release codepowerMode
- true
if power supply is to be toggledsleepTime
- sleep time for the program while the Micro runs.
Applicable only if powerMode
is true.OneWireException
- Part could not be found [ fatal ]OneWireIOException
- Data wasn't transferred properly [ recoverable ]
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |