com.googlecode.android_scripting.facade
Class BluetoothFacade

java.lang.Object
  extended by com.googlecode.android_scripting.jsonrpc.RpcReceiver
      extended by com.googlecode.android_scripting.facade.BluetoothFacade

@RpcMinSdk(value=5)
public class BluetoothFacade
extends RpcReceiver

Bluetooth functions.


Constructor Summary
BluetoothFacade(FacadeManager manager)
           
 
Method Summary
 java.lang.String bluetoothAccept(java.lang.String uuid, java.lang.Integer timeout)
           
 java.util.Map<java.lang.String,java.lang.String> bluetoothActiveConnections()
           
 java.lang.String bluetoothConnect(java.lang.String uuid, java.lang.String address)
           
 java.lang.Boolean bluetoothDiscoveryCancel()
           
 java.lang.Boolean bluetoothDiscoveryStart()
           
 java.lang.String bluetoothGetConnectedDeviceName(java.lang.String connID)
           
 java.lang.String bluetoothGetLocalAddress()
           
 java.lang.String bluetoothGetLocalName()
           
 java.lang.String bluetoothGetRemoteDeviceName(java.lang.String address)
           
 int bluetoothGetScanMode()
           
 java.lang.Boolean bluetoothIsDiscovering()
           
 void bluetoothMakeDiscoverable(java.lang.Integer duration)
           
 java.lang.String bluetoothRead(java.lang.Integer bufferSize, java.lang.String connID)
           
 java.lang.String bluetoothReadBinary(java.lang.Integer bufferSize, java.lang.String connID)
           
 java.lang.String bluetoothReadLine(java.lang.String connID)
           
 java.lang.Boolean bluetoothReadReady(java.lang.String connID)
           
 boolean bluetoothSetLocalName(java.lang.String name)
           
 void bluetoothStop(java.lang.String connID)
           
 void bluetoothWrite(java.lang.String ascii, java.lang.String connID)
           
 void bluetoothWriteBinary(java.lang.String base64, java.lang.String connID)
           
 java.lang.Boolean checkBluetoothState()
           
 void shutdown()
          Invoked when the receiver is shut down.
 java.lang.Boolean toggleBluetoothState(java.lang.Boolean enabled, java.lang.Boolean prompt)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BluetoothFacade

public BluetoothFacade(FacadeManager manager)
Method Detail

bluetoothActiveConnections

@Rpc(description="Returns active Bluetooth connections.")
public java.util.Map<java.lang.String,java.lang.String> bluetoothActiveConnections()

bluetoothWriteBinary

@Rpc(description="Send bytes over the currently open Bluetooth connection.")
public void bluetoothWriteBinary(@RpcParameter(name="base64",description="A base64 encoded String of the bytes to be sent.")
                                                java.lang.String base64,
                                                @RpcParameter(name="connID",description="Connection id")@RpcDefault(value="")@RpcOptional
                                                java.lang.String connID)
                          throws java.io.IOException
Throws:
java.io.IOException

bluetoothReadBinary

@Rpc(description="Read up to bufferSize bytes and return a chunked, base64 encoded string.")
public java.lang.String bluetoothReadBinary(@RpcParameter(name="bufferSize")@RpcDefault(value="4096")
                                                           java.lang.Integer bufferSize,
                                                           @RpcParameter(name="connID",description="Connection id")@RpcDefault(value="")@RpcOptional
                                                           java.lang.String connID)
                                     throws java.io.IOException
Throws:
java.io.IOException

bluetoothConnect

@Rpc(description="Connect to a device over Bluetooth. Blocks until the connection is established or fails.",
     returns="True if the connection was established successfully.")
public java.lang.String bluetoothConnect(@RpcParameter(name="uuid",description="The UUID passed here must match the UUID used by the server device.")@RpcDefault(value="457807c0-4897-11df-9879-0800200c9a66")
                                                               java.lang.String uuid,
                                                               @RpcParameter(name="address",description="The user will be presented with a list of discovered devices to choose from if an address is not provided.")@RpcOptional
                                                               java.lang.String address)
                                  throws java.io.IOException
Throws:
java.io.IOException

bluetoothAccept

@Rpc(description="Listens for and accepts a Bluetooth connection. Blocks until the connection is established or fails.")
public java.lang.String bluetoothAccept(@RpcParameter(name="uuid")@RpcDefault(value="457807c0-4897-11df-9879-0800200c9a66")
                                                       java.lang.String uuid,
                                                       @RpcParameter(name="timeout",description="How long to wait for a new connection, 0 is wait for ever")@RpcDefault(value="0")
                                                       java.lang.Integer timeout)
                                 throws java.io.IOException
Throws:
java.io.IOException

bluetoothMakeDiscoverable

@Rpc(description="Requests that the device be discoverable for Bluetooth connections.")
public void bluetoothMakeDiscoverable(@RpcParameter(name="duration",description="period of time, in seconds, during which the device should be discoverable")@RpcDefault(value="300")
                                                     java.lang.Integer duration)

bluetoothWrite

@Rpc(description="Sends ASCII characters over the currently open Bluetooth connection.")
public void bluetoothWrite(@RpcParameter(name="ascii")
                                          java.lang.String ascii,
                                          @RpcParameter(name="connID",description="Connection id")@RpcDefault(value="")
                                          java.lang.String connID)
                    throws java.io.IOException
Throws:
java.io.IOException

bluetoothReadReady

@Rpc(description="Returns True if the next read is guaranteed not to block.")
public java.lang.Boolean bluetoothReadReady(@RpcParameter(name="connID",description="Connection id")@RpcDefault(value="")@RpcOptional
                                                           java.lang.String connID)
                                     throws java.io.IOException
Throws:
java.io.IOException

bluetoothRead

@Rpc(description="Read up to bufferSize ASCII characters.")
public java.lang.String bluetoothRead(@RpcParameter(name="bufferSize")@RpcDefault(value="4096")
                                                     java.lang.Integer bufferSize,
                                                     @RpcParameter(name="connID",description="Connection id")@RpcOptional@RpcDefault(value="")
                                                     java.lang.String connID)
                               throws java.io.IOException
Throws:
java.io.IOException

bluetoothReadLine

@Rpc(description="Read the next line.")
public java.lang.String bluetoothReadLine(@RpcParameter(name="connID",description="Connection id")@RpcOptional@RpcDefault(value="")
                                                         java.lang.String connID)
                                   throws java.io.IOException
Throws:
java.io.IOException

bluetoothGetRemoteDeviceName

@Rpc(description="Queries a remote device for it\'s name or null if it can\'t be resolved")
public java.lang.String bluetoothGetRemoteDeviceName(@RpcParameter(name="address",description="Bluetooth Address For Target Device")
                                                                    java.lang.String address)

bluetoothGetLocalName

@Rpc(description="Gets the Bluetooth Visible device name")
public java.lang.String bluetoothGetLocalName()

bluetoothSetLocalName

@Rpc(description="Sets the Bluetooth Visible device name, returns True on success")
public boolean bluetoothSetLocalName(@RpcParameter(name="name",description="New local name")
                                                    java.lang.String name)

bluetoothGetScanMode

@Rpc(description="Gets the scan mode for the local dongle.\r\nReturn values:\r\n\t-1 when Bluetooth is disabled.\r\n\t0 if non discoverable and non connectable.\r\n\r1 connectable non discoverable.\r3 connectable and discoverable.")
public int bluetoothGetScanMode()

bluetoothGetConnectedDeviceName

@Rpc(description="Returns the name of the connected device.")
public java.lang.String bluetoothGetConnectedDeviceName(@RpcParameter(name="connID",description="Connection id")@RpcOptional@RpcDefault(value="")
                                                                       java.lang.String connID)
                                                 throws java.io.IOException
Throws:
java.io.IOException

checkBluetoothState

@Rpc(description="Checks Bluetooth state.",
     returns="True if Bluetooth is enabled.")
public java.lang.Boolean checkBluetoothState()

toggleBluetoothState

@Rpc(description="Toggle Bluetooth on and off.",
     returns="True if Bluetooth is enabled.")
public java.lang.Boolean toggleBluetoothState(@RpcParameter(name="enabled")@RpcOptional
                                                                    java.lang.Boolean enabled,
                                                                    @RpcParameter(name="prompt",description="Prompt the user to confirm changing the Bluetooth state.")@RpcDefault(value="true")
                                                                    java.lang.Boolean prompt)

bluetoothStop

@Rpc(description="Stops Bluetooth connection.")
public void bluetoothStop(@RpcParameter(name="connID",description="Connection id")@RpcOptional@RpcDefault(value="")
                                         java.lang.String connID)

bluetoothGetLocalAddress

@Rpc(description="Returns the hardware address of the local Bluetooth adapter. ")
public java.lang.String bluetoothGetLocalAddress()

bluetoothDiscoveryStart

@Rpc(description="Start the remote device discovery process. ",
     returns="true on success, false on error")
public java.lang.Boolean bluetoothDiscoveryStart()

bluetoothDiscoveryCancel

@Rpc(description="Cancel the current device discovery process.",
     returns="true on success, false on error")
public java.lang.Boolean bluetoothDiscoveryCancel()

bluetoothIsDiscovering

@Rpc(description="Return true if the local Bluetooth adapter is currently in the device discovery process. ")
public java.lang.Boolean bluetoothIsDiscovering()

shutdown

public void shutdown()
Description copied from class: RpcReceiver
Invoked when the receiver is shut down.

Specified by:
shutdown in class RpcReceiver