bool gyro_sensor::process_event(void)
{
	sensor_event_t event;

	if (m_sensor_hal->is_data_ready(true) == false)
		return true;

	m_sensor_hal->get_sensor_data(event.data);

	AUTOLOCK(m_client_info_mutex);

	if (get_client_cnt(GYROSCOPE_EVENT_UNPROCESSED_DATA_REPORT_ON_TIME)) {
		event.sensor_id = get_id();
		event.event_type = GYROSCOPE_EVENT_UNPROCESSED_DATA_REPORT_ON_TIME;
		push(event);
	}

	if (get_client_cnt(GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME)) {
		event.sensor_id = get_id();
		event.event_type = GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME;
		raw_to_base(event.data);
		push(event);
	}

	return true;
}
int bio_hrm_phy_sensor::get_sensor_data(unsigned int type, sensor_data_t &data)
{
	int ret;

	if (type != BIO_HRM_BASE_DATA_SET)
		return -1;

	ret = m_sensor_hal->get_sensor_data(data);

	raw_to_base(data);

	if (ret < 0)
		return -1;

	return 0;
}
int gyro_sensor::get_sensor_data(unsigned int type, sensor_data_t &data)
{
	int state;

	if (type != GYRO_BASE_DATA_SET)
		return -1;

	state = m_sensor_hal->get_sensor_data(data);

	if (state < 0) {
		ERR("m_sensor_hal get struct_data fail\n");
		return -1;
	}

	raw_to_base(data);

	return 0;
}
bool bio_hrm_phy_sensor::process_event(void)
{
	sensor_event_t event;

	if (!m_sensor_hal->is_data_ready(true))
		return true;

	m_sensor_hal->get_sensor_data(event.data);

	AUTOLOCK(m_client_info_mutex);

	if (get_client_cnt(BIO_HRM_EVENT_CHANGE_STATE)) {
		event.sensor_id = get_id();
		event.event_type = BIO_HRM_EVENT_CHANGE_STATE;
		raw_to_base(event.data);
		push(event);
	}

	return true;
}
Пример #5
0
void skilladv_test()
{
  INFO_PRINT << "Skill advancement tests:\n";
  test_skilladv( 20, 1 );
  test_skilladv( 512, 25 );
  test_skilladv( 1024, 50 );
  test_skilladv( 2048, 100 );
  test_skilladv( 3072, 150 );
  test_skilladv( 4096, 200 );
  test_skilladv( 5120, 225 );
  test_skilladv( 6144, 250 );
  test_skilladv( 7168, 275 );
  test_skilladv( 8192, 300 );
  test_skilladv( 16384, 400 );
  test_skilladv( 32768, 500 );
  test_skilladv( 65536, 600 );
  test_skilladv( 131072, 700 );
  test_skilladv( 262144, 800 );
  test_skilladv( 524288, 900 );
  test_skilladv( 1048576, 1000 );
  test_skilladv( 2097152, 1100 );
  test_skilladv( 4194304, 1200 );
  test_skilladv( 8388608, 1300 );
  test_skilladv( 16777216, 1400 );
  test_skilladv( 33554432, 1500 );
  test_skilladv( 67108864, 1600 );
  test_skilladv( 134217728, 1700 );
  test_skilladv( 268435456, 1800 );
  test_skilladv( 536870912, 1900 );

  for ( unsigned short base = 0; base < 2000; ++base )
  {
    INFO_PRINT << "Base " << base << ": Raw=";
    unsigned int raw = base_to_raw( base );
    INFO_PRINT << raw << ": ";
    unsigned short calcbase = raw_to_base( raw );
    if ( calcbase != base )
    {
      INFO_PRINT << "Failed (" << calcbase << ")\n";
      Plib::inc_failures( );
    }
    else
    {
      INFO_PRINT << "Passed\n";
      Plib::inc_successes( );
    }
  }

  for ( unsigned int raw = 0; raw < 2500; ++raw )
  {
    INFO_PRINT << "Raw " << raw << ": Base=";
    unsigned short base = raw_to_base( raw );
    INFO_PRINT << base << ": ";
    unsigned int calcraw = base_to_raw( base );
    if ( calcraw != raw )
    {
      INFO_PRINT << "Failed (" << calcraw << ")\n";
      Plib::inc_failures( );
    }
    else
    {
      INFO_PRINT << "Passed\n";
      Plib::inc_successes( );
    }
  }
}