#ifndef PORT_H_
#define PORT_H_

#include <object.h>

class cObjectPort : public cObject
{
public :

   enum ePortType
       {
           PORT_TYPE_NONE,
           PORT_TYPE_DISCRETE_IN,
           PORT_TYPE_DISCRETE_OUT,
           PORT_TYPE_ANALOG_IN,
           PORT_TYPE_ANALOG_OUT
       };

   enum ePortLastToggled
   {
     PORT_TOGGLED_UNKNOWN,
     PORT_TOGGLED_NONE,
     PORT_TOGGLED_WEBSITE,
     PORT_TOGGLED_CCD,
     PORT_TOGGLED_IODRIVER
   };

   cObjectPort();
   cObjectPort(cObjectPort *);
   cObjectPort(ePortType);
   ~cObjectPort();

   cTagList * getTags();
   bool parse(KourierObject *ko,std::vector<KTag*>* ct = NULL);

	//potential problem with conversion as library returns double and we are casting to float.
	bool parse(json_t *dataArray); //JSON
	   //returns an array of all the values
	json_t * getJSONObj(); //for JSON



   bool compIndex(cObject *);
   bool operator < (cObject &);
   char * printKey();
   cObject * clone();
   uint32_t getDeviceSerial() const;
   void setDeviceSerial(uint32_t deviceSerial);
   uint32_t getPortId() const;
   void setPortId(uint32_t portId);
   const char* getPortLabel() const;
   void setPortLabel(const char* portLabel);
   eObjectOpState getPortOpState() const;
   void setPortOpState(eObjectOpState portOpState);
   eObjectStatus getPortStatus() const;
   void setPortStatus(eObjectStatus portStatus);
   ePortType getPortType() const;
   void setPortType(ePortType portType);
   ePortLastToggled getPortToggled() const;
   void setPortToggled(ePortLastToggled portToggled);

private:
   void populate_tags(KTag* tag);
   uint32_t mPortID;
   uint32_t mDeviceSerial;
   ePortType mPortType;

   char *mPortLabel;
   eObjectOpState mPortOpState;
   eObjectStatus mPortStatus;
   ePortLastToggled mPortToggled;

};
#endif
