processing.android.dandelion
类 Dandelion

java.lang.Object
  继承者 processing.android.dandelion.Dandelion

public class Dandelion
extends java.lang.Object

This is a template class and can be used to start a new processing library or tool. Make sure you rename this class as well as the name of the example package 'template' to your own lobrary or tool naming convention.


字段摘要
 int[] analogInput
           
static boolean continuousMode
           
static boolean DEBUG
           
static java.lang.String DEBUGTAG
           
 boolean[] digitalInput
           
 boolean[] digitalOutput
           
static java.lang.String VERSION
           
 
构造方法摘要
Dandelion(Context ctx)
          a Constructor, used to establish a connection to a Dandelion the library will look for its path.
Dandelion(Context ctx, int num)
           
 
方法摘要
 int available()
          Returns the available number of bytes in the buffer.
 void beginAnalogInput()
           
 void beginDigitalInput()
           
 int buffer(int bytes)
          Sets the number of bytes to buffer.
 void clear()
          Clears the byte buffer.
 void disconnect()
          Disconnects the bluetooth socket.
 boolean discoveryComplete()
           
 void endAnalogInput()
           
 void endDigitalInput()
           
 java.lang.String getName()
           
 java.lang.String getReturnCode()
           
 boolean isConnected()
          Returns the status of the connection.
 boolean isEnabled()
          Returns whether the adapter is enabled.
 int last()
          Returns the last byte in the buffer.
 char lastChar()
          Returns the last byte in the buffer as char.
 java.lang.String[] list()
          Returns the list of bonded devices.
 void pairWith(java.lang.String thisAddress)
           
 void peekAnalogInput()
          Sample values of all analog channels.
 void peekDigitalInput()
          Sample values of all digital channels.
 void putReturnCode()
           
 int read()
          Returns the next byte in the buffer as an int (0-255);
 byte[] readBytes()
          Returns the whole byte buffer.
 int readBytes(byte[] buffer)
          Returns the available number of bytes in the buffer, and copies the buffer contents to the passed byte[]
 byte[] readBytesUntil(byte b)
          Returns a bytebuffer until the byte b.
 void readBytesUntil(byte b, byte[] buffer)
          TODO
 char readChar()
          Returns the next byte in the buffer as a char, if nothing is there it returns -1.
 java.lang.String readString()
          Returns the buffer as a string.
 java.lang.String readStringUntil(char c)
          Returns the buffer as string until character c.
 boolean setHigh(int channel)
          Put specified channel High.
 boolean setLow(int channel)
          Put specified channel Low.
 void startDiscovery()
           
 void stop()
          Kills the main thread.
static java.lang.String version()
          return the version of the library.
 void write(byte[] buffer)
          Writes a byte[] buffer to the output stream.
 void write(int thisInt)
          Writes a String to the output stream.
 void write(java.lang.String thisString)
          Writes a String to the output stream.
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

VERSION

public static final java.lang.String VERSION
另请参见:
常量字段值

DEBUG

public static boolean DEBUG

DEBUGTAG

public static java.lang.String DEBUGTAG

analogInput

public int[] analogInput

digitalInput

public boolean[] digitalInput

digitalOutput

public boolean[] digitalOutput

continuousMode

public static boolean continuousMode
构造方法详细信息

Dandelion

public Dandelion(Context ctx)
a Constructor, used to establish a connection to a Dandelion the library will look for its path.

参数:
theParent - use "this".

Dandelion

public Dandelion(Context ctx,
                 int num)
方法详细信息

isConnected

public boolean isConnected()
Returns the status of the connection.

返回:

isEnabled

public boolean isEnabled()
Returns whether the adapter is enabled.

返回:

list

public java.lang.String[] list()
Returns the list of bonded devices.

返回:

startDiscovery

public void startDiscovery()

pairWith

public void pairWith(java.lang.String thisAddress)

discoveryComplete

public boolean discoveryComplete()

getName

public java.lang.String getName()

available

public int available()
Returns the available number of bytes in the buffer.

返回:

version

public static java.lang.String version()
return the version of the library.

返回:
String

write

public void write(byte[] buffer)
Writes a byte[] buffer to the output stream.

参数:
buffer -

write

public void write(java.lang.String thisString)
Writes a String to the output stream.

参数:
thisString -

write

public void write(int thisInt)
Writes a String to the output stream.

参数:
buffer -

read

public int read()
Returns the next byte in the buffer as an int (0-255);

返回:

readBytes

public byte[] readBytes()
Returns the whole byte buffer.

返回:

readBytes

public int readBytes(byte[] buffer)
Returns the available number of bytes in the buffer, and copies the buffer contents to the passed byte[]

参数:
buffer -
返回:

readBytesUntil

public byte[] readBytesUntil(byte b)
Returns a bytebuffer until the byte b. If the byte b doesn't exist in the current buffer, null is returned.

参数:
b -
返回:

readBytesUntil

public void readBytesUntil(byte b,
                           byte[] buffer)
TODO

参数:
b -
buffer -

readChar

public char readChar()
Returns the next byte in the buffer as a char, if nothing is there it returns -1.

返回:

readString

public java.lang.String readString()
Returns the buffer as a string.

返回:

readStringUntil

public java.lang.String readStringUntil(char c)
Returns the buffer as string until character c.

参数:
c -
返回:

buffer

public int buffer(int bytes)
Sets the number of bytes to buffer.

参数:
bytes -
返回:

last

public int last()
Returns the last byte in the buffer.

返回:

lastChar

public char lastChar()
Returns the last byte in the buffer as char.

返回:

clear

public void clear()
Clears the byte buffer.


disconnect

public void disconnect()
Disconnects the bluetooth socket.


stop

public void stop()
Kills the main thread. Shouldn't stop when the connection disconnects,. or should it?


peekDigitalInput

public void peekDigitalInput()
Sample values of all digital channels. The value will be stored in array "digitalInput".


beginDigitalInput

public void beginDigitalInput()

endDigitalInput

public void endDigitalInput()

beginAnalogInput

public void beginAnalogInput()

endAnalogInput

public void endAnalogInput()

peekAnalogInput

public void peekAnalogInput()
Sample values of all analog channels. The value will be stored in array "analogInput".


setHigh

public boolean setHigh(int channel)
Put specified channel High. Also it will be set as an output channel.

参数:
channel - the number of digital channel

setLow

public boolean setLow(int channel)
Put specified channel Low. Also it will be set as an output channel.

参数:
channel - the number of digital channel

putReturnCode

public void putReturnCode()

getReturnCode

public java.lang.String getReturnCode()


processing library Dandelion_android by Deqing Sun. (c) 2011