lightbulb_outline Please take our October 2018 developer survey. Start survey

LowpanDriver

public abstract class LowpanDriver
extends Object

java.lang.Object
   ↳ com.google.android.things.userdriver.lowpan.LowpanDriver


Driver to implement LoWPAN device.

User defined drivers should extend this class.

The frame format used for this class is draft-rquattle-spinel-unified-00, available here: https://tools.ietf.org/html/draft-rquattle-spinel-unified-00

Summary

Constants

int ERROR_GARBAGE

Garbage-received error code.

int ERROR_IOFAIL

Input/Output-failure error code.

int ERROR_TOOBIG

Frame-too-big error code.

Public constructors

LowpanDriver()

Public methods

abstract void reset()

Physically resets the NCP.

abstract void sendFrame(byte[] frame)

Sends Spinel frames to the NCP.

abstract void start(LowpanDriverCallback callback)

Starts the LoWPAN driver and makes it ready for use.

abstract void stop()

Stops the LoWPAN driver, optionally putting it in a low-power state.

Inherited methods

From class java.lang.Object

Constants

ERROR_GARBAGE

int ERROR_GARBAGE

Garbage-received error code.

This error code is emitted via onError(int) in response to the receipt of an invalid frame from the NCP which could not be recovered. For example, the frame may be invalid due to a bad CRC or because it was too long. This error is informative for the upper layers and not fatal.

See also:

Constant Value: 5 (0x00000005)

ERROR_IOFAIL

int ERROR_IOFAIL

Input/Output-failure error code.

This error code is emitted via onError(int) in response to any sort of non-recoverable I/O failure, and may be emitted at any time. Once this error is emitted, the driver is considered stopped: a call to start(LowpanDriverCallback) is required to begin using the interface again.

Constant Value: 4 (0x00000004)

ERROR_TOOBIG

int ERROR_TOOBIG

Frame-too-big error code.

This error code is emitted via onError(int) in response to @{link #sendFrame(byte[])} being called with an argument which is too large.

Constant Value: 3 (0x00000003)

Public constructors

LowpanDriver

LowpanDriver ()

Public methods

reset

void reset ()

Physically resets the NCP. Implemented by the driver.

sendFrame

void sendFrame (byte[] frame)

Sends Spinel frames to the NCP. Implemented by the driver.

Parameters
frame byte: Frame received from NCP.

start

void start (LowpanDriverCallback callback)

Starts the LoWPAN driver and makes it ready for use.

Implemented by the driver. onStarted() MUST be called at some point during or after this method is called.

The driver can signal a failure to start by calling onError(int) on callback instead of onStarted().

Parameters
callback LowpanDriverCallback

stop

void stop ()

Stops the LoWPAN driver, optionally putting it in a low-power state.

Implemented by the driver. May be restarted by calling start(LowpanDriverCallback).