com.buglabs.bug.jni.common
Class CharDevice
java.lang.Object
com.buglabs.bug.jni.common.CharDevice
- Direct Known Subclasses:
- Accelerometer, Camera, GPS, GPSControl, InputDevice, LCDControl, PB, VonHippel
public class CharDevice
- extends java.lang.Object
Access files from Java and allow ioctls on device nodes. This class is meant to be used with
Linux device nodes.
|
Field Summary |
protected int |
fd
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fd
protected int fd
CharDevice
public CharDevice()
getFileDescriptor
public int getFileDescriptor()
open
public int open(java.lang.String file,
int mode)
- Open a file.
- Parameters:
file - mode - Refer to FCNTL_H class for constants to be passed in.
- Returns:
- negative value on failure.
getline
public java.lang.String getline()
- Returns:
- a full line from the file.
read
public int read()
- Returns:
- a byte as int from the file.
read
public int read(byte[] b)
- Parameters:
b -
- Returns:
- number of bytes read.
lseek
public long lseek(long offset,
int whence)
- Parameters:
offset - whence -
- Returns:
write
public long write(byte[] buf,
long count)
ioctl
public int ioctl(int request)
- Parameters:
request -
- Returns:
close
public int close()
- Returns: