
#include "xtherm.h"

char *location = (char *) NULL;

objident tempLocation = {
  11, 
  1, 3, 6, 1, 4, 1, 20, 1, 14, 1, 0,
};

objident tempUpdate = {
  11, 
  1, 3, 6, 1, 4, 1, 20, 1, 14, 2, 0,
};

objident tempValue = {
  11, 
  1, 3, 6, 1, 4, 1, 20, 1, 14, 3, 0,
};

objident ciscoTemp = {
  13, 
  1, 3, 6, 1, 4, 1, 9, 2, 1, 79, 0,
};


temperature_query(agent)
     Agent *agent;
{
  objident *o[3];
  caddr_t *val = (caddr_t *) NULL;
  static int cisco = 0;
  int temp;

  if(!cisco)
    {
      o[0] = &tempValue;
      o[1] = &tempLocation;
      o[2] = (objident *) NULL;

      val = (caddr_t *) make_lots_o_snmp_queries(agent, o);
    }
  if(!val || cisco)
    {
      cisco = 1;
      o[0] = &ciscoTemp;
      o[1] = (objident *) NULL;
      
      val = (caddr_t *) make_lots_o_snmp_queries(agent, o);
    }
  if(!val || !val[0])
    return(-999);

  bcopy(val[0], &temp, sizeof(temp));
  if(!cisco)
    {
      location = val[1];
      return(temp/100);
    }
  else
    {
      return(temp);
    }
}
