#include <iostream>
{
int read(
char *buf,
int count)
override {
return posixRead(buf, count); }
void write(
const char *buf,
size_t count)
override {
}
std::vector<PdCom::Variable> vars,
std::vector<std::string> ) override
{
for (const auto &v : vars)
std::cout << "Found var " << v.getPath() << "\n";
running_ = false;
}
{
std::cout << "Connected!" << std::endl;
connected_ = true;
}
public:
MyProcess(const char *host = "127.0.0.1") :
{}
bool running_ = true;
bool connected_ = false;
};
{
public:
MyProcess *p_ = nullptr;
MyAuthManager() :
PdCom::SimpleLoginManager(
"localhost") {}
std::string
getAuthname()
override {
return "bjarne"; }
{
std::cout << "completed: " << static_cast<int>(result) << std::endl;
if (result == LoginResult::Success) {
p_->list("");
}
}
};
int main()
{
MyAuthManager am;
MyProcess p;
p.setAuthManager(&am);
am.p_ = &p;
while (!p.connected_)
p.asyncData();
am.login();
while (p.running_) {
p.asyncData();
}
am.logout();
p.asyncData();
return 0;
}