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

org.ogema.driver.xbee.frames.AbstractXBeeMessage Maven / Gradle / Ivy

The newest version!
/**
 * Copyright 2011-2019 Fraunhofer-Gesellschaft zur Förderung der angewandten Wissenschaften e.V.
 *
 * This file is part of OGEMA.
 *
 *  OGEMA is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License version 3
 *  as published by the Free Software Foundation.
 *
 *  OGEMA is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with OGEMA. If not, see .
 */
package org.ogema.driver.xbee.frames;

import java.nio.ByteBuffer;

public abstract class AbstractXBeeMessage {
	protected ByteBuffer message;

	/**
	 * Use the returned message and the XBeeFrameFactory to generate the frame.
	 * 
	 * @return The message
	 * @see org.ogema.driver.xbee.manager.XBeeFrameFactory
	 */
	public byte[] getMessage() {
		return message.array();
	}

	void setMessage(byte[] message) {
		this.message = ByteBuffer.wrap(message);
	}

	byte getFrameType() {
		return message.array()[0];
	}

	void setFrameType(byte frameType) {
		message.position(0);
		message.put(frameType);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy