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.

170 lines
5.6 KiB

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