00001 00024 #ifndef PUMA_MOTOR_DRIVER_MESSAGE_H 00025 #define PUMA_MOTOR_DRIVER_MESSAGE_H 00026 00027 #include "puma_motor_driver/can_proto.h" 00028 00029 #include <stdint.h> 00030 00031 00032 namespace puma_motor_driver 00033 { 00034 00035 struct Message 00036 { 00037 uint8_t data[8]; 00038 uint32_t id; 00039 uint8_t len; 00040 00041 explicit Message(uint32_t id = 0) : id(id), len(0) 00042 { 00043 } 00044 00045 uint32_t getDeviceNumber() const 00046 { 00047 return id & CAN_MSGID_DEVNO_M; 00048 } 00049 00050 uint32_t getApi() const 00051 { 00052 return id & (CAN_MSGID_FULL_M ^ CAN_MSGID_DEVNO_M); 00053 } 00054 }; 00055 00056 } // namespace puma_motor_driver 00057 00058 #endif // PUMA_MOTOR_DRIVER_MESSAGE_H