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.

169 lines
5.6 KiB

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. objectEventReport *mpReporter = objectEventReport::getInstance();
  47. //storageProvider *mpStorPro = storageProvider::getInstance(tPath);
  48. config_setting_t *mpSettings;
  49. //mpStorPro->startNewSeries(); // Each prog start starts new Series
  50. #ifdef __linux__
  51. LOG_DEBUG("SS Disabled");
  52. #else
  53. //UINT lActiveFlag = 0;
  54. //SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, lActiveFlag, NULL, NULL);
  55. //SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, lActiveFlag, NULL, NULL);
  56. UINT timeoutLowPower;
  57. UINT timeoutPowerOff;
  58. UINT timeoutScreenSave;
  59. {
  60. SystemParametersInfo(SPI_GETLOWPOWERTIMEOUT, 0, &(timeoutLowPower), 0);
  61. SystemParametersInfo(SPI_GETPOWEROFFTIMEOUT, 0, &(timeoutPowerOff), 0);
  62. SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, &(timeoutScreenSave), 0);
  63. SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT, 0, NULL, 0);
  64. SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT, 0, NULL, 0);
  65. SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, 0, NULL, 0);
  66. }
  67. LOG_DEBUG("SS Disabled");
  68. #endif
  69. mpSettings = mpSettingsProvider->getSubNode(NULL, "APPLICATION_GUI");
  70. mainWinow *window;
  71. window = mainWinow::getInstance();
  72. //Check Startup Mode
  73. int gAppStartupMode;
  74. config_setting_t *pSetting;
  75. if (!config_setting_lookup_int(mpSettings, "STARTUP_WINDOW_MODE", &gAppStartupMode )){
  76. gAppStartupMode = 1;
  77. pSetting = config_setting_add(mpSettings, "STARTUP_WINDOW_MODE", CONFIG_TYPE_INT);
  78. config_setting_set_int(pSetting, gAppStartupMode);
  79. mpSettingsProvider->compromise();
  80. };
  81. switch( gAppStartupMode ){
  82. case 0: window->show(); break;
  83. case 1: window->showMaximized(); break;
  84. case 2: window->showFullScreen(); break;
  85. default:
  86. gAppStartupMode = 1;
  87. pSetting = config_setting_lookup(mpSettings, "STARTUP_WINDOW_MODE");
  88. config_setting_set_int(pSetting, gAppStartupMode);
  89. mpSettingsProvider->compromise();
  90. window->showMaximized();
  91. };
  92. joysticObject::getInstance();
  93. #ifdef __linux__
  94. LOG_DEBUG("SS Enabled");
  95. #else
  96. {
  97. SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT, timeoutLowPower, NULL, 0);
  98. SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT, timeoutPowerOff, NULL, 0);
  99. SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, timeoutScreenSave, NULL, 0);
  100. }
  101. LOG_DEBUG("SS Enabled");
  102. #endif
  103. delete GUI;
  104. delete window;
  105. delete LS;
  106. delete mpEventHeap;
  107. delete mpSettingsProvider;
  108. #ifdef __linux__
  109. #else
  110. //lActiveFlag = 1;
  111. //SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, lActiveFlag, 0, 0);
  112. //lActiveFlag = 20;
  113. //SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, lActiveFlag, NULL, NULL);
  114. //LOG_DEBUG("SS Enabled");
  115. #endif
  116. LOG_DEBUG("EXIT APPLICATION");
  117. delete mpLog;
  118. return 0;
  119. };
  120. #undef LOG
  121. #undef LOG_DEBUG
  122. #undef LOG_ERROR
  123. /*---------------------------------------*/
  124. /* A sample program to play C major */
  125. /* through a PC speaker */
  126. /*---------------------------------------*/
  127. /* This won't work if standard output is */
  128. /* re-directed to a non-tty device, or */
  129. /* PC speaker wave output is active */
  130. /*---------------------------------------*/
  131. /* M.G. 27-Nov-99 */
  132. /*---------------------------------------*/
  133. /*
  134. #include <sys/ioctl.h>
  135. #include <unistd.h>
  136. #include <linux/kd.h>
  137. int main(void)
  138. {
  139. int freq[] = { // C D E F G A B C
  140. 523, 587, 659, 698, 784, 880, 988, 1046 };
  141. int i;
  142. for (i = 0; i<8; i++)
  143. {
  144. ioctl(STDOUT_FILENO, KIOCSOUND, 1193180 / freq[i]);
  145. usleep(500000);
  146. }
  147. ioctl(STDOUT_FILENO, KIOCSOUND, 0); // Stop silly sound
  148. return 0;
  149. }
  150. */