1 /* 2 * 3 * Copyright 2001-2011 Texas Instruments, Inc. - http://www.ti.com/ 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package com.ti.fm; 19 20 import android.content.ComponentName; 21 import android.content.Context; 22 import android.content.Intent; 23 import android.os.IBinder; 24 import android.os.RemoteException; 25 import android.os.ServiceManager; 26 import android.content.ServiceConnection; 27 import android.util.Log; 28 29 /** 30 * The Android FmRadio API is not finalized, and *will* change. Use at your own 31 * risk. Public API for controlling the FmRadio Service. FmRadio is a proxy 32 * object for controlling the Fm Reception/Transmission Service via IPC. 33 * Creating a FmRadio object will create a binding with the FMRX service. Users 34 * of this object should call close() when they are finished with the FmRadio, 35 * so that this proxy object can unbind from the service. 36 * 37 * @hide 38 */ 39 public class FmRadio { 40 41 private static final String TAG = "FmRadio"; 42 43 private static final boolean DBG = true; 44 45 private IFmRadio mService; 46 47 private Context mContext; 48 49 private ServiceListener mServiceListener; 50 51 public static final int STATE_ENABLED = 0; 52 53 public static final int STATE_DISABLED = 1; 54 55 public static final int STATE_ENABLING = 2; 56 57 public static final int STATE_DISABLING = 3; 58 59 public static final int STATE_PAUSE = 4; 60 61 public static final int STATE_RESUME = 5; 62 63 public static final int STATE_DEFAULT = 6; 64 65 private static FmRadio INSTANCE; 66 67 /** Used when obtaining a reference to the singleton instance. */ 68 private static Object INSTANCE_LOCK = new Object(); 69 70 private boolean mInitialized = false; 71 72 // Constructor 73 private FmRadio() { 74 75 } 76 77 private ServiceConnection mConnection = new ServiceConnection() { 78 public void onServiceConnected(ComponentName className, IBinder service) { 79 // This is called when the connection with the service has been 80 // established, giving us the service object we can use to 81 // interact with the service. We are communicating with our 82 // service through an IDL interface, so get a client-side 83 // representation of that from the raw service object. 84 Log.i(TAG, "Service connected"); 85 mService = IFmRadio.Stub.asInterface(service); 86 if (mServiceListener != null) { 87 Log.i(TAG, "Sending callback"); 88 mServiceListener.onServiceConnected(); 89 } else { 90 Log.e(TAG, "mService is NULL"); 91 } 92 } 93 94 public void onServiceDisconnected(ComponentName className) { 95 // This is called when the connection with the service has been 96 // unexpectedly disconnected -- that is, its process crashed. 97 Log.i(TAG, "Service disconnected"); 98 mService = null; 99 if (mServiceListener != null) { 100 mServiceListener.onServiceDisconnected(); 101 } 102 } 103 }; 104 105 public FmRadio(Context context, ServiceListener listener) { 106 // This will be around as long as this process is 107 mContext = context.getApplicationContext(); 108 mServiceListener = listener; 109 Log.i(TAG, "FmRadio:Creating a FmRadio proxy object: " + mConnection); 110 mContext.bindService(new Intent("com.ti.server.FmService"), mConnection, 111 Context.BIND_AUTO_CREATE); 112 } 113 114 /** 115 * An interface for notifying FmRadio IPC clients when they have been 116 * connected to the FMRX service. 117 */ 118 public interface ServiceListener { 119 /** 120 * Called to notify the client when this proxy object has been connected 121 * to the FMRX service. Clients must wait for this callback before 122 * making IPC calls on the FMRX service. 123 */ 124 public void onServiceConnected(); 125 126 /** 127 * Called to notify the client that this proxy object has been 128 * disconnected from the FMRX service. Clients must not make IPC calls 129 * on the FMRX service after this callback. This callback will currently 130 * only occur if the application hosting the BluetoothAg service, but 131 * may be called more often in future. 132 */ 133 public void onServiceDisconnected(); 134 } 135 136 protected void finalize() throws Throwable { 137 if (DBG) 138 Log.d(TAG, "FmRadio:finalize"); 139 try { 140 close(); 141 } finally { 142 super.finalize(); 143 } 144 } 145 146 /** 147 * Close the connection to the backing service. Other public functions of 148 * BluetoothAg will return default error results once close() has been 149 * called. Multiple invocations of close() are ok. 150 */ 151 public synchronized void close() { 152 Log.i(TAG, "FmRadio:close"); 153 154 mContext.unbindService(mConnection); 155 } 156 157 /** 158 * Returns true if the FM RX is enabled. Returns false if not enabled, or if 159 * this proxy object if not currently connected to the FmRadio service. 160 */ 161 public boolean rxIsEnabled() { 162 if (DBG) 163 Log.d(TAG, "FmRadio:rxIsEnabled"); 164 if (mService != null) { 165 try { 166 return mService.rxIsEnabled(); 167 } catch (RemoteException e) { 168 Log.e(TAG, e.toString()); 169 } 170 } else { 171 Log.w(TAG, "Proxy not attached to service"); 172 if (DBG) 173 Log.d(TAG, Log.getStackTraceString(new Throwable())); 174 } 175 return false; 176 } 177 178 /** 179 * Returns the current FM RX state 180 */ 181 182 public int rxGetFMState() { 183 if (DBG) 184 Log.d(TAG, "FmRadio:rxGetFMState"); 185 if (mService != null) { 186 try { 187 return mService.rxGetFMState(); 188 } catch (RemoteException e) { 189 Log.e(TAG, e.toString()); 190 } 191 } else { 192 Log.w(TAG, "Proxy not attached to service"); 193 if (DBG) 194 Log.d(TAG, Log.getStackTraceString(new Throwable())); 195 } 196 return -1; 197 } 198 199 /** 200 * Returns true if the FM RX is paused. Returns false if not paused, or if 201 * this proxy object if not currently connected to the FmRadio service. 202 */ 203 204 public boolean rxIsFMPaused() { 205 if (DBG) 206 Log.d(TAG, "FmRadio:rxIsFMPaused"); 207 if (mService != null) { 208 try { 209 return mService.rxIsFMPaused(); 210 } catch (RemoteException e) { 211 Log.e(TAG, e.toString()); 212 } 213 } else { 214 Log.w(TAG, "Proxy not attached to service"); 215 if (DBG) 216 Log.d(TAG, Log.getStackTraceString(new Throwable())); 217 } 218 return false; 219 } 220 221 /** 222 * Returns true if the FM RX is enabled. Returns false if not enabled, or if 223 * this proxy object if not currently connected to the FmRadio service. 224 */ 225 public boolean rxEnable() { 226 if (DBG) 227 Log.d(TAG, "FmRadio:rxEnable"); 228 if (mService != null) { 229 try { 230 return mService.rxEnable(); 231 } catch (RemoteException e) { 232 Log.e(TAG, e.toString()); 233 } 234 } else { 235 Log.w(TAG, "Proxy not attached to service"); 236 if (DBG) 237 Log.d(TAG, Log.getStackTraceString(new Throwable())); 238 } 239 return false; 240 } 241 242 /** 243 * Returns true if the EM RX is disabled. Returns false if not enabled, or 244 * if this proxy object if not currently connected to the FmRadio service. 245 */ 246 public boolean rxDisable() { 247 if (DBG) 248 Log.d(TAG, "FmRadio:rxDisable"); 249 if (mService != null) { 250 try { 251 return mService.rxDisable(); 252 } catch (RemoteException e) { 253 Log.e(TAG, e.toString()); 254 } 255 } else { 256 Log.w(TAG, "Proxy not attached to service"); 257 if (DBG) 258 Log.d(TAG, Log.getStackTraceString(new Throwable())); 259 } 260 return false; 261 } 262 263 public boolean resumeFm() { 264 if (DBG) 265 Log.d(TAG, "FmRadio:resumeFm"); 266 if (mService != null) { 267 try { 268 return mService.resumeFm(); 269 } catch (RemoteException e) { 270 Log.e(TAG, e.toString()); 271 } 272 } else { 273 Log.w(TAG, "Proxy not attached to service"); 274 if (DBG) 275 Log.d(TAG, Log.getStackTraceString(new Throwable())); 276 } 277 return false; 278 } 279 280 public boolean rxSetBand(int band) { 281 if (DBG) 282 Log.d(TAG, "FmRadio:rxSetBand"); 283 if (mService != null) { 284 try { 285 return mService.rxSetBand(band); 286 } catch (RemoteException e) { 287 Log.e(TAG, e.toString()); 288 } 289 } else { 290 Log.w(TAG, "Proxy not attached to service"); 291 if (DBG) 292 Log.d(TAG, Log.getStackTraceString(new Throwable())); 293 } 294 return false; 295 } 296 297 public boolean rxSetBand_nb(int band) { 298 if (DBG) 299 Log.d(TAG, "FmRadio:rxSetBand_nb"); 300 if (mService != null) { 301 try { 302 return mService.rxSetBand_nb(band); 303 } catch (RemoteException e) { 304 Log.e(TAG, e.toString()); 305 } 306 } else { 307 Log.w(TAG, "Proxy not attached to service"); 308 if (DBG) 309 Log.d(TAG, Log.getStackTraceString(new Throwable())); 310 } 311 return false; 312 } 313 314 public int rxGetBand() { 315 if (DBG) 316 Log.d(TAG, "FmRadio:rxGetBand"); 317 if (mService != null) { 318 try { 319 return mService.rxGetBand(); 320 } catch (RemoteException e) { 321 Log.e(TAG, e.toString()); 322 } 323 } else { 324 Log.w(TAG, "Proxy not attached to service"); 325 if (DBG) 326 Log.d(TAG, Log.getStackTraceString(new Throwable())); 327 } 328 return 0; 329 } 330 331 public boolean rxGetBand_nb() { 332 if (DBG) 333 Log.d(TAG, "FmRadio:rxGetBand_nb"); 334 if (mService != null) { 335 try { 336 return mService.rxGetBand_nb(); 337 } catch (RemoteException e) { 338 Log.e(TAG, e.toString()); 339 } 340 } else { 341 Log.w(TAG, "Proxy not attached to service"); 342 if (DBG) 343 Log.d(TAG, Log.getStackTraceString(new Throwable())); 344 } 345 return false; 346 } 347 348 public boolean rxSetMonoStereoMode(int mode) { 349 if (DBG) 350 Log.d(TAG, "FmRadio:rxSetMonoStereoMode"); 351 if (mService != null) { 352 try { 353 return mService.rxSetMonoStereoMode(mode); 354 } catch (RemoteException e) { 355 Log.e(TAG, e.toString()); 356 } 357 } else { 358 Log.w(TAG, "Proxy not attached to service"); 359 if (DBG) 360 Log.d(TAG, Log.getStackTraceString(new Throwable())); 361 } 362 return false; 363 } 364 365 public boolean rxSetMonoStereoMode_nb(int mode) { 366 if (DBG) 367 Log.d(TAG, "FmRadio:rxSetMonoStereoMode_nb"); 368 if (mService != null) { 369 try { 370 return mService.rxSetMonoStereoMode_nb(mode); 371 } catch (RemoteException e) { 372 Log.e(TAG, e.toString()); 373 } 374 } else { 375 Log.w(TAG, "Proxy not attached to service"); 376 if (DBG) 377 Log.d(TAG, Log.getStackTraceString(new Throwable())); 378 } 379 return false; 380 } 381 382 public boolean rxIsValidChannel() { 383 if (DBG) 384 Log.d(TAG, "FmRadio:rxIsValidChannel"); 385 if (mService != null) { 386 try { 387 return mService.rxIsValidChannel(); 388 } catch (RemoteException e) { 389 Log.e(TAG, e.toString()); 390 } 391 } else { 392 Log.w(TAG, "Proxy not attached to service"); 393 if (DBG) 394 Log.d(TAG, Log.getStackTraceString(new Throwable())); 395 } 396 return false; 397 } 398 399 public boolean rxCompleteScan_nb() { 400 if (DBG) 401 Log.d(TAG, "FmRadio:rxCompleteScan_nb"); 402 if (mService != null) { 403 try { 404 return mService.rxCompleteScan_nb(); 405 } catch (RemoteException e) { 406 Log.e(TAG, e.toString()); 407 } 408 } else { 409 Log.w(TAG, "Proxy not attached to service"); 410 if (DBG) 411 Log.d(TAG, Log.getStackTraceString(new Throwable())); 412 } 413 return false; 414 } 415 416 public boolean rxStopCompleteScan_nb() { 417 if (DBG) 418 Log.d(TAG, "FmRadio:rxStopCompleteScan_nb"); 419 if (mService != null) { 420 try { 421 return mService.rxStopCompleteScan_nb(); 422 } catch (RemoteException e) { 423 Log.e(TAG, e.toString()); 424 } 425 } else { 426 Log.w(TAG, "Proxy not attached to service"); 427 if (DBG) 428 Log.d(TAG, Log.getStackTraceString(new Throwable())); 429 } 430 return false; 431 } 432 433 public int rxStopCompleteScan() { 434 if (DBG) 435 Log.d(TAG, "FmRadio:rxStopCompleteScan"); 436 if (mService != null) { 437 try { 438 return mService.rxStopCompleteScan(); 439 } catch (RemoteException e) { 440 Log.e(TAG, e.toString()); 441 } 442 } else { 443 Log.w(TAG, "Proxy not attached to service"); 444 if (DBG) 445 Log.d(TAG, Log.getStackTraceString(new Throwable())); 446 } 447 return 0; 448 } 449 450 public double rxGetFwVersion() { 451 if (DBG) 452 Log.d(TAG, "FmRadio:rxGetFwVersion"); 453 if (mService != null) { 454 try { 455 return mService.rxGetFwVersion(); 456 } catch (RemoteException e) { 457 Log.e(TAG, e.toString()); 458 } 459 } else { 460 Log.w(TAG, "Proxy not attached to service"); 461 if (DBG) 462 Log.d(TAG, Log.getStackTraceString(new Throwable())); 463 } 464 return 0; 465 } 466 467 public int rxGetCompleteScanProgress() { 468 if (DBG) 469 Log.d(TAG, "FmRadio:rxGetCompleteScanProgress"); 470 if (mService != null) { 471 try { 472 return mService.rxGetCompleteScanProgress(); 473 } catch (RemoteException e) { 474 Log.e(TAG, e.toString()); 475 } 476 } else { 477 Log.w(TAG, "Proxy not attached to service"); 478 if (DBG) 479 Log.d(TAG, Log.getStackTraceString(new Throwable())); 480 } 481 return 0; 482 } 483 484 public boolean rxGetCompleteScanProgress_nb() { 485 if (DBG) 486 Log.d(TAG, "FmRadio:rxGetCompleteScanProgress_nb"); 487 if (mService != null) { 488 try { 489 return mService.rxGetCompleteScanProgress_nb(); 490 } catch (RemoteException e) { 491 Log.e(TAG, e.toString()); 492 } 493 } else { 494 Log.w(TAG, "Proxy not attached to service"); 495 if (DBG) 496 Log.d(TAG, Log.getStackTraceString(new Throwable())); 497 } 498 return false; 499 } 500 501 public int rxGetMonoStereoMode() { 502 if (DBG) 503 Log.d(TAG, "FmRadio:rxGetMonoStereoMode"); 504 if (mService != null) { 505 try { 506 return mService.rxGetMonoStereoMode(); 507 } catch (RemoteException e) { 508 Log.e(TAG, e.toString()); 509 } 510 } else { 511 Log.w(TAG, "Proxy not attached to service"); 512 if (DBG) 513 Log.d(TAG, Log.getStackTraceString(new Throwable())); 514 } 515 return 0; 516 } 517 518 public boolean rxGetMonoStereoMode_nb() { 519 if (DBG) 520 Log.d(TAG, "FmRadio:rxGetMonoStereoMode_nb"); 521 if (mService != null) { 522 try { 523 return mService.rxGetMonoStereoMode_nb(); 524 } catch (RemoteException e) { 525 Log.e(TAG, e.toString()); 526 } 527 } else { 528 Log.w(TAG, "Proxy not attached to service"); 529 if (DBG) 530 Log.d(TAG, Log.getStackTraceString(new Throwable())); 531 } 532 return false; 533 } 534 535 public boolean rxSetMuteMode(int muteMode) { 536 if (DBG) 537 Log.d(TAG, "FmRadio:rxSetMuteMode"); 538 if (mService != null) { 539 try { 540 return mService.rxSetMuteMode(muteMode); 541 } catch (RemoteException e) { 542 Log.e(TAG, e.toString()); 543 } 544 } else { 545 Log.w(TAG, "Proxy not attached to service"); 546 if (DBG) 547 Log.d(TAG, Log.getStackTraceString(new Throwable())); 548 } 549 return false; 550 } 551 552 public boolean rxSetMuteMode_nb(int muteMode) { 553 if (DBG) 554 Log.d(TAG, "FmRadio:rxSetMuteMode_nb"); 555 if (mService != null) { 556 try { 557 return mService.rxSetMuteMode_nb(muteMode); 558 } catch (RemoteException e) { 559 Log.e(TAG, e.toString()); 560 } 561 } else { 562 Log.w(TAG, "Proxy not attached to service"); 563 if (DBG) 564 Log.d(TAG, Log.getStackTraceString(new Throwable())); 565 } 566 return false; 567 } 568 569 public int rxGetMuteMode() { 570 if (DBG) 571 Log.d(TAG, "FmRadio:rxGetMuteMode"); 572 if (mService != null) { 573 try { 574 return mService.rxGetMuteMode(); 575 } catch (RemoteException e) { 576 Log.e(TAG, e.toString()); 577 } 578 } else { 579 Log.w(TAG, "Proxy not attached to service"); 580 if (DBG) 581 Log.d(TAG, Log.getStackTraceString(new Throwable())); 582 } 583 return 0; 584 } 585 586 public boolean rxGetMuteMode_nb() { 587 if (DBG) 588 Log.d(TAG, "FmRadio:rxGetMuteMode_nb"); 589 if (mService != null) { 590 try { 591 return mService.rxGetMuteMode_nb(); 592 } catch (RemoteException e) { 593 Log.e(TAG, e.toString()); 594 } 595 } else { 596 Log.w(TAG, "Proxy not attached to service"); 597 if (DBG) 598 Log.d(TAG, Log.getStackTraceString(new Throwable())); 599 } 600 return false; 601 } 602 603 public boolean rxSetRfDependentMuteMode(int rfMuteMode) { 604 if (DBG) 605 Log.d(TAG, "FmRadio:rxSetRfDependentMuteMode"); 606 if (mService != null) { 607 try { 608 return mService.rxSetRfDependentMuteMode(rfMuteMode); 609 } catch (RemoteException e) { 610 Log.e(TAG, e.toString()); 611 } 612 } else { 613 Log.w(TAG, "Proxy not attached to service"); 614 if (DBG) 615 Log.d(TAG, Log.getStackTraceString(new Throwable())); 616 } 617 return false; 618 } 619 620 public boolean rxSetRfDependentMuteMode_nb(int rfMuteMode) { 621 if (DBG) 622 Log.d(TAG, "FmRadio:rxSetRfDependentMuteMode_nb"); 623 if (mService != null) { 624 try { 625 return mService.rxSetRfDependentMuteMode_nb(rfMuteMode); 626 } catch (RemoteException e) { 627 Log.e(TAG, e.toString()); 628 } 629 } else { 630 Log.w(TAG, "Proxy not attached to service"); 631 if (DBG) 632 Log.d(TAG, Log.getStackTraceString(new Throwable())); 633 } 634 return false; 635 } 636 637 public int rxGetRfDependentMuteMode() { 638 if (DBG) 639 Log.d(TAG, "FmRadio:rxGetRfDependentMuteMode"); 640 if (mService != null) { 641 try { 642 return mService.rxGetRfDependentMuteMode(); 643 } catch (RemoteException e) { 644 Log.e(TAG, e.toString()); 645 } 646 } else { 647 Log.w(TAG, "Proxy not attached to service"); 648 if (DBG) 649 Log.d(TAG, Log.getStackTraceString(new Throwable())); 650 } 651 return 0; 652 } 653 654 public boolean rxGetRfDependentMuteMode_nb() { 655 if (DBG) 656 Log.d(TAG, "FmRadio:rxGetRfDependentMuteMode_nb"); 657 if (mService != null) { 658 try { 659 return mService.rxGetRfDependentMuteMode_nb(); 660 } catch (RemoteException e) { 661 Log.e(TAG, e.toString()); 662 } 663 } else { 664 Log.w(TAG, "Proxy not attached to service"); 665 if (DBG) 666 Log.d(TAG, Log.getStackTraceString(new Throwable())); 667 } 668 return false; 669 } 670 671 public boolean rxSetRssiThreshold(int threshhold) { 672 if (DBG) 673 Log.d(TAG, "FmRadio:rxSetRssiThreshold"); 674 if (mService != null) { 675 try { 676 return mService.rxSetRssiThreshold(threshhold); 677 } catch (RemoteException e) { 678 Log.e(TAG, e.toString()); 679 } 680 } else { 681 Log.w(TAG, "Proxy not attached to service"); 682 if (DBG) 683 Log.d(TAG, Log.getStackTraceString(new Throwable())); 684 } 685 return false; 686 } 687 688 public boolean rxSetRssiThreshold_nb(int threshhold) { 689 if (DBG) 690 Log.d(TAG, "FmRadio:rxSetRssiThreshold_nb"); 691 if (mService != null) { 692 try { 693 return mService.rxSetRssiThreshold_nb(threshhold); 694 } catch (RemoteException e) { 695 Log.e(TAG, e.toString()); 696 } 697 } else { 698 Log.w(TAG, "Proxy not attached to service"); 699 if (DBG) 700 Log.d(TAG, Log.getStackTraceString(new Throwable())); 701 } 702 return false; 703 } 704 705 public int rxGetRssiThreshold() { 706 if (DBG) 707 Log.d(TAG, "FmRadio:rxGetRssiThreshold"); 708 if (mService != null) { 709 try { 710 return mService.rxGetRssiThreshold(); 711 } catch (RemoteException e) { 712 Log.e(TAG, e.toString()); 713 } 714 } else { 715 Log.w(TAG, "Proxy not attached to service"); 716 if (DBG) 717 Log.d(TAG, Log.getStackTraceString(new Throwable())); 718 } 719 return 0; 720 } 721 722 public boolean rxGetRssiThreshold_nb() { 723 if (DBG) 724 Log.d(TAG, "FmRadio:rxGetRssiThreshold_nb"); 725 if (mService != null) { 726 try { 727 return mService.rxGetRssiThreshold_nb(); 728 } catch (RemoteException e) { 729 Log.e(TAG, e.toString()); 730 } 731 } else { 732 Log.w(TAG, "Proxy not attached to service"); 733 if (DBG) 734 Log.d(TAG, Log.getStackTraceString(new Throwable())); 735 } 736 return false; 737 } 738 739 public boolean rxSetDeEmphasisFilter(int filter) { 740 if (DBG) 741 Log.d(TAG, "FmRadio:rxSetDeEmphasisFilter"); 742 if (mService != null) { 743 try { 744 return mService.rxSetDeEmphasisFilter(filter); 745 } catch (RemoteException e) { 746 Log.e(TAG, e.toString()); 747 } 748 } else { 749 Log.w(TAG, "Proxy not attached to service"); 750 if (DBG) 751 Log.d(TAG, Log.getStackTraceString(new Throwable())); 752 } 753 return false; 754 } 755 756 public boolean rxSetDeEmphasisFilter_nb(int filter) { 757 if (DBG) 758 Log.d(TAG, "FmRadio:rxSetDeEmphasisFilter_nb"); 759 if (mService != null) { 760 try { 761 return mService.rxSetDeEmphasisFilter_nb(filter); 762 } catch (RemoteException e) { 763 Log.e(TAG, e.toString()); 764 } 765 } else { 766 Log.w(TAG, "Proxy not attached to service"); 767 if (DBG) 768 Log.d(TAG, Log.getStackTraceString(new Throwable())); 769 } 770 return false; 771 } 772 773 public int rxGetDeEmphasisFilter() { 774 if (DBG) 775 Log.d(TAG, "FmRadio:rxGetDeEmphasisFilter"); 776 if (mService != null) { 777 try { 778 return mService.rxGetDeEmphasisFilter(); 779 } catch (RemoteException e) { 780 Log.e(TAG, e.toString()); 781 } 782 } else { 783 Log.w(TAG, "Proxy not attached to service"); 784 if (DBG) 785 Log.d(TAG, Log.getStackTraceString(new Throwable())); 786 } 787 return 0; 788 } 789 790 public boolean rxGetDeEmphasisFilter_nb() { 791 if (DBG) 792 Log.d(TAG, "FmRadio:rxGetDeEmphasisFilter_nb"); 793 if (mService != null) { 794 try { 795 return mService.rxGetDeEmphasisFilter_nb(); 796 } catch (RemoteException e) { 797 Log.e(TAG, e.toString()); 798 } 799 } else { 800 Log.w(TAG, "Proxy not attached to service"); 801 if (DBG) 802 Log.d(TAG, Log.getStackTraceString(new Throwable())); 803 } 804 return false; 805 } 806 807 public boolean rxSetVolume(int volume) { 808 if (DBG) 809 Log.d(TAG, "FmRadio:rxSetVolume"); 810 if (mService != null) { 811 try { 812 return mService.rxSetVolume(volume); 813 } catch (RemoteException e) { 814 Log.e(TAG, e.toString()); 815 } 816 } else { 817 Log.w(TAG, "Proxy not attached to service"); 818 if (DBG) 819 Log.d(TAG, Log.getStackTraceString(new Throwable())); 820 } 821 return false; 822 } 823 824 public boolean rxSetChannelSpacing(int channelSpace) { 825 826 if (DBG) 827 Log.d(TAG, "FmRadio:rxSetChannelSpacing"); 828 if (mService != null) { 829 try { 830 return mService.rxSetChannelSpacing(channelSpace); 831 } catch (RemoteException e) { 832 Log.e(TAG, e.toString()); 833 } 834 } else { 835 Log.w(TAG, "Proxy not attached to service"); 836 if (DBG) 837 Log.d(TAG, Log.getStackTraceString(new Throwable())); 838 } 839 return false; 840 } 841 842 public boolean rxSetChannelSpacing_nb(int channelSpace) { 843 if (DBG) 844 Log.d(TAG, "FmRadio:rxSetChannelSpacing_nb"); 845 if (mService != null) { 846 try { 847 return mService.rxSetChannelSpacing_nb(channelSpace); 848 } catch (RemoteException e) { 849 Log.e(TAG, e.toString()); 850 } 851 } else { 852 Log.w(TAG, "Proxy not attached to service"); 853 if (DBG) 854 Log.d(TAG, Log.getStackTraceString(new Throwable())); 855 } 856 return false; 857 } 858 859 public int rxGetVolume() { 860 if (DBG) 861 Log.d(TAG, "FmRadio:rxGetVolume"); 862 if (mService != null) { 863 try { 864 return mService.rxGetVolume(); 865 } catch (RemoteException e) { 866 Log.e(TAG, e.toString()); 867 } 868 } else { 869 Log.w(TAG, "Proxy not attached to service"); 870 if (DBG) 871 Log.d(TAG, Log.getStackTraceString(new Throwable())); 872 } 873 return 0; 874 } 875 876 public boolean rxGetVolume_nb() { 877 if (DBG) 878 Log.d(TAG, "FmRadio:rxGetVolume_nb"); 879 if (mService != null) { 880 try { 881 return mService.rxGetVolume_nb(); 882 } catch (RemoteException e) { 883 Log.e(TAG, e.toString()); 884 } 885 } else { 886 Log.w(TAG, "Proxy not attached to service"); 887 if (DBG) 888 Log.d(TAG, Log.getStackTraceString(new Throwable())); 889 } 890 return false; 891 } 892 893 public int rxGetChannelSpacing() { 894 if (DBG) 895 Log.d(TAG, "FmRadio:rxGetChannelSpacing"); 896 if (mService != null) { 897 try { 898 return mService.rxGetChannelSpacing(); 899 } catch (RemoteException e) { 900 Log.e(TAG, e.toString()); 901 } 902 } else { 903 Log.w(TAG, "Proxy not attached to service"); 904 if (DBG) 905 Log.d(TAG, Log.getStackTraceString(new Throwable())); 906 } 907 return 0; 908 } 909 910 public boolean rxGetChannelSpacing_nb() { 911 if (DBG) 912 Log.d(TAG, "FmRadio:rxGetChannelSpacing"); 913 if (mService != null) { 914 try { 915 return mService.rxGetChannelSpacing_nb(); 916 } catch (RemoteException e) { 917 Log.e(TAG, e.toString()); 918 } 919 } else { 920 Log.w(TAG, "Proxy not attached to service"); 921 if (DBG) 922 Log.d(TAG, Log.getStackTraceString(new Throwable())); 923 } 924 return false; 925 } 926 927 public boolean rxTune_nb(int freq) { 928 if (DBG) 929 Log.d(TAG, "FmRadio:rxTune_nb"); 930 if (mService != null) { 931 try { 932 return mService.rxTune_nb(freq); 933 } catch (RemoteException e) { 934 Log.e(TAG, e.toString()); 935 } 936 } else { 937 Log.w(TAG, "Proxy not attached to service"); 938 if (DBG) 939 Log.d(TAG, Log.getStackTraceString(new Throwable())); 940 } 941 return false; 942 } 943 944 public int rxGetTunedFrequency() { 945 if (DBG) 946 Log.d(TAG, "FmRadio:rxGetTunedFrequency"); 947 if (mService != null) { 948 try { 949 return mService.rxGetTunedFrequency(); 950 } catch (RemoteException e) { 951 Log.e(TAG, e.toString()); 952 } 953 } else { 954 Log.w(TAG, "Proxy not attached to service"); 955 if (DBG) 956 Log.d(TAG, Log.getStackTraceString(new Throwable())); 957 } 958 return 0; 959 } 960 961 public boolean rxGetTunedFrequency_nb() { 962 if (DBG) 963 Log.d(TAG, "FmRadio:rxGetTunedFrequency_nb"); 964 if (mService != null) { 965 try { 966 return mService.rxGetTunedFrequency_nb(); 967 } catch (RemoteException e) { 968 Log.e(TAG, e.toString()); 969 } 970 } else { 971 Log.w(TAG, "Proxy not attached to service"); 972 if (DBG) 973 Log.d(TAG, Log.getStackTraceString(new Throwable())); 974 } 975 return false; 976 } 977 978 public boolean rxSeek_nb(int direction) { 979 if (DBG) 980 Log.d(TAG, "FmRadio:rxSeek_nb"); 981 if (mService != null) { 982 try { 983 return mService.rxSeek_nb(direction); 984 } catch (RemoteException e) { 985 Log.e(TAG, e.toString()); 986 } 987 } else { 988 Log.w(TAG, "Proxy not attached to service"); 989 if (DBG) 990 Log.d(TAG, Log.getStackTraceString(new Throwable())); 991 } 992 return false; 993 } 994 995 public boolean rxStopSeek() { 996 if (DBG) 997 Log.d(TAG, "FmRadio:rxStopSeek"); 998 if (mService != null) { 999 try { 1000 return mService.rxStopSeek(); 1001 } catch (RemoteException e) { 1002 Log.e(TAG, e.toString()); 1003 } 1004 } else { 1005 Log.w(TAG, "Proxy not attached to service"); 1006 if (DBG) 1007 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1008 } 1009 return false; 1010 } 1011 1012 public boolean rxStopSeek_nb() { 1013 if (DBG) 1014 Log.d(TAG, "FmRadio:rxStopSeek_nb"); 1015 if (mService != null) { 1016 try { 1017 return mService.rxStopSeek_nb(); 1018 } catch (RemoteException e) { 1019 Log.e(TAG, e.toString()); 1020 } 1021 } else { 1022 Log.w(TAG, "Proxy not attached to service"); 1023 if (DBG) 1024 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1025 } 1026 return false; 1027 } 1028 1029 public int rxGetRdsSystem() { 1030 if (DBG) 1031 Log.d(TAG, "FmRadio:rxGetRdsSystem"); 1032 if (mService != null) { 1033 try { 1034 return mService.rxGetRdsSystem(); 1035 } catch (RemoteException e) { 1036 Log.e(TAG, e.toString()); 1037 } 1038 } else { 1039 Log.w(TAG, "Proxy not attached to service"); 1040 if (DBG) 1041 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1042 } 1043 return 0; 1044 } 1045 1046 public boolean rxGetRdsSystem_nb() { 1047 if (DBG) 1048 Log.d(TAG, "FmRadio:rxGetRdsSystem_nb"); 1049 if (mService != null) { 1050 try { 1051 return mService.rxGetRdsSystem_nb(); 1052 } catch (RemoteException e) { 1053 Log.e(TAG, e.toString()); 1054 } 1055 } else { 1056 Log.w(TAG, "Proxy not attached to service"); 1057 if (DBG) 1058 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1059 } 1060 return false; 1061 } 1062 1063 public int rxGetRssi() { 1064 if (DBG) 1065 Log.d(TAG, "FmRadio:rxGetRssi"); 1066 if (mService != null) { 1067 try { 1068 return mService.rxGetRssi(); 1069 } catch (RemoteException e) { 1070 Log.e(TAG, e.toString()); 1071 } 1072 } else { 1073 Log.w(TAG, "Proxy not attached to service"); 1074 if (DBG) 1075 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1076 } 1077 return 0; 1078 } 1079 1080 public boolean rxGetRssi_nb() { 1081 if (DBG) 1082 Log.d(TAG, "FmRadio:rxGetRssi_nb"); 1083 if (mService != null) { 1084 try { 1085 return mService.rxGetRssi_nb(); 1086 } catch (RemoteException e) { 1087 Log.e(TAG, e.toString()); 1088 } 1089 } else { 1090 Log.w(TAG, "Proxy not attached to service"); 1091 if (DBG) 1092 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1093 } 1094 return false; 1095 } 1096 1097 public boolean rxSetRdsSystem(int system) { 1098 if (DBG) 1099 Log.d(TAG, "FmRadio:rxSetRdsSystem"); 1100 if (mService != null) { 1101 try { 1102 return mService.rxSetRdsSystem(system); 1103 } catch (RemoteException e) { 1104 Log.e(TAG, e.toString()); 1105 } 1106 } else { 1107 Log.w(TAG, "Proxy not attached to service"); 1108 if (DBG) 1109 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1110 } 1111 return false; 1112 } 1113 1114 public boolean rxSetRdsSystem_nb(int system) { 1115 if (DBG) 1116 Log.d(TAG, "FmRadio:rxSetRdsSystem_nb"); 1117 if (mService != null) { 1118 try { 1119 return mService.rxSetRdsSystem_nb(system); 1120 } catch (RemoteException e) { 1121 Log.e(TAG, e.toString()); 1122 } 1123 } else { 1124 Log.w(TAG, "Proxy not attached to service"); 1125 if (DBG) 1126 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1127 } 1128 return false; 1129 } 1130 1131 public boolean rxEnableRds() { 1132 if (DBG) 1133 Log.d(TAG, "FmRadio:rxEnableRds"); 1134 if (mService != null) { 1135 try { 1136 return mService.rxEnableRds(); 1137 } catch (RemoteException e) { 1138 Log.e(TAG, e.toString()); 1139 } 1140 } else { 1141 Log.w(TAG, "Proxy not attached to service"); 1142 if (DBG) 1143 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1144 } 1145 return false; 1146 } 1147 1148 public boolean rxDisableRds() { 1149 if (DBG) 1150 Log.d(TAG, "FmRadio:rxDisableRds"); 1151 if (mService != null) { 1152 try { 1153 return mService.rxDisableRds(); 1154 } catch (RemoteException e) { 1155 Log.e(TAG, e.toString()); 1156 } 1157 } else { 1158 Log.w(TAG, "Proxy not attached to service"); 1159 if (DBG) 1160 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1161 } 1162 return false; 1163 } 1164 1165 public boolean rxEnableRds_nb() { 1166 if (DBG) 1167 Log.d(TAG, "FmRadio:rxEnableRds_nb"); 1168 if (mService != null) { 1169 try { 1170 return mService.rxEnableRds_nb(); 1171 } catch (RemoteException e) { 1172 Log.e(TAG, e.toString()); 1173 } 1174 } else { 1175 Log.w(TAG, "Proxy not attached to service"); 1176 if (DBG) 1177 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1178 } 1179 return false; 1180 } 1181 1182 public boolean rxDisableRds_nb() { 1183 if (DBG) 1184 Log.d(TAG, "FmRadio:rxDisableRds_nb"); 1185 if (mService != null) { 1186 try { 1187 return mService.rxDisableRds_nb(); 1188 } catch (RemoteException e) { 1189 Log.e(TAG, e.toString()); 1190 } 1191 } else { 1192 Log.w(TAG, "Proxy not attached to service"); 1193 if (DBG) 1194 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1195 } 1196 return false; 1197 } 1198 1199 public boolean rxSetRdsGroupMask(int mask) { 1200 if (DBG) 1201 Log.d(TAG, "FmRadio:rxSetRdsGroupMask"); 1202 if (mService != null) { 1203 try { 1204 return mService.rxSetRdsGroupMask(mask); 1205 } catch (RemoteException e) { 1206 Log.e(TAG, e.toString()); 1207 } 1208 } else { 1209 Log.w(TAG, "Proxy not attached to service"); 1210 if (DBG) 1211 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1212 } 1213 return false; 1214 } 1215 1216 public boolean rxSetRdsGroupMask_nb(int mask) { 1217 if (DBG) 1218 Log.d(TAG, "FmRadio:rxSetRdsGroupMask_nb"); 1219 if (mService != null) { 1220 try { 1221 return mService.rxSetRdsGroupMask_nb(mask); 1222 } catch (RemoteException e) { 1223 Log.e(TAG, e.toString()); 1224 } 1225 } else { 1226 Log.w(TAG, "Proxy not attached to service"); 1227 if (DBG) 1228 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1229 } 1230 return false; 1231 } 1232 1233 public long rxGetRdsGroupMask() { 1234 if (DBG) 1235 Log.d(TAG, "FmRadio:rxSetRdsGroupMask"); 1236 if (mService != null) { 1237 try { 1238 return mService.rxGetRdsGroupMask(); 1239 } catch (RemoteException e) { 1240 Log.e(TAG, e.toString()); 1241 } 1242 } else { 1243 Log.w(TAG, "Proxy not attached to service"); 1244 if (DBG) 1245 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1246 } 1247 return 0; 1248 } 1249 1250 public boolean rxGetRdsGroupMask_nb() { 1251 if (DBG) 1252 Log.d(TAG, "FmRadio:rxGetRdsGroupMask_nb"); 1253 if (mService != null) { 1254 try { 1255 return mService.rxGetRdsGroupMask_nb(); 1256 } catch (RemoteException e) { 1257 Log.e(TAG, e.toString()); 1258 } 1259 } else { 1260 Log.w(TAG, "Proxy not attached to service"); 1261 if (DBG) 1262 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1263 } 1264 return false; 1265 } 1266 1267 public boolean rxSetRdsAfSwitchMode(int mode) { 1268 if (DBG) 1269 Log.d(TAG, "FmRadio:rxSetRdsAfSwitchMode"); 1270 if (mService != null) { 1271 try { 1272 return mService.rxSetRdsAfSwitchMode(mode); 1273 } catch (RemoteException e) { 1274 Log.e(TAG, e.toString()); 1275 } 1276 } else { 1277 Log.w(TAG, "Proxy not attached to service"); 1278 if (DBG) 1279 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1280 } 1281 return false; 1282 } 1283 1284 public boolean rxSetRdsAfSwitchMode_nb(int mode) { 1285 if (DBG) 1286 Log.d(TAG, "FmRadio:rxSetRdsAfSwitchMode_nb"); 1287 if (mService != null) { 1288 try { 1289 return mService.rxSetRdsAfSwitchMode_nb(mode); 1290 } catch (RemoteException e) { 1291 Log.e(TAG, e.toString()); 1292 } 1293 } else { 1294 Log.w(TAG, "Proxy not attached to service"); 1295 if (DBG) 1296 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1297 } 1298 return false; 1299 } 1300 1301 public int rxGetRdsAfSwitchMode() { 1302 if (DBG) 1303 Log.d(TAG, "FmRadio:rxGetRdsAfSwitchMode"); 1304 if (mService != null) { 1305 try { 1306 return mService.rxGetRdsAfSwitchMode(); 1307 } catch (RemoteException e) { 1308 Log.e(TAG, e.toString()); 1309 } 1310 } else { 1311 Log.w(TAG, "Proxy not attached to service"); 1312 if (DBG) 1313 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1314 } 1315 return 0; 1316 } 1317 1318 public boolean rxGetRdsAfSwitchMode_nb() { 1319 if (DBG) 1320 Log.d(TAG, "FmRadio:rxGetRdsAfSwitchMode_nb"); 1321 if (mService != null) { 1322 try { 1323 return mService.rxGetRdsAfSwitchMode_nb(); 1324 } catch (RemoteException e) { 1325 Log.e(TAG, e.toString()); 1326 } 1327 } else { 1328 Log.w(TAG, "Proxy not attached to service"); 1329 if (DBG) 1330 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1331 } 1332 return false; 1333 } 1334 1335 public boolean rxChangeAudioTarget(int mask, int digitalConfig) { 1336 if (DBG) 1337 Log.d(TAG, "FmRadio:rxChangeAudioTarget"); 1338 if (mService != null) { 1339 try { 1340 return mService.rxChangeAudioTarget(mask, digitalConfig); 1341 } catch (RemoteException e) { 1342 Log.e(TAG, e.toString()); 1343 } 1344 } else { 1345 Log.w(TAG, "Proxy not attached to service"); 1346 if (DBG) 1347 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1348 } 1349 return false; 1350 } 1351 1352 public boolean rxChangeDigitalTargetConfiguration(int digitalConfig) { 1353 if (DBG) 1354 Log.d(TAG, "FmRadio:rxChangeDigitalTargetConfiguration"); 1355 if (mService != null) { 1356 try { 1357 return mService.rxChangeDigitalTargetConfiguration(digitalConfig); 1358 } catch (RemoteException e) { 1359 Log.e(TAG, e.toString()); 1360 } 1361 } else { 1362 Log.w(TAG, "Proxy not attached to service"); 1363 if (DBG) 1364 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1365 } 1366 return false; 1367 } 1368 1369 public boolean rxEnableAudioRouting() { 1370 if (DBG) 1371 Log.d(TAG, "FmRadio:rxEnableAudioRouting"); 1372 if (mService != null) { 1373 try { 1374 return mService.rxEnableAudioRouting(); 1375 } catch (RemoteException e) { 1376 Log.e(TAG, e.toString()); 1377 } 1378 } else { 1379 Log.w(TAG, "Proxy not attached to service"); 1380 if (DBG) 1381 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1382 } 1383 return false; 1384 } 1385 1386 public boolean rxDisableAudioRouting() { 1387 if (DBG) 1388 Log.d(TAG, "FmRadio:rxDisableAudioRouting"); 1389 if (mService != null) { 1390 try { 1391 return mService.rxDisableAudioRouting(); 1392 } catch (RemoteException e) { 1393 Log.e(TAG, e.toString()); 1394 } 1395 } else { 1396 Log.w(TAG, "Proxy not attached to service"); 1397 if (DBG) 1398 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1399 } 1400 return false; 1401 } 1402 1403 /************** Fm TX *****************/ 1404 public boolean txEnable() { 1405 if (DBG) 1406 Log.d(TAG, "FmRadio:txEnable"); 1407 if (mService != null) { 1408 try { 1409 return mService.txEnable(); 1410 } catch (RemoteException e) { 1411 Log.e(TAG, e.toString()); 1412 } 1413 } else { 1414 Log.w(TAG, "Proxy not attached to service"); 1415 if (DBG) 1416 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1417 } 1418 return false; 1419 } 1420 1421 /** 1422 * Returns true if the EM RX is disabled. Returns false if not enabled, or 1423 * if this proxy object if not currently connected to the FmRadio service. 1424 */ 1425 public boolean txDisable() { 1426 if (DBG) 1427 Log.d(TAG, "FmRadio:txDisable"); 1428 if (mService != null) { 1429 try { 1430 return mService.txDisable(); 1431 } catch (RemoteException e) { 1432 Log.e(TAG, e.toString()); 1433 } 1434 } else { 1435 Log.w(TAG, "Proxy not attached to service"); 1436 if (DBG) 1437 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1438 } 1439 return false; 1440 } 1441 1442 public boolean txStartTransmission() { 1443 if (DBG) 1444 Log.d(TAG, "FmRadio:txStartTransmission"); 1445 if (mService != null) { 1446 try { 1447 return mService.txStartTransmission(); 1448 } catch (RemoteException e) { 1449 Log.e(TAG, e.toString()); 1450 } 1451 } else { 1452 Log.w(TAG, "Proxy not attached to service"); 1453 if (DBG) 1454 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1455 } 1456 return false; 1457 } 1458 1459 public boolean txStopTransmission() { 1460 if (DBG) 1461 Log.d(TAG, "FmRadio:txStopTransmission"); 1462 if (mService != null) { 1463 try { 1464 return mService.txStopTransmission(); 1465 } catch (RemoteException e) { 1466 Log.e(TAG, e.toString()); 1467 } 1468 } else { 1469 Log.w(TAG, "Proxy not attached to service"); 1470 if (DBG) 1471 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1472 } 1473 return false; 1474 } 1475 1476 public boolean txTune(long freq) { 1477 if (DBG) 1478 Log.d(TAG, "FmRadio:txTune"); 1479 if (mService != null) { 1480 try { 1481 return mService.txTune(freq); 1482 } catch (RemoteException e) { 1483 Log.e(TAG, e.toString()); 1484 } 1485 } else { 1486 Log.w(TAG, "Proxy not attached to service"); 1487 if (DBG) 1488 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1489 } 1490 return false; 1491 } 1492 1493 public boolean txSetPowerLevel(int powerLevel) { 1494 if (DBG) 1495 Log.d(TAG, "FmRadio:txSetPowerLevel"); 1496 if (mService != null) { 1497 try { 1498 return mService.txSetPowerLevel(powerLevel); 1499 } catch (RemoteException e) { 1500 Log.e(TAG, e.toString()); 1501 } 1502 } else { 1503 Log.w(TAG, "Proxy not attached to service"); 1504 if (DBG) 1505 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1506 } 1507 return false; 1508 } 1509 1510 public boolean txEnableRds() { 1511 if (DBG) 1512 Log.d(TAG, "FmRadio:txEnableRds"); 1513 if (mService != null) { 1514 try { 1515 return mService.txEnableRds(); 1516 } catch (RemoteException e) { 1517 Log.e(TAG, e.toString()); 1518 } 1519 } else { 1520 Log.w(TAG, "Proxy not attached to service"); 1521 if (DBG) 1522 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1523 } 1524 return false; 1525 } 1526 1527 public boolean txDisableRds() { 1528 if (DBG) 1529 Log.d(TAG, "FmRadio:txDisableRds"); 1530 if (mService != null) { 1531 try { 1532 return mService.txDisableRds(); 1533 } catch (RemoteException e) { 1534 Log.e(TAG, e.toString()); 1535 } 1536 } else { 1537 Log.w(TAG, "Proxy not attached to service"); 1538 if (DBG) 1539 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1540 } 1541 return false; 1542 } 1543 1544 public boolean txSetRdsTransmissionMode(int mode) { 1545 if (DBG) 1546 Log.d(TAG, "FmRadio:txSetRdsTransmissionMode"); 1547 if (mService != null) { 1548 try { 1549 return mService.txSetRdsTransmissionMode(mode); 1550 } catch (RemoteException e) { 1551 Log.e(TAG, e.toString()); 1552 } 1553 } else { 1554 Log.w(TAG, "Proxy not attached to service"); 1555 if (DBG) 1556 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1557 } 1558 return false; 1559 } 1560 1561 public boolean txSetRdsTextPsMsg(String psString) { 1562 if (DBG) 1563 Log.d(TAG, "FmRadio:txSetRdsTextPsMsg"); 1564 if (mService != null) { 1565 try { 1566 return mService.txSetRdsTextPsMsg(psString); 1567 } catch (RemoteException e) { 1568 Log.e(TAG, e.toString()); 1569 } 1570 } else { 1571 Log.w(TAG, "Proxy not attached to service"); 1572 if (DBG) 1573 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1574 } 1575 return false; 1576 } 1577 1578 public boolean txWriteRdsRawData(String rawData) { 1579 if (DBG) 1580 Log.d(TAG, "FmRadio:txWriteRdsRawData"); 1581 if (mService != null) { 1582 try { 1583 return mService.txWriteRdsRawData(rawData); 1584 } catch (RemoteException e) { 1585 Log.e(TAG, e.toString()); 1586 } 1587 } else { 1588 Log.w(TAG, "Proxy not attached to service"); 1589 if (DBG) 1590 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1591 } 1592 return false; 1593 } 1594 1595 public boolean txSetMonoStereoMode(int mode) { 1596 if (DBG) 1597 Log.d(TAG, "FmRadio:txSetMonoStereoMode"); 1598 if (mService != null) { 1599 try { 1600 return mService.txSetMonoStereoMode(mode); 1601 } catch (RemoteException e) { 1602 Log.e(TAG, e.toString()); 1603 } 1604 } else { 1605 Log.w(TAG, "Proxy not attached to service"); 1606 if (DBG) 1607 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1608 } 1609 return false; 1610 } 1611 1612 public boolean txSetPreEmphasisFilter(int preEmpFilter) { 1613 if (DBG) 1614 Log.d(TAG, "FmRadio:txSetPreEmphasisFilter"); 1615 if (mService != null) { 1616 try { 1617 return mService.txSetPreEmphasisFilter(preEmpFilter); 1618 } catch (RemoteException e) { 1619 Log.e(TAG, e.toString()); 1620 } 1621 } else { 1622 Log.w(TAG, "Proxy not attached to service"); 1623 if (DBG) 1624 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1625 } 1626 return false; 1627 } 1628 1629 public boolean txSetMuteMode(int muteMode) { 1630 if (DBG) 1631 Log.d(TAG, "FmRadio:txSetMuteMode"); 1632 if (mService != null) { 1633 try { 1634 return mService.txSetMuteMode(muteMode); 1635 } catch (RemoteException e) { 1636 Log.e(TAG, e.toString()); 1637 } 1638 } else { 1639 Log.w(TAG, "Proxy not attached to service"); 1640 if (DBG) 1641 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1642 } 1643 return false; 1644 } 1645 1646 public boolean txSetRdsAfCode(int afCode) { 1647 if (DBG) 1648 Log.d(TAG, "FmRadio:txSetRdsAfCode"); 1649 if (mService != null) { 1650 try { 1651 return mService.txSetRdsAfCode(afCode); 1652 } catch (RemoteException e) { 1653 Log.e(TAG, e.toString()); 1654 } 1655 } else { 1656 Log.w(TAG, "Proxy not attached to service"); 1657 if (DBG) 1658 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1659 } 1660 return false; 1661 } 1662 1663 public boolean txSetRdsPiCode(int piCode) { 1664 if (DBG) 1665 Log.d(TAG, "FmRadio:txSetRdsPiCode"); 1666 if (mService != null) { 1667 try { 1668 return mService.txSetRdsPiCode(piCode); 1669 } catch (RemoteException e) { 1670 Log.e(TAG, e.toString()); 1671 } 1672 } else { 1673 Log.w(TAG, "Proxy not attached to service"); 1674 if (DBG) 1675 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1676 } 1677 return false; 1678 } 1679 1680 public boolean txSetRdsPtyCode(int ptyCode) { 1681 Log.d(TAG, "FmRadio:txSetRdsPtyCode"); 1682 if (mService != null) { 1683 try { 1684 return mService.txSetRdsPtyCode(ptyCode); 1685 } catch (RemoteException e) { 1686 Log.e(TAG, e.toString()); 1687 } 1688 } else { 1689 Log.w(TAG, "Proxy not attached to service"); 1690 if (DBG) 1691 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1692 } 1693 return false; 1694 } 1695 1696 public boolean txSetRdsTextRepertoire(int repertoire) { 1697 if (DBG) 1698 Log.d(TAG, "FmRadio:txSetRdsTextRepertoire"); 1699 if (mService != null) { 1700 try { 1701 return mService.txSetRdsTextRepertoire(repertoire); 1702 } catch (RemoteException e) { 1703 Log.e(TAG, e.toString()); 1704 } 1705 } else { 1706 Log.w(TAG, "Proxy not attached to service"); 1707 if (DBG) 1708 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1709 } 1710 return false; 1711 } 1712 1713 public boolean txSetRdsPsDisplayMode(int dispalyMode) { 1714 if (DBG) 1715 Log.d(TAG, "FmRadio:txSetRdsPsDisplayMode"); 1716 if (mService != null) { 1717 try { 1718 return mService.txSetRdsPsDisplayMode(dispalyMode); 1719 } catch (RemoteException e) { 1720 Log.e(TAG, e.toString()); 1721 } 1722 } else { 1723 Log.w(TAG, "Proxy not attached to service"); 1724 if (DBG) 1725 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1726 } 1727 return false; 1728 } 1729 1730 public boolean txSetRdsPsScrollSpeed(int scrollSpeed) { 1731 if (DBG) 1732 Log.d(TAG, "FmRadio:txSetRdsPsScrollSpeed"); 1733 if (mService != null) { 1734 try { 1735 return mService.txSetRdsPsScrollSpeed(scrollSpeed); 1736 } catch (RemoteException e) { 1737 Log.e(TAG, e.toString()); 1738 } 1739 } else { 1740 Log.w(TAG, "Proxy not attached to service"); 1741 if (DBG) 1742 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1743 } 1744 return false; 1745 } 1746 1747 public boolean txSetRdsTextRtMsg(int msgType, String msg, int msgLength) { 1748 if (DBG) 1749 Log.d(TAG, "FmRadio:txSetRdsTextRtMsg"); 1750 if (mService != null) { 1751 try { 1752 return mService.txSetRdsTextRtMsg(msgType, msg, msgLength); 1753 } catch (RemoteException e) { 1754 Log.e(TAG, e.toString()); 1755 } 1756 } else { 1757 Log.w(TAG, "Proxy not attached to service"); 1758 if (DBG) 1759 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1760 } 1761 return false; 1762 } 1763 1764 public boolean txSetRdsTransmittedGroupsMask(long rdsTrasmittedGrpMask) { 1765 if (DBG) 1766 Log.d(TAG, "FmRadio:txSetRdsTransmittedGroupsMask"); 1767 if (mService != null) { 1768 try { 1769 return mService.txSetRdsTransmittedGroupsMask(rdsTrasmittedGrpMask); 1770 } catch (RemoteException e) { 1771 Log.e(TAG, e.toString()); 1772 } 1773 } else { 1774 Log.w(TAG, "Proxy not attached to service"); 1775 if (DBG) 1776 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1777 } 1778 return false; 1779 } 1780 1781 public boolean txSetRdsTrafficCodes(int taCode, int tpCode) { 1782 if (DBG) 1783 Log.d(TAG, "FmRadio:txSetRdsTrafficCodes"); 1784 if (mService != null) { 1785 try { 1786 return mService.txSetRdsTrafficCodes(taCode, tpCode); 1787 } catch (RemoteException e) { 1788 Log.e(TAG, e.toString()); 1789 } 1790 } else { 1791 Log.w(TAG, "Proxy not attached to service"); 1792 if (DBG) 1793 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1794 } 1795 return false; 1796 } 1797 1798 public boolean txSetRdsMusicSpeechFlag(int musicSpeechFlag) { 1799 if (DBG) 1800 Log.d(TAG, "FmRadio:txSetRdsMusicSpeechFlag"); 1801 if (mService != null) { 1802 try { 1803 return mService.txSetRdsMusicSpeechFlag(musicSpeechFlag); 1804 } catch (RemoteException e) { 1805 Log.e(TAG, e.toString()); 1806 } 1807 } else { 1808 Log.w(TAG, "Proxy not attached to service"); 1809 if (DBG) 1810 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1811 } 1812 return false; 1813 } 1814 1815 public boolean txSetRdsECC(int ecc) { 1816 if (DBG) 1817 Log.d(TAG, "FmRadio:txSetRdsECC"); 1818 if (mService != null) { 1819 try { 1820 return mService.txSetRdsECC(ecc); 1821 } catch (RemoteException e) { 1822 Log.e(TAG, e.toString()); 1823 } 1824 } else { 1825 Log.w(TAG, "Proxy not attached to service"); 1826 if (DBG) 1827 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1828 } 1829 return false; 1830 } 1831 1832 public boolean txChangeAudioSource(int audioSrc, int ecalSampleFreq) { 1833 if (DBG) 1834 Log.d(TAG, "FmRadio:txChangeAudioSource"); 1835 if (mService != null) { 1836 try { 1837 return mService.txChangeAudioSource(audioSrc, ecalSampleFreq); 1838 } catch (RemoteException e) { 1839 Log.e(TAG, e.toString()); 1840 } 1841 } else { 1842 Log.w(TAG, "Proxy not attached to service"); 1843 if (DBG) 1844 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1845 } 1846 return false; 1847 } 1848 1849 public boolean txChangeDigitalSourceConfiguration(int ecalSampleFreq) { 1850 if (DBG) 1851 Log.d(TAG, "FmRadio:txChangeDigitalSourceConfiguration"); 1852 if (mService != null) { 1853 try { 1854 return mService.txChangeDigitalSourceConfiguration(ecalSampleFreq); 1855 } catch (RemoteException e) { 1856 Log.e(TAG, e.toString()); 1857 } 1858 } else { 1859 Log.w(TAG, "Proxy not attached to service"); 1860 if (DBG) 1861 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1862 } 1863 return false; 1864 } 1865 1866 /** 1867 * Returns the current FM TX state 1868 */ 1869 public int txGetFMState() { 1870 if (DBG) 1871 Log.d(TAG, "FmRadio:txGetFMState"); 1872 if (mService != null) { 1873 try { 1874 return mService.txGetFMState(); 1875 } catch (RemoteException e) { 1876 Log.e(TAG, e.toString()); 1877 } 1878 } else { 1879 Log.w(TAG, "Proxy not attached to service"); 1880 if (DBG) 1881 Log.d(TAG, Log.getStackTraceString(new Throwable())); 1882 } 1883 return -1; 1884 } 1885 1886 } 1887