コード例 #1
0
ファイル: monitor_device.c プロジェクト: Audioniek/Fortis-4G
/*{{{  MonitorRecordEvent*/
void MonitorRecordEvent(struct DeviceContext_s*         Context,
						unsigned int                    SourceId,
						monitor_event_code_t            EventCode,
						unsigned long long              TimeStamp,
						unsigned int                    Parameters[MONITOR_PARAMETER_COUNT],
						const char*                     Description)
{
	struct EventQueue_s*                EventList;
	unsigned int                        Next;
	unsigned int                        EventReceived   = false;
	unsigned long                       Flags;
	struct EventRecord_s*               EventRecord;
	struct EventValue_s*                StoredEvent;
	StoredEvent                 = &(Context->StoredEventValues[EventCode & MONITOR_EVENT_INDEX_MASK]);
	if (Parameters)
		memcpy(StoredEvent->Parameters, Parameters, sizeof(Parameters));
	StoredEvent->Count++;
	if ((EventCode & MONITOR_EVENT_REPORT_ON_REQUEST) != 0)
		return;
	if ((Context->Status.subsystem_mask & EventCode) == 0)
		return;
	EventList                   = &Context->EventQueue;
	spin_lock_irqsave(&EventList->Lock, Flags);
	Next                        = (EventList->Write + 1) % MAX_MONITOR_EVENT;
	if (Next == EventList->Read)
	{
		EventList->LostCount++;
		EventList->Read         = (EventList->Read + 1) % MAX_MONITOR_EVENT;
	}
	EventRecord                 = &(EventList->Event[EventList->Write]);
	if (Parameters)
		EventRecord->RecordLength       = snprintf((char*) & (EventRecord->EventString), MONITOR_EVENT_RECORD_SIZE,
										  "%s at %lluus source %d (0x%x, 0x%x, 0x%x, 0x%x) \"%s\"\n",
										  EventName(EventCode), TimeStamp, SourceId,
										  Parameters[0], Parameters[1], Parameters[2], Parameters[3], Description);
	else
		EventRecord->RecordLength       = snprintf((char*) & (EventRecord->EventString), MONITOR_EVENT_RECORD_SIZE,
										  "%s at %lluus source %d \"%s\"\n",
										  EventName(EventCode), TimeStamp, SourceId, Description);
	EventRecord->EventString[MONITOR_EVENT_RECORD_SIZE - 1]       = '\n';
	if (EventRecord->RecordLength > MONITOR_EVENT_RECORD_SIZE)
		EventRecord->RecordLength       = MONITOR_EVENT_RECORD_SIZE;
	EventList->Write                    = Next;
	EventReceived                       = true;
	spin_unlock_irqrestore(&EventList->Lock, Flags);
	/*MONITOR_DEBUG ("Write:%d, Read:%d: Message:%s\n", EventList->Write, EventList->Read, (char*)(EventRecord->EventString));*/
	if (EventReceived)
		wake_up_interruptible(&EventList->EventReceived);
}
コード例 #2
0
// -----------------------------------------------------------------------------
// CG711DecoderIntfcTestClass::AddExpectedEvent
// Add an event to the expected events' list
// -----------------------------------------------------------------------------
void CG711DecoderIntfcTestClass::AddExpectedEvent(TG711ExpectedEvent event, TInt ms)
{
	FTRACE(FPrint(_L("CG711DecoderIntfcTestClass::AddExpectedEvent")));
	iExpectedEvents.Append(event);
	TPtrC eventName = EventName(event);
	iLog->Log(_L("Adding expected event:(0x%02x)%S Total=%d"), event, &eventName, iExpectedEvents.Count() );

	if ( iTimeoutController && !iTimeoutController->IsActive() )
		{
		if (ms > 0)
			{
            iTimeoutController->Start( TTimeIntervalMicroSeconds(ms * 1000) );
			}
		else
			{
			iLog->Log(_L("Timeout with default value (1s)"));
			iTimeoutController->Start( TTimeIntervalMicroSeconds(1000000) );
			}
		}
}
コード例 #3
0
// -----------------------------------------------------------------------------
// COpenMAXALTestModule::AddExpectedEvent
// Add an event to the expected events' list
// -----------------------------------------------------------------------------
void COpenMAXALTestModule::AddExpectedEvent(TOMXExpectedEvent event, TInt ms)
{
   iLog->Log(_L("COpenMAXALTestModule::AddExpectedEvent"));
    iExpectedEvents.Append(event);
    TPtrC eventName = EventName(event);
    iLog->Log(_L("Adding expected event:(0x%02x)%S Total=%d"), event, &eventName, iExpectedEvents.Count() );

    if ( iTimeoutController && !iTimeoutController->IsActive() )
        {
        if (ms > 0)
            {
            iTimeoutController->Start( TTimeIntervalMicroSeconds(ms * 1000) );
            }
        else
            {
            iLog->Log(_L("Timeout with default value (1s)"));
            iTimeoutController->Start( TTimeIntervalMicroSeconds(1000000) );
            }
        }
}
コード例 #4
0
// -----------------------------------------------------------------------------
// CWmaDecoderIntfcTestClass::ProcessEvent
// -----------------------------------------------------------------------------
void CWmaDecoderIntfcTestClass::ProcessEvent(TWmaExpectedEvent aEvent, TInt aError)
{
	FTRACE(FPrint(_L("CWmaDecoderIntfcTestClass::ProcessExpectedEvent")));
	TPtrC nameEvent = EventName(aEvent);

	// Check for error
	if (aError == KErrNone)
	{
		// Remove the event
		if (RemoveExpectedEvent(aEvent))
		{
			iLog->Log(_L("Expected Event: (0x%02x)%S has ocurred Total=%d"), aEvent, &nameEvent,iExpectedEvents.Count());
		}
		else
		{
			iLog->Log(_L("Event: (0x%02x)%S has ocurred"), aEvent, &nameEvent);
			return;
		}



		// All expected events have ocurred
		if (iExpectedEvents.Count() == 0 )
		{
			Signal();
			iTimeoutController->Cancel();
		}


	}
	else
	{
		iLog->Log(_L("[Error] Event: (0x%02x)%S return with error code=%d"), aEvent, &nameEvent, aError);
		if (iExpectedEvents.Count() != 0 )
		{
			RemoveExpectedEvent(aEvent);
		}
		iTimeoutController->Cancel();
		Signal(KErrCallbackErrorCode);
	}
}
コード例 #5
0
HRESULT CPlayer::HandleEvent(UINT_PTR pUnkPtr)
{
    HRESULT hr = S_OK;
    HRESULT hrStatus = S_OK;            // Event status
    MediaEventType meType = MEUnknown;  // Event type
    MF_TOPOSTATUS TopoStatus = MF_TOPOSTATUS_INVALID; // Used with MESessionTopologyStatus event.    

    IUnknown *pUnk = NULL;
    IMFMediaEvent *pEvent = NULL;

    // pUnkPtr is really an IUnknown pointer.
    pUnk = (IUnknown*)pUnkPtr;

    if (pUnk == NULL)
    {
        return E_POINTER;
    }

    CHECK_HR(hr = pUnk->QueryInterface(__uuidof(IMFMediaEvent), (void**)&pEvent));

    // Get the event type.
    CHECK_HR(hr = pEvent->GetType(&meType));

    // Get the event status. If the operation that triggered the event did
    // not succeed, the status is a failure code.
    CHECK_HR(hr = pEvent->GetStatus(&hrStatus));

    TRACE((L"Media event: %s\n", EventName(meType)));

    // Check if the async operation succeeded.
    if (SUCCEEDED(hrStatus))
    {
        // Switch on the event type. Update the internal state of the CPlayer as needed.
        switch(meType)
        {
        case MESessionTopologyStatus:
            // Get the status code.
            CHECK_HR(hr = pEvent->GetUINT32(MF_EVENT_TOPOLOGY_STATUS, (UINT32*)&TopoStatus));
            switch (TopoStatus)
            {
            case MF_TOPOSTATUS_READY: 
                hr = OnTopologyReady(pEvent);
                break;
            default: 
                // Nothing to do.
                break;  
            }
            break;

        case MEEndOfPresentation:
            CHECK_HR(hr = OnPresentationEnded(pEvent));
            break;
        }
    }
    else
    {
        hr = hrStatus;
    }

done:
    SAFE_RELEASE(pUnk);
    SAFE_RELEASE(pEvent);
    return hr;
}
コード例 #6
0
ファイル: events.c プロジェクト: Limsik/e17
static void
EventsCompress(XEvent * evq, int count)
{
   XEvent             *ev, *ev2;
   int                 i, j, n;
   int                 xa, ya, xb, yb;
   int                 type;

#if ENABLE_DEBUG_EVENTS
   /* Debug - should be taken out */
   if (EDebug(EDBUG_TYPE_COMPRESSION))
      for (i = 0; i < count; i++)
	 if (evq[i].type)
	    Eprintf("EventsCompress-1 %3d %s w=%#lx\n", i,
		    EventName(evq[i].type), evq[i].xany.window);
#endif

   /* Loop through event list, starting with latest */
   for (i = count - 1; i >= 0; i--)
     {
	ev = evq + i;

	type = ev->type;
	switch (type)
	  {
	  case 0:
	     /* Already thrown away */
	  default:
	     break;

	  case MotionNotify:
	     /* Discard all but last motion event */
	     j = i - 1;
	     n = 0;
	     for (; j >= 0; j--)
	       {
		  ev2 = evq + j;
		  if (ev2->type == type)
		    {
		       n++;
		       ev2->type = 0;
		    }
	       }
#if ENABLE_DEBUG_EVENTS
	     if (n && EDebug(EDBUG_TYPE_COMPRESSION))
		Eprintf("EventsCompress n=%4d %s %#lx x,y = %d,%d\n",
			n, EventName(type), ev->xmotion.window,
			ev->xmotion.x, ev->xmotion.y);
#endif
	     break;

	  case LeaveNotify:
	     for (j = i - 1; j >= 0; j--)
	       {
		  ev2 = evq + j;
		  if (ev2->type == EnterNotify)
		    {
		       if (ev2->xcrossing.window == ev->xcrossing.window)
			  goto do_enter_leave_nuked;
		    }
	       }
	     break;
	   do_enter_leave_nuked:
	     ev2->type = ev->type = 0;
	     for (n = i - 1; n > j; n--)
	       {
		  ev2 = evq + n;
		  if (ev2->type == MotionNotify)
		    {
		       if (ev2->xmotion.window != ev->xmotion.window)
			  continue;
		       ev2->type = 0;
		    }
	       }
#if ENABLE_DEBUG_EVENTS
	     if (EDebug(EDBUG_TYPE_COMPRESSION))
		Eprintf("EventsCompress n=%4d %s %#lx\n",
			1, EventName(type), ev->xcrossing.window);
#endif
	     break;

	  case DestroyNotify:
	     for (j = i - 1; j >= 0; j--)
	       {
		  ev2 = evq + j;
		  switch (ev2->type)
		    {
		    case CreateNotify:
		       if (ev2->xcreatewindow.window !=
			   ev->xdestroywindow.window)
			  continue;
		       ev2->type = EX_EVENT_CREATE_GONE;
		       j = -1;	/* Break for() */
		       break;
		    case DestroyNotify:
		       break;
		    case UnmapNotify:
		       if (ev2->xunmap.window != ev->xdestroywindow.window)
			  continue;
		       ev2->type = EX_EVENT_UNMAP_GONE;
		       break;
		    case MapNotify:
		       if (ev2->xmap.window != ev->xdestroywindow.window)
			  continue;
		       ev2->type = EX_EVENT_MAP_GONE;
		       break;
		    case MapRequest:
		       if (ev2->xmaprequest.window != ev->xdestroywindow.window)
			  continue;
		       ev2->type = EX_EVENT_MAPREQUEST_GONE;
		       break;
		    case ReparentNotify:
		       if (ev2->xreparent.window != ev->xdestroywindow.window)
			  continue;
		       ev2->type = EX_EVENT_REPARENT_GONE;
		       break;
		    case ConfigureRequest:
		       if (ev2->xconfigurerequest.window !=
			   ev->xdestroywindow.window)
			  continue;
		       ev2->type = 0;
		       break;
		    default:
		       /* Nuke all other events on a destroyed window */
		       if (ev2->xany.window != ev->xdestroywindow.window)
			  continue;
		       ev2->type = 0;
		       break;
		    }
	       }
	     break;

	  case Expose:
	     n = 0;
	     xa = ev->xexpose.x;
	     xb = xa + ev->xexpose.width;
	     ya = ev->xexpose.y;
	     yb = ya + ev->xexpose.height;
	     for (j = i - 1; j >= 0; j--)
	       {
		  ev2 = evq + j;
		  if (ev2->type == type &&
		      ev2->xexpose.window == ev->xexpose.window)
		    {
		       n++;
		       ev2->type = 0;
		       if (xa > ev2->xexpose.x)
			  xa = ev2->xexpose.x;
		       if (xb < ev2->xexpose.x + ev2->xexpose.width)
			  xb = ev2->xexpose.x + ev2->xexpose.width;
		       if (ya > ev2->xexpose.y)
			  ya = ev2->xexpose.y;
		       if (yb < ev2->xexpose.y + ev2->xexpose.height)
			  yb = ev2->xexpose.y + ev2->xexpose.height;
		    }
	       }
	     if (n)
	       {
		  ev->xexpose.x = xa;
		  ev->xexpose.width = xb - xa;
		  ev->xexpose.y = ya;
		  ev->xexpose.height = yb - ya;
	       }
#if ENABLE_DEBUG_EVENTS
	     if (EDebug(EDBUG_TYPE_COMPRESSION))
		Eprintf("EventsCompress n=%4d %s %#lx x=%4d-%4d y=%4d-%4d\n",
			n, EventName(type), ev->xexpose.window, xa, xb, ya, yb);
#endif
	     break;

	  case EX_EVENT_SHAPE_NOTIFY:
	     n = 0;
	     for (j = i - 1; j >= 0; j--)
	       {
		  ev2 = evq + j;
		  if (ev2->type == type && ev2->xany.window == ev->xany.window)
		    {
		       n++;
		       ev2->type = 0;
		    }
	       }
#if ENABLE_DEBUG_EVENTS
	     if (n && EDebug(EDBUG_TYPE_COMPRESSION))
		Eprintf("EventsCompress n=%4d %s %#lx\n",
			n, EventName(type), ev->xmotion.window);
#endif
	     break;

	  case GraphicsExpose:
	  case NoExpose:
	     /* Not using these */
	     ev->type = 0;
	     break;
	  }
     }

#if ENABLE_DEBUG_EVENTS
   /* Debug - should be taken out */
   if (EDebug(EDBUG_TYPE_COMPRESSION))
      for (i = 0; i < count; i++)
	 if (evq[i].type)
	    Eprintf("EventsCompress-2 %3d %s w=%#lx\n", i,
		    EventName(evq[i].type), evq[i].xany.window);
#endif
}
コード例 #7
0
ファイル: events.c プロジェクト: Limsik/e17
void
EventShow(const XEvent * ev)
{
   char               *txt, buf[64];

   Esnprintf(buf, sizeof(buf), "%#08lx %cEV-%s ev=%#lx",
	     ev->xany.serial, (ev->xany.send_event) ? '*' : ' ',
	     EventName(ev->type), ev->xany.window);

   switch (ev->type)
     {
     case KeyPress:
     case KeyRelease:
	Eprintf("%s sub=%#lx x,y=%d,%d state=%#x keycode=%#x ss=%d\n", buf,
		ev->xkey.subwindow, ev->xkey.x, ev->xkey.y,
		ev->xkey.state, ev->xkey.keycode, ev->xkey.same_screen);
	break;
     case ButtonPress:
     case ButtonRelease:
	Eprintf("%s sub=%#lx x,y=%d,%d state=%#x button=%#x ss=%d\n", buf,
		ev->xbutton.subwindow, ev->xbutton.x, ev->xbutton.y,
		ev->xbutton.state, ev->xbutton.button, ev->xbutton.same_screen);
	break;
     case MotionNotify:
	Eprintf("%s sub=%#lx x,y=%d,%d rx,ry=%d,%d ss=%d\n", buf,
		ev->xmotion.subwindow, ev->xmotion.x, ev->xmotion.y,
		ev->xmotion.x_root, ev->xmotion.y_root,
		ev->xmotion.same_screen);
	break;
     case EnterNotify:
     case LeaveNotify:
	Eprintf("%s sub=%#lx x,y=%d,%d m=%s d=%s ss=%d focus=%d\n", buf,
		ev->xcrossing.subwindow, ev->xcrossing.x, ev->xcrossing.y,
		EventNotifyModeName(ev->xcrossing.mode),
		EventNotifyDetailName(ev->xcrossing.detail),
		ev->xcrossing.same_screen, ev->xcrossing.focus);
	break;
     case FocusIn:
     case FocusOut:
	Eprintf("%s m=%s d=%s\n", buf, EventNotifyModeName(ev->xfocus.mode),
		EventNotifyDetailName(ev->xfocus.detail));
	break;
     case KeymapNotify:
     case Expose:
     case GraphicsExpose:
	Eprintf("%sx %d+%d %dx%d\n", buf,
		ev->xexpose.x, ev->xexpose.y,
		ev->xexpose.width, ev->xexpose.height);
	break;
     case VisibilityNotify:
	Eprintf("%s state=%d\n", buf, ev->xvisibility.state);
	break;
     case CreateNotify:
     case DestroyNotify:
     case UnmapNotify:
     case MapRequest:
     case EX_EVENT_CREATE_GONE:
     case EX_EVENT_UNMAP_GONE:
     case EX_EVENT_MAPREQUEST_GONE:
	Eprintf("%s win=%#lx\n", buf, ev->xcreatewindow.window);
	break;
     case MapNotify:
     case EX_EVENT_MAP_GONE:
	Eprintf("%s win=%#lx or=%d\n", buf, ev->xmap.window,
		ev->xmap.override_redirect);
	break;
     case ReparentNotify:
     case EX_EVENT_REPARENT_GONE:
	Eprintf("%s win=%#lx parent=%#lx %d+%d\n", buf,
		ev->xreparent.window, ev->xreparent.parent,
		ev->xreparent.x, ev->xreparent.y);
	break;
     case ConfigureNotify:
	Eprintf("%s win=%#lx %d+%d %dx%d bw=%d above=%#lx\n", buf,
		ev->xconfigure.window, ev->xconfigure.x,
		ev->xconfigure.y, ev->xconfigure.width, ev->xconfigure.height,
		ev->xconfigure.border_width, ev->xconfigure.above);
	break;
     case ConfigureRequest:
	Eprintf("%s win=%#lx m=%#lx %d+%d %dx%d bw=%d above=%#lx stk=%d\n",
		buf, ev->xconfigurerequest.window,
		ev->xconfigurerequest.value_mask, ev->xconfigurerequest.x,
		ev->xconfigurerequest.y, ev->xconfigurerequest.width,
		ev->xconfigurerequest.height,
		ev->xconfigurerequest.border_width, ev->xconfigurerequest.above,
		ev->xconfigurerequest.detail);
	break;
     case GravityNotify:
	goto case_common;
     case ResizeRequest:
	Eprintf("%s %dx%d\n", buf,
		ev->xresizerequest.width, ev->xresizerequest.height);
	break;
     case CirculateNotify:
     case CirculateRequest:
	goto case_common;
     case PropertyNotify:
	txt = XGetAtomName(disp, ev->xproperty.atom);
	Eprintf("%s Atom=%s(%ld)\n", buf, txt, ev->xproperty.atom);
	XFree(txt);
	break;
     case SelectionClear:
     case SelectionRequest:
     case SelectionNotify:
     case ColormapNotify:
	goto case_common;
     case ClientMessage:
	txt = XGetAtomName(disp, ev->xclient.message_type);
	Eprintf("%s ev_type=%s(%ld) data: %08lx %08lx %08lx %08lx %08lx\n",
		buf, txt, ev->xclient.message_type,
		ev->xclient.data.l[0], ev->xclient.data.l[1],
		ev->xclient.data.l[2], ev->xclient.data.l[3],
		ev->xclient.data.l[4]);
	XFree(txt);
	break;
     case MappingNotify:
	Eprintf("%s req=%d first=%d count=%d\n",
		buf, ev->xmapping.request,
		ev->xmapping.first_keycode, ev->xmapping.count);
	break;

     case EX_EVENT_SHAPE_NOTIFY:
#define se ((XShapeEvent *)ev)
	Eprintf("%s kind=%d shaped=%d %d,%d %dx%d\n", buf,
		se->kind, se->shaped, se->x, se->y, se->width, se->height);
#undef se
	break;
#if USE_XSCREENSAVER
     case EX_EVENT_SAVER_NOTIFY:
#define se ((XScreenSaverNotifyEvent *)ev)
	Eprintf("%s state=%d kind=%d\n", buf, se->state, se->kind);
#undef se
	break;
#endif
#if USE_XRANDR
     case EX_EVENT_SCREEN_CHANGE_NOTIFY:
	Eprintf("%s\n", buf);
	break;
#endif
#if USE_COMPOSITE
#define de ((XDamageNotifyEvent *)ev)
     case EX_EVENT_DAMAGE_NOTIFY:
	Eprintf("%s level=%d more=%x %d+%d %dx%d\n", buf,
		de->level, de->more,
		de->area.x, de->area.y, de->area.width, de->area.height);
	break;
#undef de
#endif
     default:
      case_common:
	Eprintf("%s\n", buf);
	break;
     }
}
コード例 #8
0
// IGoalPipeListener
////////////////////////////////////////////////////////////////////////////
void CDialogActorContext::OnGoalPipeEvent( IPipeUser* pPipeUser, EGoalPipeEvent event, int goalPipeId, bool& unregisterListenerAfterEvent )
{
	if (m_goalPipeID != goalPipeId && m_exPosAnimPipeID != goalPipeId)
		return;

#if 1
	DiaLOG::Log(DiaLOG::eAlways, "[DIALOG] CDialogActorContext::OnGoalPipeEvent: %s 0x%p actorID=%d goalPipe=%d m_goalPipeID=%d m_exPosAnimPipeID=%d event=%s",
		m_pSession->GetDebugName(), this, m_actorID, goalPipeId, m_goalPipeID, m_exPosAnimPipeID, EventName(event));
#endif

	switch (event)
	{
	case ePN_Deselected:
	case ePN_Removed:
		if (CheckActorFlags(CDialogSession::eDACF_NoAIAbort) == false)
		{
			if (m_goalPipeID == goalPipeId)
				m_bAbortFromAI = true;
		}
		break;
	case ePN_AnimStarted:
		m_bAnimStarted = true;
		break;
	default:
		break;
	}
}