void InputObject::executeProcess() { auto state = static_cast<InputState*>(getState()); while (haveMoreEvents() == true) { auto event = getEvent(); if (dynamic_cast<const ClockEvent*>(event)) { IntVTime currentTime = dynamic_cast<const IntVTime&>(getSimulationTime()); // Send a random signal to all connected components IntVTime recvTime = currentTime + propagationDelay; bool value = distribution(state->generator) == 1; for (auto& it : outputs) { it.first->receiveEvent(new SignalEvent( getSimulationTime(), recvTime, this, it.first, it.second, value )); } // Schedule another clock tick recvTime = currentTime + clockPeriod; receiveEvent(new ClockEvent(getSimulationTime(), recvTime, this, this)); return; } } }
void IPCEventTransport::flush(){ int num_msg = incoming_queue->get_num_msg(); for(int i = 0; i < num_msg - 1; i++){ receiveEvent(); } }
void Testee_receiveMessage(void* self, void* ifitem, const etMessage* msg){ ET_MSC_LOGGER_SYNC_ENTRY("Testee", "_receiveMessage") receiveEvent(self, (etPort*)ifitem, msg->evtID, (void*)(((char*)msg)+MEM_CEIL(sizeof(etMessage)))); ET_MSC_LOGGER_SYNC_EXIT }
void Client::startRead() { //@puts("reading"); char *buffer = (char*)malloc(sizeof(char)*10240); int bytesAvail = client.bytesAvailable(); client.read(buffer, bytesAvail); buffer[bytesAvail] = '\0'; int bytesPushed=0; int *size=(int*)malloc(sizeof(int)); Action *action = (Action*)malloc(sizeof(int)); char *msg; //loop through the available messages while(bytesPushed<bytesAvail){ *size=0; popMetadata(&buffer,action,size,&msg); bytesPushed+=(*size+8); if(bytesPushed<=bytesAvail){ //@printf("Bytes pushed: %i, Bytes available: %i\n",bytesPushed,bytesAvail); if(bytesPushed<bytesAvail){ //@printf("Msg: %s\nData remaining: %s\n\n",msg,buffer); } else { //@printf("Msg: %s\n\n",msg); } switch(*action) { case KEY_EVENT: receiveEvent(stringToEvent(msg)); break; case INSERT_STRING: insertString(msg); break; case REMOVE_STRING: removeString(msg); break; case INITIAL_SEND: initialRead(msg); break; case CURSOR_MOVE: if(moveRemoteCursor(msg)) cursorPositionChanged(); break; default: puts("We don't take your kind here."); break; } } else { puts("Well, that went badly."); } } }
void Btz_i2c::OnReceive(int bytes) { receiveEvent(bytes); }