167ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath// Copyright 2011 Google Inc. All Rights Reserved.
267ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath
367ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamathpackage android.speech.tts;
467ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath
567ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamathimport android.speech.tts.TextToSpeechService.UtteranceProgressDispatcher;
667ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath
767ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamathabstract class PlaybackQueueItem implements Runnable {
867ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath    private final UtteranceProgressDispatcher mDispatcher;
967ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath    private final Object mCallerIdentity;
1067ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath
1167ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath    PlaybackQueueItem(TextToSpeechService.UtteranceProgressDispatcher dispatcher,
1267ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath            Object callerIdentity) {
1367ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath        mDispatcher = dispatcher;
1467ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath        mCallerIdentity = callerIdentity;
1567ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath    }
1667ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath
1767ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath    Object getCallerIdentity() {
1867ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath        return mCallerIdentity;
1967ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath    }
2067ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath
2167ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath    protected UtteranceProgressDispatcher getDispatcher() {
2267ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath        return mDispatcher;
2367ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath    }
2467ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath
2590d15d2371ad85f22254be6985455aa2baa5d15dPrzemyslaw Szczepaniak    @Override
2667ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath    public abstract void run();
2790d15d2371ad85f22254be6985455aa2baa5d15dPrzemyslaw Szczepaniak
2890d15d2371ad85f22254be6985455aa2baa5d15dPrzemyslaw Szczepaniak    /**
2990d15d2371ad85f22254be6985455aa2baa5d15dPrzemyslaw Szczepaniak     * Stop the playback.
3090d15d2371ad85f22254be6985455aa2baa5d15dPrzemyslaw Szczepaniak     *
3190d15d2371ad85f22254be6985455aa2baa5d15dPrzemyslaw Szczepaniak     * @param errorCode Cause of the stop. Can be either one of the error codes from
32fc4b2890378eb1b6e0b11d60d703eb6854268064Przemyslaw Szczepaniak     *         {@link android.speech.tts.TextToSpeech} or
33fc4b2890378eb1b6e0b11d60d703eb6854268064Przemyslaw Szczepaniak     *         {@link android.speech.tts.TextToSpeech#STOPPED}
3490d15d2371ad85f22254be6985455aa2baa5d15dPrzemyslaw Szczepaniak     *         if stopped on a client request.
3590d15d2371ad85f22254be6985455aa2baa5d15dPrzemyslaw Szczepaniak     */
3690d15d2371ad85f22254be6985455aa2baa5d15dPrzemyslaw Szczepaniak    abstract void stop(int errorCode);
3767ae6bc83cf2b30b0c61b9ebba5fed7a0038549cNarayan Kamath}
38