Skip to content

Commit fb47a09

Browse files
Updated ALF test client
1 parent fa848aa commit fb47a09

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/CommandLineUtilities/AliceLowlevelFrontend/AliceLowlevelFrontend.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <boost/algorithm/string/predicate.hpp>
1717
#include <boost/format.hpp>
1818
#include "AlfException.h"
19+
#include "Sca.h"
1920

2021
namespace AliceO2 {
2122
namespace roc {
@@ -161,6 +162,31 @@ class PublishRpc : DimRpcInfoWrapper
161162
}
162163
};
163164

165+
class PublishScaRpc : DimRpcInfoWrapper
166+
{
167+
public:
168+
PublishScaRpc(const std::string& serviceName)
169+
: DimRpcInfoWrapper(serviceName)
170+
{
171+
}
172+
173+
void publish(std::string dnsName, double frequency, const std::vector<Sca::CommandData>& commandDataPairs)
174+
{
175+
std::ostringstream stream;
176+
stream << dnsName << ';';
177+
for (size_t i = 0; i < commandDataPairs.size(); ++i) {
178+
stream << commandDataPairs[i].command << ',' << commandDataPairs[i].data;
179+
if ((i + 1) < commandDataPairs.size()) {
180+
stream << '\n';
181+
}
182+
}
183+
stream << ';' << frequency;
184+
printf("Publish SCA: %s\n", stream.str().c_str());
185+
setString(stream.str());
186+
getString();
187+
}
188+
};
189+
164190
class PublishStopRpc: DimRpcInfoWrapper
165191
{
166192
public:

src/CommandLineUtilities/AliceLowlevelFrontend/ProgramAliceLowlevelFrontendClient.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,13 @@ class ProgramAliceLowlevelFrontendClient: public Program
6969
Alf::ScaGpioWriteRpc scaGpioWriteRpc(names.scaGpioWrite());
7070
Alf::ScaWriteSequence scaWriteSequence(names.scaWriteSequence());
7171
Alf::PublishRpc publishRpc(names.publishStartCommandRpc());
72+
Alf::PublishScaRpc publishScaRpc(names.publishScaStartCommandRpc());
7273

7374
publishRpc.publish("ALF/TEST/1", 1.0, {0x1fc});
7475
publishRpc.publish("ALF/TEST/2", 3.0, {0x100, 0x104, 0x108});
7576

77+
publishScaRpc.publish("ALF/TEST/SCA_1", 1.0, {{0x0, 0x1}, {0x10, 0x11}});
78+
7679
for (int i = 0; i < 10; ++i) {
7780
cout << "SCA GPIO write '" << i << "'" << endl;
7881
cout << " result: " << scaGpioWriteRpc.write(i) << endl;
@@ -135,6 +138,7 @@ class ProgramAliceLowlevelFrontendClient: public Program
135138
Alf::PublishStopRpc publishStopRpc(names.publishStopCommandRpc());
136139
publishStopRpc.stop("ALF/TEST/1");
137140
publishStopRpc.stop("ALF/TEST/2");
141+
publishStopRpc.stop("ALF/TEST/SCA_1");
138142
}
139143

140144
int mSerialNumber;

0 commit comments

Comments
 (0)