You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

172 lines
5.6 KiB

7 years ago
​
7 years ago
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include <winsock2.h>
  2. #include <stdio.h>
  3. extern "C" { FILE __iob_func[3] = { *stdin,*stdout,*stderr }; }
  4. #include "main_window.h"
  5. #include "../../components/base/basicSettingsProvider.h"
  6. #include "../../components/base/basicEventHeap.h"
  7. #include "../../data/media/mediaVideoSourceManager.h"
  8. #include "../../components/object/objectFileLoggingService.h"
  9. #include "../../components/object/objectSystemAnchor.h"
  10. #include "../../data/media/video/videoAVLIBSource.h"
  11. #include "../../data/net/onvifDeviceNode.h"
  12. #include "../../components/object/objectEventReport.h"
  13. #define LOG(X) mpLog->Log( "Main", NULL, X )
  14. #define LOG_DEBUG( X ) mpLog->Log( "Main", NULL, _LOG_DEBUG, X )
  15. #define LOG_ERROR( X ) mpLog->Log( "Main", NULL, _LOG_ERROR, X )
  16. //int main(int argc, char *argv[]) {
  17. int APIENTRY _tWinMain(HINSTANCE hInstance,
  18. HINSTANCE hPrevInstance,
  19. LPTSTR lpCmdLine,
  20. int nCmdShow){
  21. //Beep(512, 512);
  22. //Beep(256, 256);
  23. //Beep(128, 128);
  24. guiClass *GUI;
  25. systemAnchor *ANCH;
  26. GUI = guiClass::getInstance();
  27. GUI->init(0, NULL);//argc, argv);
  28. ANCH = systemAnchor::getInstance();
  29. basicLogCollection *mpLog = basicLogCollection::getInstance();
  30. objectFileLoggingService *fLog;
  31. char tPath[1024];
  32. char *ttPtz=NULL;
  33. //ttPtz = (char *)GUI->getApp()->applicationDirPath().toStdString().c_str();
  34. if( ttPtz!= NULL ){
  35. sprintf(tPath, "%s/my.log", ttPtz);
  36. } else {
  37. sprintf(tPath, "my.log" );
  38. };
  39. fLog = new objectFileLoggingService(tPath);
  40. mpLog->addHandler((basicLoggingService *)fLog);
  41. printf("From now - refer to log file\n");
  42. LOG_DEBUG("ENTER APPLICATION");
  43. basicSettingsProvider *mpSettingsProvider = basicSettingsProvider::getInstance();
  44. basicEventHeap *mpEventHeap = basicEventHeap::getInstance();
  45. mediaVideoSourceManager *LS = mediaVideoSourceManager::getInstance();
  46. //sprintf(tPath, "%s/data/storage", GUI->getApp()->applicationDirPath().toStdString().c_str());
  47. sprintf(tPath, "data/storage");
  48. //ToDO: Check Report Object!
  49. //objectEventReport *mpReporter = objectEventReport::getInstance();
  50. //storageProvider *mpStorPro = storageProvider::getInstance(tPath);
  51. config_setting_t *mpSettings;
  52. //mpStorPro->startNewSeries(); // Each prog start starts new Series
  53. #ifdef __linux__
  54. LOG_DEBUG("SS Disabled");
  55. #else
  56. //UINT lActiveFlag = 0;
  57. //SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, lActiveFlag, NULL, NULL);
  58. //SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, lActiveFlag, NULL, NULL);
  59. UINT timeoutLowPower;
  60. UINT timeoutPowerOff;
  61. UINT timeoutScreenSave;
  62. {
  63. SystemParametersInfo(SPI_GETLOWPOWERTIMEOUT, 0, &(timeoutLowPower), 0);
  64. SystemParametersInfo(SPI_GETPOWEROFFTIMEOUT, 0, &(timeoutPowerOff), 0);
  65. SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, &(timeoutScreenSave), 0);
  66. SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT, 0, NULL, 0);
  67. SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT, 0, NULL, 0);
  68. SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, 0, NULL, 0);
  69. }
  70. LOG_DEBUG("SS Disabled");
  71. #endif
  72. mpSettings = mpSettingsProvider->getSubNode(NULL, "APPLICATION_GUI");
  73. mainWinow *window;
  74. window = mainWinow::getInstance();
  75. //Check Startup Mode
  76. int gAppStartupMode;
  77. config_setting_t *pSetting;
  78. if (!config_setting_lookup_int(mpSettings, "STARTUP_WINDOW_MODE", &gAppStartupMode )){
  79. gAppStartupMode = 1;
  80. pSetting = config_setting_add(mpSettings, "STARTUP_WINDOW_MODE", CONFIG_TYPE_INT);
  81. config_setting_set_int(pSetting, gAppStartupMode);
  82. mpSettingsProvider->compromise();
  83. };
  84. switch( gAppStartupMode ){
  85. case 0: window->show(); break;
  86. case 1: window->showMaximized(); break;
  87. case 2: window->showFullScreen(); break;
  88. default:
  89. gAppStartupMode = 1;
  90. pSetting = config_setting_lookup(mpSettings, "STARTUP_WINDOW_MODE");
  91. config_setting_set_int(pSetting, gAppStartupMode);
  92. mpSettingsProvider->compromise();
  93. window->showMaximized();
  94. };
  95. joysticObject::getInstance();
  96. #ifdef __linux__
  97. LOG_DEBUG("SS Enabled");
  98. #else
  99. {
  100. SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT, timeoutLowPower, NULL, 0);
  101. SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT, timeoutPowerOff, NULL, 0);
  102. SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, timeoutScreenSave, NULL, 0);
  103. }
  104. LOG_DEBUG("SS Enabled");
  105. #endif
  106. delete GUI;
  107. delete window;
  108. delete LS;
  109. delete mpEventHeap;
  110. delete mpSettingsProvider;
  111. #ifdef __linux__
  112. #else
  113. //lActiveFlag = 1;
  114. //SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, lActiveFlag, 0, 0);
  115. //lActiveFlag = 20;
  116. //SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, lActiveFlag, NULL, NULL);
  117. //LOG_DEBUG("SS Enabled");
  118. #endif
  119. LOG_DEBUG("EXIT APPLICATION");
  120. delete mpLog;
  121. return 0;
  122. };
  123. #undef LOG
  124. #undef LOG_DEBUG
  125. #undef LOG_ERROR
  126. /*---------------------------------------*/
  127. /* A sample program to play C major */
  128. /* through a PC speaker */
  129. /*---------------------------------------*/
  130. /* This won't work if standard output is */
  131. /* re-directed to a non-tty device, or */
  132. /* PC speaker wave output is active */
  133. /*---------------------------------------*/
  134. /* M.G. 27-Nov-99 */
  135. /*---------------------------------------*/
  136. /*
  137. #include <sys/ioctl.h>
  138. #include <unistd.h>
  139. #include <linux/kd.h>
  140. int main(void)
  141. {
  142. int freq[] = { // C D E F G A B C
  143. 523, 587, 659, 698, 784, 880, 988, 1046 };
  144. int i;
  145. for (i = 0; i<8; i++)
  146. {
  147. ioctl(STDOUT_FILENO, KIOCSOUND, 1193180 / freq[i]);
  148. usleep(500000);
  149. }
  150. ioctl(STDOUT_FILENO, KIOCSOUND, 0); // Stop silly sound
  151. return 0;
  152. }
  153. */