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

/**
 * 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: Array[Byte]): Packet = {
    val p = Packet(seq.toByte, systemId, componentId, messageId, payload)
    seq += 1
    p
  }
}