com.buglabs.bug.jni.common
Class CharDevice

java.lang.Object
  extended by 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
           
 
Constructor Summary
CharDevice()
           
 
Method Summary
 int close()
           
 int getFileDescriptor()
           
 java.lang.String getline()
           
 int ioctl(int request)
           
 long lseek(long offset, int whence)
           
 int open(java.lang.String file, int mode)
          Open a file.
 int read()
           
 int read(byte[] b)
           
 long write(byte[] buf, long count)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fd

protected int fd
Constructor Detail

CharDevice

public CharDevice()
Method Detail

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: