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

zaber.motion.binary.Message Maven / Gradle / Ivy

Go to download

A library that aims to provide easy-to-use API for communication with Zaber devices using Zaber ASCII Protocol.

There is a newer version: 6.7.0
Show newest version
// ===== THIS FILE IS GENERATED FROM A TEMPLATE ===== //
// ============== DO NOT EDIT DIRECTLY ============== //

package zaber.motion.binary;

import zaber.motion.protobufs.Main;

/**
 * A message in the Binary protocol.
 */
public final class Message {

    private int deviceAddress;

    /**
     * Number of the device that sent or should receive the message.
     */
    public void setDeviceAddress(int deviceAddress) {
        this.deviceAddress = deviceAddress;
    }

    /**
     * @return Number of the device that sent or should receive the message.
     */
    public int getDeviceAddress() {
        return this.deviceAddress;
    }

    private int command;

    /**
     * The warning flag contains the highest priority warning currently active for the device or axis.
     */
    public void setCommand(int command) {
        this.command = command;
    }

    /**
     * @return The warning flag contains the highest priority warning currently active for the device or axis.
     */
    public int getCommand() {
        return this.command;
    }

    private int data;

    /**
     * Data payload of the message, if applicable, or zero otherwise.
     */
    public void setData(int data) {
        this.data = data;
    }

    /**
     * @return Data payload of the message, if applicable, or zero otherwise.
     */
    public int getData() {
        return this.data;
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("Message { ");
        sb.append("deviceAddress: ");
        sb.append(this.deviceAddress);
        sb.append(", ");
        sb.append("command: ");
        sb.append(this.command);
        sb.append(", ");
        sb.append("data: ");
        sb.append(this.data);
        sb.append(" }");
        return sb.toString();
    }

    public static Message fromProtobuf(Main.BinaryMessage pbData) {
        Message obj = new Message();
        obj.setDeviceAddress(pbData.getDeviceAddress());
        obj.setCommand(pbData.getCommand());
        obj.setData(pbData.getData());
        return obj;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy