OSDN Git Service

ちょっとだけデバッグ
authorosx86_pt1 <rmitachi@ta2.so-net.ne.jp>
Thu, 17 Mar 2016 16:48:08 +0000 (01:48 +0900)
committerosx86_pt1 <rmitachi@ta2.so-net.ne.jp>
Thu, 17 Mar 2016 16:48:08 +0000 (01:48 +0900)
iPTd_R2.sdf
src/ry0/iPTd/Controller.cpp
src/ry0/iPTd/Controller.h
src/ry0/iPTd/HTTPD.cpp
src/ry0/iPTd/HTTPD.h
src/ry0/iPTd/Reservation.cpp
src/ry0/iPTd/Reservation.h
src/ry0/iPTd/Streaming.cpp
src/ry0/iPTd/Streaming.h

index c6fe068..4b2e466 100644 (file)
Binary files a/iPTd_R2.sdf and b/iPTd_R2.sdf differ
index 048b261..a33c7bb 100644 (file)
@@ -5,7 +5,7 @@
 \r
 #include <time.h>\r
 \r
-#define DBG_LEVEL 3\r
+#define DBG_LEVEL 1\r
 #include "Raym/Log.h"\r
 \r
 #include "b25/arib_std_b25.h"\r
@@ -137,8 +137,8 @@ void Controller::systemWillSuspend()
 \r
     RaymUnlock(this);\r
 \r
-#ifdef OBJC_MEMORY_CHECK\r
-    DebugLog0("global_objc_count_ = %d", Raym::global_objc_count_);\r
+#ifdef RAYM_MEMORY_CHECK\r
+    DebugLog0("global_raym_count_ = %d", Raym::global_raym_count_);\r
 #endif\r
     DebugLog2("Controller::systemWillSuspend() end");\r
 }\r
@@ -278,16 +278,19 @@ void Controller::detectNonIdle()
 #pragma mark ------- プロパティ取得 -------\r
 #endif\r
 \r
+/*\r
+ *\r
+ */\r
 bool Controller::isTunerInitialized(int tuner)\r
 {\r
     DebugLog2("Controller::isTunerInitialized()");\r
 \r
     bool result = false;\r
 \r
+    RaymLock(this);\r
+\r
     if ((0 <= tuner) && (tuner < _tuner_count))\r
     {\r
-        RaymLock(this);\r
-\r
         Dictionary *tunersInfo = _props->dictionaryForKey(KEY_TUNERS);\r
         if (tunersInfo != NULL)\r
         {\r
@@ -297,24 +300,26 @@ bool Controller::isTunerInitialized(int tuner)
                 result = tunerInfo->boolForKey(KEY_INITIALIZED);\r
             }\r
         }\r
-\r
-        RaymUnlock(this);\r
     }\r
 \r
+    RaymUnlock(this);\r
+\r
     return result;\r
 }\r
 \r
+/*\r
+ *\r
+ */\r
 bool Controller::isTunerEnabled(int tuner)\r
 {\r
     DebugLog2("Controller::isTunerEnabled()");\r
 \r
     bool result = false;\r
 \r
+    RaymLock(this);\r
+\r
     if ((0 <= tuner) && (tuner < _tuner_count))\r
     {\r
-        // lock\r
-        EnterCriticalSection(&_cs);\r
-\r
         Dictionary *tunersInfo = _props->dictionaryForKey(KEY_TUNERS);\r
         if (tunersInfo != NULL)\r
         {\r
@@ -324,25 +329,26 @@ bool Controller::isTunerEnabled(int tuner)
                 result = tunerInfo->boolForKey(KEY_ENABLED);\r
             }\r
         }\r
-\r
-        // unlock\r
-        LeaveCriticalSection(&_cs);\r
     }\r
 \r
+    RaymUnlock(this);\r
+\r
     return result;\r
 }\r
 \r
+/*\r
+ *\r
+ */\r
 bool Controller::isChannelEnabled(int tuner, int channel)\r
 {\r
     DebugLog2("Controller::isChannelEnabled()");\r
 \r
     bool result = false;\r
 \r
+    RaymLock(this);\r
+\r
     if ((0 <= tuner) && (tuner < _tuner_count) && (0 <= channel) && (channel <= Tuner::MAX_CHANNELS_ISDB_T))\r
     {\r
-        // lock\r
-        EnterCriticalSection(&_cs);\r
-\r
         Dictionary *tunersInfo = _props->dictionaryForKey(KEY_TUNERS);\r
         if (tunersInfo != NULL)\r
         {\r
@@ -362,11 +368,10 @@ bool Controller::isChannelEnabled(int tuner, int channel)
                 }\r
             }\r
         }\r
-\r
-        // unlock\r
-        LeaveCriticalSection(&_cs);\r
     }\r
 \r
+    RaymUnlock(this);\r
+\r
     return result;\r
 }\r
 \r
@@ -379,17 +384,17 @@ void Controller::scanChannel(int tuner)
 {\r
     DebugLog2("Controller::scanChannel(%d)", tuner);\r
 \r
+    RaymLock(this);\r
     if ((tuner < 0) || (_tuner_count <= tuner))\r
     {\r
+        RaymUnlock(this);\r
         DebugLog3("Invalid tuner: %d", tuner);\r
         return;\r
     }\r
 \r
+    DebugLog0("");\r
     DebugLog0("start channel scan of \"%s\".", _tuners[tuner]->name());\r
 \r
-    // lock\r
-    EnterCriticalSection(&_cs);\r
-\r
     // 設定ファイルから全チューナ情報取得\r
     Dictionary *tunersInfo = _props->dictionaryForKey(KEY_TUNERS);\r
     if (tunersInfo == NULL)\r
@@ -412,7 +417,7 @@ void Controller::scanChannel(int tuner)
     tunerInfo->setBool(false, KEY_INITIALIZED);\r
 \r
     // unlock\r
-    LeaveCriticalSection(&_cs);\r
+    RaymUnlock(this);\r
 \r
     // 全チャンネル情報を作成\r
     Dictionary *channels = Dictionary::dictionaryWithCapacity(0);\r
@@ -486,8 +491,7 @@ void Controller::scanChannel(int tuner)
         // チャンネルIDを設定\r
         channelInfo->setString(channelID, KEY_CHANNEL_ID);\r
 \r
-        // lock\r
-        EnterCriticalSection(&_cs);\r
+        RaymLock(this);\r
 \r
         // チャンネル設定\r
         if (_tuners[tuner]->setChannel(ch))\r
@@ -538,12 +542,10 @@ void Controller::scanChannel(int tuner)
             DebugLog0("  CH %s: NG", chkey);\r
         }\r
 \r
-        // unlock\r
-        LeaveCriticalSection(&_cs);\r
+        RaymUnlock(this);\r
     }\r
 \r
-    // lock\r
-    EnterCriticalSection(&_cs);\r
+    RaymLock(this);\r
 \r
     // チューナを初期化済みに更新\r
     tunerInfo->setBool(true, KEY_INITIALIZED);\r
@@ -577,21 +579,22 @@ void Controller::scanChannel(int tuner)
     // 設定ファイルを更新\r
     _props->writeToFile(_props_path, true);\r
 \r
-    // unlock\r
-    LeaveCriticalSection(&_cs);\r
+    RaymUnlock(this);\r
 }\r
 \r
+/*\r
+ *\r
+ */\r
 int Controller::getChannel(int tuner)\r
 {\r
     DebugLog2("Controller::getChannel()");\r
 \r
     int channel = -1;\r
 \r
+    RaymLock(this);\r
+\r
     if ((0 <= tuner) && (tuner < _tuner_count))\r
     {\r
-        // lock\r
-        EnterCriticalSection(&_cs);\r
-\r
         Dictionary *tunersInfo = _status->dictionaryForKey(KEY_TUNERS);\r
         if (tunersInfo != NULL)\r
         {\r
@@ -601,25 +604,26 @@ int Controller::getChannel(int tuner)
                 channel = tunerInfo->integerForKey(KEY_CHANNEL);\r
             }\r
         }\r
-\r
-        // unlock\r
-        LeaveCriticalSection(&_cs);\r
     }\r
 \r
+    RaymUnlock(this);\r
+\r
     return channel;\r
 }\r
 \r
+/*\r
+ *\r
+ */\r
 bool Controller::setChannel(int tuner, int channel)\r
 {\r
     DebugLog2("Controller::setChannel()");\r
 \r
     bool result = false;\r
 \r
+    RaymLock(this);\r
+\r
     if ((0 <= tuner) && (tuner < _tuner_count))\r
     {\r
-        // lock\r
-        EnterCriticalSection(&_cs);\r
-\r
         if (!_tuners[tuner]->isLocked())\r
         {\r
             Dictionary *tunersInfo = _status->dictionaryForKey(KEY_TUNERS);\r
@@ -646,17 +650,12 @@ bool Controller::setChannel(int tuner, int channel)
 \r
                     result = true;\r
                 }\r
-                else\r
-                {\r
-                    DebugLog0("set channel failed. %d, %d", tuner, channel);\r
-                }\r
             }\r
         }\r
-\r
-        // unlock\r
-        LeaveCriticalSection(&_cs);\r
     }\r
 \r
+    RaymUnlock(this);\r
+\r
     return result;\r
 }\r
 \r
@@ -678,21 +677,6 @@ void Controller::timerExpired(Timer *timer, void *userInfo)
         {\r
             // 初期化成功\r
             DebugLog2("tuner initialize success.");\r
-#if 0\r
-            // EPG収集用タイマ起動(ISDB-S)\r
-            _timer_epg_s = NSTimer::alloc()->initWithTimeInterval(DEF_COLLECT_EPG_DELAY, this, (void *)CMD_COLLECT_EPG_ISDB_S, true);\r
-            if (_timer_epg_s != NULL)\r
-            {\r
-                _timer_epg_s->fire();\r
-            }\r
-\r
-            // EPG収集用タイマ起動(ISDB-T)\r
-            _timer_epg_t = NSTimer::alloc()->initWithTimeInterval(DEF_COLLECT_EPG_DELAY, this, (void *)CMD_COLLECT_EPG_ISDB_T, true);\r
-            if (_timer_epg_t != NULL)\r
-            {\r
-                _timer_epg_t->fire();\r
-            }\r
-#endif\r
         }\r
         else\r
         {\r
@@ -708,41 +692,6 @@ void Controller::timerExpired(Timer *timer, void *userInfo)
             suspend();\r
         }\r
         break;\r
-\r
-    case CMD_PERIODIC:                                  // 周期処理\r
-        periodic();\r
-        break;\r
-\r
-    case CMD_PERIODIC_2:                                // 周期処理2\r
-        periodic_2();\r
-        break;\r
-\r
-    case CMD_COLLECT_EPG_ISDB_S:                        // EPG収集(ISDB-S)\r
-        // 番組情報収集(ISDB-S)\r
-        if (collectEPGs(Tuner::ISDB_S))\r
-        {\r
-            // 終了(繰り返し無し)\r
-            _timer_epg_s->setRepeats(false);\r
-        }\r
-        else\r
-        {\r
-            // リトライ\r
-            _timer_epg_s->setTimeInterval(DEF_COLLECT_EPG_RETRY);\r
-        }\r
-        break;\r
-\r
-    case CMD_COLLECT_EPG_ISDB_T:                        // 番組情報収集(ISDB-T)\r
-        if (collectEPGs(Tuner::ISDB_T))\r
-        {\r
-            // 終了(繰り返し無し)\r
-            _timer_epg_t->setRepeats(false);\r
-        }\r
-        else\r
-        {\r
-            // リトライ\r
-            _timer_epg_t->setTimeInterval(DEF_COLLECT_EPG_RETRY);\r
-        }\r
-        break;\r
 #endif\r
     }\r
 }\r
@@ -871,9 +820,9 @@ int Controller::restart()
         }\r
     }\r
 \r
-    // UDPポートマッピング\r
-    DebugLog0("  UDP Port Mapping    :");\r
-    DebugLog0("    tuner, ch -> port");\r
+    DebugLog0("");\r
+    DebugLog0("UDP Port Mapping");\r
+    DebugLog0("  Tuner, CH -> Port");\r
     int udpport = _props->integerForKey(KEY_BEGIN_UDP_PORT);\r
     for (int tuner = 0; tuner < _tuner_count; ++tuner)\r
     {\r
@@ -882,12 +831,14 @@ int Controller::restart()
         {\r
             if (isChannelEnabled(tuner, ch))\r
             {\r
-                DebugLog0("    %5d,%3d -> %5d", tuner, ch, udpport);\r
+                DebugLog0("  %5d,%3d -> %5d", tuner, ch, udpport);\r
                 _streaming->mapping(tuner, ch, udpport++);\r
             }\r
         }\r
     }\r
 \r
+    _reservation->systemResumed();\r
+\r
     RaymLock(this);\r
     _initialized = true;\r
     RaymUnlock(this);\r
@@ -931,6 +882,16 @@ int Controller::start()
     DebugLog0("iPTd ver %s (rev.%d)", VERSION, REVISION);\r
     DebugLog0("initialize...");\r
 \r
+    HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId());\r
+    if (hProcess != NULL)\r
+    {\r
+        if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS) == FALSE)\r
+        {\r
+            DebugLog0("SetPriorityClass failed.");\r
+        }\r
+        CloseHandle(hProcess);\r
+    }\r
+\r
     int result = 0;\r
 \r
     // 初期化\r
@@ -942,19 +903,19 @@ int Controller::start()
         _system_path = String::stringWithFormat("%s", GetExecutePath());\r
         if (_system_path == NULL)\r
         {\r
-            DebugLog0("error: GetExecutePath()\n");\r
+            DebugLog0("error: GetExecutePath()");\r
             result = -1;\r
             break;\r
         }\r
         _system_path = _system_path->stringByReplacingOccurrencesOfString("iPTd.exe", "");\r
         _system_path->retain();\r
-        DebugLog2("_system_path: %s\n", _system_path->cString());\r
+        DebugLog1("system path: %s", _system_path->cString());\r
 \r
         // プロパティファイルのパス設定\r
         _props_path = String::alloc()->initWithFormat("%s%s.iptd.plist", _system_path->cString(), _plist_prefix);\r
         if (_props_path == NULL)\r
         {\r
-            DebugLog0("error: set property file path.\n");\r
+            DebugLog0("error: set property file path.");\r
             result = -1;\r
             break;\r
         }\r
@@ -963,19 +924,19 @@ int Controller::start()
         _props = Dictionary::alloc()->initWithContentsOfFile(_props_path);\r
         if (_props == NULL)\r
         {\r
-            DebugLog1("because \"%s\" is not exists, created.\n", _props_path->cString());\r
+            DebugLog1("property file: %s (created)", _props_path->cString());\r
             _props = Dictionary::alloc()->initWithCapacity(0);\r
         }\r
         else\r
         {\r
-            DebugLog1("property file: \"%s\"\n", _props_path->cString());\r
+            DebugLog1("property file: %s", _props_path->cString());\r
         }\r
 \r
         // ステータスファイルのパス設定\r
         _status_path = String::alloc()->initWithFormat("%s%s.iptd.status.plist", _system_path->cString(), _plist_prefix);\r
         if (_status_path == NULL)\r
         {\r
-            DebugLog0("error: set status file path.\n");\r
+            DebugLog0("error: set status file path.");\r
             result = -1;\r
             break;\r
         }\r
@@ -984,12 +945,12 @@ int Controller::start()
         _status = Dictionary::alloc()->initWithContentsOfFile(_status_path);\r
         if (_status == NULL)\r
         {\r
-            DebugLog1("because \"%s\" is not exists, created.\n", _status_path->cString());\r
+            DebugLog1("status file: %s (created)", _status_path->cString());\r
             _status = Dictionary::alloc()->initWithCapacity(0);\r
         }\r
         else\r
         {\r
-            DebugLog1("status file: \"%s\"\n", _status_path->cString());\r
+            DebugLog1("status file: %s", _status_path->cString());\r
         }\r
 \r
         // システム名\r
@@ -1128,7 +1089,7 @@ int Controller::start()
                 result = -1;\r
                 break;\r
             }\r
-            _props->setString(String::alloc()->initWithFormat("%s\\Videos", public_dir), KEY_STORE_PATH);\r
+            _props->setString(String::stringWithFormat("%s\\Videos", public_dir), KEY_STORE_PATH);\r
 \r
             // 更新フラグ\r
             updated = true;\r
@@ -1156,14 +1117,6 @@ int Controller::start()
             break;\r
         }\r
 \r
-        //\r
-        _streaming = Streaming::alloc()->initWithController(this);\r
-        if (_streaming == NULL)\r
-        {\r
-            result = -1;\r
-            break;\r
-        }\r
-\r
         // httpdのルートパス\r
         String *rootPath = _system_path->stringByAppendingPathComponent("html");\r
         isDir = false;\r
@@ -1180,15 +1133,6 @@ int Controller::start()
 */\r
         }\r
 \r
-        //\r
-        _httpd = HTTPD::alloc()->initWithController(this, _props->integerForKey(KEY_HTTP_PORT), rootPath);\r
-        if (_httpd == NULL)\r
-        {\r
-            result = -1;\r
-            break;\r
-        }\r
-\r
-\r
         // プロパティファイルを保存\r
         if (updated)\r
         {\r
@@ -1217,6 +1161,23 @@ int Controller::start()
             }\r
         }\r
 \r
+\r
+        //\r
+        _streaming = Streaming::alloc()->initWithController(this);\r
+        if (_streaming == NULL)\r
+        {\r
+            result = -1;\r
+            break;\r
+        }\r
+\r
+        //\r
+        _httpd = HTTPD::alloc()->initWithController(this, _props->integerForKey(KEY_HTTP_PORT), rootPath);\r
+        if (_httpd == NULL)\r
+        {\r
+            result = -1;\r
+            break;\r
+        }\r
+\r
         if (!_httpd->start())\r
         {\r
             DebugLog0("Can't start httpd.");\r
@@ -1224,7 +1185,6 @@ int Controller::start()
             break;\r
         }\r
 \r
-\r
         // 再開タイマ起動\r
         _timer_restart = Timer::alloc()->initWithTimeInterval(1.0, this, (void *)CMD_RESTART, false);\r
         _timer_restart->fire();\r
index 2e5ff8d..2984fc3 100644 (file)
@@ -16,7 +16,7 @@
 #include "ry0/iPTd/HTTPD.h"\r
 \r
 #define VERSION "1.00"\r
-#define REVISION 11\r
+#define REVISION 12\r
 \r
 namespace ry0\r
 {\r
index 07d8e1b..8693e8a 100644 (file)
@@ -23,7 +23,6 @@ namespace iPTd
 HTTPD::HTTPD()\r
 {\r
     _controller  = NULL;\r
-    _tuner_count = -1;\r
     _tuners      = NULL;\r
     _httpd       = NULL;\r
     _port        = -1;\r
@@ -44,7 +43,6 @@ HTTPD *HTTPD::alloc()
 HTTPD *HTTPD::initWithController(Controller *controller, int port, String *path)\r
 {\r
     _controller  = controller;\r
-    _tuner_count = controller->_tuner_count;\r
     _tuners      = controller->_tuners;\r
 \r
     _port        = port;\r
@@ -111,11 +109,34 @@ HTTPResponse *HTTPD::request(HTTPRequest *request, SOCKADDR_IN *client)
             // String::substringWithRange() の実装は後回しなので。。\r
             std::string s = uri->cString();\r
             int tuner = atoi(s.substr(1, 3).c_str());\r
-            if ((0 <= tuner) && (tuner < _tuner_count))\r
+            if ((0 <= tuner) && (tuner < _controller->_tuner_count))\r
             {\r
                 response = requestTunerControl(request, client, tuner);\r
             }\r
         }\r
+\r
+        else if (uri->isMatch("^/iptd.log$"))\r
+        {\r
+            String *path = _controller->_system_path->stringByAppendingPathComponent("log");\r
+            if (path != NULL)\r
+            {\r
+                path = path->stringByAppendingPathComponent("iptd.log");\r
+                if (path != NULL)\r
+                {\r
+                    response = _httpd->responseWithPath(path, request);\r
+                    if (response != NULL)\r
+                    {\r
+                        if (response->message() != NULL)\r
+                        {\r
+                            if (response->message()->header() != NULL)\r
+                            {\r
+                                response->message()->header()->setFieldBodyWithName("text/plane; charset=UTF-8", "Content-Type");\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+        }\r
     }\r
 \r
     return response;\r
index 0e40158..c55af0c 100644 (file)
@@ -21,7 +21,6 @@ class HTTPD : public Raym::Object,
 {\r
 private:\r
     Controller *            _controller;\r
-    int                     _tuner_count;\r
     ry0::device::Tuner **   _tuners;\r
 \r
     NET::HTTPDaemon *       _httpd;\r
index d8dd16d..c08bcd4 100644 (file)
@@ -42,7 +42,6 @@ static const TimeInterval DEF_COLLECT_EPG_LIMIT_T   = 20.5;
 Reservation::Reservation()\r
 {\r
     _controller         = NULL;\r
-    _tuner_count        = -1;\r
     _tuners             = NULL;\r
     _reservations_path  = NULL;\r
     _reservations       = NULL;\r
@@ -74,7 +73,6 @@ Reservation *Reservation::alloc()
 Reservation *Reservation::initWithController(Controller *controller)\r
 {\r
     _controller  = controller;\r
-    _tuner_count = controller->_tuner_count;\r
     _tuners      = controller->_tuners;\r
 \r
     _reservations_path = String::alloc()->initWithFormat("%s%s.iptd.reservations.plist", _controller->_system_path->cString(), Controller::_plist_prefix);\r
@@ -87,7 +85,7 @@ Reservation *Reservation::initWithController(Controller *controller)
     _reservations = Dictionary::alloc()->initWithContentsOfFile(_reservations_path);\r
     if (_reservations == NULL)\r
     {\r
-        DebugLog1("because \"%s\" is not exists, created.", _reservations_path->cString());\r
+        DebugLog1("reservations file: %s (created)", _reservations_path->cString());\r
         _reservations = Dictionary::alloc()->initWithCapacity(0);\r
         if (_reservations == NULL)\r
         {\r
@@ -98,7 +96,7 @@ Reservation *Reservation::initWithController(Controller *controller)
     }\r
     else\r
     {\r
-        DebugLog1("reservations file: \"%s\"", _reservations_path->cString());\r
+        DebugLog1("reservations file: %s", _reservations_path->cString());\r
 \r
         _reservation_seq_id = _reservations->integerForKey(KEY_EPG_LAST_RESV_ID);\r
     }\r
@@ -113,7 +111,7 @@ Reservation *Reservation::initWithController(Controller *controller)
     _epgs = Dictionary::alloc()->initWithContentsOfFile(_epgs_path);\r
     if (_epgs == NULL)\r
     {\r
-        DebugLog1("because \"%s\" is not exists, created.", _epgs_path->cString());\r
+        DebugLog1("epgs file: %s (created)", _epgs_path->cString());\r
         _epgs = Dictionary::alloc()->initWithCapacity(0);\r
         if (_epgs == NULL)\r
         {\r
@@ -123,7 +121,7 @@ Reservation *Reservation::initWithController(Controller *controller)
     }\r
     else\r
     {\r
-        DebugLog1("epgs file: \"%s\"", _epgs_path->cString());\r
+        DebugLog1("epgs file: %s", _epgs_path->cString());\r
 \r
         // 過去の番組データは削除\r
         removePastEPGs();\r
@@ -160,7 +158,7 @@ bool Reservation::canTerminate()
 \r
     time_t now = time(NULL);\r
 \r
-    for (int tuner = 0; tuner < _tuner_count; ++tuner)\r
+    for (int tuner = 0; tuner < _controller->_tuner_count; ++tuner)\r
     {\r
         Array *array = _reservations->arrayForKey(_tuners[tuner]->name());\r
         if ((array == NULL) || (array->count() == 0))\r
@@ -211,6 +209,8 @@ void Reservation::systemWillSuspend()
 \r
 void Reservation::systemResumed()\r
 {\r
+    DebugLog2("%s", __FUNCTION__);\r
+\r
     RaymLock(_controller);\r
 \r
     _cancel_epg_collect = false;\r
@@ -257,7 +257,7 @@ bool Reservation::reserve(int tuner, Dictionary *in_epg)
     // lock\r
     RaymLock(_controller);\r
 \r
-    while ((0 <= tuner) && (tuner < _tuner_count) && (in_epg != NULL))\r
+    while ((0 <= tuner) && (tuner < _controller->_tuner_count) && (in_epg != NULL))\r
     {\r
         Dictionary *epg = Dictionary::dictionaryWithDictionary(in_epg);\r
         if (epg == NULL)\r
@@ -345,7 +345,7 @@ bool Reservation::cancel(int tuner, int reserve_id)
     RaymLock(_controller);\r
 \r
     //\r
-    if ((0 <= tuner) && (tuner < _tuner_count))\r
+    if ((0 <= tuner) && (tuner < _controller->_tuner_count))\r
     {\r
         Array *array = _reservations->arrayForKey(_tuners[tuner]->name());\r
         if (array != NULL)\r
@@ -369,7 +369,7 @@ bool Reservation::cancel(int tuner, int reserve_id)
     //\r
     else if ((tuner < 0) && (0 <= reserve_id) && (reserve_id < 1000000))\r
     {\r
-        for (int i = 0; i < _tuner_count; ++i)\r
+        for (int i = 0; i < _controller->_tuner_count; ++i)\r
         {\r
             Array *array = _reservations->arrayForKey(_tuners[i]->name());\r
             if (array != NULL)\r
@@ -428,7 +428,7 @@ void Reservation::updateSchedule()
     }\r
 \r
     // 録画予約をチェック\r
-    for (int tuner = 0; tuner < _tuner_count; ++tuner)\r
+    for (int tuner = 0; tuner < _controller->_tuner_count; ++tuner)\r
     {\r
         Array *array = _reservations->arrayForKey(_tuners[tuner]->name());\r
         if ((array == NULL) || (array->count() == 0))\r
@@ -602,7 +602,7 @@ void Reservation::collectEPGsForTuner(int tuner, TimeInterval limit)
     // 既にロックされた状態でコールされる前提\r
     bool locked = false;\r
     RaymLock(_controller);\r
-    if ((0 <= tuner) && (tuner < _tuner_count))\r
+    if ((0 <= tuner) && (tuner < _controller->_tuner_count))\r
     {\r
         locked = _tuners[tuner]->isLocked();\r
     }\r
@@ -705,7 +705,7 @@ bool Reservation::collectEPGs(Tuner::Type type)
     int tuner = 0;\r
     bool locked = false;\r
     RaymLock(_controller);\r
-    for (int i = _tuner_count - 1; i >= 0; --i)\r
+    for (int i = _controller->_tuner_count - 1; i >= 0; --i)\r
     {\r
         if (_controller->isTunerEnabled(i))\r
         {\r
@@ -725,7 +725,7 @@ bool Reservation::collectEPGs(Tuner::Type type)
     // ロック確認\r
     if (!locked)\r
     {\r
-        DebugLog0("Controller::collectEPGs(%s) end(Can't locled).", type == Tuner::ISDB_S ? "ISDB-S" : "ISDB-T");\r
+        DebugLog0("Controller::collectEPGs(%s) end(Can't locked).", type == Tuner::ISDB_S ? "ISDB-S" : "ISDB-T");\r
         // ロックできない場合は収集しない\r
         return false;\r
     }\r
@@ -803,7 +803,7 @@ void Reservation::periodic()
     bool need_update = false;\r
 \r
 #ifdef RAYM_MEMORY_CHECK\r
-    DebugLog0("global_objc_count_ = %d", Raym::global_raym_count_);\r
+//    DebugLog0("global_objc_count_ = %d", Raym::global_raym_count_);\r
 #endif\r
 \r
     // lock\r
@@ -812,10 +812,10 @@ void Reservation::periodic()
     // 現在時刻取得\r
     time_t now = time(NULL);\r
 \r
-    DebugLog2("periodic: %d", now);\r
+//    DebugLog2("periodic: %d", now);\r
 \r
     //\r
-    for (int tuner = 0; tuner < _tuner_count; ++tuner)\r
+    for (int tuner = 0; tuner < _controller->_tuner_count; ++tuner)\r
     {\r
         Array *array = _reservations->arrayForKey(_tuners[tuner]->name());\r
         if ((array == NULL) || (array->count() == 0))\r
@@ -984,14 +984,13 @@ void Reservation::periodic()
         _reservations->writeToFile(_reservations_path, true);\r
     }\r
 \r
-#if 0\r
     // EPG収集時刻を取得\r
-    NSString *collect_str = _props->stringForKey(KEY_COLLECT_EPG_TIME);\r
+    String *collect_str = _controller->_props->stringForKey(KEY_COLLECT_EPG_TIME);\r
     if (collect_str != NULL)\r
     {\r
         // 秒に変換\r
         time_t collect_time = 0;\r
-        getTimeWithString(collect_str, &collect_time);\r
+        Controller::getTimeWithString(collect_str, &collect_time);\r
 \r
         // 現在時刻と比較\r
         if ((collect_time <= now) && (now < collect_time + 1))\r
@@ -1001,7 +1000,7 @@ void Reservation::periodic()
             {\r
                 // EPG収集用タイマ起動(ISDB-S)\r
                 RELEASE(_timer_epg_s);\r
-                _timer_epg_s = NSTimer::alloc()->initWithTimeInterval(DEF_COLLECT_EPG_DELAY, this, (void *)CMD_COLLECT_EPG_ISDB_S, true);\r
+                _timer_epg_s = Timer::alloc()->initWithTimeInterval(DEF_COLLECT_EPG_DELAY, this, (void *)CMD_COLLECT_EPG_ISDB_S, true);\r
                 if (_timer_epg_s != NULL)\r
                 {\r
                     _timer_epg_s->fire();\r
@@ -1013,7 +1012,7 @@ void Reservation::periodic()
             {\r
                 // EPG収集用タイマ起動(ISDB-T)\r
                 RELEASE(_timer_epg_t);\r
-                _timer_epg_t = NSTimer::alloc()->initWithTimeInterval(DEF_COLLECT_EPG_DELAY, this, (void *)CMD_COLLECT_EPG_ISDB_T, true);\r
+                _timer_epg_t = Timer::alloc()->initWithTimeInterval(DEF_COLLECT_EPG_DELAY, this, (void *)CMD_COLLECT_EPG_ISDB_T, true);\r
                 if (_timer_epg_t != NULL)\r
                 {\r
                     _timer_epg_t->fire();\r
@@ -1021,7 +1020,6 @@ void Reservation::periodic()
             }\r
         }\r
     }\r
-#endif\r
 \r
     // unlock\r
     RaymUnlock(_controller);\r
@@ -1056,7 +1054,7 @@ void Reservation::periodic()
     _timer_periodic->setTimeInterval(1.005 - interval);\r
 \r
 #ifdef RAYM_MEMORY_CHECK\r
-    DebugLog0("global_objc_count_ = %d", Raym::global_raym_count_);\r
+//    DebugLog0("global_objc_count_ = %d", Raym::global_raym_count_);\r
 #endif\r
 }\r
 \r
index 9a85e12..01938a5 100644 (file)
@@ -20,7 +20,6 @@ class Reservation : public Raym::Object,
 {\r
 private:\r
     Controller *            _controller;\r
-    int                     _tuner_count;\r
     ry0::device::Tuner **   _tuners;\r
 \r
     Raym::String *          _reservations_path;\r
index 6d01f57..6fe7748 100644 (file)
@@ -7,7 +7,7 @@
 #include <Iphlpapi.h>\r
 #include <time.h>\r
 \r
-#define DBG_LEVEL 3\r
+#define DBG_LEVEL 0\r
 #include "Raym/Log.h"\r
 \r
 #include "keys.h"\r
@@ -26,7 +26,6 @@ Streaming::Streaming()
     DebugLog2("%s", __FUNCTION__);\r
 \r
     _controller     = NULL;\r
-    _tuner_count    = -1;\r
     _tuners         = NULL;\r
     _ctrls          = NULL;\r
     _timer_periodic = NULL;\r
@@ -55,7 +54,6 @@ Streaming *Streaming::alloc()
 Streaming *Streaming::initWithController(Controller *controller)\r
 {\r
     _controller  = controller;\r
-    _tuner_count = controller->_tuner_count;\r
     _tuners      = controller->_tuners;\r
 \r
     // 制御情報\r
index 3f8cf74..b8a24c1 100644 (file)
@@ -21,7 +21,6 @@ class Streaming : public Raym::Object,
 {\r
 private:\r
     Controller *           _controller;\r
-    int                    _tuner_count;\r
     ry0::device::Tuner **  _tuners;\r
 \r
     Raym::Dictionary *     _ctrls;\r