Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ros_lib/mavros_msgs/FileRemove.h@0:8f3710bfd298, 2020-09-02 (annotated)
- Committer:
- irfantitok
- Date:
- Wed Sep 02 13:51:31 2020 +0000
- Revision:
- 0:8f3710bfd298
Resolved round not found
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
irfantitok | 0:8f3710bfd298 | 1 | #ifndef _ROS_SERVICE_FileRemove_h |
irfantitok | 0:8f3710bfd298 | 2 | #define _ROS_SERVICE_FileRemove_h |
irfantitok | 0:8f3710bfd298 | 3 | #include <stdint.h> |
irfantitok | 0:8f3710bfd298 | 4 | #include <string.h> |
irfantitok | 0:8f3710bfd298 | 5 | #include <stdlib.h> |
irfantitok | 0:8f3710bfd298 | 6 | #include "ros/msg.h" |
irfantitok | 0:8f3710bfd298 | 7 | |
irfantitok | 0:8f3710bfd298 | 8 | namespace mavros_msgs |
irfantitok | 0:8f3710bfd298 | 9 | { |
irfantitok | 0:8f3710bfd298 | 10 | |
irfantitok | 0:8f3710bfd298 | 11 | static const char FILEREMOVE[] = "mavros_msgs/FileRemove"; |
irfantitok | 0:8f3710bfd298 | 12 | |
irfantitok | 0:8f3710bfd298 | 13 | class FileRemoveRequest : public ros::Msg |
irfantitok | 0:8f3710bfd298 | 14 | { |
irfantitok | 0:8f3710bfd298 | 15 | public: |
irfantitok | 0:8f3710bfd298 | 16 | typedef const char* _file_path_type; |
irfantitok | 0:8f3710bfd298 | 17 | _file_path_type file_path; |
irfantitok | 0:8f3710bfd298 | 18 | |
irfantitok | 0:8f3710bfd298 | 19 | FileRemoveRequest(): |
irfantitok | 0:8f3710bfd298 | 20 | file_path("") |
irfantitok | 0:8f3710bfd298 | 21 | { |
irfantitok | 0:8f3710bfd298 | 22 | } |
irfantitok | 0:8f3710bfd298 | 23 | |
irfantitok | 0:8f3710bfd298 | 24 | virtual int serialize(unsigned char *outbuffer) const |
irfantitok | 0:8f3710bfd298 | 25 | { |
irfantitok | 0:8f3710bfd298 | 26 | int offset = 0; |
irfantitok | 0:8f3710bfd298 | 27 | uint32_t length_file_path = strlen(this->file_path); |
irfantitok | 0:8f3710bfd298 | 28 | varToArr(outbuffer + offset, length_file_path); |
irfantitok | 0:8f3710bfd298 | 29 | offset += 4; |
irfantitok | 0:8f3710bfd298 | 30 | memcpy(outbuffer + offset, this->file_path, length_file_path); |
irfantitok | 0:8f3710bfd298 | 31 | offset += length_file_path; |
irfantitok | 0:8f3710bfd298 | 32 | return offset; |
irfantitok | 0:8f3710bfd298 | 33 | } |
irfantitok | 0:8f3710bfd298 | 34 | |
irfantitok | 0:8f3710bfd298 | 35 | virtual int deserialize(unsigned char *inbuffer) |
irfantitok | 0:8f3710bfd298 | 36 | { |
irfantitok | 0:8f3710bfd298 | 37 | int offset = 0; |
irfantitok | 0:8f3710bfd298 | 38 | uint32_t length_file_path; |
irfantitok | 0:8f3710bfd298 | 39 | arrToVar(length_file_path, (inbuffer + offset)); |
irfantitok | 0:8f3710bfd298 | 40 | offset += 4; |
irfantitok | 0:8f3710bfd298 | 41 | for(unsigned int k= offset; k< offset+length_file_path; ++k){ |
irfantitok | 0:8f3710bfd298 | 42 | inbuffer[k-1]=inbuffer[k]; |
irfantitok | 0:8f3710bfd298 | 43 | } |
irfantitok | 0:8f3710bfd298 | 44 | inbuffer[offset+length_file_path-1]=0; |
irfantitok | 0:8f3710bfd298 | 45 | this->file_path = (char *)(inbuffer + offset-1); |
irfantitok | 0:8f3710bfd298 | 46 | offset += length_file_path; |
irfantitok | 0:8f3710bfd298 | 47 | return offset; |
irfantitok | 0:8f3710bfd298 | 48 | } |
irfantitok | 0:8f3710bfd298 | 49 | |
irfantitok | 0:8f3710bfd298 | 50 | const char * getType(){ return FILEREMOVE; }; |
irfantitok | 0:8f3710bfd298 | 51 | const char * getMD5(){ return "a1f82596372c52a517e1fe32d1e998e8"; }; |
irfantitok | 0:8f3710bfd298 | 52 | |
irfantitok | 0:8f3710bfd298 | 53 | }; |
irfantitok | 0:8f3710bfd298 | 54 | |
irfantitok | 0:8f3710bfd298 | 55 | class FileRemoveResponse : public ros::Msg |
irfantitok | 0:8f3710bfd298 | 56 | { |
irfantitok | 0:8f3710bfd298 | 57 | public: |
irfantitok | 0:8f3710bfd298 | 58 | typedef bool _success_type; |
irfantitok | 0:8f3710bfd298 | 59 | _success_type success; |
irfantitok | 0:8f3710bfd298 | 60 | typedef int32_t _r_errno_type; |
irfantitok | 0:8f3710bfd298 | 61 | _r_errno_type r_errno; |
irfantitok | 0:8f3710bfd298 | 62 | |
irfantitok | 0:8f3710bfd298 | 63 | FileRemoveResponse(): |
irfantitok | 0:8f3710bfd298 | 64 | success(0), |
irfantitok | 0:8f3710bfd298 | 65 | r_errno(0) |
irfantitok | 0:8f3710bfd298 | 66 | { |
irfantitok | 0:8f3710bfd298 | 67 | } |
irfantitok | 0:8f3710bfd298 | 68 | |
irfantitok | 0:8f3710bfd298 | 69 | virtual int serialize(unsigned char *outbuffer) const |
irfantitok | 0:8f3710bfd298 | 70 | { |
irfantitok | 0:8f3710bfd298 | 71 | int offset = 0; |
irfantitok | 0:8f3710bfd298 | 72 | union { |
irfantitok | 0:8f3710bfd298 | 73 | bool real; |
irfantitok | 0:8f3710bfd298 | 74 | uint8_t base; |
irfantitok | 0:8f3710bfd298 | 75 | } u_success; |
irfantitok | 0:8f3710bfd298 | 76 | u_success.real = this->success; |
irfantitok | 0:8f3710bfd298 | 77 | *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 78 | offset += sizeof(this->success); |
irfantitok | 0:8f3710bfd298 | 79 | union { |
irfantitok | 0:8f3710bfd298 | 80 | int32_t real; |
irfantitok | 0:8f3710bfd298 | 81 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 82 | } u_r_errno; |
irfantitok | 0:8f3710bfd298 | 83 | u_r_errno.real = this->r_errno; |
irfantitok | 0:8f3710bfd298 | 84 | *(outbuffer + offset + 0) = (u_r_errno.base >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 85 | *(outbuffer + offset + 1) = (u_r_errno.base >> (8 * 1)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 86 | *(outbuffer + offset + 2) = (u_r_errno.base >> (8 * 2)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 87 | *(outbuffer + offset + 3) = (u_r_errno.base >> (8 * 3)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 88 | offset += sizeof(this->r_errno); |
irfantitok | 0:8f3710bfd298 | 89 | return offset; |
irfantitok | 0:8f3710bfd298 | 90 | } |
irfantitok | 0:8f3710bfd298 | 91 | |
irfantitok | 0:8f3710bfd298 | 92 | virtual int deserialize(unsigned char *inbuffer) |
irfantitok | 0:8f3710bfd298 | 93 | { |
irfantitok | 0:8f3710bfd298 | 94 | int offset = 0; |
irfantitok | 0:8f3710bfd298 | 95 | union { |
irfantitok | 0:8f3710bfd298 | 96 | bool real; |
irfantitok | 0:8f3710bfd298 | 97 | uint8_t base; |
irfantitok | 0:8f3710bfd298 | 98 | } u_success; |
irfantitok | 0:8f3710bfd298 | 99 | u_success.base = 0; |
irfantitok | 0:8f3710bfd298 | 100 | u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
irfantitok | 0:8f3710bfd298 | 101 | this->success = u_success.real; |
irfantitok | 0:8f3710bfd298 | 102 | offset += sizeof(this->success); |
irfantitok | 0:8f3710bfd298 | 103 | union { |
irfantitok | 0:8f3710bfd298 | 104 | int32_t real; |
irfantitok | 0:8f3710bfd298 | 105 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 106 | } u_r_errno; |
irfantitok | 0:8f3710bfd298 | 107 | u_r_errno.base = 0; |
irfantitok | 0:8f3710bfd298 | 108 | u_r_errno.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
irfantitok | 0:8f3710bfd298 | 109 | u_r_errno.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
irfantitok | 0:8f3710bfd298 | 110 | u_r_errno.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
irfantitok | 0:8f3710bfd298 | 111 | u_r_errno.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
irfantitok | 0:8f3710bfd298 | 112 | this->r_errno = u_r_errno.real; |
irfantitok | 0:8f3710bfd298 | 113 | offset += sizeof(this->r_errno); |
irfantitok | 0:8f3710bfd298 | 114 | return offset; |
irfantitok | 0:8f3710bfd298 | 115 | } |
irfantitok | 0:8f3710bfd298 | 116 | |
irfantitok | 0:8f3710bfd298 | 117 | const char * getType(){ return FILEREMOVE; }; |
irfantitok | 0:8f3710bfd298 | 118 | const char * getMD5(){ return "85394f2e941a8937ac567a617f06157f"; }; |
irfantitok | 0:8f3710bfd298 | 119 | |
irfantitok | 0:8f3710bfd298 | 120 | }; |
irfantitok | 0:8f3710bfd298 | 121 | |
irfantitok | 0:8f3710bfd298 | 122 | class FileRemove { |
irfantitok | 0:8f3710bfd298 | 123 | public: |
irfantitok | 0:8f3710bfd298 | 124 | typedef FileRemoveRequest Request; |
irfantitok | 0:8f3710bfd298 | 125 | typedef FileRemoveResponse Response; |
irfantitok | 0:8f3710bfd298 | 126 | }; |
irfantitok | 0:8f3710bfd298 | 127 | |
irfantitok | 0:8f3710bfd298 | 128 | } |
irfantitok | 0:8f3710bfd298 | 129 | #endif |