From ee628edab1c60cf8c3a4b07e6614eebe52a0a21b Mon Sep 17 00:00:00 2001 From: Jaikumar Ganesh Date: Wed, 29 Sep 2010 11:34:59 -0700 Subject: Expose Vendor Specific Headset Event Intent. The Bluetooth Headset spec doesn't cover all cases. For example, there is nothing defined to show the battery status of the headset on the phone. This intent allows 3rd party applications to communicate effectively with vendor headsets. For example, Plantronics has an app for Android headsets and when used with Plantronics headsets, they will be able to use extra information from the headset. Change-Id: Ib997327103cbbe57d64c52ba27f74162b6769798 --- .../bluetooth/BluetoothAssignedNumbers.java | 4 +- .../java/android/bluetooth/BluetoothHeadset.java | 88 ++++++++++++++++++---- 2 files changed, 75 insertions(+), 17 deletions(-) (limited to 'framework/java') diff --git a/framework/java/android/bluetooth/BluetoothAssignedNumbers.java b/framework/java/android/bluetooth/BluetoothAssignedNumbers.java index 55bc814066..580e9ff56f 100644 --- a/framework/java/android/bluetooth/BluetoothAssignedNumbers.java +++ b/framework/java/android/bluetooth/BluetoothAssignedNumbers.java @@ -23,12 +23,10 @@ package android.bluetooth; * @see * The Official Bluetooth SIG Member Website | Company Identifiers * - * @hide */ public class BluetoothAssignedNumbers { - //// Bluetooth SIG Company ID values - + // Bluetooth SIG Company ID values /* * Ericsson Technology Licensing. */ diff --git a/framework/java/android/bluetooth/BluetoothHeadset.java b/framework/java/android/bluetooth/BluetoothHeadset.java index c64fdbe396..3aea418e47 100644 --- a/framework/java/android/bluetooth/BluetoothHeadset.java +++ b/framework/java/android/bluetooth/BluetoothHeadset.java @@ -86,12 +86,35 @@ public final class BluetoothHeadset implements BluetoothProfile { /** - * Broadcast Action: Indicates a headset has posted a vendor-specific event. - *

Always contains the extra fields {@link #EXTRA_DEVICE}, - * {@link #EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_CMD}, and - * {@link #EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_ARGS}. + * Intent used to broadcast that the headset has posted a + * vendor-specific event. + * + *

This intent will have 4 extras and 1 category. + * {@link BluetoothDevice#EXTRA_DEVICE} - The remote Bluetooth Device + * {@link #EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_CMD} - The vendor specific + * command + * {@link #EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_CMD_TYPE} - The AT command + * type. + * Can be one of {@link #AT_CMD_TYPE_READ}, {@link #AT_CMD_TYPE_TEST}, + * or {@link #AT_CMD_TYPE_SET}, {@link #AT_CMD_TYPE_BASIC}, + * {@link #AT_CMD_TYPE_ACTION}. + * + * {@link #EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_ARGS} - Command arguments. + * + * The category is the Company ID of the vendor defining the + * vendor-specific command. {@link BluetoothAssignedNumbers} + * @see + * Bluetooth SIG Assigned Numbers - Company Identifiers + * + * For example, for Plantronics specific events + * Category will be {@link #VENDOR_SPECIFIC_HEADSET_EVENT_COMPANY_ID_CATEGORY}.55 + * + *

For example, an AT+XEVENT=foo,3 will get translated into + * EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_CMD = +XEVENT + * EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_CMD_TYPE = AT_CMD_TYPE_SET + * EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_ARGS = foo, 3 + * *

Requires {@link android.Manifest.permission#BLUETOOTH} to receive. - * @hide */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_VENDOR_SPECIFIC_HEADSET_EVENT = @@ -100,31 +123,68 @@ public final class BluetoothHeadset implements BluetoothProfile { /** * A String extra field in {@link #ACTION_VENDOR_SPECIFIC_HEADSET_EVENT} * intents that contains the name of the vendor-specific command. - * @hide */ public static final String EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_CMD = "android.bluetooth.headset.extra.VENDOR_SPECIFIC_HEADSET_EVENT_CMD"; /** * An int extra field in {@link #ACTION_VENDOR_SPECIFIC_HEADSET_EVENT} - * intents that contains the Company ID of the vendor defining the vendor-specific - * command. - * @see - * Bluetooth SIG Assigned Numbers - Company Identifiers - * @hide + * intents that contains the AT command type of the vendor-specific command. + */ + public static final String EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_CMD_TYPE = + "android.bluetooth.headset.extra.VENDOR_SPECIFIC_HEADSET_EVENT_CMD_TYPE"; + + /** + * AT command type READ used with + * {@link #EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_CMD_TYPE} + * For example, AT+VGM?. There are no arguments for this command type. */ - public static final String EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_COMPANY_ID = - "android.bluetooth.headset.extra.VENDOR_SPECIFIC_HEADSET_EVENT_COMPANY_ID"; + public static final int AT_CMD_TYPE_READ = 0; + + /** + * AT command type TEST used with + * {@link #EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_CMD_TYPE} + * For example, AT+VGM=?. There are no arguments for this command type. + */ + public static final int AT_CMD_TYPE_TEST = 1; + + /** + * AT command type SET used with + * {@link #EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_CMD_TYPE} + * For example, AT+VGM=. + */ + public static final int AT_CMD_TYPE_SET = 2; + + /** + * AT command type BASIC used with + * {@link #EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_CMD_TYPE} + * For example, ATD. Single character commands and everything following the + * character are arguments. + */ + public static final int AT_CMD_TYPE_BASIC = 3; + + /** + * AT command type ACTION used with + * {@link #EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_CMD_TYPE} + * For example, AT+CHUP. There are no arguments for action commands. + */ + public static final int AT_CMD_TYPE_ACTION = 4; /** * A Parcelable String array extra field in * {@link #ACTION_VENDOR_SPECIFIC_HEADSET_EVENT} intents that contains * the arguments to the vendor-specific command. - * @hide */ public static final String EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_ARGS = "android.bluetooth.headset.extra.VENDOR_SPECIFIC_HEADSET_EVENT_ARGS"; + /** + * The intent category to be used with {@link #ACTION_VENDOR_SPECIFIC_HEADSET_EVENT} + * for the companyId + */ + public static final String VENDOR_SPECIFIC_HEADSET_EVENT_COMPANY_ID_CATEGORY = + "android.bluetooth.headset.intent.category.companyid"; + /* * Headset state when SCO audio is connected * This state can be one of -- cgit v1.2.3