/*

ARIA header files for use with ARNL 1.7.1

Copyright(C) 2004, 2005 ActivMedia Robotics, LLC. 
Copyright(C) 2006, 2007, 2008, 2009 MobileRobots Inc.
All rights reserved.

This copy of Aria was relicensed for use with Arnl and the Arnl
license by MobileRobots Inc.  If you wish to download a seperate
distribution of Aria licensed under the GPL or a commercial license go to
http://www.mobilerobots.com/SOFTWARE/aria.html or contact MobileRobots
Inc, at robots@mobilerobots.com or MobileRobots Inc,
10 Columbia Drive, Amherst, NH 03031; 800-639-9481

MobileRobots Inc hereby grants to other individuals or
organizations permission to use this software with Arnl and in
compliance with the Arnl license.  This software may not be
distributed to others except by MobileRobots Inc.

MobileRobots Inc does not make any representations about the
suitability of this software for any purpose.  It is provided "as is"
without express or implied warranty.

*/
#ifndef ARSERVERSENSORINFO_H
#define ARSERVERSENSORINFO_H

#include "Aria.h"
#include "ArServerBase.h"

class ArServerClient;

/** Service providing clients with data from range sensors.
 * This service accepts the following data requests: 
 * <ul>
 *  <li><code>getSensorList</code> to get a list of all robot sensors</li>
 *  <li><code>getSensorCurrent</code> to get one range sensor's set of current  readings</li>
 *  <li><code>getSensorCumulative</code> to get one range sensor's set of cumualtive  readings</li>
 * </ul>
 *
 * The <code>getSensorList</code> request replies with the following data packet:
 * <ol>
 *  <li>Number of sensors (2-byte integer)
 *  <li>For each sensor:
 *    <ol><li>sensor name (Null-terminated string)</li></ol>
 *  </li>
 * </ol>
 *
 * The <code>getSensorCurrent</code> and <code>getSensorCumulative</code>
 * requests must include the following data:
 * <ol>
 *  <li>Sensor name (Null-terminated string)</li>
 * </ol>
 *
 * The <code>getSensorCurrent</code> and <code>getSensorCumulative</code>
 * requests reply with the following data packets:
 * <ol>
 *  <li>Number of readings, or -1 for invalid sensor name error (2-byte integer)</li>
 *  <li>Sensor name (null-terminated string)</li>
 *  <li>For each reading:
 *    <ol>
 *      <li>X coordinate of reading (4-byte integer)</li>
 *      <li>Y coordinate of reading (4-byte integer)</li>
 *    </ol>
 *  </li>
 * </ol>
 *
 * This service's requests are all in the <code>SensorInfo</code> group.
 */
class ArServerInfoSensor
{
public:
  AREXPORT ArServerInfoSensor(ArServerBase *server, ArRobot *robot);
  AREXPORT virtual ~ArServerInfoSensor();
  AREXPORT void getSensorList(ArServerClient *client, ArNetPacket *packet);
  AREXPORT void getSensorCurrent(ArServerClient *client, ArNetPacket *packet);
  AREXPORT void getSensorCumulative(ArServerClient *client, 
				    ArNetPacket *packet);
protected:
  ArRobot *myRobot;
  ArServerBase *myServer;
  ArFunctor2C<ArServerInfoSensor, ArServerClient *, ArNetPacket *> myGetSensorListCB;
  ArFunctor2C<ArServerInfoSensor, ArServerClient *, ArNetPacket *> myGetSensorCurrentCB;
  ArFunctor2C<ArServerInfoSensor, ArServerClient *, ArNetPacket *> myGetSensorCumulativeCB;
  
};


#endif
