org.ogema.driver.xbee.frames.AbstractXBeeMessage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xbee Show documentation
Show all versions of xbee Show documentation
Low-level xbee device driver
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);
}
}