net.rim.blackberry.api.accessory
Interface Accessory

All Superinterfaces:
Persistable

public interface Accessory
extends Persistable

Represents an accessory.

An accessory can be anything that is connected physically or wirelessly to the device. An accessory has several properties that define it:

Type
Indicates the general purpose of the accessory. These TYPE_* fields show predefined types, but there may be other types that do not exist in this set.
Unique Id
A unique identifier for the accessory. This could be a serial number. See Accessory.getUniqueId().
URL
A URL that is associated with the accessory. This could be a link to a related application. See Accessory.getUrl()
Application ID
An accessory can associate itself with a specific application. The accessory and application both have to know this common identifier known as the application id. The application registers this application id using AccessoryManager.registerApplication. See Accessory.getApplicationId().
Accessory Specific Properties
Accessory specific properties are stored as byte arrays and can be accessed using Accessory.getProperty(int). These properties can be handled in an application and accessory specific way.

Since:
BlackBerry API 7.0.0

Field Summary
static int TYPE_AUDIO
          Constant specifying that an audio cradle is connected.
static int TYPE_BEDSIDE
          Constant specifying that a bedside cradle is connected.
static int TYPE_CAR_KIT
          Constant specifying that a car kit cradle is connected.
static int TYPE_CHARGER
          Constant specifying that a charger is connected.
static int TYPE_DESKTOP
          Constant specifying that a desktop cradle is connected.
static int TYPE_HOLSTER
          Constant specifying that a holster cradle is connected.
static int TYPE_MULTIMEDIA
          Constant specifying that a multimedia cradle is connected.
static int TYPE_NONE
          Constant specifying that no cradle is connected.
static int TYPE_SIMPLE
          Constant specifying a "simple" accessory that can't specify its type.
 
Method Summary
 int getAccessoryType()
          Returns one of the TYPE_* constants.
 String getApplicationId()
          The application ID identifies an application on the device that this accessory is related to.
 byte[] getProperty(int key)
          Returns data corresponding to the given property key.
 IntEnumeration getPropertyKeys()
          Returns an enumeration to the property keys.
 String getUniqueId()
          An accessory's unique id.
 URI getUrl()
          Returns a URL associated with the accessory.
 boolean hasUSBPassThrough()
          Returns true if the accessory has USB Passthrough.
 boolean isSelfPowered()
          Returns true if the accessory can provide external AC power.
 NDEFMessage toNDEFMessage()
          Converts the accessory to an NDEF message.
 



Field Detail

TYPE_NONE

static final int TYPE_NONE
Constant specifying that no cradle is connected.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

TYPE_SIMPLE

static final int TYPE_SIMPLE
Constant specifying a "simple" accessory that can't specify its type.

A simple accessory can be of any functional type and is less expensive to manufacture.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

TYPE_CHARGER

static final int TYPE_CHARGER
Constant specifying that a charger is connected.

This can be any general charger that does not specify a specific type. This includes "simple" cradles, USB-ID devices that specify a "charger" type, and any charger that does not have USB-ID or NFC.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

TYPE_HOLSTER

static final int TYPE_HOLSTER
Constant specifying that a holster cradle is connected.

The holster cradle assumes that the user cannot interact with the BlackBerry device.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

TYPE_CAR_KIT

static final int TYPE_CAR_KIT
Constant specifying that a car kit cradle is connected.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

TYPE_DESKTOP

static final int TYPE_DESKTOP
Constant specifying that a desktop cradle is connected.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

TYPE_BEDSIDE

static final int TYPE_BEDSIDE
Constant specifying that a bedside cradle is connected.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

TYPE_AUDIO

static final int TYPE_AUDIO
Constant specifying that an audio cradle is connected.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

TYPE_MULTIMEDIA

static final int TYPE_MULTIMEDIA
Constant specifying that a multimedia cradle is connected.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0


Method Detail

getUniqueId

String getUniqueId()
An accessory's unique id.

Returns:
the uniqueId
Since:
BlackBerry API 7.0.0

getAccessoryType

int getAccessoryType()
Returns one of the TYPE_* constants.

Returns:
the accessoryType
Since:
BlackBerry API 7.0.0

getUrl

URI getUrl()
Returns a URL associated with the accessory.

Returns:
the url
Since:
BlackBerry API 7.0.0

getApplicationId

String getApplicationId()
The application ID identifies an application on the device that this accessory is related to. The accessory is mapped to an application when the application registers itself with the AccessoryManager using AccessoryManager.registerApplication(String, net.rim.device.api.system.ApplicationDescriptor).

Returns:
the applicationId
See Also:
AccessoryManager.registerApplication(String, net.rim.device.api.system.ApplicationDescriptor)
Since:
BlackBerry API 7.0.0

toNDEFMessage

NDEFMessage toNDEFMessage()
                          throws IOException
Converts the accessory to an NDEF message.

Returns:
the NDEF message version of the accessory.
Throws:
IOException - if converting this accessory fails.
Since:
BlackBerry API 7.0.0

getProperty

byte[] getProperty(int key)
Returns data corresponding to the given property key. These properties are accessory specific so applications will need to know how to deal with them.

These properties do not contain Accessory Protocol properties such as class, type, transport capability etc. Use the accessor methods to retrieve those properties.

Parameters:
key - a property key.
Returns:
data corresponding to the key or null if no data exists.
Since:
BlackBerry API 7.0.0

getPropertyKeys

IntEnumeration getPropertyKeys()
Returns an enumeration to the property keys.

Returns:
an enumeration to the property keys.
See Also:
Accessory.getProperty(int)
Since:
BlackBerry API 7.0.0

isSelfPowered

boolean isSelfPowered()
Returns true if the accessory can provide external AC power.

Power could come via USB or charging contacts.

Returns:
if the accessory provides external AC power.
See Also:
#hasUSBPassThrough()}
Since:
BlackBerry API 7.0.0

hasUSBPassThrough

boolean hasUSBPassThrough()
Returns true if the accessory has USB Passthrough.

This means the USB connection may provide power at USB or AC rate.

Returns:
true if the accessory has USB Passthrough.
Since:
BlackBerry API 7.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal