diff options
author | Matthew Xie <mattx@google.com> | 2012-06-28 15:37:51 -0700 |
---|---|---|
committer | Matthew Xie <mattx@google.com> | 2012-06-28 15:37:51 -0700 |
commit | b420d7792e1981529881172bc9f5e25af9e9d66d (patch) | |
tree | 1509cc1d677e1acdd1a035fbdf64f36c7b518f2e | |
parent | d8ca062b061b04561c60873905ecbcf0fdfda1a9 (diff) | |
download | wpan-b420d7792e1981529881172bc9f5e25af9e9d66d.tar.gz |
Remove Bluetooth SCO app as part of remove bluez
Bluetooth SCO app is based on Bluez stack. As we are removing
Bluez stack, this app has to be removed.
Change-Id: I92599e9aa6e7a410cd373a71b67377f3938f569f
-rw-r--r-- | bt_sco_app/Android.mk | 30 | ||||
-rw-r--r-- | bt_sco_app/bt_sco_app.c | 312 | ||||
-rw-r--r-- | tools/BluetoothSCOApp/Android.mk | 18 | ||||
-rw-r--r-- | tools/BluetoothSCOApp/AndroidManifest.xml | 20 | ||||
-rw-r--r-- | tools/BluetoothSCOApp/CleanSpec.mk | 52 | ||||
-rw-r--r-- | tools/BluetoothSCOApp/default.properties | 11 | ||||
-rw-r--r-- | tools/BluetoothSCOApp/gen/com/ti/bluetoothSCOapp/R.java | 31 | ||||
-rw-r--r-- | tools/BluetoothSCOApp/res/drawable-hdpi/icon.png | bin | 2836 -> 0 bytes | |||
-rw-r--r-- | tools/BluetoothSCOApp/res/drawable-ldpi/icon.png | bin | 2836 -> 0 bytes | |||
-rw-r--r-- | tools/BluetoothSCOApp/res/drawable-mdpi/icon.png | bin | 2836 -> 0 bytes | |||
-rw-r--r-- | tools/BluetoothSCOApp/res/layout/main.xml | 15 | ||||
-rw-r--r-- | tools/BluetoothSCOApp/res/values/strings.xml | 9 | ||||
-rw-r--r-- | tools/BluetoothSCOApp/src/com/ti/bluetoothSCOapp/connect.java | 172 | ||||
-rw-r--r-- | tools/BluetoothSCOApp/strings.xml | 8 | ||||
-rw-r--r-- | tools/FM/FmTxApp/src/com/ti/fmtxapp/FmTx.java | 1 |
15 files changed, 0 insertions, 679 deletions
diff --git a/bt_sco_app/Android.mk b/bt_sco_app/Android.mk deleted file mode 100644 index 0533563..0000000 --- a/bt_sco_app/Android.mk +++ /dev/null @@ -1,30 +0,0 @@ -ifeq ($(BOARD_HAVE_BLUETOOTH),true) -LOCAL_PATH:= $(call my-dir) - -# -# bt_sco_app -# - -include $(CLEAR_VARS) - -LOCAL_C_INCLUDES:= \ - $(call include-path-for, bluez-libs) \ - external/bluetooth/bluez/lib - -LOCAL_CFLAGS:= \ - -DVERSION=\"3.36\" - -LOCAL_SRC_FILES:= \ - bt_sco_app.c - -LOCAL_SHARED_LIBRARIES := \ - libbluetooth libcutils -#LOCAL_STATIC_LIBRARIES := \ -# libbluez-common-static -LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) -LOCAL_MODULE_TAGS := eng -LOCAL_MODULE:=bt_sco_app - -include $(BUILD_EXECUTABLE) - -endif diff --git a/bt_sco_app/bt_sco_app.c b/bt_sco_app/bt_sco_app.c deleted file mode 100644 index e955466..0000000 --- a/bt_sco_app/bt_sco_app.c +++ /dev/null @@ -1,312 +0,0 @@ -/* - * - * BlueZ - Bluetooth protocol stack for Linux - * - * Copyright (C) 2008-2009 Texas Instruments, Inc. - * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com> - * Copyright (C) 2002-2008 Marcel Holtmann <marcel@holtmann.org> - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <errno.h> -#include <ctype.h> -#include <unistd.h> -#include <stdlib.h> -#include <getopt.h> -#include <syslog.h> -#include <signal.h> -#include <sys/time.h> -#include <sys/socket.h> - -#include <bluetooth/bluetooth.h> -#include <bluetooth/hci.h> -#include <bluetooth/hci_lib.h> -#include <bluetooth/sco.h> - -/* Static Local variables */ - -/* BD Address of the BT head set */ -static bdaddr_t bdaddr; - -/* Buffer to receive data feom headset */ -static unsigned char *buffer; - -/* Default data size */ -static long data_size = 672; - -/* Handling termination of process through signals */ -static volatile int terminate = 0; - -/* Static functions declerations */ -static void send_hciCmd(int dev_id, int command_length, char **command); - - -/** Function to handle signal terminations */ -static void sig_term(int sig) { - terminate = 1; -} - -/** do_connect Function - * This function Creates the SCO connection to the BT headset - * - * Parameters : - * @ svr : BD address of headset - * Returns SCO socket id on success - * suitable error code - */ -static int do_connect(char *svr) -{ - struct sockaddr_sco addr; - struct sco_conninfo conn; - socklen_t optlen; - int sk; - - /* Create socket */ - sk = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_SCO); - if (sk < 0) { - syslog(LOG_ERR, "Can't create socket: %s (%d)", - strerror(errno), errno); - return -1; - } - - /* Bind to local address */ - memset(&addr, 0, sizeof(addr)); - addr.sco_family = AF_BLUETOOTH; - bacpy(&addr.sco_bdaddr, &bdaddr); - - if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) { - syslog(LOG_ERR, "Can't bind socket: %s (%d)", - strerror(errno), errno); - goto error; - } - - /* Connect to remote device */ - memset(&addr, 0, sizeof(addr)); - addr.sco_family = AF_BLUETOOTH; - str2ba(svr, &addr.sco_bdaddr); - - if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) { - syslog(LOG_ERR, "Can't connect: %s (%d)", - strerror(errno), errno); - goto error; - } - - /* Get connection information */ - memset(&conn, 0, sizeof(conn)); - optlen = sizeof(conn); - - if (getsockopt(sk, SOL_SCO, SCO_CONNINFO, &conn, &optlen) < 0) { - syslog(LOG_ERR, "Can't get SCO connection information: %s (%d)", - strerror(errno), errno); - goto error; - } - - syslog(LOG_INFO, "Connected [handle %d, class 0x%02x%02x%02x]", - conn.hci_handle, - conn.dev_class[2], conn.dev_class[1], conn.dev_class[0]); - - return sk; - -error: - close(sk); - return -1; -} - -/** dump_mode Function - * This function waits till disconnection is intiated from headset or from - * the application. - * - * Parameters : - * @ sk : SCO socket id - * Returns VOID - */ -static void dump_mode(int sk) -{ - int len; - - /* Wait till disconnect is issued from the headset OR - * IF the application is killed using signals - */ - while ( ((len = read(sk, buffer, data_size)) > 0) && (!terminate) ) - syslog(LOG_INFO, "Recevied %d bytes", len); -} - -/** send_hciCmd Function - * This function takes the hci commands for the BT chip configurations, creates - * a hci channel to send the commadns through UART to configure BT chip - * - * Parameters : - * @ dev_id : HCI device ID - * @ command_length : Number of arguments of the command - * @ command : Pointer to command list - * Returns 0 upon success - * , different error messages depending upon the error. - */ -static void send_hciCmd(int dev_id, int command_length, char **command) -{ - unsigned char buf[HCI_MAX_EVENT_SIZE], *ptr = buf; - struct hci_filter flt; - hci_event_hdr *hdr; - int i, opt, len, dd; - uint16_t ocf; - uint8_t ogf; - - if (dev_id < 0) - dev_id = hci_get_route(NULL); - - errno = 0; - ogf = strtol(command[0], NULL, 16); - ocf = strtol(command[1], NULL, 16); - - for (i = 2, len = 0; i < command_length && len < sizeof(buf); i++, len++) - *ptr++ = (uint8_t) strtol(command[i], NULL, 16); - - dd = hci_open_dev(dev_id); - if (dd < 0) { - perror("Device open failed"); - return; - } - - /* Setup filter */ - hci_filter_clear(&flt); - hci_filter_set_ptype(HCI_EVENT_PKT, &flt); - hci_filter_all_events(&flt); - if (setsockopt(dd, SOL_HCI, HCI_FILTER, &flt, sizeof(flt)) < 0) { - perror("HCI filter setup failed"); - return; - } - - /* Send the BT chip configuration commands */ - if (hci_send_cmd(dd, ogf, ocf, len, buf) < 0) { - perror("Send failed"); - return; - } - - /* Wait for the command completion event */ - len = read(dd, buf, sizeof(buf)); - if (len < 0) { - perror("Read failed"); - return; - } - - hdr = (void *)(buf + 1); - ptr = buf + (1 + HCI_EVENT_HDR_SIZE); - len -= (1 + HCI_EVENT_HDR_SIZE); - - hci_close_dev(dd); -} - -/** USAGE Function - * This function displays the usage of the bt_sco_app application. - * - * Parameters : - * @ VOID - * Returns VOID - */ -static void usage(void) -{ - printf("bt_scoapp\n" - "Usage:\n"); - printf("\tbt_scoapp [bd_addr]\n"); -} - -/** Main Function - * The main function takes the command line BD adress of headset as inputs , - * Calls the hci send configuration function and then creates a SCO connection. - * - * Parameters : - * @ argc : Number of arguments on the command line - * @ argv : Pointer to argument list - BD addr is the only valid argument. - * Returns 0 upon success - * , different error messages depending upon the error. - */ -int main(int argc ,char *argv[]) -{ - struct sigaction sa; - int opt, i = 0, sk; - - /* BT PCM configurations commands */ - char *command[] = { "0x3f", "0x106", /* OCF and OGF */ - "0x80", "0x00", /* Bit clock - 128KHz*/ - "0x00", /* BT chip as Master*/ - "0x40", "0x1f", "0x00", "0x00", /* Sampling rate - 8KHz*/ - "0x01", "0x00", /* 50% Duty cycle*/ - "0x00", /* Frame sync at falling edge*/ - "0x00", /* FS Active high polarity*/ - "0x00", /* FS direction - [Reserved]*/ - "0x10", "0x00", /* CH1 16 -bit OUT size*/ - "0x01", "0x00", /* One Clock delay */ - "0x00", /* Data driven at rising edge*/ - "0x10", "0x00", /* CH1 16 -bit IN size */ - "0x01", "0x00", /* CH1 DAta IN One Clock delay*/ - "0x00", /* Data driven at sampling edge*/ - "0x00", /* Reserved bit*/ - "0x10", "0x00", /* CH2 16 -bit OUT size*/ - "0x11", "0x00", /* CH2 data OUT off set*/ - "0x00", /* Data driven at rising edge*/ - "0x10", "0x00", /* CH2 16 -bit IN size*/ - "0x11", "0x00", /* CH2 data IN off set*/ - "0x00", /* Data Sampled at rising edge*/ - "0x00" /* Reserved bit*/ - }; - int command_length = 36; /* Length of the BT configuration commands */ - - /* Check if the number of arguemts mentioned is 2 */ - if (argc != 2) - { - printf("\n Wrong input - No BD headset address specified"); - usage(); - exit(1); - } - - memset(&sa, 0, sizeof(sa)); - sa.sa_flags = SA_NOCLDSTOP; - sa.sa_handler = sig_term; - sigaction(SIGTERM, &sa, NULL); - sigaction(SIGINT, &sa, NULL); - sigaction(SIGCHLD, &sa, NULL); - sigaction(SIGPIPE, &sa, NULL); - - openlog("bt_sco_app", LOG_PERROR | LOG_PID, LOG_LOCAL0); - - /* Allocate memory for the buffer */ - if (!(buffer = malloc(data_size))) { - perror("Can't allocate data buffer"); - exit(1); - } - /* send the BT configuration commands */ - send_hciCmd(-1,command_length,command); - - sleep(2); /* wait for some time while BT chip is configured */ - - sk = do_connect(argv[1]); - if (sk < 0) - exit(1); - dump_mode(sk); - - syslog(LOG_INFO, "Exit"); - - closelog(); - - return 0; -} diff --git a/tools/BluetoothSCOApp/Android.mk b/tools/BluetoothSCOApp/Android.mk deleted file mode 100644 index 810bea0..0000000 --- a/tools/BluetoothSCOApp/Android.mk +++ /dev/null @@ -1,18 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -LOCAL_PACKAGE_NAME := BluetoothSCOApp -LOCAL_SDK_VERSION := current -LOCAL_CERTIFICATE := shared - - -include $(BUILD_PACKAGE) - -# Use the following include to make our test apk. -include $(call all-makefiles-under,$(LOCAL_PATH)) - - diff --git a/tools/BluetoothSCOApp/AndroidManifest.xml b/tools/BluetoothSCOApp/AndroidManifest.xml deleted file mode 100644 index ac57300..0000000 --- a/tools/BluetoothSCOApp/AndroidManifest.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.ti.bluetoothSCOapp" > - <uses-permission android:name="android.permission.BLUETOOTH" /> - <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> - <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> - <uses-permission android:name="android.permission.BROADCAST_STICKY" /> - - <application android:icon="@drawable/icon" android:label="@string/app_name"> - <activity android:name=".connect" - android:label="@string/app_name"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - - </application> - -</manifest> diff --git a/tools/BluetoothSCOApp/CleanSpec.mk b/tools/BluetoothSCOApp/CleanSpec.mk deleted file mode 100644 index 169d6aa..0000000 --- a/tools/BluetoothSCOApp/CleanSpec.mk +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (C) 2007 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - - -# If you don't need to do a full clean build but would like to touch -# a file or delete some intermediate files, add a clean step to the end -# of the list. These steps will only be run once, if they haven't been -# run before. -# -# E.g.: -# $(call add-clean-step, touch -c external/sqlite/sqlite3.h) -# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) -# -# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with -# files that are missing or have been moved. -# -# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. -# Use $(OUT_DIR) to refer to the "out" directory. -# -# If you need to re-do something that's already mentioned, just copy -# the command and add it to the bottom of the list. E.g., if a change -# that you made last week required touching a file and a change you -# made today requires touching the same file, just copy the old -# touch step and add it to the end of the list. -# -# ************************************************ -# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST -# ************************************************ - -# For example: -#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) -#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) -#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) -#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) -$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS//BluetoothSCOApp*) -$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/BluetoothSCOApp*) - -# ************************************************ -# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST -# ************************************************ diff --git a/tools/BluetoothSCOApp/default.properties b/tools/BluetoothSCOApp/default.properties deleted file mode 100644 index e2e8061..0000000 --- a/tools/BluetoothSCOApp/default.properties +++ /dev/null @@ -1,11 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "build.properties", and override values to adapt the script to your -# project structure. - -# Project target. -target=android-8 diff --git a/tools/BluetoothSCOApp/gen/com/ti/bluetoothSCOapp/R.java b/tools/BluetoothSCOApp/gen/com/ti/bluetoothSCOapp/R.java deleted file mode 100644 index e45ec40..0000000 --- a/tools/BluetoothSCOApp/gen/com/ti/bluetoothSCOapp/R.java +++ /dev/null @@ -1,31 +0,0 @@ -/* AUTO-GENERATED FILE. DO NOT MODIFY. - * - * This class was automatically generated by the - * aapt tool from the resource data it found. It - * should not be modified by hand. - */ - -package com.ti.bluetoothSCOapp; - -public final class R { - public static final class attr { - } - public static final class drawable { - public static final int icon=0x7f020000; - } - public static final class id { - public static final int CheckBox01=0x7f050002; - public static final int TextView01=0x7f050000; - public static final int TextView02=0x7f050001; - } - public static final class layout { - public static final int main=0x7f030000; - } - public static final class string { - public static final int BTenable=0x7f040002; - public static final int Copyright=0x7f040003; - public static final int Version=0x7f040004; - public static final int app_name=0x7f040001; - public static final int hello=0x7f040000; - } -} diff --git a/tools/BluetoothSCOApp/res/drawable-hdpi/icon.png b/tools/BluetoothSCOApp/res/drawable-hdpi/icon.png Binary files differdeleted file mode 100644 index 6ca35af..0000000 --- a/tools/BluetoothSCOApp/res/drawable-hdpi/icon.png +++ /dev/null diff --git a/tools/BluetoothSCOApp/res/drawable-ldpi/icon.png b/tools/BluetoothSCOApp/res/drawable-ldpi/icon.png Binary files differdeleted file mode 100644 index 6ca35af..0000000 --- a/tools/BluetoothSCOApp/res/drawable-ldpi/icon.png +++ /dev/null diff --git a/tools/BluetoothSCOApp/res/drawable-mdpi/icon.png b/tools/BluetoothSCOApp/res/drawable-mdpi/icon.png Binary files differdeleted file mode 100644 index 6ca35af..0000000 --- a/tools/BluetoothSCOApp/res/drawable-mdpi/icon.png +++ /dev/null diff --git a/tools/BluetoothSCOApp/res/layout/main.xml b/tools/BluetoothSCOApp/res/layout/main.xml deleted file mode 100644 index 31560ce..0000000 --- a/tools/BluetoothSCOApp/res/layout/main.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - > -<TextView - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:text="@string/hello" android:capitalize="words"/> -<TextView android:id="@+id/TextView01" android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="@string/Copyright"></TextView> -<TextView android:text="@string/Version" android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView> -<CheckBox android:id="@+id/CheckBox01" android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="@string/BTenable" android:checked="false" android:clickable="true" android:onClick="onClick"></CheckBox> - -</LinearLayout> diff --git a/tools/BluetoothSCOApp/res/values/strings.xml b/tools/BluetoothSCOApp/res/values/strings.xml deleted file mode 100644 index 409ea9b..0000000 --- a/tools/BluetoothSCOApp/res/values/strings.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string name="hello">Bluetooth SCO Music Enable</string> - <string name="app_name">BluetoothSCOApp</string> - -<string name="BTenable">Enable Music via Media Player</string> -<string name="Copyright">Texas Instruments</string> -<string name="Version">Ver 2.0</string> -</resources> diff --git a/tools/BluetoothSCOApp/src/com/ti/bluetoothSCOapp/connect.java b/tools/BluetoothSCOApp/src/com/ti/bluetoothSCOapp/connect.java deleted file mode 100644 index 3a95954..0000000 --- a/tools/BluetoothSCOApp/src/com/ti/bluetoothSCOapp/connect.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright 2001-2011 Texas Instruments, Inc. - http://www.ti.com/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Bluetooth SCO App: The app establishes a SCO connection for non-voice call - * use case, for eg. Music streaming(mono) on BT SCO link. Also, BT SCO voice record - * can also be tested from sound recorder after running this app. - * - * Version: 2.0 - */ - -package com.ti.bluetoothSCOapp; - -import java.util.Set; - -import android.app.Activity; -import android.bluetooth.BluetoothAdapter; -import android.bluetooth.BluetoothDevice; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.media.AudioManager; -import android.os.Bundle; -import android.util.Log; -import android.view.View; -import android.widget.CheckBox; -import android.widget.Toast; - - -public class connect extends Activity { - private static final String TAG = "BluetoothSCO"; - private static final boolean DEBUG = true; - private AudioManager mAudioManager = null; - private Context mContext = null; - /* Broadcast receiver for the SCO State broadcast intent.*/ - private final BroadcastReceiver mSCOHeadsetAudioState = new BroadcastReceiver() { - - public void onReceive(Context context, Intent intent) { - //if(DEBUG) - // Log.e(TAG, " mSCOHeadsetAudioState--->onReceive"); - - int state = intent.getIntExtra(AudioManager.EXTRA_SCO_AUDIO_STATE, -1); - - if (state == AudioManager.SCO_AUDIO_STATE_CONNECTED) { - DisplayToast("BT SCO Music is now enabled. Play song in Media Player"); - } else if (state == AudioManager.SCO_AUDIO_STATE_DISCONNECTED) { - DisplayToast("BT SCO Music is now disabled"); - } - } - }; - - // Local Bluetooth adapter - private BluetoothAdapter mBluetoothAdapter = null; - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - - // Get local Bluetooth adapter - mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); - - // If the adapter is null, then Bluetooth is not supported - if (mBluetoothAdapter == null) { - Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show(); - finish(); - return; - } - mContext = this; - IntentFilter newintent = new IntentFilter(); - newintent.addAction(AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED); - mContext.registerReceiver(mSCOHeadsetAudioState, newintent); - - // Check whether BT is enabled - if (!mBluetoothAdapter.isEnabled()) { - Toast.makeText(this, "Bluetooth is not enabled", Toast.LENGTH_LONG).show(); - finish(); - return; - } - - // get the Audio Service context - mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); - if (mAudioManager == null){ - Log.e(TAG, "mAudiomanager is null"); - finish(); - return; - } - // Android 2.2 onwards supports BT SCO for non-voice call use case - // Check the Android version whether it supports or not. - if(!mAudioManager.isBluetoothScoAvailableOffCall()) { - Toast.makeText(this, "Platform does not support use of SCO for off call", Toast.LENGTH_LONG).show(); - finish(); - return; - } - - // Check list of bonded devices - Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices(); - // If there are paired devices - if (pairedDevices.size() > 0) { - // Loop through paired devices - for (BluetoothDevice device : pairedDevices) { - Log.e(TAG, "BT Device :"+device.getName()+ " , BD_ADDR:" + device.getAddress()); - } - // To do: - // Need to check from the paired devices which supports BT HF profile - // and take action based on that. - } else { - Toast.makeText(this, "No Paired Headset, Pair and connect to phone audio", Toast.LENGTH_LONG).show(); - finish(); - return; - } - - // Check whether BT A2DP (media) is connected - // If yes, ask user to disconnect - if(mAudioManager.isBluetoothA2dpOn ()){ - Toast.makeText(this, "Disconnect A2DP (media audio) to headset from Bluetooth Settings", Toast.LENGTH_LONG).show(); - finish(); - return; - } - - // Check whether it is connected to phone audio - // TO DO: - Toast.makeText(this, "Make sure:Device is connected to Headset & Connected to Phone Audio only!", Toast.LENGTH_LONG).show(); - - // Ok everything seems to be fine - // start now - CheckBox checkBox = (CheckBox) findViewById(R.id.CheckBox01); - - checkBox.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - if (((CheckBox)v).isChecked()) { - if(DEBUG) - Log.e(TAG, "BTSCOApp: Checkbox Checked "); - mAudioManager.setBluetoothScoOn(true); - mAudioManager.startBluetoothSco(); - // OMAP4 has dedicated support for MM playback on BT SCO - // so just establish SCO connection and play music in media player - // OMAP4 ABE takes care of 44.1 to 8k conversion. - - // For other platform or omap3, the user - // needs to play mono 8k sample using aplay on shell - } else { - if(DEBUG) - Log.e(TAG, "BTSCOApp Checkbox Unchecked "); - mAudioManager.setBluetoothScoOn(false); - mAudioManager.stopBluetoothSco(); - } - } - }); - } - - private void DisplayToast(String msg) - { - Toast.makeText(getBaseContext(), msg, - Toast.LENGTH_SHORT).show(); - } - -} diff --git a/tools/BluetoothSCOApp/strings.xml b/tools/BluetoothSCOApp/strings.xml deleted file mode 100644 index 0619a58..0000000 --- a/tools/BluetoothSCOApp/strings.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string name="hello">Bluetooth SCO Music Enable</string> - <string name="app_name">BluetoothSCOApp</string> - -<string name="BTenable">Enable Music via Media Player</string> -<string name="Copyright">Texas Instruments</string> -</resources> diff --git a/tools/FM/FmTxApp/src/com/ti/fmtxapp/FmTx.java b/tools/FM/FmTxApp/src/com/ti/fmtxapp/FmTx.java index 20e81b6..af13176 100644 --- a/tools/FM/FmTxApp/src/com/ti/fmtxapp/FmTx.java +++ b/tools/FM/FmTxApp/src/com/ti/fmtxapp/FmTx.java @@ -50,7 +50,6 @@ import android.content.DialogInterface; import com.ti.fm.FmRadio; import com.ti.fm.FmRadioIntent; import com.ti.fm.IFmConstants; -import android.server.*; /**************************************************************/ public class FmTx extends Activity implements View.OnClickListener, |