void cSkinSTTNGDisplayChannel::Flush(void) { if (withInfo) { if (!message) { const cFont *font = cFont::GetFont(fontSml); cString date = DayDateTime(); int w = font->Width(date); osd->DrawText(x4 - w - 2, y7 - font->Height(date), date, Theme.Color(clrChannelDate), frameColor, font); cDevice *Device = cDevice::PrimaryDevice(); const tTrackId *Track = Device->GetTrack(Device->GetCurrentAudioTrack()); if (!Track && *lastTrackId.description || Track && strcmp(lastTrackId.description, Track->description)) { osd->DrawText(x3 + 2, y6, Track ? Track->description : "", Theme.Color(clrChannelName), frameColor, font, x4 - x3 - w - 4); strn0cpy(lastTrackId.description, Track ? Track->description : "", sizeof(lastTrackId.description)); } } int seen = 0; if (present) { time_t t = time(NULL); if (t > present->StartTime()) seen = min(y4 - y3 - 1, int((y4 - y3) * double(t - present->StartTime()) / present->Duration())); } if (seen != lastSeen) { osd->DrawRectangle(x1 + Gap, y3, x1 + Gap + ScrollWidth - 1, y4 - 1, Theme.Color(clrChannelTimebarRest)); if (seen) osd->DrawRectangle(x1 + Gap, y3, x1 + Gap + ScrollWidth - 1, y3 + seen, Theme.Color(clrChannelTimebarSeen)); lastSeen = seen; } } osd->Flush(); }
// cIsThread override: virtual void Execute(void) override { do { m_MojangAPI.Update(); } while (!m_ShouldTerminate && !m_evtNotify.Wait(60 * 60 * 1000)); // Repeat every 60 minutes until termination request }
// 이벤트 핸들러 호출 bool cWindow::DispatchEvent( cEvent &event ) { cEventHandler::SearchEventTable(event); if (!event.IsSkip() && m_parent) // 이벤트가 스킵되지 않았다면 부모로 올라가서 실행한다. { if (cWindow *parent = dynamic_cast<cWindow*>(m_parent)) parent->SearchEventTable(event); } return true; }
bool cLSTEHandler::Next(bool &Last) { if (*m_Error != NULL) { Last = true; cString str(m_Error); m_Error = NULL; return m_Client->Respond(m_Errno, "%s", *str); } Last = false; switch (m_State) { case Channel: if (m_Schedule != NULL) { cChannel *channel = Channels.GetByChannelID(m_Schedule->ChannelID(), true); if (channel != NULL) { m_State = Event; return m_Client->Respond(-215, "C %s %s", *channel->GetChannelID().ToString(), channel->Name()); } else { esyslog("ERROR: vdr streamdev: unable to find channel %s by ID", *m_Schedule->ChannelID().ToString()); m_State = EndChannel; return Next(Last); } } else { m_State = EndEPG; return Next(Last); } break; case Event: if (m_Event != NULL) { m_State = Title; #ifdef __FreeBSD__ return m_Client->Respond(-215, "E %u %d %d %X", m_Event->EventID(), #else return m_Client->Respond(-215, "E %u %ld %d %X", m_Event->EventID(), #endif m_Event->StartTime(), m_Event->Duration(), m_Event->TableID()); } else {
/** @brief call event handler */ bool cEventHandler::SearchEventTable( cEvent &event ) { BOOST_FOREACH(auto &entry, m_EventTable) { if ((event.GetType() == entry.type) && (event.GetId() == entry.id)) { if (entry.handler) { cEventHandler *handler = entry.handler; (handler->*entry.fn)( event ); } else { // not yet //EvtHandler_Fn fn = (EvtHandler_Fn)entry.fn; //(*fn)(event); } } } return true; }
void cEventHandlerHeurKillAV::OnAntiAV(cEvent& event, int32_t av_id) { uint32_t nAntiAV_Count = 0; { cProcess pProcess = event.GetProcess(); if (!pProcess) return; uint32_t anti_av_flag = MAKE_ANTI_AV_FLAG(av_id); if (0 != (pProcess->m_nAntiAV_Flags & anti_av_flag)) return; pProcess->m_nAntiAV_Flags |= anti_av_flag; pProcess->m_nAntiAV_Count++; nAntiAV_Count = pProcess->m_nAntiAV_Count; } if (nAntiAV_Count >= 2) return m_pEventMgr->OnAntiAVMultiple(event, av_id); return; }
static void sAddEvent(GVariantBuilder *Array, const cEvent &Event) { const char *c; guint32 tu32; guint64 tu64; int ti; gboolean tb; GVariantBuilder *arr = g_variant_builder_new(G_VARIANT_TYPE("a(sv)")); cString cid = Event.ChannelID().ToString(); c = *cid; cDBusHelper::AddKeyValue(arr, "ChannelID", "s", (void**)&c); tu32 = Event.EventID(); cDBusHelper::AddKeyValue(arr, "EventID", "u", (void**)&tu32); c = Event.Title(); if (c != NULL) cDBusHelper::AddKeyValue(arr, "Title", "s", (void**)&c); c = Event.ShortText(); if (c != NULL) cDBusHelper::AddKeyValue(arr, "ShortText", "s", (void**)&c); c = Event.Description(); if (c != NULL) cDBusHelper::AddKeyValue(arr, "Description", "s", (void**)&c); tu64 = Event.StartTime(); cDBusHelper::AddKeyValue(arr, "StartTime", "t", (void**)&tu64); tu64 = Event.EndTime(); cDBusHelper::AddKeyValue(arr, "EndTime", "t", (void**)&tu64); tu64 = Event.Duration(); cDBusHelper::AddKeyValue(arr, "Duration", "t", (void**)&tu64); tu64 = Event.Vps(); cDBusHelper::AddKeyValue(arr, "Vps", "t", (void**)&tu64); ti = Event.RunningStatus(); cDBusHelper::AddKeyValue(arr, "RunningStatus", "i", (void**)&ti); #if VDRVERSNUM >= 10711 ti = Event.ParentalRating(); cDBusHelper::AddKeyValue(arr, "ParentalRating", "i", (void**)&ti); tb = Event.HasTimer(); cDBusHelper::AddKeyValue(arr, "HasTimer", "b", (void**)&tb); for (int i = 0; i < MaxEventContents; i++) { tu32 = Event.Contents(i); if (tu32 != 0) { cDBusHelper::AddKeyValue(arr, *cString::sprintf("ContentID[%d]", i), "u", (void**)&tu32); c = cEvent::ContentToString(tu32); cDBusHelper::AddKeyValue(arr, *cString::sprintf("Content[%d]", i), "s", (void**)&c); } } #endif g_variant_builder_add_value(Array, g_variant_builder_end(arr)); g_variant_builder_unref(arr); }