OSDN Git Service

EPG収集
[iptd/iPTd.git] / src / ry0 / iPTd / Controller.h
1 /**\r
2  * @file Controller.h\r
3  *\r
4  */\r
5 \r
6 #pragma once\r
7 \r
8 \r
9 #include "Raym/Raym.h"\r
10 \r
11 #include "keys.h"\r
12 #include "ry0/device/TunerFactory.h"\r
13 \r
14 #include "ry0/iPTd/Reservation.h"\r
15 #include "ry0/iPTd/Streaming.h"\r
16 #include "ry0/iPTd/HTTPD.h"\r
17 \r
18 #define VERSION "1.00"\r
19 #define REVISION 11\r
20 \r
21 namespace ry0\r
22 {\r
23 namespace iPTd\r
24 {\r
25 \r
26 typedef struct tm TM;\r
27 typedef struct sockaddr SOCKADDR;\r
28 typedef struct sockaddr_in SOCKADDR_IN;\r
29 typedef struct _stat STAT;\r
30 \r
31 class Controller : public Raym::Application,\r
32                    public Raym::TimerDelegate\r
33 {\r
34 protected:\r
35     Controller();\r
36     ~Controller();\r
37 \r
38 public:\r
39     static const char * _plist_prefix;\r
40     Raym::String *      _system_path;           // システムパス(実行ファイルが配置されているディレクトリ)\r
41     Raym::String *      _props_path;            // プロパティファイルのパス\r
42     Raym::Dictionary *  _props;                 // プロパティ\r
43     Raym::String *      _status_path;           // ステータスファイルのパス\r
44     Raym::Dictionary *  _status;                // ステータス\r
45     int                 _idle_count;            // アイドルカウンタ\r
46 \r
47     Raym::Timer *       _timer_restart;         // 再開処理用\r
48 \r
49     Reservation *       _reservation;           // 予約録画制御\r
50     Streaming *         _streaming;             // ストリーミング制御\r
51     HTTPD *             _httpd;                 // HTTP制御\r
52 \r
53     bool                            _initialized;           // 初期化済み\r
54     HMODULE                         _multi2_dll;\r
55 \r
56     int                             _tuner_count;\r
57     ry0::device::Tuner *            _tuners[ry0::device::MAX_TUNERS];\r
58 \r
59 \r
60     static Controller *alloc();\r
61     int restart();\r
62 \r
63     // misc\r
64     static void getTimeWithString(Raym::String *str, time_t *time_var);\r
65     static void getTimeWithEPG(Raym::Dictionary *epg, time_t *start, time_t *end);\r
66 \r
67     // タイマ満了IF (from Timer)\r
68     void timerExpired(Raym::Timer *timer, void *userInfo);\r
69 \r
70     // チューナ制御用IF\r
71     void scanChannel(int tuner);\r
72     int getChannel(int tuner);\r
73     bool setChannel(int tuner, int channel);\r
74 \r
75     // プロパティ取得関連\r
76     bool isTunerInitialized(int tuner);\r
77     bool isTunerEnabled(int tuner);\r
78     bool isChannelEnabled(int tuner, int channel);\r
79     Raym::Array *stationInfos(ry0::device::Tuner::Type type);\r
80     Raym::String *stationName(ry0::device::Tuner::Type type, int channel);\r
81     Raym::Array *programsForServices(Raym::Array *services);\r
82     Raym::String *Controller::stationNameForServiceID(Raym::String *service_id);\r
83 \r
84 \r
85     int  start();\r
86     void systemWillSuspend();\r
87     void systemResumed();\r
88     void detectIdle();\r
89     void detectNonIdle();\r
90     bool canSuspend();\r
91     bool canTerminate();\r
92 };\r
93 \r
94 } // iPTd\r
95 } // ry0\r