User Tools

Site Tools


steereo:classes:steereoclientsteering

SteereoClientSteering

Description

With this class assists you in writing your steering clients. It provides functions for connecting, making requests, and getting responses.
To handle responses to your requests you have to register functions for each command. You can see this in action in the Howto. It also manages you connections, as your client can have connections to more than one simulation.

Functions

Function you will need

  •  SteereoConnection* startConnection (SteereoCommunicator* commu, std::string ip, std::string port, int connNr = 0) 

    connects to the simulation listening at ip and port using the SteereoCommunicator commu. It establishes a data and control connections and returns the descriptions as SteereoConnection. With connNr you specify which number this connection has (needed when this is at least the second connection of your client). This function tries to connect until it has success. This way you can start the simulation also after the client.

  •  void startAccepting (int connNr = 0) 

    With this your client starts accepting responses from the simulation at connection number connNr.

Function you may also consider very useful

Especially if your not only using SteerParameterClient you will need these functions.

  •  int makeRequest (request req, SteereoStream* data, int connNr = 0) 
     int makeRequest (std::string reqName, int connNr = 0)
     int makeRequest (std::string reqName, std::string reqParam, int connNr = 0) 
     int makeRequest (std::string reqName, SteereoStream* data, int connNr = 0) 
     int makeRequest (std::string reqName, std::string reqParam, int queue, SteereoStream* data, int connNr = 0) 
     int makeRequest (std::string reqName, int queue, SteereoStream* data, int connNr = 0) 
     int makeRequest (std::string reqName, std::string reqParam, SteereoStream* data, int connNr = 0) 

    Many possibilities to make a request to the simulation at connection connNr. You have to specify the name of the command you request and can also give a string with parameters (separated with a space) and a SteereoStream with additional data for the command as well as the queue number of the simulation in which the request should be inserted. You will get the ID of your request as return value.

  •  bool hasBeenExecuted (int id) 

    Checks if the request with ID id has already been executed in the simulation.

  •  void addAction (std::string forCommand, PtrToAcceptFct action) 

    Specify the function that handles the responses from forCommand. The function action returns nothing and gets a request structure (e.g. void myHandler(request req)). You have to take care to eventually receive data from the simulation, if forCommand sends some, yourself !

  •  std::list<std::string> SteereoClientSteering::receiveSteeringMethods (int connNr) 

    Receive a list of available commands from the simulation at connection connNr.

  •  void closeConnection (int connNr = 0) 
     void closeConnections () 

    Close either one connection or all. It is good style to close your connections, just before exiting the client.

steereo/classes/steereoclientsteering.txt · Last modified: 2010/08/03 12:23 by hpcdjenz