当前位置: 首页>>代码示例>>C++>>正文


C++ sendEvent函数代码示例

本文整理汇总了C++中sendEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ sendEvent函数的具体用法?C++ sendEvent怎么用?C++ sendEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sendEvent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sendEvent

void PluginWidgetAndroid::exitFullScreen(bool pluginInitiated) {
    if (!m_isFullScreen || !m_embeddedView) {
        return;
    }

    // remove the full screen surface from the view hierarchy
    if (pluginInitiated) {
        m_core->hideFullScreenPlugin();
    }

    // add the embedded view back
    if (m_drawingModel != kOpenGL_ANPDrawingModel)
        m_core->updateSurface(m_embeddedView, m_pluginWindow->x, m_pluginWindow->y,
                m_pluginWindow->width, m_pluginWindow->height);

    // send event to notify plugin of full screen change
    ANPEvent event;
    SkANP::InitEvent(&event, kLifecycle_ANPEventType);
    event.data.lifecycle.action = kExitFullScreen_ANPLifecycleAction;
    sendEvent(event);

    m_isFullScreen = false;
}
开发者ID:AndDiSa,项目名称:platform_external_webkit,代码行数:23,代码来源:PluginWidgetAndroid.cpp

示例2: updateScreenShape

bool
COSXScreen::onDisplayChange()
{
	// screen resolution may have changed.  save old shape.
	SInt32 xOld = m_x, yOld = m_y, wOld = m_w, hOld = m_h;

	// update shape
	updateScreenShape();

	// do nothing if resolution hasn't changed
	if (xOld != m_x || yOld != m_y || wOld != m_w || hOld != m_h) {
		if (m_isPrimary) {
			// warp mouse to center if off screen
			if (!m_isOnScreen) {
				warpCursor(m_xCenter, m_yCenter);
			}
		}

		// send new screen info
		sendEvent(m_events->forIPrimaryScreen().shapeChanged());
	}

	return true;
}
开发者ID:rakete,项目名称:synergy-foss,代码行数:24,代码来源:COSXScreen.cpp

示例3: Rect

void GUIListGadget::updateItem(GUIListItem* Item, dim::point2di &Pos)
{
    if (!Item || !Item->getVisible())
        return;
    
    dim::rect2di Rect(
        Rect_.Left, Pos.Y, Rect_.Right, Pos.Y + Item->getItemSize()
    );
    
    if (VertScroll_.getVisible())
        Rect.Right -= SCROLLBAR_SIZE;
    if (HorzScroll_.getVisible() && Rect.Bottom > Rect_.Bottom - SCROLLBAR_SIZE)
        Rect.Bottom = Rect_.Bottom - SCROLLBAR_SIZE;
    
    Pos.Y += Item->getItemSize();
    
    /* Update current item */
    if (mouseOver(Rect))
    {
        Item->isPicked_ = true;
        
        if (mouseLeft())
        {
            SelectedItem_ = Item;
            
            SGUIEvent Event;
            {
                Event.Object    = EVENT_GADGET;
                Event.Type      = EVENT_ACTIVATE;
                Event.Gadget    = this;
                Event.SubData   = Item;
            }
            sendEvent(Event);
        }
    }
}
开发者ID:bekasov,项目名称:SoftPixelEngine,代码行数:36,代码来源:spGUIListGadget.cpp

示例4: n

//----------------------------------------------------------------
void GraphView::addNodesInternal(unsigned int nbAdded, const std::vector<node> *nodes) {
  _nodes.reserve(_nodes.size() + nbAdded);

  std::vector<node>::const_iterator it;

  if (nodes)
    it = nodes->begin();
  else {
    nodes = &getSuperGraph()->nodes();
    it = nodes->begin() + nodes->size() - nbAdded;
  }

  std::vector<node>::const_iterator ite = nodes->end();

  for (; it != ite; ++it) {
    node n(*it);
    assert(getRootImpl()->isElement(n));
    _nodeData.set(n.id, new SGraphNodeData());
    _nodes.add(n);
  }

  if (hasOnlookers())
    sendEvent(GraphEvent(*this, GraphEvent::TLP_ADD_NODES, nbAdded));
}
开发者ID:tulip5,项目名称:tulip,代码行数:25,代码来源:GraphView.cpp

示例5: mTouch

//*************************************************************************
//
//   mTouch -- simulates the multi touch protocol A sequence (see the Linux
//	input protocol definition).  Expects x,y coordinates
// 	followed by the finger id and the pressure.    Finger ID is
//	currently ignored.   If pressure is > 0 then we assume this is 
//	a touch down event otherwise it is a touch up event which is 
//	signled by a empty MT and SYNC report.
//
//*************************************************************************
void mTouch ( int conn, int dev)
{
   int             x,y,s,f;
   x = getInt (conn);
   y = getInt (conn);
   f = getInt (conn);
   s = getInt (conn);
   
   sendEvent (dev, EV_ABS, ABS_MT_POSITION_X, x);
   sendEvent (dev, EV_ABS, ABS_MT_POSITION_Y, y);
   sendEvent (dev, EV_KEY, BTN_TOUCH, (s>0));   
   sendEvent (dev, EV_SYN, SYN_MT_REPORT, 0);

   if (s == 0)
   {
      sendEvent (dev, EV_SYN, SYN_MT_REPORT, 0);
      sendEvent (dev, EV_SYN, SYN_REPORT, 0);   
   }
 
   if (verbose) printf(" %d %d %d %d\n",x,y,f,s);
}
开发者ID:Topographic0cean,项目名称:src,代码行数:31,代码来源:touchd.c

示例6: UAVObjLoad

/**
 * Load an object from the file system (SD card).
 * A file with the name of the object will be opened.
 * The object data can be saved using the UAVObjSave function.
 * @param[in] obj The object handle.
 * @param[in] instId The object instance
 * @return 0 if success or -1 if failure
 */
int32_t UAVObjLoad(UAVObjHandle obj, uint16_t instId)
{
#if defined(PIOS_INCLUDE_FLASH_SECTOR_SETTINGS)
	ObjectList *objEntry = (ObjectList *) obj;

	if (objEntry == NULL)
		return -1;

	ObjectInstList *instEntry = getInstance(objEntry, instId);

	if (instEntry == NULL)
		return -1;

	if (instEntry->data == NULL)
		return -1;

	// Fire event on success
	if (PIOS_FLASHFS_ObjLoad(obj, instId, instEntry->data) == 0)
		sendEvent(objEntry, instId, EV_UNPACKED);
	else
		return -1;
#endif

#if defined(PIOS_INCLUDE_SDCARD)
	  FILEINFO file;
	  ObjectList *objEntry;
	  UAVObjHandle loadedObj;
	  ObjectList *loadedObjEntry;
	  uint8_t filename[14];

	  // Check for file system availability
	  if (PIOS_SDCARD_IsMounted() == 0) {
		    return -1;
	  }
	  // Lock
	  xSemaphoreTakeRecursive(mutex, portMAX_DELAY);

	  // Cast to object
	  objEntry = (ObjectList *) obj;

	  // Get filename
	  objectFilename(objEntry, filename);

	  // Open file
	  if (PIOS_FOPEN_READ(filename, file)) {
		    xSemaphoreGiveRecursive(mutex);
		    return -1;
	  }
	  // Load object
	  loadedObj = UAVObjLoadFromFile(&file);
	  if (loadedObj == 0) {
		    PIOS_FCLOSE(file);
		    xSemaphoreGiveRecursive(mutex);
		    return -1;
	  }
	  // Check that the IDs match
	  loadedObjEntry = (ObjectList *) loadedObj;
	  if (loadedObjEntry->id != objEntry->id) {
		    PIOS_FCLOSE(file);
		    xSemaphoreGiveRecursive(mutex);
		    return -1;
	  }
	  // Done, close file and unlock
	  PIOS_FCLOSE(file);
	  xSemaphoreGiveRecursive(mutex);
#endif /* PIOS_INCLUDE_SDCARD */
	  return 0;
}
开发者ID:LeeSaferite,项目名称:OpenPilot,代码行数:76,代码来源:uavobjectmanager.c

示例7: notificationForWrapper

void NotificationPresenterClientQt::sendDisplayEvent(NotificationWrapper* wrapper)
{
    Notification* notification = notificationForWrapper(wrapper);
    if (notification)
        sendEvent(notification, "show");
}
开发者ID:fmalita,项目名称:webkit,代码行数:6,代码来源:NotificationPresenterClientQt.cpp

示例8: LOGV

void MtpServer::sendObjectRemoved(MtpObjectHandle handle) {
    LOGV("sendObjectRemoved %d\n", handle);
    sendEvent(MTP_EVENT_OBJECT_REMOVED, handle);
}
开发者ID:28vicky,项目名称:platform_frameworks_base,代码行数:4,代码来源:MtpServer.cpp

示例9: UAVObjLoadFromFile

/**
 * Load an object from the file system (SD card).
 * @param[in] file File to read from
 * @return The handle of the object loaded or NULL if a failure
 */
UAVObjHandle UAVObjLoadFromFile(FILEINFO * file)
{
#if defined(PIOS_INCLUDE_SDCARD)
	  uint32_t bytesRead;
	  ObjectList *objEntry;
	  ObjectInstList *instEntry;
	  uint32_t objId;
	  uint16_t instId;
	  UAVObjHandle obj;

	  // Check for file system availability
	  if (PIOS_SDCARD_IsMounted() == 0) {
		    return NULL;
	  }
	  // Lock
	  xSemaphoreTakeRecursive(mutex, portMAX_DELAY);

	  // Read the object ID
	  if (PIOS_FREAD(file, &objId, sizeof(objId), &bytesRead)) {
		    xSemaphoreGiveRecursive(mutex);
		    return NULL;
	  }
	  // Get the object
	  obj = UAVObjGetByID(objId);
	  if (obj == 0) {
		    xSemaphoreGiveRecursive(mutex);
		    return NULL;
	  }
	  objEntry = (ObjectList *) obj;

	  // Get the instance ID
	  instId = 0;
	  if (!objEntry->isSingleInstance) {
		    if (PIOS_FREAD
			(file, &instId, sizeof(instId), &bytesRead)) {
			      xSemaphoreGiveRecursive(mutex);
			      return NULL;
		    }
	  }
	  // Get the instance information
	  instEntry = getInstance(objEntry, instId);

	  // If the instance does not exist create it and any other instances before it
	  if (instEntry == NULL) {
		    instEntry = createInstance(objEntry, instId);
		    if (instEntry == NULL) {
			      // Error, unlock and return
			      xSemaphoreGiveRecursive(mutex);
			      return NULL;
		    }
	  }
	  // Read the instance data
	  if (PIOS_FREAD
	      (file, instEntry->data, objEntry->numBytes, &bytesRead)) {
		    xSemaphoreGiveRecursive(mutex);
		    return NULL;
	  }
	  // Fire event
	  sendEvent(objEntry, instId, EV_UNPACKED);

	  // Unlock
	  xSemaphoreGiveRecursive(mutex);
	  return obj;
#else /* PIOS_INCLUDE_SDCARD */
	  return NULL;
#endif
}
开发者ID:LeeSaferite,项目名称:OpenPilot,代码行数:72,代码来源:uavobjectmanager.c

示例10: ignore_but_report_signals


//.........这里部分代码省略.........
						eDebug("wait for driver eof timeout");
#if defined(__sh__) // Fix to ensure that event evtEOF is called at end of playbackl part 2/3
						if (already_empty)
						{
							break;
						}
						else
						{
							already_empty = true;
							continue;
						}
#else
						continue;
#endif
					case 1:
						eDebug("wait for driver eof ok");
						break;
					default:
						eDebug("wait for driver eof aborted by signal");
						/* Check m_stop after interrupted syscall. */
						if (m_stop)
							break;
						continue;
				}
			}

			if (m_stop)
				break;

				/* in stream_mode, we are sending EOF events
				   over and over until somebody responds.

				   in stream_mode, think of evtEOF as "buffer underrun occurred". */
			sendEvent(evtEOF);

			if (m_stream_mode)
			{
				eDebug("reached EOF, but we are in stream mode. delaying 1 second.");
				sleep(1);
				continue;
			}
			else if (++eofcount < 10)
			{
				eDebug("reached EOF, but the file may grow. delaying 1 second.");
				sleep(1);
				continue;
			}
			break;
		} else
		{
			/* Write data to mux */
			int buf_start = 0;
			filterRecordData(m_buffer, buf_end);
			while ((buf_start != buf_end) && !m_stop)
			{
				int w = write(m_fd_dest, m_buffer + buf_start, buf_end - buf_start);

				if (w <= 0)
				{
					/* Check m_stop after interrupted syscall. */
					if (m_stop) {
						w = 0;
						buf_start = 0;
						buf_end = 0;
						break;
					}
开发者ID:Adga52,项目名称:enigma2,代码行数:67,代码来源:filepush.cpp

示例11: while

void ResourceManager::loop()
{
    iMustStopLoop = false;
    
    while( !iMustStopLoop )
    {
        _updateElapsedTime();
        
        UpdateEvent updateEvent(this, iElapsedTime);
        
        // The 'ResourceManager::loop()' function only updates the 'logical' objects. Renderers are updated
        // using the 'Renderer::launch()' function. To draw a RenderTarget, use 'Renderer::registerTarget()' to
        // enable it to drawing.
        
        // This loop only updates every Windows, and every RenderSceneManager.
        
        // First, we update every Windows objects.
        WindowHolderList whlist = iWindowManager->getWindows();
        
        if(whlist.empty() && iCloseBehaviour == CloseBehaviour::AllWindowClosed)
        {
            iMustStopLoop = true;
        }
        
        else
        {
            if( !whlist.empty() )
            {
                for(auto wholder : whlist)
                {
                    if(wholder)
                    {
                        if(wholder->hasBeenClosed())
                        {
                            // Window has been closed, we can destroy it.
                            iWindowManager->remove(wholder->getName());
                        }
                        
                        else
                        {
                            // For now , we have to lock the mutex here to be sure any operations are made
                            // within a valid mutex.
                            
                            wholder->lockGuard();
                            
                            wholder->onEvent(updateEvent);
                            
                            wholder->unlockGuard();
                            
                            iPerWindowBehaviours.call();
                        }
                    }
                }
            }
            
            iLoopBehaviours.call();
        }
        
        // Update also the RenderScene's objects.
        RenderSceneHolderList smhlist = iRenderSceneManager->getAll();
        
        if( !smhlist.empty() )
        {
            for(auto smholder : smhlist)
            {
                if( smholder )
                {
                    smholder->onEvent(updateEvent);
                }
            }
        }
        
        // Finally we send update event to every Listeners.
        sendEvent(updateEvent);
    }
}
开发者ID:luk2010,项目名称:GRE,代码行数:76,代码来源:ResourceManager.cpp

示例12: setIoPrio


//.........这里部分代码省略.........
			}
			if (errno == EINTR || errno == EBUSY || errno == EAGAIN)
				continue;
			if (errno == EOVERFLOW)
			{
				eWarning("OVERFLOW while playback?");
				continue;
			}
			eDebug("eFilePushThread *read error* (%m) - not yet handled");
		}

			/* a read might be mis-aligned in case of a short read. */
		int d = buf_end % m_blocksize;
		if (d)
			buf_end -= d;

		if (buf_end == 0)
		{
				/* on EOF, try COMMITting once. */
			if (m_send_pvr_commit)
			{
				struct pollfd pfd;
				pfd.fd = m_fd_dest;
				pfd.events = POLLIN;
				switch (poll(&pfd, 1, 250)) // wait for 250ms
				{
					case 0:
						eDebug("wait for driver eof timeout");
						continue;
					case 1:
						eDebug("wait for driver eof ok");
						break;
					default:
						eDebug("wait for driver eof aborted by signal");
						/* Check m_stop after interrupted syscall. */
						if (m_stop)
							break;
						continue;
				}
			}

			if (m_stop)
				break;

				/* in stream_mode, we are sending EOF events 
				   over and over until somebody responds.
				   
				   in stream_mode, think of evtEOF as "buffer underrun occurred". */
			sendEvent(evtEOF);

			if (m_stream_mode)
			{
				eDebug("reached EOF, but we are in stream mode. delaying 1 second.");
				sleep(1);
				continue;
			}
			else if (++eofcount < 10)
			{
				eDebug("reached EOF, but the file may grow. delaying 1 second.");
				sleep(1);
				continue;
			}
			break;
		} else
		{
			/* Write data to mux */
			int buf_start = 0;
			filterRecordData(m_buffer, buf_end);
			while ((buf_start != buf_end) && !m_stop)
			{
				int w = write(m_fd_dest, m_buffer + buf_start, buf_end - buf_start);

				if (w <= 0)
				{
					/* Check m_stop after interrupted syscall. */
					if (m_stop) {
						w = 0;
						buf_start = 0;
						buf_end = 0;
						break;
					}
					if (w < 0 && (errno == EINTR || errno == EAGAIN || errno == EBUSY))
						continue;
					eDebug("eFilePushThread WRITE ERROR");
					sendEvent(evtWriteError);
					break;
				}
				buf_start += w;
			}

			eofcount = 0;
			m_current_position += buf_end;
			bytes_read += buf_end;
			if (m_sg)
				current_span_remaining -= buf_end;
		}
	}
	sendEvent(evtStopped);
	eDebug("FILEPUSH THREAD STOP");
}
开发者ID:Ophiuchus1312,项目名称:enigma2-master,代码行数:101,代码来源:filepush.cpp

示例13: printf

void CCombatNPC::update(s32 elapsedTime) {
  
	IAIEntity::update(elapsedTime);
  
	#ifdef NPC_DEBUG
		printf("NPC (%i) Update nodes\n", node->getID());
	#endif

	if (FieldOfView) {      
		FieldOfView->setPosition(Node->getAbsolutePosition());
		FieldOfView->setRotation(Node->getRotation() + FOV_ROTATION);
	}
  
	if (DebugFOV) {
		DebugFOV->updateAbsolutePosition();
		DebugFOV->setPosition(Node->getAbsolutePosition());
		DebugFOV->setRotation(Node->getRotation() + FOV_ROTATION);
	}  
  
	#ifdef NPC_DEBUG
		printf("NPC (%i) check FOV\n", Node->getID());
	#endif
	checkFieldOfVision();

	switch (State) {
		case ENST_WAITING: {
			#ifdef NPC_DEBUG
				printf("NPC (%i) waiting\n", node->getID());
			#endif
			if (StayPut) {// If we want to stay put then keep waiting, whilst scanning the area
				return;
			} else {
				// If we've completed our path we return
				if (PathToDestination.size() == 0 && CurrentWaypoint == PathDestinationWaypoint) {
					sendEvent(ENET_AT_GOAL, NULL);
					changeState(ENST_WAITING);
				} else 
					changeState(ENST_FOLLOWING_PATH); // Keep on going!
			}
			break;    
		}
		case ENST_MOVING: {
			#ifdef NPC_DEBUG
				printf("NPC (%i) moving\n", node->getID());
			#endif
			if (DestinationWaypoint && !(Node->getAbsolutePosition().getDistanceFrom(DestinationWaypoint->getPosition() + NodeOffset) <= AtDestinationThreshold) ) {
				// Not at our destination yet so move a bit closer
				core::vector3df dir = ((DestinationWaypoint->getPosition() + NodeOffset) - Node->getAbsolutePosition()).normalize();
				f32 factor = elapsedTime * MoveSpeed;
				Node->setPosition(Node->getAbsolutePosition() + dir * factor);
				break; 
			} else { // reached destination, wait for what to do next
				//currentWaypoint = destinationWaypoint;
				changeState(ENST_WAITING);
			}
			break;    
		}
		case ENST_FOLLOWING_PATH: {
			#ifdef NPC_DEBUG
				printf("NPC (%i) following path\n", node->getID());
			#endif
			// If we're not at the current waypoint then go there (this can happen when stopping mid-path)
			if (DestinationWaypoint && !(Node->getPosition().getDistanceFrom(DestinationWaypoint->getPosition() + NodeOffset) <= AtDestinationThreshold) ) {
				DestinationWaypoint = CurrentWaypoint;
			} else {
				if (PathToDestination.size() == 0) {
					changeState(ENST_WAITING);
					break;
				}
				// Take the next waypoint in the path (the path is in reverse so we take from the back)
				DestinationWaypoint = PathToDestination[PathToDestination.size()-1];
				// remove the waypoint we've just taken
				PathToDestination.erase(PathToDestination.size()-1); 
			}
       
			if (DestinationWaypoint) {
				// Rotate to face new destination and set running animation
				rotateToFace(DestinationWaypoint->getPosition() + NodeOffset);     
				// Update current waypoint, that being the one we're aiming for.
				CurrentWaypoint = DestinationWaypoint;
				changeState(ENST_MOVING);
			} else changeState(ENST_WAITING);        
      
			break;    
		}     
	}
  
	#ifdef NPC_DEBUG
		printf("NPC (%i) updated\n", Node->getID());
	#endif
   
}
开发者ID:Assyr,项目名称:PlasmaDefence,代码行数:92,代码来源:CCombatNPC.cpp

示例14: sizeof


//.........这里部分代码省略.........

        // Go through devices that have been lost since last run
        
        _deviceHash::iterator itPrev;
        for ( itPrev = deviceHashPrev.begin(); itPrev != deviceHashPrev.end(); ++itPrev ) {

            wxString key = itPrev->first;
            CDetectedDevice *pDev = itPrev->second;
            if ( NULL == pDev ) {
                continue;
            }
            
            if ( false == pDev->m_bfound ) {

                if ( bSendTokenActivity ) {

                    vscpEventEx evx;

                    memset( evx.GUID, 0, 16 );   // Use interface GUID
                    evx.vscp_class = VSCP_CLASS2_LEVEL1_INFORMATION;
                    evx.vscp_type = VSCP_TYPE_INFORMATION_TOKEN_ACTIVITY;
                    evx.timestamp = wxDateTime::Now().GetTicks();
                    evx.head = VSCP_PRIORITY_NORMAL;
                    evx.sizeData = 8;
                    evx.data[ 0 ] = ( 18 << 2 ) + 2;   // Bluetooth device + "Released" 
                    evx.data[ 1 ] = zone;
                    evx.data[ 2 ] = subzone;
                    evx.data[ 3 ] = 0;               // Frame 0
                    evx.data[ 4 ] = pDev->m_address[ 0 ];
                    evx.data[ 5 ] = pDev->m_address[ 1 ];
                    evx.data[ 6 ] = pDev->m_address[ 2 ];
                    evx.data[ 7 ] = pDev->m_address[ 3 ];
   
                    sendEvent( evx ); // Send the event

                    memset( evx.GUID, 0, 16 );   // Use interface GUID
                    evx.vscp_class = VSCP_CLASS2_LEVEL1_INFORMATION;
                    evx.vscp_type = VSCP_TYPE_INFORMATION_TOKEN_ACTIVITY;
                    evx.timestamp = wxDateTime::Now().GetMillisecond();
                    evx.head = VSCP_PRIORITY_NORMAL;
                    evx.sizeData = 6;
                    evx.data[ 0 ] = ( 18 << 2 ) + 2;   // Bluetooth device + "Released" 
                    evx.data[ 1 ] = zone;
                    evx.data[ 2 ] = subzone;
                    evx.data[ 3 ] = 1;               // Frame 1
                    evx.data[ 4 ] = pDev->m_address[ 4 ];
                    evx.data[ 5 ] = pDev->m_address[ 5 ];

                    sendEvent( evx );

                }

                // Remove it
                delete pDev;
                deviceHashPrev[ key ] = NULL;

            }
            else {

                // Prepare for next detection loop
                pDev->m_bfound = false;

            }

        }
开发者ID:ajje,项目名称:vscp,代码行数:66,代码来源:vscpbtdetect.cpp

示例15: nodeName

 void HttpInterface::evVariableOrEvent(HttpRequest* req, strings& args)
 {
     string nodeName(args[0]);
     size_t eventPos;
     
     if ( ! commonDefinitions.events.contains(UTF8ToWString(args[1]), &eventPos))
     {
         // this is a variable
         if (req->method.find("POST") == 0 || args.size() >= 3)
         {
             // set variable value
             strings values;
             if (args.size() >= 3)
                 values.assign(args.begin()+1, args.end());
             else
             {
                 // Parse POST form data
                 values.push_back(args[1]);
                 parse_json_form(req->content, values);
             }
             if (values.size() == 0)
             {
                 finishResponse(req, 404, "");
                 if (verbose)
                     cerr << req << " evVariableOrEevent 404 can't set variable " << args[0] << ", no values" <<  endl;
                 return;
             }
             sendSetVariable(nodeName, values);
             finishResponse(req, 200, "");
             if (verbose)
                 cerr << req << " evVariableOrEevent 200 set variable " << values[0] <<  endl;
         }
         else
         {
             // get variable value
             strings values;
             values.assign(args.begin()+1, args.begin()+2);
             
             unsigned source, start;
             if ( ! getNodeAndVarPos(nodeName, values[0], source, start))
             {
                 finishResponse(req, 404, "");
                 if (verbose)
                     cerr << req << " evVariableOrEevent 404 no such variable " << values[0] <<  endl;
                 return;
             }
             
             sendGetVariables(nodeName, values);
             pendingVariables[std::make_pair(source,start)].insert(req);
             
             if (verbose)
                 cerr << req << " evVariableOrEevent schedule var " << values[0]
                 << "(" << source << "," << start << ") add " << req << " to subscribers" <<  endl;
             return;
         }
     }
     else
     {
         // this is an event
         // arguments are args 1..N
         strings data;
         data.push_back(args[1]);
         if (args.size() >= 3)
             for (size_t i=2; i<args.size(); ++i)
                 data.push_back((args[i].c_str()));
         else if (req->method.find("POST") == 0)
         {
             // Parse POST form data
             parse_json_form(std::string(req->content, req->content.size()), data);
         }
         sendEvent(nodeName, data);
         finishResponse(req, 200, ""); // or perhaps {"return_value":null,"cmd":"sendEvent","name":nodeName}?
         return;
     }
 }
开发者ID:bluemagic-club,项目名称:aseba,代码行数:75,代码来源:http.cpp


注:本文中的sendEvent函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。