/*
 * zGo2Measurement.h
 * 
 * Gocator system communication library
 * Copyright (C) 2010 by LMI Technologies Inc.
 * 
 * Licensed under The MIT License.
 * Redistributions of files must retain the above copyright notice.
 */
#ifndef LMITECH_GO2_Z_MEASUREMENT_H_INCLUDED
#define LMITECH_GO2_Z_MEASUREMENT_H_INCLUDED

#include <Go2Measurement.h>
#include <Go2PartTypes.h>
#include <z/zGo2PartTypes.h>
#include <Go2System.h>
#include <zXml.h>
#include <zList.h>
#include <z/zGo2Object.h>
#include <Go2ApiBegin.h>

typedef Go2Status (ZAPI_CALL *Go2MeasurementReadMethod)(Go2Measurement measurement, zXml xml, zXmlItem item); 
typedef Go2Status (ZAPI_CALL *Go2MeasurementWriteMethod)(Go2Measurement measurement, zXml xml, zXmlItem item); 

#define GO2_MEASUREMENT_FIELDS()                                \
    GO2_OBJECT_FIELDS();                                        \
    Go2System system;                                           \
    Go2UInt32 id;                                               \
    zText128 name;                                              \
    zList linkableIds;                                          \
    Go2Bool linkEnabled;                                        \
    Go2UInt32 link;                                             \
    zList sourceOptions;                                        \
    Go2UInt32 source;                                           \
    Go2Double decisionMin;                                      \
    Go2Double decisionMax;                                      \
    Go2Double scale;                                            \
    Go2Double offset;                                           \
    Go2Bool holdEnabled;                                        \
    Go2Bool smoothingEnabled;                                   \
    Go2UInt32 smoothingWindowMin;                               \
    Go2UInt32 smoothingWindowMax;                               \
    Go2UInt32 smoothingWindow;                                  \
    Go2MeasurementReadMethod Read;                              \
    Go2MeasurementWriteMethod Write

typedef struct Go2MeasurementClass
{   
    GO2_MEASUREMENT_FIELDS(); 
} Go2MeasurementClass; 

GO2_EXPORT(Go2Status) Go2Measurement_Init(Go2Measurement measurement, Go2Type type, Go2UInt32 id, Go2System system);
GO2_EXPORT(Go2Status) Go2Measurement_VRelease(Go2Measurement measurement); 

GO2_EXPORT(Go2Status) Go2Measurement_Read(Go2Measurement measurement, zXml xml, zXmlItem item); 
GO2_EXPORT(Go2Status) Go2Measurement_Write(Go2Measurement measurement, zXml xml, zXmlItem item); 

GO2_EXPORT(Go2Status) Go2Measurement_VRead(Go2Measurement measurement, zXml xml, zXmlItem item); 
GO2_EXPORT(Go2Status) Go2Measurement_VWrite(Go2Measurement measurement, zXml xml, zXmlItem item); 

GO2_EXPORT(Go2UInt32) Go2Measurement_LinkOptionCount(Go2Measurement measurement);
GO2_EXPORT(Go2UInt32) Go2Measurement_LinkOptionAt(Go2Measurement measurement, Go2UInt32 index);
GO2_EXPORT(Go2Status) Go2Measurement_EnableLink(Go2Measurement measurement, Go2Bool enable);  
GO2_EXPORT(Go2Bool) Go2Measurement_LinkEnabled(Go2Measurement measurement);  
GO2_EXPORT(Go2Status) Go2Measurement_SetLink(Go2Measurement measurement, Go2UInt32 link); 
GO2_EXPORT(Go2UInt32) Go2Measurement_Link(Go2Measurement measurement); 

GO2_EXPORT(Go2UInt32) Go2Measurement_SourceOptionCount(Go2Measurement measurement);
GO2_EXPORT(Go2UInt32) Go2Measurement_SourceOptionAt(Go2Measurement measurement, Go2UInt32 index);
GO2_EXPORT(Go2Status) Go2Measurement_SetSource(Go2Measurement measurement, Go2UInt32 source);
GO2_EXPORT(Go2UInt32) Go2Measurement_Source(Go2Measurement measurement);

GO2_EXPORT(Go2Status) Go2Measurement_SetDecisionMin(Go2Measurement measurement, Go2Double min); 
GO2_EXPORT(Go2Double) Go2Measurement_DecisionMin(Go2Measurement measurement); 
GO2_EXPORT(Go2Status) Go2Measurement_SetDecisionMax(Go2Measurement measurement, Go2Double max); 
GO2_EXPORT(Go2Double) Go2Measurement_DecisionMax(Go2Measurement measurement); 

GO2_EXPORT(Go2Status) Go2Measurement_SetScale(Go2Measurement measurement, Go2Double scale);
GO2_EXPORT(Go2Double) Go2Measurement_Scale(Go2Measurement measurement);
GO2_EXPORT(Go2Status) Go2Measurement_SetOffset(Go2Measurement measurement, Go2Double offset);
GO2_EXPORT(Go2Double) Go2Measurement_Offset(Go2Measurement measurement);
GO2_EXPORT(Go2Status) Go2Measurement_EnableHold(Go2Measurement measurement, Go2Bool enable); 
GO2_EXPORT(Go2Bool) Go2Measurement_HoldEnabled(Go2Measurement measurement); 
GO2_EXPORT(Go2Status) Go2Measurement_EnableSmoothing(Go2Measurement measurement, Go2Bool enable); 
GO2_EXPORT(Go2Bool) Go2Measurement_SmoothingEnabled(Go2Measurement measurement); 
GO2_EXPORT(Go2UInt32) Go2Measurement_SmoothingWindowMin(Go2Measurement measurement); 
GO2_EXPORT(Go2UInt32) Go2Measurement_SmoothingWindowMax(Go2Measurement measurement); 
GO2_EXPORT(Go2Status) Go2Measurement_SetSmoothingWindow(Go2Measurement measurement, Go2UInt32 window); 
GO2_EXPORT(Go2UInt32) Go2Measurement_SmoothingWindow(Go2Measurement measurement); 

/*
 * Go2PartMeasurement Class 
 */

#define GO2_PART_MEASUREMENT_FIELDS()                           \
    GO2_MEASUREMENT_FIELDS();                                   \
    Go2Bool regionEnabled;                                      \
    Go2PartRegion3d region

typedef struct Go2PartMeasurementClass
{   
    GO2_PART_MEASUREMENT_FIELDS();
} Go2PartMeasurementClass; 

GO2_EXPORT(Go2Status) Go2PartMeasurement_Init(Go2PartMeasurement measurement, Go2Type type, Go2UInt32 id, Go2System system);
GO2_EXPORT(Go2Status) Go2PartMeasurement_VRelease(Go2PartMeasurement measurement); 

GO2_EXPORT(Go2Status) Go2PartMeasurement_Read(Go2PartMeasurement measurement, zXml xml, zXmlItem item); 
GO2_EXPORT(Go2Status) Go2PartMeasurement_Write(Go2PartMeasurement measurement, zXml xml, zXmlItem item); 

GO2_EXPORT(Go2Status) Go2PartMeasurement_VRead(Go2PartMeasurement measurement, zXml xml, zXmlItem item); 
GO2_EXPORT(Go2Status) Go2PartMeasurement_VWrite(Go2PartMeasurement measurement, zXml xml, zXmlItem item); 

GO2_EXPORT(Go2Status) Go2PartMeasurement_EnableRegion(Go2PartMeasurement measurement, Go2Bool enable);  
GO2_EXPORT(Go2Bool) Go2PartMeasurement_RegionEnabled(Go2PartMeasurement measurement);  
GO2_EXPORT(Go2PartRegion3d) Go2PartMeasurement_Region(Go2PartMeasurement measurement);


/*
 * Go2Script Class 
 */

typedef struct Go2ScriptClass
{   
    GO2_MEASUREMENT_FIELDS(); 
    zChar* sourceCode; 
    zList outputList;
} Go2ScriptClass; 

GO2_EXPORT(Go2Status) Go2Script_Construct(Go2Script* measurement, Go2UInt32 id, Go2System system); 
GO2_EXPORT(Go2Status) Go2Script_Init(Go2Script measurement, Go2UInt32 id, Go2System system);

GO2_EXPORT(Go2Status) Go2Script_VRelease(Go2Script measurement);
GO2_EXPORT(Go2Status) Go2Script_VRead(Go2Script measurement, zXml xml, zXmlItem item); 
GO2_EXPORT(Go2Status) Go2Script_VWrite(Go2Script measurement, zXml xml, zXmlItem item); 

#include <Go2ApiEnd.h>

#endif      /* #ifndef LMITECH_GO2_Z_MEASUREMENT_H_INCLUDED */
