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

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

/*
 *
 * 2020 Copyright (C) Geotab Inc. All rights reserved.
 */

package com.geotab.model.entity.textmessage;

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

/**
 * The contents of a {@link TextMessage} containing data to give to a third-party IOX Add-On over an
 * RS232.
 */
@NoArgsConstructor
@Getter
@Setter
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
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