コード例 #1
0
int updateSensorRecordFromSSRAESC(const void *record) {

	sensorRES_t *pRec = (sensorRES_t *) record;
	uint8_t stype;
	int index, i=0;

	stype = find_sensor(pRec->sensor_number);

	// 0xC3 types use the assertion7_0 for the value to be set
	// so skip the reseach and call the correct event reporting
	// function
	if (stype == 0xC3) {

		shouldReport(stype, 0x00, &index);
		reportSensorEventAssert(pRec, index);

	} else {
		// Scroll through each bit position .  Determine
		// if any bit is either asserted or Deasserted.
		for(i=0;i<8;i++) {

			if ((ISBITSET(pRec->assert_state7_0,i))  &&
				(shouldReport(stype, i, &index)))
			{
				reportSensorEventAssert(pRec, index);
			}
			if ((ISBITSET(pRec->assert_state14_8,i))  &&
				(shouldReport(stype, i+8, &index)))
			{
				reportSensorEventAssert(pRec, index);
			}
			if ((ISBITSET(pRec->deassert_state7_0,i))  &&
				(shouldReport(stype, i, &index)))
			{
				reportSensorEventDeassert(pRec, index);
			}
			if ((ISBITSET(pRec->deassert_state14_8,i))  &&
				(shouldReport(stype, i+8, &index)))
			{
				reportSensorEventDeassert(pRec, index);
			}
		}

	}


	return 0;
}
コード例 #2
0
void SmartTestCaseResultCollector::
startTestCaseIfHaveNot(const TestCaseInfoReader* testcase)
{
   if(!shouldReport())
   {
      collector->startTestCase(testcase);
   }
}
コード例 #3
0
ファイル: vrpn_Tracker_ButtonFly.C プロジェクト: bilke/vrpn
void vrpn_Tracker_ButtonFly::mainloop()
{
  int i;
  struct timeval  now;
  double	  interval;	// How long since the last report, in secs

  // Call generic server mainloop, since we are a server
  server_mainloop();

  // Mainloop() all of the buttons that are defined and the analog
  // scale values if they are defined so that we will get all of
  // the values fresh.
  for (i = 0; i < d_num_axes; i++) {
    d_axes[i].btn->mainloop();
  }
  if (d_vel_scale != NULL) { d_vel_scale->mainloop(); };
  if (d_rot_scale != NULL) { d_rot_scale->mainloop(); };

  // See if it has been long enough since our last report.
  // If so, generate a new one.
  vrpn_gettimeofday(&now, NULL);
  interval = duration(now, d_prevtime);

  if (shouldReport(interval)) {
    // Figure out the new matrix based on the current values and
    // the length of the interval since the last report
    update_matrix_based_on_values(interval);
    d_prevtime = now;

    // Set the time on the report to now.
    vrpn_Tracker::timestamp = now;

    // pack and deliver tracker report;
    if (d_connection) {
      char	msgbuf[1000];
      int	len = encode_to(msgbuf);
      if (d_connection->pack_message(len, vrpn_Tracker::timestamp,
	      position_m_id, d_sender_id, msgbuf,
	      vrpn_CONNECTION_LOW_LATENCY)) {
      fprintf(stderr,"Tracker ButtonFly: cannot write message: tossing\n");
      }
    } else {
      fprintf(stderr,"Tracker ButtonFly: No valid connection\n");
    }

  // We're not always sending reports, but we still want to
  // update the matrix so that we don't integrate over
  // too long a timespan when we do finally report a change.
  } else if (interval >= d_update_interval) {
    // Figure out the new matrix based on the current values and
    // the length of the interval since the last report
    update_matrix_based_on_values(interval);
    d_prevtime = now;
  }
}
コード例 #4
0
void
SmartTestCaseResultCollector::
endTestCase
      ( const TestCaseInfoReader *testcase
      , unsigned int secs
      , unsigned int usecs)
{
   if(shouldReport())
   {
      collector->endTestCase(testcase, secs, usecs);
   }
}
コード例 #5
0
ファイル: vrpn_Tracker_AnalogFly.C プロジェクト: vrpn/vrpn
void vrpn_Tracker_AnalogFly::mainloop()
{
  struct timeval	now;
  double	interval;	// How long since the last report, in secs

  // Call generic server mainloop, since we are a server
  server_mainloop();

  // Mainloop() all of the analogs that are defined and the button
  // so that we will get all of the values fresh.
  if (d_x.ana != NULL) { d_x.ana->mainloop(); };
  if (d_y.ana != NULL) { d_y.ana->mainloop(); };
  if (d_z.ana != NULL) { d_z.ana->mainloop(); };
  if (d_sx.ana != NULL) { d_sx.ana->mainloop(); };
  if (d_sy.ana != NULL) { d_sy.ana->mainloop(); };
  if (d_sz.ana != NULL) { d_sz.ana->mainloop(); };
  if (d_reset_button != NULL) { d_reset_button->mainloop(); };
  if (d_clutch_button != NULL) { d_clutch_button->mainloop(); };

  // See if it has been long enough since our last report.
  // If so, generate a new one.
  vrpn_gettimeofday(&now, NULL);
  interval = vrpn_TimevalDurationSeconds(now, d_prevtime);

  if (shouldReport(interval)) {

    // Set the time on the report to now, if not an absolute
    // tracker.  Absolute trackers have their time values set
    // to match the time at which their analog devices gave the
    // last report.
    if (!d_absolute) {
      vrpn_Tracker::timestamp = now;
    }

    // Figure out the new matrix based on the current values and
    // the length of the interval since the last report
    update_matrix_based_on_values(interval);

    // pack and deliver tracker report;
    if (d_connection) {
      char	msgbuf[1000];
      int	len = encode_to(msgbuf);
      if (d_connection->pack_message(len, vrpn_Tracker::timestamp,
	      position_m_id, d_sender_id, msgbuf,
	      vrpn_CONNECTION_LOW_LATENCY)) {
      fprintf(stderr,"Tracker AnalogFly: "
              "cannot write message: tossing\n");
      }
    } else {
      fprintf(stderr,"Tracker AnalogFly: "
              "No valid connection\n");
    }

    // We just sent a report, so reset the time
    d_prevtime = now;
  }

  // We're not always sending reports, but we still want to
  // update the interval clock so that we don't integrate over
  // too long a timespan when we do finally report a change.
  if (interval >= d_update_interval) {
    d_prevtime = now;
  }
}