RequestQueue.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2017, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package ArmarX
19 * @author Stefan Reither( stefan dot reither at kit dot edu)
20 * @date 2021
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25#pragma once
26
27#include <condition_variable>
28#include <memory>
29#include <vector>
30
32
34{
35 class RequestBase;
36 class SDOUpdateRequest;
37
38 struct SDOIdentifier;
39 class EtherCATState;
40
41 struct RegisterDataList;
42 struct EtherCATFrameList;
43
44 /**
45 * @class RequestQueue
46 * @ingroup Library-ethercat
47 * @brief Brief description of class RequestQueue.
48 *
49 * Detailed description of class RequestQueue.
50 */
52 {
53 public:
57
58 std::shared_ptr<RequestBase> getNextRequest();
59 void postReply(std::shared_ptr<RequestBase>&& request);
60
61
62 bool postSDOReadRequest(SDOIdentifier sdoIdentifier,
63 int* buflen,
64 unsigned char* buf,
65 bool completeAccess);
66 bool postSDOWriteRequest(SDOIdentifier sdoIdentifier,
67 int buflen,
68 unsigned char* buf,
69 bool completeAccess);
70
71
72 bool postChangeStateRequest(std::uint16_t slaveIndex,
73 EtherCATState state,
74 bool validate,
75 EtherCATState* actualState);
76
77
79
80 bool postRegisterResetRequest(std::uint16_t slaveIndex);
81
82 bool postRegisterReadRequest(std::vector<RegisterDataList>& registerData);
83
84 bool postRegisterReadRequest(EtherCATFrameList* frames, std::uint16_t amountFramesToRead);
85
86
87 private:
88 bool postRequest(const std::shared_ptr<RequestBase>& request);
89 bool postSDOUpdateRequest(const std::shared_ptr<SDOUpdateRequest>& request);
90
91 struct QueueImpl;
93
94 std::condition_variable requestCV;
95 };
96
97} // namespace armarx::control::ethercat
Wrapper for a pointer to propagate const to the pointed to value.
This class is a wrapper around an enum containing the different EtherCAT states.
Brief description of class RequestBase.
Definition RequestBase.h:13
bool postSDOReadRequest(SDOIdentifier sdoIdentifier, int *buflen, unsigned char *buf, bool completeAccess)
bool postRegisterReadRequest(std::vector< RegisterDataList > &registerData)
std::shared_ptr< RequestBase > getNextRequest()
RequestQueue & operator=(RequestQueue rhs)
bool postReadStatesRequest(EtherCATState *state)
void postReply(std::shared_ptr< RequestBase > &&request)
bool postChangeStateRequest(std::uint16_t slaveIndex, EtherCATState state, bool validate, EtherCATState *actualState)
bool postSDOWriteRequest(SDOIdentifier sdoIdentifier, int buflen, unsigned char *buf, bool completeAccess)
bool postRegisterResetRequest(std::uint16_t slaveIndex)
Brief description of class SDOUpdateRequest.
The EtherCATFrameList struct holds a list of EtherCAT frames that can be scheduled in round-robin-sty...
Brief description of struct RegisterDataList.