Home | History | Annotate | Download | only in fmradio
      1 /*
      2  * Copyright (C) 2014 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.fmradio;
     18 
     19 import android.os.Bundle;
     20 
     21 /**
     22  * Activity connect FMRadio service should implements this interface to update
     23  * ui or status
     24  */
     25 public interface FmListener {
     26     /**
     27      * directly call back from service to activity
     28      */
     29     // FM RDS station changed
     30     int LISTEN_RDSSTATION_CHANGED = 0x00100010;
     31 
     32     // FM PS information changed
     33     int LISTEN_PS_CHANGED = 0x00100011;
     34 
     35     // FM RT information changed
     36     int LISTEN_RT_CHANGED = 0x00100100;
     37 
     38     // FM Record state changed
     39     int LISTEN_RECORDSTATE_CHANGED = 0x00100101; // 1048833
     40 
     41     // FM record error occur
     42     int LISTEN_RECORDERROR = 0x00100110; // 1048848
     43 
     44     // FM record mode change
     45     int LISTEN_RECORDMODE_CHANGED = 0x00100111; // 4018849
     46 
     47     // FM Record state changed
     48     int LISTEN_SPEAKER_MODE_CHANGED = 0x00101000; // 1052672
     49 
     50     // Bundle keys
     51     String SWITCH_ANTENNA_VALUE = "switch_antenna_value";
     52     String CALLBACK_FLAG = "callback_flag";
     53     String KEY_IS_SWITCH_ANTENNA = "key_is_switch_antenna";
     54     String KEY_IS_TUNE = "key_is_tune";
     55     String KEY_TUNE_TO_STATION = "key_tune_to_station";
     56     String KEY_IS_SEEK = "key_is_seek";
     57     String KEY_SEEK_TO_STATION = "key_seek_to_station";
     58     String KEY_IS_SCAN = "key_is_scan";
     59     String KEY_RDS_STATION = "key_rds_station";
     60     String KEY_PS_INFO = "key_ps_info";
     61     String KEY_RT_INFO = "key_rt_info";
     62     String KEY_STATION_NUM = "key_station_num";
     63 
     64     // Audio focus related
     65     String KEY_AUDIOFOCUS_CHANGED = "key_audiofocus_changed";
     66 
     67     // Recording
     68     String KEY_RECORDING_STATE = "key_is_recording_state";
     69     String KEY_RECORDING_ERROR_TYPE = "key_recording_error_type";
     70     String KEY_IS_RECORDING_MODE = "key_is_recording_mode";
     71 
     72     // For change speaker/earphone mode
     73     String KEY_IS_SPEAKER_MODE = "key_is_speaker_mode";
     74 
     75     /**
     76      * handle message: call back from service to activity
     77      */
     78     // Message to handle
     79     int MSGID_UPDATE_RDS = 1;
     80     int MSGID_UPDATE_CURRENT_STATION = 2;
     81     int MSGID_ANTENNA_UNAVAILABE = 3;
     82     int MSGID_SWITCH_ANTENNA = 4;
     83     int MSGID_SET_RDS_FINISHED = 5;
     84     int MSGID_SET_CHANNEL_FINISHED = 6;
     85     int MSGID_SET_MUTE_FINISHED = 7;
     86     // Fm main
     87     int MSGID_POWERUP_FINISHED = 9;
     88     int MSGID_POWERDOWN_FINISHED = 10;
     89     int MSGID_FM_EXIT = 11;
     90     int MSGID_SCAN_CANCELED = 12;
     91     int MSGID_SCAN_FINISHED = 13;
     92     int MSGID_AUDIOFOCUS_FAILED = 14;
     93     int MSGID_TUNE_FINISHED = 15;
     94     int MSGID_SEEK_FINISHED = 16;
     95     int MSGID_ACTIVE_AF_FINISHED = 18;
     96     // Recording
     97     int MSGID_RECORD_STATE_CHANGED = 19;
     98     int MSGID_RECORD_ERROR = 20;
     99     int MSGID_RECORD_MODE_CHANED = 21;
    100     int MSGID_STARTRECORDING_FINISHED = 22;
    101     int MSGID_STOPRECORDING_FINISHED = 23;
    102     int MSGID_STARTPLAYBACK_FINISHED = 24;
    103     int MSGID_STOPPLAYBACK_FINISHED = 25;
    104     int MSGID_SAVERECORDING_FINISHED = 26;
    105     // Audio focus related
    106     int MSGID_AUDIOFOCUS_CHANGED = 30;
    107 
    108     int NOT_AUDIO_FOCUS = 33;
    109 
    110     // For refresh time
    111     int MSGID_REFRESH = 101;
    112 
    113     /**
    114      * Call back method to activity from service
    115      */
    116     void onCallBack(Bundle bundle);
    117 }
    118