Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef FLATHEADERS
00032 #include "simple_message/messages/joint_feedback_message.h"
00033 #include "simple_message/joint_data.h"
00034 #include "simple_message/byte_array.h"
00035 #include "simple_message/log_wrapper.h"
00036 #else
00037 #include "joint_feedback_message.h"
00038 #include "joint_data.h"
00039 #include "byte_array.h"
00040 #include "log_wrapper.h"
00041 #endif
00042
00043 using namespace industrial::shared_types;
00044 using namespace industrial::byte_array;
00045 using namespace industrial::simple_message;
00046 using namespace industrial::joint_feedback;
00047
00048 namespace industrial
00049 {
00050 namespace joint_feedback_message
00051 {
00052
00053 JointFeedbackMessage::JointFeedbackMessage(void)
00054 {
00055 this->init();
00056 }
00057
00058 JointFeedbackMessage::~JointFeedbackMessage(void)
00059 {
00060
00061 }
00062
00063 bool JointFeedbackMessage::init(industrial::simple_message::SimpleMessage & msg)
00064 {
00065 bool rtn = false;
00066 ByteArray data = msg.getData();
00067 this->init();
00068
00069 if (data.unload(this->data_))
00070 {
00071 rtn = true;
00072 }
00073 else
00074 {
00075 LOG_ERROR("Failed to unload joint feedback message data");
00076 }
00077 return rtn;
00078 }
00079
00080 void JointFeedbackMessage::init(industrial::joint_feedback::JointFeedback & data)
00081 {
00082 this->init();
00083 this->data_.copyFrom(data);
00084 }
00085
00086 void JointFeedbackMessage::init()
00087 {
00088 this->setMessageType(StandardMsgTypes::JOINT_FEEDBACK);
00089 this->data_.init();
00090 }
00091
00092 bool JointFeedbackMessage::load(ByteArray *buffer)
00093 {
00094 bool rtn = false;
00095 LOG_COMM("Executing joint feedback message load");
00096 if (buffer->load(this->data_))
00097 {
00098 rtn = true;
00099 }
00100 else
00101 {
00102 rtn = false;
00103 LOG_ERROR("Failed to load joint feedback message data");
00104 }
00105 return rtn;
00106 }
00107
00108 bool JointFeedbackMessage::unload(ByteArray *buffer)
00109 {
00110 bool rtn = false;
00111 LOG_COMM("Executing joint feedback message unload");
00112
00113 if (buffer->unload(this->data_))
00114 {
00115 rtn = true;
00116 }
00117 else
00118 {
00119 rtn = false;
00120 LOG_ERROR("Failed to unload joint feedback message data");
00121 }
00122 return rtn;
00123 }
00124
00125 }
00126 }
00127