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.

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