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.

180 lines
5.8 KiB

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