execute_program_message.cpp
Go to the documentation of this file.
1 /*********************************************************************
2 * FSRobo-R Package BSDL
3 * ---------
4 * Copyright (C) 2019 FUJISOFT. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without modification,
7 * are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation and/or
12 * other materials provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of its contributors
14 * may be used to endorse or promote products derived from this software without
15 * specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *********************************************************************/
28 
32 
36 
37 namespace fsrobo_r_driver
38 {
39 namespace simple_message
40 {
41 namespace execute_program_message
42 {
43 
45 {
46  this->init();
47 }
48 
50 {
51 }
52 
54 {
55  ByteArray data = msg.getData();
56  this->init();
57 
58  if (!data.unload(this->cmd_))
59  {
60  LOG_ERROR("Failed to unload ExecuteProgram data");
61  return false;
62  }
63 
64  return true;
65 }
66 
68 {
69  this->init();
70  this->cmd_.copyFrom(cmd);
71 }
72 
74 {
76  this->cmd_.init();
77 }
78 
80 {
81  LOG_COMM("Executing ExecuteProgram message load");
82  if (!buffer->load(this->cmd_))
83  {
84  LOG_ERROR("Failed to load ExecuteProgram message");
85  return false;
86  }
87 
88  return true;
89 }
90 
92 {
93  LOG_COMM("Executing ExecuteProgram message unload");
94 
95  if (!buffer->unload(this->cmd_))
96  {
97  LOG_ERROR("Failed to unload ExecuteProgram message");
98  return false;
99  }
100 
101  return true;
102 }
103 
104 }
105 }
106 }
void init()
Initializes a empty execute program command.
void setMessageType(int message_type=industrial::simple_message::StandardMsgTypes::INVALID)
void copyFrom(ExecuteProgram &src)
Copies the passed in value.
fsrobo_r_driver::simple_message::execute_program::ExecuteProgram cmd_
#define LOG_COMM(format,...)
bool load(industrial::shared_types::shared_bool value)
#define LOG_ERROR(format,...)
industrial::byte_array::ByteArray & getData()
bool unload(industrial::shared_types::shared_bool &value)
Class encapsulated write single io data. FSRobo-R specific interface to set IO element on the control...


fsrobo_r_driver
Author(s): F-ROSROBO
autogenerated on Sun Feb 9 2020 03:58:29