5 #ifndef __RD_YARP_NETWORK_MANAGER_HPP__
6 #define __RD_YARP_NETWORK_MANAGER_HPP__
10 #include <yarp/os/PeriodicThread.h>
11 #include <yarp/os/PortReaderBuffer.h>
12 #include <yarp/os/Bottle.h>
13 #include <yarp/os/RpcClient.h>
14 #include <yarp/os/BufferedPort.h>
16 #include "NetworkManager.hpp"
38 private yarp::os::PeriodicThread,
39 public yarp::os::TypedReaderCallback<yarp::os::Bottle>
53 static const std::string
id;
62 virtual bool configure(
const std::string & parameter,
const Player & value);
81 void onRead(yarp::os::Bottle& b);
96 yarp::os::RpcClient rpcClient;
97 yarp::os::BufferedPort<yarp::os::Bottle> callbackPort;
107 #endif //-- __RD_NETWORK_MANAGER_HPP__
virtual bool configure(const std::string ¶meter, const Player &value)
Configures a parameter with a value.
Definition: YarpNetworkManager.cpp:170
virtual bool keepAlive()
Keeps the user connected to the server (requires to be called periodically)
Definition: YarpNetworkManager.cpp:261
Player player
Player.
Definition: YarpNetworkManager.hpp:100
void onRead(yarp::os::Bottle &b)
Yarp callback for incoming messages.
Definition: YarpNetworkManager.cpp:114
virtual bool start()
Start the network manager.
Definition: YarpNetworkManager.cpp:45
virtual bool logout()
Log the user out of the network.
Definition: YarpNetworkManager.cpp:236
Class that represents a player of this game, with a 'unique' id, name, health, team id and score.
Definition: Player.hpp:21
The main, catch-all namespace for Robot Devastation.
Definition: groups.dox:4
static bool RegisterManager()
Register this manager in the NetworkManager registry so that can be used.
Definition: YarpNetworkManager.cpp:20
YarpNetworkManager()
Constructor.
Definition: YarpNetworkManager.cpp:30
virtual bool isStopped() const
Returns true if manager is stopped (obviously)
Definition: YarpNetworkManager.cpp:165
virtual bool login()
Log the user into the network.
Definition: YarpNetworkManager.cpp:204
virtual bool stop()
Stop the network manager.
Definition: YarpNetworkManager.cpp:143
static YarpNetworkManager * uniqueInstance
Reference to this manager (unique instance)
Definition: YarpNetworkManager.hpp:90
static const std::string id
String that identifies this manager.
Definition: YarpNetworkManager.hpp:53
Manages the communications between the user and the Server using YARP.
Definition: YarpNetworkManager.hpp:37
Manages the communications between the user and the RobotDevastation network.
Definition: NetworkManager.hpp:37
static const int KEEPALIVE_RATE_MS
Period of the keep alive (called by run() )
Definition: YarpNetworkManager.hpp:93
virtual bool sendPlayerHit(const Player &player, int damage)
Communicate to the network that a player has been hit by the user.
Definition: YarpNetworkManager.cpp:181