#ifndef SRF10_H
#define SRF10_H

#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/i2c.h>
//#include <stdio.h>
//#include <stdlib.h>
#include <unistd.h>

class Srf10
{
  private:
    int i2cHandle;  // file handle from open of I2C
    int i2cAddr;  // address on I2C bus
    char pingBuf[2];  // result specifier
    char readBuf[2];  // result value
    char readReg;  // value of 2 is register to read from

  public:
    Srf10(int handle, int addr, char rt = 'c' );
    void ping();  // fire sensor
    int readS();  // read stored register value
    void setResultType(char); // i = inches, c = centimeters, s = micro-seconds

/*
  ** NOTE **: only one sensor can be on the i2c line when changing an
              address

  There are 16 addresses available to the srf10 range sensor (0-15).  The
  changeAddress method will take a number from 0 - 15 and perform the 
  necessary commands to change the address of that sensor.

  ** REMEMBER **: only one sensor can be on the i2c line when changing an
                  address
*/
    void changeAddress(int newAddress); // To change the srf10 i2c device address


}; // Srf10

#endif
