Wyatt  1.0.1
EncoderMessage.cpp
1 //
2 // Created by Tucker Haydon on 4/25/17.
3 //
4 
5 #include "messages/EncoderMessage.h"
6 
7 EncoderMessage::EncoderMessage(Hardware hardware, double data) : IMessage(hardware) {
8  this->data = data;
9 
10  if((int)(hardware.messageLength) != sizeof(double)) {
11  throw MessageLengthException(hardware);
12  }
13 }
14 
16  // Nothing.
17 }
18 
20  return this->data;
21 }
22 
24  std::string serial;
25  serial.append(1, hardware.address);
26  serial.append((char*)(&(this->data)), sizeof(double));
27  return serial;
28 }
29 
30 
EncoderMessage(Hardware hardware, double data)
std::string serialize() override
Hardware hardware
Definition: IMessage.h:45
~EncoderMessage() override