// Auto-generated. Do not edit!

// (in-package kmriiwa_chemist_msgs.msg)


"use strict";

const _serializer = _ros_msg_utils.Serialize;
const _arraySerializer = _serializer.Array;
const _deserializer = _ros_msg_utils.Deserialize;
const _arrayDeserializer = _deserializer.Array;
const _finder = _ros_msg_utils.Find;
const _getByteLength = _ros_msg_utils.getByteLength;

//-----------------------------------------------------------

class TaskUpdate {
  constructor(initObj={}) {
    if (initObj === null) {
      // initObj === null is a special case for deserialization where we don't initialize fields
      this.GO = null;
      this.PAUSE = null;
      this.ABORT = null;
      this.task_update = null;
    }
    else {
      if (initObj.hasOwnProperty('GO')) {
        this.GO = initObj.GO
      }
      else {
        this.GO = 0;
      }
      if (initObj.hasOwnProperty('PAUSE')) {
        this.PAUSE = initObj.PAUSE
      }
      else {
        this.PAUSE = 0;
      }
      if (initObj.hasOwnProperty('ABORT')) {
        this.ABORT = initObj.ABORT
      }
      else {
        this.ABORT = 0;
      }
      if (initObj.hasOwnProperty('task_update')) {
        this.task_update = initObj.task_update
      }
      else {
        this.task_update = 0;
      }
    }
  }

  static serialize(obj, buffer, bufferOffset) {
    // Serializes a message object of type TaskUpdate
    // Serialize message field [GO]
    bufferOffset = _serializer.int32(obj.GO, buffer, bufferOffset);
    // Serialize message field [PAUSE]
    bufferOffset = _serializer.int32(obj.PAUSE, buffer, bufferOffset);
    // Serialize message field [ABORT]
    bufferOffset = _serializer.int32(obj.ABORT, buffer, bufferOffset);
    // Serialize message field [task_update]
    bufferOffset = _serializer.int32(obj.task_update, buffer, bufferOffset);
    return bufferOffset;
  }

  static deserialize(buffer, bufferOffset=[0]) {
    //deserializes a message object of type TaskUpdate
    let len;
    let data = new TaskUpdate(null);
    // Deserialize message field [GO]
    data.GO = _deserializer.int32(buffer, bufferOffset);
    // Deserialize message field [PAUSE]
    data.PAUSE = _deserializer.int32(buffer, bufferOffset);
    // Deserialize message field [ABORT]
    data.ABORT = _deserializer.int32(buffer, bufferOffset);
    // Deserialize message field [task_update]
    data.task_update = _deserializer.int32(buffer, bufferOffset);
    return data;
  }

  static getMessageSize(object) {
    return 16;
  }

  static datatype() {
    // Returns string type for a message object
    return 'kmriiwa_chemist_msgs/TaskUpdate';
  }

  static md5sum() {
    //Returns md5sum for a message object
    return 'c08c1c70045e593cba267795ca4bec4f';
  }

  static messageDefinition() {
    // Returns full string definition for message
    return `
    int32 GO
    int32 PAUSE
    int32 ABORT
    int32 task_update
    `;
  }

  static Resolve(msg) {
    // deep-construct a valid message object instance of whatever was passed in
    if (typeof msg !== 'object' || msg === null) {
      msg = {};
    }
    const resolved = new TaskUpdate(null);
    if (msg.GO !== undefined) {
      resolved.GO = msg.GO;
    }
    else {
      resolved.GO = 0
    }

    if (msg.PAUSE !== undefined) {
      resolved.PAUSE = msg.PAUSE;
    }
    else {
      resolved.PAUSE = 0
    }

    if (msg.ABORT !== undefined) {
      resolved.ABORT = msg.ABORT;
    }
    else {
      resolved.ABORT = 0
    }

    if (msg.task_update !== undefined) {
      resolved.task_update = msg.task_update;
    }
    else {
      resolved.task_update = 0
    }

    return resolved;
    }
};

module.exports = TaskUpdate;
