2014-05-15 11:44:28 -06:00
|
|
|
/*
|
|
|
|
* CurrentState.cpp
|
|
|
|
*
|
|
|
|
* Created on: 15 maj 2014
|
|
|
|
* Author: MattLech
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "CurrentState.h"
|
|
|
|
|
|
|
|
static CurrentState* instance;
|
2014-05-28 17:02:22 -06:00
|
|
|
unsigned int x = 0;
|
|
|
|
unsigned int y = 0;
|
|
|
|
unsigned int z = 0;
|
|
|
|
unsigned int speed = 0;
|
2014-05-15 11:44:28 -06:00
|
|
|
|
|
|
|
CurrentState * CurrentState::getInstance() {
|
|
|
|
if (!instance) {
|
|
|
|
instance = new CurrentState();
|
|
|
|
};
|
|
|
|
return instance;
|
|
|
|
};
|
|
|
|
|
|
|
|
CurrentState::CurrentState() {
|
2014-05-28 17:02:22 -06:00
|
|
|
x = 0;
|
|
|
|
y = 0;
|
|
|
|
z = 0;
|
|
|
|
speed = 0;
|
2014-05-15 11:44:28 -06:00
|
|
|
}
|
|
|
|
|
2014-05-25 17:20:00 -06:00
|
|
|
unsigned int CurrentState::getX() {
|
2014-05-15 11:44:28 -06:00
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
2014-05-25 17:20:00 -06:00
|
|
|
unsigned int CurrentState::getY() {
|
2014-05-15 11:44:28 -06:00
|
|
|
return y;
|
|
|
|
}
|
|
|
|
|
2014-05-25 17:20:00 -06:00
|
|
|
unsigned int CurrentState::getZ() {
|
2014-05-15 11:44:28 -06:00
|
|
|
return z;
|
|
|
|
}
|
|
|
|
|
2014-05-25 17:20:00 -06:00
|
|
|
unsigned int* CurrentState::getPoint() {
|
|
|
|
unsigned int currentPoint[3] = {x, y, z};
|
|
|
|
return currentPoint;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CurrentState::setX(unsigned int newX) {
|
2014-05-15 15:46:47 -06:00
|
|
|
x = newX;
|
|
|
|
}
|
|
|
|
|
2014-05-25 17:20:00 -06:00
|
|
|
void CurrentState::setY(unsigned int newY) {
|
2014-05-15 15:46:47 -06:00
|
|
|
y = newY;
|
|
|
|
}
|
|
|
|
|
2014-05-25 17:20:00 -06:00
|
|
|
void CurrentState::setZ(unsigned int newZ) {
|
2014-05-15 15:46:47 -06:00
|
|
|
z = newZ;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CurrentState::print() {
|
|
|
|
Serial.println("Current state");
|
|
|
|
Serial.print("X:");
|
|
|
|
Serial.print(x);
|
|
|
|
Serial.print(", Y:");
|
|
|
|
Serial.print(y);
|
|
|
|
Serial.print(", Z:");
|
|
|
|
Serial.println(z);
|
2014-05-28 17:02:22 -06:00
|
|
|
Serial.print(", speed:");
|
|
|
|
Serial.println(speed);
|
2014-05-15 15:46:47 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|