1 /*
2  * Copyright (C) 2016 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.tv.data.epg;
18 
19 import android.support.annotation.NonNull;
20 import android.support.annotation.WorkerThread;
21 
22 import com.android.tv.data.Channel;
23 import com.android.tv.data.Lineup;
24 import com.android.tv.data.Program;
25 import com.android.tv.dvr.SeriesInfo;
26 
27 import java.util.List;
28 
29 /**
30  * An interface used to retrieve the EPG data. This class should be used in worker thread.
31  */
32 @WorkerThread
33 public interface EpgReader {
34     /**
35      * Checks if the reader is available.
36      */
isAvailable()37     boolean isAvailable();
38 
39     /**
40      * Returns the timestamp of the current EPG.
41      * The format should be YYYYMMDDHHmmSS as a long value. ex) 20160308141500
42      */
getEpgTimestamp()43     long getEpgTimestamp();
44 
45     /**
46      * Returns the channels list.
47      */
getChannels(@onNull String lineupId)48     List<Channel> getChannels(@NonNull String lineupId);
49 
50     /**
51      * Returns the lineups list.
52      */
getLineups(@onNull String postalCode)53     List<Lineup> getLineups(@NonNull String postalCode);
54 
55     /**
56      * Returns the programs for the given channel. The result is sorted by the start time.
57      * Note that the {@code Program} doesn't have valid program ID because it's not retrieved from
58      * TvProvider.
59      */
getPrograms(long channelId)60     List<Program> getPrograms(long channelId);
61 
62     /**
63      * Returns the series information for the given series ID.
64      */
getSeriesInfo(String seriesId)65     SeriesInfo getSeriesInfo(String seriesId);
66 }
67