本文整理汇总了Java中com.github.pires.obd.enums.ObdProtocols类的典型用法代码示例。如果您正苦于以下问题:Java ObdProtocols类的具体用法?Java ObdProtocols怎么用?Java ObdProtocols使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObdProtocols类属于com.github.pires.obd.enums包,在下文中一共展示了ObdProtocols类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: performCalculations
import com.github.pires.obd.enums.ObdProtocols; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* This method exists so that for each command, there must be a method that is
* called only once to perform calculations.
*/
@Override
protected void performCalculations() {
String result = getResult();
char protocolNumber;
if (result.length() == 2) {//the obdProtocol was set automatic and its format A#
protocolNumber = result.charAt(1);
} else protocolNumber = result.charAt(0);
ObdProtocols[] protocols = ObdProtocols.values();
for (ObdProtocols protocol : protocols) {
if (protocol.getValue() == protocolNumber) {
this.obdProtocol = protocol;
break;
}
}
}
开发者ID:pires,项目名称:obd-java-api,代码行数:22,代码来源:DescribeProtocolNumberCommand.java
示例2: testGetCalculatedResult
import com.github.pires.obd.enums.ObdProtocols; //导入依赖的package包/类
@Test
public void testGetCalculatedResult() throws Exception {
mockIn = createMock(InputStream.class);
mockIn.read();
expectLastCall().andReturn((byte) 'A');
expectLastCall().andReturn((byte) '3');
expectLastCall().andReturn((byte) '>');
expectLastCall().andReturn((byte) '2');
expectLastCall().andReturn((byte) '>');
replayAll();
// call the method to test
command.readResult(mockIn);
assertEquals(command.getCalculatedResult(), ObdProtocols.ISO_9141_2.name());//AUTO ISO_9141_2
// call the method to test
command.readResult(mockIn);
assertEquals(command.getCalculatedResult(), ObdProtocols.SAE_J1850_VPW.name());//SAE_J1850_VPW
verifyAll();
}
开发者ID:pires,项目名称:obd-java-api,代码行数:23,代码来源:DescribeProtocolNumberCommandTest.java
示例3: testGetProtocol
import com.github.pires.obd.enums.ObdProtocols; //导入依赖的package包/类
@Test
public void testGetProtocol() throws Exception {
mockIn = createMock(InputStream.class);
mockIn.read();
expectLastCall().andReturn((byte) 'A');
expectLastCall().andReturn((byte) '6');
expectLastCall().andReturn((byte) '>');
expectLastCall().andReturn((byte) '7');
expectLastCall().andReturn((byte) '>');
replayAll();
// call the method to test
command.readResult(mockIn);
assertEquals(command.getObdProtocol(), ObdProtocols.ISO_15765_4_CAN);//AUTO ISO_15765_4_CAN
// call the method to test
command.readResult(mockIn);
assertEquals(command.getObdProtocol(), ObdProtocols.ISO_15765_4_CAN_B);//ISO_15765_4_CAN_B
verifyAll();
}
开发者ID:pires,项目名称:obd-java-api,代码行数:23,代码来源:DescribeProtocolNumberCommandTest.java
示例4: startService
import com.github.pires.obd.enums.ObdProtocols; //导入依赖的package包/类
public void startService(final String remoteDevice) {
Log.d(TAG, "Starting " + this.getClass().getName() + " service..");
// Let's configure the connection.
Log.d(TAG, "Queing jobs for connection configuration..");
queueJob(new ObdCommandJob(new ObdResetCommand()));
queueJob(new ObdCommandJob(new EchoOffCommand()));
/*
* Will send second-time based on tests.
*
* TODO this can be done w/o having to queue jobs by just issuing
* command.run(), command.getResult() and validate the result.
*/
queueJob(new ObdCommandJob(new EchoOffCommand()));
queueJob(new ObdCommandJob(new LineFeedOffCommand()));
queueJob(new ObdCommandJob(new TimeoutCommand(62)));
// For now set protocol to AUTO
queueJob(new ObdCommandJob(new SelectProtocolCommand(ObdProtocols.AUTO)));
// Job for returning dummy data
queueJob(new ObdCommandJob(new AmbientAirTemperatureCommand()));
queueCounter = 0L;
Log.d(TAG, "Initialization jobs queued.");
isRunning = true;
}
开发者ID:JetBridge-io,项目名称:react-native-obd2,代码行数:30,代码来源:MockObdGatewayService.java
示例5: obdConnectionInit
import com.github.pires.obd.enums.ObdProtocols; //导入依赖的package包/类
private void obdConnectionInit() {
// Let's configure the connection.
log.debug("Queueing jobs for connection configuration..");
// queueJob(new CloseCommand());
// queueJob(new ObdRawCommand("01 00"));
// queueJob(new ObdResetCommand());
//Below is to give the adapter enough time to reset before sending the commands, otherwise the first startup commands could be ignored.
try {
Thread.sleep(4000);
} catch (InterruptedException e) {
e.printStackTrace();
}
queueJob(new EchoOffCommand());
/*
* Will read second-time based on tests.
*
* TODO this can be done w/o having to queue jobs by just issuing
* command.run(), command.getResult() and validate the result.
*/
queueJob(new EchoOffCommand());
queueJob(new LineFeedOffCommand());
// queueJob(new TimeoutCommand(62));
// Get protocol from preferences
final String protocol = sharedPreferences.getString(Config.PROTOCOLS_LIST_KEY, "AUTO");
queueJob(new SelectProtocolCommand(ObdProtocols.valueOf(protocol)));
// Job for returning dummy data
queueJob(new AmbientAirTemperatureCommand());
// Control
// queueJob(new ModuleVoltageCommand());
// queueJob(new EquivalentRatioCommand());
// queueJob(new DistanceMILOnCommand());
// queueJob(new DtcNumberCommand());
// queueJob(new TimingAdvanceCommand());
// queueJob(new TroubleCodesCommand());
queueJob(new VinCommand());
obdCommandsProducer.resetQueueCounter();
log.debug("Initialization jobs queued.");
}
开发者ID:kocur,项目名称:Obd2-Tracker,代码行数:48,代码来源:ObdBluetoothService.java
示例6: ObdReader
import com.github.pires.obd.enums.ObdProtocols; //导入依赖的package包/类
public ObdReader(BluetoothSocket btSocket) {
mBtSocket = btSocket;
hasGotDistanceFuel = false;
setupObdCommands.add(new EchoOffCommand());
setupObdCommands.add(new LineFeedOffCommand());
setupObdCommands.add(new TimeoutCommand(125));
setupObdCommands.add(new SelectProtocolCommand(ObdProtocols.AUTO));
// speed
mObdCommands.add(new SpeedCommand());
mObdCommands.add(new RPMCommand());
// engine
mObdCommands.add(new AbsoluteLoadCommand());
mObdCommands.add(new LoadCommand());
mObdCommands.add(new MassAirFlowCommand());
mObdCommands.add(new OilTempCommand());
mObdCommands.add(new RuntimeCommand());
mObdCommands.add(new ThrottlePositionCommand());
// fuel
mObdCommands.add(new AirFuelRatioCommand());
mObdCommands.add(new ConsumptionRateCommand());
mObdCommands.add(new FindFuelTypeCommand());
mObdCommands.add(new FuelTrimCommand());
mObdCommands.add(new WidebandAirFuelRatioCommand());
// pressure
mObdCommands.add(new BarometricPressureCommand());
mObdCommands.add(new FuelPressureCommand());
mObdCommands.add(new FuelRailPressureCommand());
mObdCommands.add(new IntakeManifoldPressureCommand());
// temperature
mObdCommands.add(new AirIntakeTemperatureCommand());
mObdCommands.add(new AmbientAirTemperatureCommand());
mObdCommands.add(new EngineCoolantTemperatureCommand());
}
开发者ID:Gaso-UFS,项目名称:gaso,代码行数:42,代码来源:ObdReader.java
示例7: SelectProtocolCommand
import com.github.pires.obd.enums.ObdProtocols; //导入依赖的package包/类
/**
* <p>Constructor for SelectProtocolCommand.</p>
*
* @param protocol a {@link com.github.pires.obd.enums.ObdProtocols} object.
*/
public SelectProtocolCommand(final ObdProtocols protocol) {
super("AT SP " + protocol.getValue());
this.protocol = protocol;
}
开发者ID:pires,项目名称:obd-java-api,代码行数:10,代码来源:SelectProtocolCommand.java
示例8: getObdProtocol
import com.github.pires.obd.enums.ObdProtocols; //导入依赖的package包/类
/**
* <p>Getter for the field <code>obdProtocol</code>.</p>
*
* @return a {@link com.github.pires.obd.enums.ObdProtocols} object.
*/
public ObdProtocols getObdProtocol() {
return obdProtocol;
}
开发者ID:pires,项目名称:obd-java-api,代码行数:9,代码来源:DescribeProtocolNumberCommand.java
注:本文中的com.github.pires.obd.enums.ObdProtocols类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论