ReliableDataTransferProtocolHandler

class ReliableDataTransferProtocolHandler(    var maximumTransferUnitSizeInBytes: Int = BleConnectivityProtocolDefinitions.defaultMaximumTransferUnitSizeInBytes,     windowSizeInNumberOfPackets: Int = 8,     coroutineScope: CoroutineScope = MainScope())

Implements a reliable data transfer protocol based on automatic repeat requests (ARQ).

It maintains a transfer window of the specified windowSizeInNumberOfPackets packets. Data that is bigger than the specified maximumTransferUnitSizeInBytes will be split up in multiple packets.

Input and output are done using Channels. A channel is either reliable or unreliable and either input or output.

Reliable input generally originates from the application and reliable output generally goes to the application. Unreliable output and input can be send over an unreliable link. Here we define unreliable as being accurate but not necessarily complete.

| Application |---- Reliable Input ---> | Protocol Handler | --- Unreliable Output --> | Link | | | | | | Layer | || <--- Reliable Output ---|| <--- Unreliable Input ----|___|

Note It is assumed that the unreliable channel generally sends packets in order.

Constructors

Link copied to clipboard
fun ReliableDataTransferProtocolHandler(    maximumTransferUnitSizeInBytes: Int = BleConnectivityProtocolDefinitions.defaultMaximumTransferUnitSizeInBytes,     windowSizeInNumberOfPackets: Int = 8,     coroutineScope: CoroutineScope = MainScope())

Properties

Link copied to clipboard
var maximumTransferUnitSizeInBytes: Int
Link copied to clipboard
val reliableInputChannel: SendChannel<ByteArray>

Application data that is to be send should be send to this channel.

Link copied to clipboard
val reliableOutputChannel: ReceiveChannel<ByteArray>

The output of the reliable data.

Link copied to clipboard
val unreliableInputChannel: SendChannel<ByteArray>

Packets read from an unreliable link should be sent to this channel.

Link copied to clipboard
val unreliableOutputChannel: ReceiveChannel<ByteArray>

This will output packets that should be send over the unreliable link.

Functions

Link copied to clipboard
fun onDestroy()