Учет и контроль реализации обработки информации на примере ООО "ЭККО-РОС"
Дипломная работа - Компьютеры, программирование
Другие дипломы по предмету Компьютеры, программирование
tReportTime, endReportTime);
stats->SetDaysStatisticsArray(statisticsServer->GetDayReportInArray(), statisticsServer->GetDayReportOutArray());
for (int i = 0; i < number; i++)
{
if (stats->GenerateReportMethod(true, (i+1).ToString()))
{
String ^report = stats->GetPeriodStatistics();
File::WriteAllText(reportArchiveFiles[i], report);::WriteAllText(reportReadyToSendFiles[i], report);::WriteAllText(reportReadyToIndexFilse[i], report);
}
}
ReportWorker::SendEmailAndCopyReport(reportReadyToSendFiles, curTime, endReportTime);
}
catch(Exception^ e)
{
Log::UpdateDevLog("Error: problems with reports saving. " + e->Message);
}
{
if (Convert::ToBoolean(XmlFunctions::GetXMLParameter("/CounterParameters/Reports/Server/Enabled")))
{^cur ;(cur = startReportTime; *cur AddHours(1))
{^curNext = cur;= cur->AddHours(1);res = -1;(int camIdx = 0; camIdx < Utilities::GetNumberOfEntrances(); camIdx++)
{^ client = gcnew ClientLib( XmlFunctions::GetXMLParameter("/CounterParameters/Reports/Server/IP"),::GetXMLParameter("/CounterParameters/Reports/Server/Port"),^ _file = gcnew FileParameters();
_file->m_name = reportArchiveFiles[camIdx];in, out;>GetStatFromFile(_file,*(DateTime^)cur,*(DateTime^)curNext,in,out);(in != 0 || out != 0)
{::UpdateDevLog("Try to send: " + XmlFunctions::GetXMLParameter("/CounterParameters/ShopID") + camIdx.ToString() +
SendPassages(XmlFunctions::GetXMLParameter("/CounterParameters/ShopID"),">(*cur).ToString() + in.ToString() + out.ToString());= client -> SendPassages( XmlFunctions::Get XMLParameter("/CounterParameters/ShopID"),
}::SetLastReportTime(cur,true);
}
}
}
}(Exception^ e)
{::UpdateDevLog("Error: problems with reports sending to report service. " + e->Message + "\n" + e->Source + "\n" + e->StackTrace);
}
}
}
}WorkingThread::SendShopStatusIfNeeded
{(Convert::ToBoolean(XmlFunctions::GetXMLParameter("/CounterParameters/Reports/Server/Enabled")))
=2)">{now = DateTime::Now;savePeriod = now - m_LastTimeShopStatusSent; (savePeriod.TotalSeconds >= 2)
{
{^ client = gcnew ClientLib( XmlFunctions::GetXMLParameter("/CounterParameters/Reports/Server/IP"),res = client->SetShopStatus(XmlFunctions::Get XMLParameter("/CounterParameters/ShopID"), true);(res != 0)::UpdateDevLog("Error: problems with setting shop status. ");
}(Exception^ e)
{::UpdateDevLog("Error: problems with setting shop status. " + e->Message);
}_LastTimeShopStatusSent = now;
}
}
}WorkingThread::SaveStatisticsIfNeeded()
{now = DateTime::Now;
TimeSpan savePeriod = now - m_LastTimeStatisticsSaved;
//we have to save statistics periodically for the case of power failure
=10)">if (savePeriod.TotalMinutes >= 10)
{
//save the statistics to a file
StatisticsThread ^stats = gcnew StatisticsThread;
//Block access to dayReport
Monitor::Enter(this);
stats->SetDayStatistics(dayReport->ToString(), dayReportOut->ToString(), currentDay);
Monitor::Exit(this);
stats->m_camIndex = m_CamIdx;
Thread ^reportThread = gcnew Thread(gcnew ThreadStart(stats, &StatisticsThread::SaveStatistics));
CultureManager::SetCurrentThreadCulture(reportThread);
reportThread->Start();
//TODO: check the saving succeed
m_LastTimeStatisticsSaved = now;
}
}WorkingThread::SendFrameAndCountersToAllClients(IplImage* frame) // отсылает картинку и число посетителей в граф клиент
{
0)">if (m_minUpdatePeriod.CompareTo(DateTime::Now - m_LastTimeClientUpdatted) > 0)
{
return;
}
Object ^lockObj = packedImage;
if (lockObj != nullptr)
{
if (!Monitor::TryEnter(lockObj, 5))
{
//No luck, another thread is sending this image, try on the next iteration
return;
}
}
m_LastTimeClientUpdatted = DateTime::Now;
DateTime ^now = DateTime::Now;
int imageWidth = statisticsServer->GetWidth();
int imageHeight = statisticsServer->GetHeight();
if (statisticsServer->HaveClients())
{
bool drawGrid = statisticsServer->GetDrawGrid();
bool showCounters = statisticsServer->GetShowCounters();
if (tmpImg == 0 ||
tmpImg->width != imageWidth || tmpImg->height != imageHeight ||
tmpImg->depth != frame->depth || tmpImg->nChannels != frame->nChannels ||
tmpImg->origin != frame->origin)
{
if (tmpImg != 0)
{
IplImage *p = tmpImg;
cvReleaseImage(&p);
tmpImg = 0;
}
tmpImg = cvCreateImage(cvSize(imageWidth, imageHeight), frame->depth, frame->nChannels);
tmpImg->origin = frame->origin;
}
if (drawGrid || showCounters)
{
CvSize size = cvSize(frame->width, frame->height);
IplImage *grid = cvCreateImage(size, frame->depth, frame->nChannels);
grid->origin = frame->origin;
cvCopy(frame, grid);
if (drawGrid)
{
m_drawer->DrawGrid(grid);
}
if (showCounters && !this->statisticsServer->GetIsAllEntrances())
{
m_drawer->ShowCounters(grid, *m_currentCount);
}
packedImage = PackImage(grid, imageWidth, imageHeight, packedImage, tmpImg);
cvReleaseImage(&grid);
}
else
{
packedImage = PackImage(frame, imageWidth, imageHeight, packedImage, tmpImg);
}
}
int samples1 = m_counter->GetNumberOfSamples(1);
int samples2 = m_counter->GetNumberOfSamples(2);
statisticsServer->UpdateFrameAndCounter(
packedImage,
*m_currentCount,
*m_currentCountOut,
imageWidth,
imageHeight,
samples1,
samples2, m_CamIdx);
*m_count1 = m_counter->GetCurrentCount();
*m_count2 = m_counter->GetCurrentCountOut();
if (m_lastCount != (*m_currentCount) || m_lastCountOut != (*m_currentCountOut))
{
//Add new users to the list
int user = 0;
int numberOfNewUsers = *m_currentCount - m_lastCount;
int numberOfOutgoing = *m_currentCountOut - m_lastCountOut;
Monitor::Enter(this);
for (user = 0; user < numberOfNewUsers; user++)
{
dayReport = dayReport->Append(DateStringConverter::GetCurrentFormattedTime(now)+"\r\n");
}
for (user = 0; user < numberOfOutgoing; user++)
{
dayReportOut = dayReportOut->Append(DateStringConverter::GetCurrentFormattedTime(now)+"-\r\n");
}
Monitor::Exit(this);
m_lastCount = *m_currentCount;
m_lastCountOut = *m_currentCountOut;
//statisticsServer->UpdateFrameAndCounter(
// packedImage,
// *m_currentCount,
// *m_currentCountOut,
// imageWidth,
// imageHeight,
// samples1,
// samples2, m_CamIdx);
}
if (lockObj != nullptr)
{
Monitor::Exit(lockObj);
}
}WorkingThread::ProcessFrame()
{
if (m_SystemStateObserver.IsShopOpenNow())
{
if (statisticsServer->GetIsCalc(m_CamIdx))
{
#if SONAR_ENABLED(m_counter->Process(m_IplFrame, -1) == -2)
#else(m_counter->Process(m_IplFrame) == -2)
#endif
{::stopWorking = true;
}
}
}
}WorkingThread::IsDieTime()
{
return m_isTimeToExit || Utilities::stopWorking;
}WorkingThread::StartWorking() // запуск сервиса подiета
{
// Модуль проверки состояния камеры
m_SystemStateObserver.SystemStart(m_CamIdx);
int samples1 = m_counter->GetNumberOfSamples(1);
int samples2 = m_counter->GetNumberOfSamples(2);
statisticsServer->UpdateFrameAndCounter(nullptr, *m_currentCount, *m_currentCountOut,
statisticsServer->GetWidth(), statisticsServer->GetHeight(),
samples1, samples2, m_CamIdx);();
InitializeTestWindow();
time_t timer;
time(&timer);
time_t cur_timer;
int fps = 0;
//main loop
while (!IsDieTime())
{
time(&cur_timer);
if (cur_timer == timer)
{
fps++;
}
else
{
ShowCountersInTestConsole(fps);
fps = 0;
timer = cur_timer;
}
Monitor::Enter(frameLock);
if (!CameraGetNextFrame())
continue;
if (statisticsServer->GetIsWriteVideo(m_CamIdx))
{
m_VideoWriter.SaveFrame(m_IplFrame, m_CamIdx);
#if SONAR_ENABLED
GetSonarValue(),m_CamIdx);">m_SonarDataWriter.SaveSonarValue(m_counter->GetSonarValue(), m_CamIdx);
#endif
}
if (m_IplFrame != NULL)
{
ProcessFrame();
SendFrameAndCountersToAllClients(m_IplFrame);
ShowFrameInTestWindow();
}
SendReportIfNeeded();
SaveStatisticsIfNeeded();();
m_SystemStateObserver.SystemCheck((Int64)m_IplFrame, *m_currentCount, *m_currentCountOut, m_CamIdx);
Monito
Copyright © 2008-2014 studsell.com рубрикатор по предметам рубрикатор по типам работ пользовательское соглашение