00001 /* 00002 * Copyright 2013 Southwest Research Institute 00003 00004 Licensed under the Apache License, Version 2.0 (the "License"); 00005 you may not use this file except in compliance with the License. 00006 You may obtain a copy of the License at 00007 00008 http://www.apache.org/licenses/LICENSE-2.0 00009 00010 Unless required by applicable law or agreed to in writing, software 00011 distributed under the License is distributed on an "AS IS" BASIS, 00012 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 See the License for the specific language governing permissions and 00014 limitations under the License. 00015 */ 00016 00017 #ifndef GRIPPER_MESSAGE_H 00018 #define GRIPPER_MESSAGE_H 00019 00020 #include "simple_message/typed_message.h" 00021 #include "simple_message/simple_message.h" 00022 #include "simple_message/shared_types.h" 00023 00024 00025 namespace mtconnect_cnc_robot_example 00026 { 00027 namespace gripper_message 00028 { 00029 00033 namespace GripperOperationTypes 00034 { 00035 enum GripperOperationType 00036 { 00037 INVALID = 0, 00038 INIT, 00039 OPEN, 00040 CLOSE 00041 }; 00042 } 00043 typedef GripperOperationTypes::GripperOperationType GripperOperationType; 00044 00048 //* GripperMessage 00056 class GripperMessage : public industrial::typed_message::TypedMessage 00057 00058 { 00059 public: 00066 GripperMessage(void); 00071 ~GripperMessage(void); 00079 bool init(industrial::simple_message::SimpleMessage & msg); 00080 00087 void init(GripperOperationType operation); 00088 00093 void init(); 00094 00095 // Overrides - SimpleSerialize 00096 bool load(industrial::byte_array::ByteArray *buffer); 00097 bool unload(industrial::byte_array::ByteArray *buffer); 00098 00099 unsigned int byteLength() 00100 { 00101 return sizeof(industrial::shared_types::shared_int(operation_)); 00102 } 00103 00104 GripperOperationType operation_; 00105 00106 private: 00107 00108 00109 }; 00110 00111 } 00112 } 00113 00114 #endif /* GRIPPER_MESSAGE_H */