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.

176 lines
5.8 KiB

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