• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VehicleSpeed类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



VehicleSpeed类属于com.openxc.measurements包,在下文中一共展示了VehicleSpeed类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onServiceConnected

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
public void onServiceConnected(ComponentName className, IBinder service) {
    Log.i(TAG, "Bound to VehicleManager");
    // When the VehicleManager starts up, we store a reference to it
    // here in "mVehicleManager" so we can call functions on it
    // elsewhere in our code.
    mVehicleManager = ((VehicleManager.VehicleBinder) service)
            .getService();

    // We want to receive updates whenever the EngineSpeed changes. We
    // have an EngineSpeed.Listener (see above, mSpeedListener) and here
    // we request that the VehicleManager call its receive() method
    // whenever the EngineSpeed changes
    mVehicleManager.addListener(EngineSpeed.class, mSpeedListener);
    mVehicleManager.addListener(VehicleSpeed.class, mVehicleSpeedListener);
    //mVehicleManager.addListener(Longitude.class,longitudeListener);
    //mVehicleManager.addListener(Latitude.class,latitudeListener);

    setConnectionState(openXcState, true);


}
 
开发者ID:freeloki,项目名称:FordOpenXCHackathon,代码行数:22,代码来源:MainActivity.java


示例2: testLocationWhenAllPresent

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
@MediumTest
public void testLocationWhenAllPresent() throws InterruptedException {
    prepareServices();
    source.inject(Latitude.ID, latitude);
    source.inject(Longitude.ID, longitude);
    source.inject(VehicleSpeed.ID, speed);
    TestUtils.pause(1000);

    // LocationManager just does *not* seem to work on a 2.3.x emulator
    if(android.os.Build.VERSION.SDK_INT >=
            android.os.Build.VERSION_CODES.HONEYCOMB) {
        Location lastVehicleLocation = mLocationManager.getLastKnownLocation(
                VehicleLocationProvider.VEHICLE_LOCATION_PROVIDER);
        assertThat(lastVehicleLocation, notNullValue());
        assertThat(lastVehicleLocation.getLatitude(), equalTo(latitude));
        assertThat(lastVehicleLocation.getLongitude(), equalTo(longitude));
        assertThat(lastVehicleLocation.getSpeed(), equalTo(speed.floatValue()));
    }
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:20,代码来源:VehicleLocationProviderTest.java


示例3: testOverwritesNativeGps

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
@MediumTest
public void testOverwritesNativeGps() throws InterruptedException {
    prepareServices();
    source.inject(Latitude.ID, latitude);
    source.inject(Longitude.ID, longitude);
    source.inject(VehicleSpeed.ID, speed);
    TestUtils.pause(1000);

    // LocationManager just does *not* seem to work on a 2.3.x emulator
    if(android.os.Build.VERSION.SDK_INT >=
            android.os.Build.VERSION_CODES.HONEYCOMB) {
        Location lastAndroidLocation = mLocationManager.getLastKnownLocation(
                LocationManager.GPS_PROVIDER);
        assertThat(lastAndroidLocation, notNullValue());
        assertThat(lastAndroidLocation.getLatitude(), equalTo(latitude));
        assertThat(lastAndroidLocation.getLongitude(), equalTo(longitude));
        assertThat(lastAndroidLocation.getSpeed(), equalTo(speed.floatValue()));
    }
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:20,代码来源:VehicleLocationProviderTest.java


示例4: setOverwritingStatus

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
/**
 * Enable or disable overwriting Android's native GPS values with those from
 * the vehicle.
 *
 * If enabled, the GPS_PROVIDER from Android will respond with data taken
 * from the vehicle interface. The native GPS values will be used until GPS
 * data is actually received from the vehicle, so if the specific car you're
 * plugged into doesn't have GPS then the values will not be overwritten,
 * regardless of this setting.
 */
public void setOverwritingStatus(boolean enabled) {
    mOverwriteNativeStatus = enabled;
    mNativeGpsOverridden = false;
    if(mLocationManager != null && !enabled) {
        try {
            mLocationManager.removeTestProvider(
                    LocationManager.GPS_PROVIDER);
            Log.d(TAG, "Disabled overwriting native GPS with OpenXC GPS");
        } catch(IllegalArgumentException e) {
            Log.d(TAG, "Unable to remove GPS test provider - " +
                    "probably wasn't added yet");
        }

        mVehicleManager.removeListener(Latitude.class, this);
        mVehicleManager.removeListener(Longitude.class, this);
        mVehicleManager.removeListener(VehicleSpeed.class, this);
    } else {
        Log.d(TAG, "Enabled overwriting native GPS with OpenXC GPS");

        mVehicleManager.addListener(Latitude.class, this);
        mVehicleManager.addListener(Longitude.class, this);
        mVehicleManager.addListener(VehicleSpeed.class, this);
    }
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:35,代码来源:VehicleLocationProvider.java


示例5: receive

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
@Override
public void receive(Measurement measurement) {
    final VehicleSpeed speed = (VehicleSpeed) measurement;
    final float speedy = (float) speed.getValue().doubleValue();
    Log.i(TAG, "Vehicle Speed Simulation: " + speedy);
    mIgniteHandler.setSpeedData(speedy);


    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            mSpeedView.speedTo(speedy, 500);
        }
    });
}
 
开发者ID:freeloki,项目名称:FordOpenXCHackathon,代码行数:16,代码来源:MainActivity.java


示例6: testNotOverwrittenWhenDisabled

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
@MediumTest
public void testNotOverwrittenWhenDisabled() {
    prepareServices();
    locationProvider.setOverwritingStatus(false);
    source.inject(Latitude.ID, latitude + 1);
    source.inject(Longitude.ID, longitude);
    source.inject(VehicleSpeed.ID, speed);
    TestUtils.pause(100);
    Location lastAndroidLocation = mLocationManager.getLastKnownLocation(
            LocationManager.GPS_PROVIDER);
    if(lastAndroidLocation != null) {
        assertTrue(lastAndroidLocation.getLatitude() != latitude + 1);
    }
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:15,代码来源:VehicleLocationProviderTest.java


示例7: testListenForMeasurement

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
@MediumTest
public void testListenForMeasurement() throws VehicleServiceException,
        UnrecognizedMeasurementTypeException {
    prepareServices();
    service.addListener(VehicleSpeed.class, speedListener);
    source.inject(VehicleSpeed.ID, 42.0);
    assertNotNull(speedReceived);
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:9,代码来源:VehicleManagerTest.java


示例8: testCustomSink

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
@MediumTest
public void testCustomSink() throws DataSourceException {
    prepareServices();
    assertNull(receivedMessageId);
    service.addSink(mCustomSink);
    source.inject(VehicleSpeed.ID, 42.0);
    assertNotNull(receivedMessageId);
    service.removeSink(mCustomSink);
    receivedMessageId = null;
    source.inject(VehicleSpeed.ID, 42.0);
    assertNull(receivedMessageId);
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:13,代码来源:VehicleManagerTest.java


示例9: testAddListenersTwoMeasurements

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
@MediumTest
public void testAddListenersTwoMeasurements()
        throws VehicleServiceException,
        UnrecognizedMeasurementTypeException {
    prepareServices();
    service.addListener(VehicleSpeed.class, speedListener);
    service.addListener(SteeringWheelAngle.class, steeringWheelListener);
    source.inject(VehicleSpeed.ID, 42.0);
    source.inject(SteeringWheelAngle.ID, 12.1);
    assertNotNull(steeringAngleReceived);
    assertNotNull(speedReceived);
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:13,代码来源:VehicleManagerTest.java


示例10: testRemoveMeasurementListener

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
@MediumTest
public void testRemoveMeasurementListener() throws VehicleServiceException,
        UnrecognizedMeasurementTypeException {
    prepareServices();
    service.addListener(VehicleSpeed.class, speedListener);
    source.inject(VehicleSpeed.ID, 42.0);
    service.removeListener(VehicleSpeed.class, speedListener);
    speedReceived = null;
    source.inject(VehicleSpeed.ID, 42.0);
    TestUtils.pause(10);
    assertNull(speedReceived);
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:13,代码来源:VehicleManagerTest.java


示例11: testRemoveWithoutListening

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
@MediumTest
public void testRemoveWithoutListening()
        throws VehicleServiceException,
        UnrecognizedMeasurementTypeException {
    prepareServices();
    service.removeListener(VehicleSpeed.class, speedListener);
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:8,代码来源:VehicleManagerTest.java


示例12: testRemoveOneMeasurementListener

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
@MediumTest
public void testRemoveOneMeasurementListener()
        throws VehicleServiceException,
        UnrecognizedMeasurementTypeException {
    prepareServices();
    service.addListener(VehicleSpeed.class, speedListener);
    service.addListener(SteeringWheelAngle.class, steeringWheelListener);
    source.inject(VehicleSpeed.ID, 42.0);
    service.removeListener(VehicleSpeed.class, speedListener);
    speedReceived = null;
    source.inject(VehicleSpeed.ID, 42.0);
    TestUtils.pause(10);
    assertNull(speedReceived);
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:15,代码来源:VehicleManagerTest.java


示例13: testConsistentAge

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
@MediumTest
public void testConsistentAge()
        throws UnrecognizedMeasurementTypeException,
        NoValueException, VehicleServiceException, DataSourceException {
    prepareServices();
    source.inject(VehicleSpeed.ID, 42.0);
    TestUtils.pause(1);
    Measurement measurement = service.get(VehicleSpeed.class);
    long age = measurement.getAge();
    assertTrue("Measurement age (" + age + ") should be > 5ms",
            age > 5);
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:13,代码来源:VehicleManagerTest.java


示例14: testGetMeasurement

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
@MediumTest
public void testGetMeasurement() throws UnrecognizedMeasurementTypeException,
        NoValueException {
    prepareServices();
    source.inject(VehicleSpeed.ID, 42.0);
    VehicleSpeed measurement = (VehicleSpeed)
            service.get(VehicleSpeed.class);
    assertNotNull(measurement);
    assertEquals(measurement.getValue().doubleValue(), 42.0);
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:11,代码来源:VehicleManagerTest.java


示例15: stop

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
public void stop() {
    if(mVehicleManager != null) {
        mVehicleManager.removeListener(Latitude.class, this);
        mVehicleManager.removeListener(Longitude.class, this);
        mVehicleManager.removeListener(VehicleSpeed.class, this);
    }

    if(mLocationManager != null && mLocationManager.getProvider(
                VEHICLE_LOCATION_PROVIDER) != null) {
        mLocationManager.removeTestProvider(VEHICLE_LOCATION_PROVIDER);
    }
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:13,代码来源:VehicleLocationProvider.java


示例16: receive

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
@Override
public void receive(Measurement measurement) {
    if(measurement instanceof Latitude || measurement instanceof Longitude
            || measurement instanceof VehicleSpeed) {
        // To keep down the number of times we touch the Android location
        // system to update the location, only update if we have a change in
        // the measurements we use.
        updateLocation();
    }
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:11,代码来源:VehicleLocationProvider.java


示例17: receiveNonMatchingMeasurementNotPropagated

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
@Test
public void receiveNonMatchingMeasurementNotPropagated() throws
        DataSinkException, UnrecognizedMeasurementTypeException {
    VehicleSpeed speed = new VehicleSpeed(42.0);
    sink.register(speed.getClass(), speedListener);
    SteeringWheelAngle angle = new SteeringWheelAngle(10.1);
    sink.receive(angle.toVehicleMessage());
    sink.clearQueue();
    assertThat(speedReceived, nullValue());
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:11,代码来源:MessageListenerSinkTest.java


示例18: listenerReceivesMeasurement

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
@Test
public void listenerReceivesMeasurement() throws DataSinkException,
       UnrecognizedMeasurementTypeException {
    VehicleSpeed speed = new VehicleSpeed(42.0);
    sink.register(speed.getClass(), speedListener);
    sink.receive(speed.toVehicleMessage());
    sink.clearQueue();
    assertThat(speedReceived, notNullValue());
    assertEquals(speedReceived, speed);
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:11,代码来源:MessageListenerSinkTest.java


示例19: removeMeasurementListenerByClass

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
@Test
public void removeMeasurementListenerByClass()
        throws UnrecognizedMeasurementTypeException, DataSinkException {
    VehicleSpeed speed = new VehicleSpeed(42.0);
    sink.register(speed.getClass(), speedListener);
    sink.unregister(speed.getClass(), speedListener);
    sink.receive(speed.toVehicleMessage());
    sink.clearQueue();
    assertThat(speedReceived, nullValue());
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:11,代码来源:MessageListenerSinkTest.java


示例20: removeMeasurementListener

import com.openxc.measurements.VehicleSpeed; //导入依赖的package包/类
@Test
public void removeMeasurementListener()
        throws UnrecognizedMeasurementTypeException, DataSinkException {
    VehicleSpeed speed = new VehicleSpeed(42.0);
    sink.register(speed.getClass(), speedListener);
    sink.unregister(speed.getClass(), speedListener);
    sink.receive(speed.toVehicleMessage());
    sink.clearQueue();
    assertThat(speedReceived, nullValue());
}
 
开发者ID:bibhrajit,项目名称:openxc-androidStudio,代码行数:11,代码来源:MessageListenerSinkTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DeclareOk类代码示例发布时间:2022-05-23
下一篇:
Java IntKeyIntValueHashMap类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap