Exemplo n.º 1
0
int main(int argc, char *argv[])
{
  AcuRiteDecoder decoder;
  
  read_data(argv[1]);

  // Begin a test pass - load the decoder and start passing it data
  datap = 0;
  while (datap < datacount) {
    curr_millis = datapoints[datap].t * 1000.0; // convert seconds to milliseconds
    unsigned long new_micros = datapoints[datap].t * 1000000.0;
    //printf(" [@ %lu = %d] ", new_micros, datapoints[datap].l);

    unsigned long elapsed_micros = new_micros - curr_micros;
    curr_micros = new_micros;

    if (decoder.nextPulse(elapsed_micros)) {
      byte size;
      const byte* data = decoder.getData(size);

      interpretData(data, size);
      decoder.resetDecoder();
    }

    datap++;
  }

  return 0;
}
Exemplo n.º 2
0
void DataHandler(char * data){
		/* data is the date received from uart.
		 * which has mode etc information encoded onto it.
		 */
	/* first I have to verify whether the data is correct then we have to interpre the data.
	 * step by step token by token.
	 */
	
	

		//call data validator.
		if(validateData(data)){	
			interpretData(data);	
		}
		else{
#ifdef DEBUG		
				printf("Data Validation failed");
#endif
		}






}
Exemplo n.º 3
0
char* abstractSlotRef::interpretForCompiledSender(oop receiver, oop sel,
                                                  oop arg1 ) {
  oop res = interpretData( receiver, sel, arg1 );
  if ( res != badOop ) {
    ReturnResult_stub_result = res;
    return first_inst_addr(ReturnResult_stub);
  } else {
    sneaky_method_argument_to_interpret = contents();
    return first_inst_addr(interpret_from_compiled_sender);
  }
}
Exemplo n.º 4
0
oop abstractSlotRef::interpret( oop receiver, oop sel, oop del,
                                oop* argp, int32 nargs) {
  oop res = interpretData( receiver, sel, *argp );
  if (res != badOop) return res;
  res = ::interpret( receiver,
                     sel,
                     del,
                     contents(),
                     methodHolder_or_map(receiver),
                     argp,
                     nargs);
  return res;
}
void ClientConnection::receiveBody() {
	if (recBuffer.size() == 0)
		recBuffer.resize(recTotal);

	socket.async_receive(buffer(recBuffer.data() + recBytes, (recTotal - recBytes)), [&](boost::system::error_code ec, size_t size) {
		recBytes += size;
		if (recBytes < recTotal)
		{
			receiveBody();
		}
		else
		{
			interpretData();
		}
	});
}
Exemplo n.º 6
0
void USBSerialCom::processSerialPort()
{   
	while(pc.readable())
    {           
        const char c = pc.getc();            
           //pc.f("%i-",c);

        if (incoming_message_type != 0)   //if it is not the first bit of the packet
        { 
       // pc.printf("D%c!",c);
            if (nbr_incom_char < NBR_CHAR_NAV)
            {                           
                if(c >= 47 &&  c < 58) // if the character received is a number                    
                {
                    inputString[nbr_incom_char] = c;                    
                    nbr_incom_char++;
                }
                else if(c == '!')   //if the character received is end of the packet
                {
                    inputString[nbr_incom_char] = c;                    
                    nbr_incom_char++;
                    if(interpretData()){
						// one valid message has been received
						t_timeout_com.reset();
						pc.printf("Dmsg recu_%s!", inputString);
					}
					incoming_message_type = 0;
                }
                else if (c == 45)
                { 
                    sign = true;
                }
                else // character not recognized, we cancel
                {
                    incoming_message_type = 0;
                }                                            
            }
            else //default, packet overwhelmed
            {
                pc.printf("Ddef_o!");
                incoming_message_type = 0;
            }
        }
        else //if it is the first bit of the packet, check if it is a standard message
        {
			switch (c)
			{
				case 'X':
				case 'Y':
				case 'A':
				case 'L':
				case 'R':
				case 'T':
				case 'V':
				case 'S':
				case 'U':
				case 'I':
				case '{':
				case '}':
				case '^':
				case '=':
				case '(':
				case ')':
				case '_':
				case '|':
				{ 
					incoming_message_type = c;

					// reset message data at beginning of message
					nbr_incom_char = 0;
					sign = false;

					break;
				}
				default:
					//Unknown incomming data   
					break;
			}
        }
    }
    
}
Exemplo n.º 7
0
void AcuriteAnalyzer::WorkerThread()
{
  AcuRiteDecoder decoder;
  U32 lastPulse = 0;
  Frame frame; // for saving/printing data
  frame.mFlags = 0;
  frame.mStartingSampleInclusive = 0;

  mResults.reset( new AcuriteAnalyzerResults( this, mSettings.get() ) );
  SetAnalyzerResults( mResults.get() );
  mResults->AddChannelBubblesWillAppearOn( mSettings->mInputChannel );
  
  mSampleRateHz = GetSampleRate();
  log("mSampleRateHz is %lu", mSampleRateHz);
  mSampleRateMs = mSampleRateHz / 1000000;
  log("mSampleRateMs is %lu", mSampleRateMs);
  
  mSerial = GetAnalyzerChannelData( mSettings->mInputChannel );

  log("Looking for start low...");

  // Have to start on a low pulse...
  if( mSerial->GetBitState() == BIT_HIGH )
    mSerial->AdvanceToNextEdge();
  
  while (1) {
    // Find the leading edge
    log("looking for next leading edge");
    mSerial->AdvanceToNextEdge();

    // Determine the time of this pulse
    U64 samplepos = mSerial->GetSampleNumber() / mSampleRateMs;

    if ( (!frame.mStartingSampleInclusive) || 
	 decoder.state == DecodeOOK::UNKNOWN ) {
      frame.mStartingSampleInclusive = mSerial->GetSampleNumber();
      mResults->AddMarker( mSerial->GetSampleNumber(), AnalyzerResults::Dot, mSettings->mInputChannel );
    }

    // Pass the pulse to the decoder
    log("calling decoder.nextPulse(%lu)", (unsigned long)samplepos - lastPulse);
    if (decoder.nextPulse((unsigned long)samplepos - lastPulse)) {
      byte size;

      log("nextPulse is now done");

      const byte *data = decoder.getData(size);
      char output[1024];
      interpretData(data, size, output);
      decoder.resetDecoder();

      // Display the data
      mResults->AddMarker( mSerial->GetSampleNumber(), AnalyzerResults::Dot, mSettings->mInputChannel );
      frame.mEndingSampleInclusive = mSerial->GetSampleNumber();
      frame.mData1 = (U64)output; // fixme - this is fugly.
      mResults->AddFrame( frame );
      mResults->CommitResults();

      ReportProgress( frame.mEndingSampleInclusive );

      // reset frame for next one
      frame.mStartingSampleInclusive = 0;
      
      // make sure we're at a low level when we're done decoding
      if ( mSerial->GetBitState() == BIT_HIGH)
	mSerial->AdvanceToNextEdge();
    }

    log("Decoder state is now %d", decoder.state);
    lastPulse = samplepos;
  }


}
Exemplo n.º 8
0
void MainWindow::initConnections()
{
    connect(m_trace, SIGNAL(startedLoadingTrace()),
            this, SLOT(startedLoadingTrace()));
    connect(m_trace, SIGNAL(loaded(int)),
            this, SLOT(loadProgess(int)));
    connect(m_trace, SIGNAL(finishedLoadingTrace()),
            this, SLOT(finishedLoadingTrace()));
    connect(m_trace, SIGNAL(startedSaving()),
            this, SLOT(slotStartedSaving()));
    connect(m_trace, SIGNAL(saved()),
            this, SLOT(slotSaved()));
    connect(m_trace, SIGNAL(changed(ApiTraceEvent*)),
            this, SLOT(slotTraceChanged(ApiTraceEvent*)));
    connect(m_trace, SIGNAL(findResult(ApiTrace::SearchRequest,ApiTrace::SearchResult,ApiTraceCall*)),
            this, SLOT(slotSearchResult(ApiTrace::SearchRequest,ApiTrace::SearchResult,ApiTraceCall*)));
    connect(m_trace, SIGNAL(foundFrameStart(ApiTraceFrame*)),
            this, SLOT(slotFoundFrameStart(ApiTraceFrame*)));
    connect(m_trace, SIGNAL(foundFrameEnd(ApiTraceFrame*)),
            this, SLOT(slotFoundFrameEnd(ApiTraceFrame*)));
    connect(m_trace, SIGNAL(foundCallIndex(ApiTraceCall*)),
            this, SLOT(slotJumpToResult(ApiTraceCall*)));

    connect(m_retracer, SIGNAL(finished(const QString&)),
            this, SLOT(replayFinished(const QString&)));
    connect(m_retracer, SIGNAL(error(const QString&)),
            this, SLOT(replayError(const QString&)));
    connect(m_retracer, SIGNAL(foundState(ApiTraceState*)),
            this, SLOT(replayStateFound(ApiTraceState*)));
    connect(m_retracer, SIGNAL(foundProfile(trace::Profile*)),
            this, SLOT(replayProfileFound(trace::Profile*)));
    connect(m_retracer, SIGNAL(foundThumbnails(const QList<QImage>&)),
            this, SLOT(replayThumbnailsFound(const QList<QImage>&)));
    connect(m_retracer, SIGNAL(retraceErrors(const QList<ApiTraceError>&)),
            this, SLOT(slotRetraceErrors(const QList<ApiTraceError>&)));

    connect(m_ui.vertexInterpretButton, SIGNAL(clicked()),
            m_vdataInterpreter, SLOT(interpretData()));
    connect(m_ui.vertexTypeCB, SIGNAL(currentIndexChanged(const QString&)),
            m_vdataInterpreter, SLOT(setTypeFromString(const QString&)));
    connect(m_ui.vertexStrideSB, SIGNAL(valueChanged(int)),
            m_vdataInterpreter, SLOT(setStride(int)));
    connect(m_ui.vertexComponentsSB, SIGNAL(valueChanged(int)),
            m_vdataInterpreter, SLOT(setComponents(int)));
    connect(m_ui.startingOffsetSB, SIGNAL(valueChanged(int)),
            m_vdataInterpreter, SLOT(setStartingOffset(int)));


    connect(m_ui.actionNew, SIGNAL(triggered()),
            this, SLOT(createTrace()));
    connect(m_ui.actionOpen, SIGNAL(triggered()),
            this, SLOT(openTrace()));
    connect(m_ui.actionQuit, SIGNAL(triggered()),
            this, SLOT(close()));

    connect(m_ui.actionFind, SIGNAL(triggered()),
            this, SLOT(slotSearch()));
    connect(m_ui.actionGo, SIGNAL(triggered()),
            this, SLOT(slotGoTo()));
    connect(m_ui.actionGoFrameStart, SIGNAL(triggered()),
            this, SLOT(slotGoFrameStart()));
    connect(m_ui.actionGoFrameEnd, SIGNAL(triggered()),
            this, SLOT(slotGoFrameEnd()));

    connect(m_ui.actionReplay, SIGNAL(triggered()),
            this, SLOT(replayStart()));
    connect(m_ui.actionProfile, SIGNAL(triggered()),
            this, SLOT(replayProfile()));
    connect(m_ui.actionStop, SIGNAL(triggered()),
            this, SLOT(replayStop()));
    connect(m_ui.actionLookupState, SIGNAL(triggered()),
            this, SLOT(lookupState()));
    connect(m_ui.actionTrim, SIGNAL(triggered()),
            this, SLOT(trim()));
    connect(m_ui.actionShowThumbnails, SIGNAL(triggered()),
            this, SLOT(showThumbnails()));
    connect(m_ui.actionOptions, SIGNAL(triggered()),
            this, SLOT(showSettings()));

    connect(m_ui.callView->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
            this, SLOT(callItemSelected(const QModelIndex &)));
    connect(m_ui.callView, SIGNAL(doubleClicked(const QModelIndex &)),
            this, SLOT(callItemActivated(const QModelIndex &)));
    connect(m_ui.callView, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(customContextMenuRequested(QPoint)));

    connect(m_ui.surfacesTreeWidget,
            SIGNAL(customContextMenuRequested(const QPoint &)),
            SLOT(showSurfacesMenu(const QPoint &)));
    connect(m_ui.surfacesTreeWidget,
            SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)),
            SLOT(showSelectedSurface()));

    connect(m_ui.detailsWebView, SIGNAL(linkClicked(const QUrl&)),
            this, SLOT(openHelp(const QUrl&)));

    connect(m_ui.nonDefaultsCB, SIGNAL(toggled(bool)),
            this, SLOT(fillState(bool)));

    connect(m_jumpWidget, SIGNAL(jumpTo(int)),
            SLOT(slotJumpTo(int)));

    connect(m_searchWidget,
            SIGNAL(searchNext(const QString&, Qt::CaseSensitivity)),
            SLOT(slotSearchNext(const QString&, Qt::CaseSensitivity)));
    connect(m_searchWidget,
            SIGNAL(searchPrev(const QString&, Qt::CaseSensitivity)),
            SLOT(slotSearchPrev(const QString&, Qt::CaseSensitivity)));

    connect(m_traceProcess, SIGNAL(tracedFile(const QString&)),
            SLOT(createdTrace(const QString&)));
    connect(m_traceProcess, SIGNAL(error(const QString&)),
            SLOT(traceError(const QString&)));

    connect(m_trimProcess, SIGNAL(trimmedFile(const QString&)),
            SLOT(createdTrim(const QString&)));
    connect(m_trimProcess, SIGNAL(error(const QString&)),
            SLOT(trimError(const QString&)));

    connect(m_ui.errorsDock, SIGNAL(visibilityChanged(bool)),
            m_ui.actionShowErrorsDock, SLOT(setChecked(bool)));
    connect(m_ui.actionShowErrorsDock, SIGNAL(triggered(bool)),
            m_ui.errorsDock, SLOT(setVisible(bool)));
    connect(m_ui.errorsTreeWidget,
            SIGNAL(itemActivated(QTreeWidgetItem*, int)),
            this, SLOT(slotErrorSelected(QTreeWidgetItem*)));

    connect(m_ui.actionShowProfileDialog, SIGNAL(triggered(bool)),
            m_profileDialog, SLOT(show()));
    connect(m_profileDialog, SIGNAL(jumpToCall(int)),
            this, SLOT(slotJumpTo(int)));
}