aboutsummaryrefslogtreecommitdiff
path: root/mavlink-library/src/main/twirl/org/mavlink/Assembler.scala.txt
blob: e3571e6c6b6720a08c909e33f8f5fa61fe3fb96b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
@(__context: Context)@_header(__context)
package org.mavlink

import java.nio.ByteBuffer

/**
 * Utility class for assembling packets with increasing sequence number
 * originating from given system and component IDs.
 */
class Assembler(systemId: Byte, componentId: Byte) {
  private var seq = 0;

  /** Assemble a given message ID and payload into a packet. */
  def assemble(messageId: Byte, payload: ByteBuffer): Packet = {
    val p = Packet(seq.toByte, systemId, componentId, messageId, payload)
    seq += 1
    p
  }	
}