command-queue


Лицензия

Лицензия

MIT
Группа

Группа

com.high-mobility
Идентификатор

Идентификатор

command-queue
Последняя версия

Последняя версия

1.1.0
Дата

Дата

Тип

Тип

aar
Описание

Описание

command-queue
command-queue
Ссылка на сайт

Ссылка на сайт

https://github.com/highmobility/command-queue-android
Система контроля версий

Система контроля версий

https://github.com/highmobility/command-queue-android

Скачать command-queue

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.high-mobility/command-queue/ -->
<dependency>
    <groupId>com.high-mobility</groupId>
    <artifactId>command-queue</artifactId>
    <version>1.1.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.high-mobility/command-queue/
implementation 'com.high-mobility:command-queue:1.1.0'
// https://jarcasting.com/artifacts/com.high-mobility/command-queue/
implementation ("com.high-mobility:command-queue:1.1.0")
'com.high-mobility:command-queue:aar:1.1.0'
<dependency org="com.high-mobility" name="command-queue" rev="1.1.0">
  <artifact name="command-queue" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.high-mobility', module='command-queue', version='1.1.0')
)
libraryDependencies += "com.high-mobility" % "command-queue" % "1.1.0"
[com.high-mobility/command-queue "1.1.0"]

Зависимости

compile (7)

Идентификатор библиотеки Тип Версия
org.jetbrains.kotlin : kotlin-android-extensions-runtime jar 1.4.10
com.high-mobility : hmkit-android jar 2.0.5
com.high-mobility : hmkit-crypto jar 1.4.6
com.high-mobility : hmkit-utils jar 1.4.5
com.high-mobility : hmkit-auto-api jar 3.12.0
com.google.code.findbugs : jsr305 jar 3.0.2
com.jakewharton.timber : timber jar 4.7.1

Модули Проекта

Данный проект не имеет модулей.

Queue can be used to send multiple commands in a row. It is meant to be used as a layer between HMKit and the app, where all link communication is forwarded to the queue. It returns the response commands or failure indications if the commands fail.

See BleCommandQueue or TelematicsCommandQueue for more info about using the queue.

ConnectedLink link;
BleCommandQueue queue;

void sendCommands() {
  queue = new BleCommandQueue(iQueue);
  // get the VehicleStatus and wait for a response before sending OpenGasFlap.
  queue.queue(new VehicleStatus.GetVehicleStatus(), VehicleStatus.State.class);
  // send OpenGasFlap and only wait for the ack, not the GasFlapState response.
  queue.queue(new Fueling.ControlGasFlap(LockState.LOCKED, Position.CLOSED));
  // send HonkAndFlash straight after the OpenGasFlap ack.
  queue.queue(new HonkHornFlashLights.HonkFlash(3, new Duration(3d, Duration.Unit.SECONDS)));
}

// forward all link communication to the queue.

// MARK: LinkListener

@Override
public void onCommandReceived(Link link, Bytes bytes) {
  queue.onCommandReceived(bytes);
}

@Override
public void onLinkLost(ConnectedLink connectedLink) {
  queue.purge;
}

// MARK: CommandQueue

IBleCommandQueue iQueue = new IBleCommandQueue() {
  @Override public void onCommandAck(Command sentCommand) {
    // An ack was received for a queue command.
  }

  @Override public void onCommandReceived(Command command, Command sentCommand) {
    // One of the queue commands got a response.
  }

  @Override public void onCommandFailed(CommandFailure reason, Command sentCommand) {
    // A command failed. All commands in queue are cancelled.
  }

  @Override public void sendCommand(Command command) {
    // Send a queue command via link 
    link.sendCommand(command, new Link.CommandCallback() {
        @Override public void onCommandSent() {
          queue.onCommandSent(command);
        }

        @Override public void onCommandFailed(LinkError linkError) {
          queue.onCommandFailedToSend(command, linkError);
        }
    });
  }
};
com.high-mobility

HIGH MOBILITY

Версии библиотеки

Версия
1.1.0