All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.geotab.model.entity.textmessage.SerialIoxContent Maven / Gradle / Ivy

package com.geotab.model.entity.textmessage;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.geotab.model.serialization.serdes.ByteArrayDeserializer;
import com.geotab.model.serialization.serdes.ByteArraySerializer;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * The contents of a {@link TextMessage} containing data to give to a third-party IOX Add-On over an RS232.
 */
@Getter @Setter
@NoArgsConstructor
public class SerialIoxContent extends DataToComponentContent {

  /**
   * The data to send to the IoxAddon. Up to 249 bytes can be sent.
   */
  @JsonDeserialize(using = ByteArrayDeserializer.class)
  @JsonSerialize(using = ByteArraySerializer.class)
  private Byte[] data;

  /**
   * The channel the IoxAddOn is communicating over. 0 means the Add-On is not attached.
   */
  private int channel;

  public void setChannel(int channel) {
    this.channel = channel;
    this.setDeviceIndex(channel);
  }

  @Builder(builderMethodName = "serialIoxContentBuilder")
  public SerialIoxContent(Byte[] data, int channel) {
    super(MessageContentType.SERIAL_IOX, 0, 0, channel, true);
    this.data = data;
    this.channel = channel;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy