Android Telematics

Telematics class provides the ability to send commands via telematics. It can be accessed from the HMKit singleton.

Send a command to a device via telematics.

Declaration

public void sendCommand(Bytes command, DeviceSerial serial, CommandCallback callback)

Parameters

command

The command bytes that will be sent to the device

serial

Serial number of the device

callback

A CommandCallback object that is invoked either with the response bytes or an error

Read More

Example

Command command = new Doors.LockUnlockDoors(LockState.UNLOCKED);
HMKit.getInstance().getTelematics().sendCommand(command,
    serial, new Telematics.CommandCallback() {
        @Override
        public void onCommandResponse(Bytes bytes) {
            // Parse response here
            Command command = CommandResolver.resolve(bytes);

            if (command instanceof Doors.State) {
                // Doors state response received
            }
        }

        @Override
        public void onCommandFailed(TelematicsError error) {
            // Error received
        }
    });

Send a command to a device via telematics.

Declaration

public void sendCommand(Bytes command, DeviceSerial serial, ContentType contentType, int version, CommandCallback callback)

Parameters

command

The command bytes that will be sent to the device

serial

Serial number of the device

contentType

The command content type. See ContentType for possible options

version

The command version

callback

A CommandCallback object that is invoked either with the response bytes or an error

Discussion

This function allows customisation of the command type. By defult, the sendCommand should be used.

Read More

Example

Command command = new Doors.LockUnlockDoors(LockState.UNLOCKED);
HMKit.getInstance().getTelematics().sendCommand(command,
    serial, ContentType.AUTO_API, 2, new Telematics.CommandCallback() {
        @Override
        public void onCommandResponse(Bytes bytes) {
            // Parse response here
            Command command = CommandResolver.resolve(bytes);

            if (command instanceof Doors.State) {
                // Doors state response received
            }
        }

        @Override
        public void onCommandFailed(TelematicsError error) {
            // Error received
        }
    });

Command Callback

Declaration

public interface CommandCallback {
    void onCommandResponse(Bytes bytes);
    void onCommandFailed(TelematicsError error);
}

Discussion

CommandCallback is used to notify the user about telematics command result