/*
 * Go2PartHeight.c
 * 
 * Gocator system communication library
 * Copyright (C) 2013 by LMI Technologies Inc.
 * 
 * Licensed under The MIT License.
 * Redistributions of files must retain the above copyright notice.
 */

#include <z/Go2Measurements/zGo2PartHeight.h>
#include <z/zGo2PartTypes.h>
#include <z/zGo2System.h>
#include <string.h>

/*
 * Go2PartHeight Class 
 */

GO2_EXPORT(Go2Status) Go2PartHeight_Construct(Go2Part* measurement, Go2UInt32 id, Go2Object system)
{
    Go2PartHeight output = zNIL; 
    Go2Status status = zOK; 

    zCHECK(zCalloc(&output, 1, sizeof(Go2PartHeightClass))); 

    if (!zSUCCESS(status = Go2PartHeight_Init(output, id, system)))
    {
        zCHECK(Go2Object_Destroy(output)); 
        return status; 
    }

    *measurement = output; 

    return GO2_OK; 
}

GO2_EXPORT(Go2Status) Go2PartHeight_Init(Go2PartHeight measurement, Go2UInt32 id, Go2Object system)
{
    Go2PartHeightClass* obj = zHANDLE_POINTER(measurement);

    zCHECK(Go2PartMeasurement_Init(measurement, GO2_TYPE_PART_HEIGHT, id, system)); 

    obj->Read = Go2PartHeight_VRead; 
    obj->Write = Go2PartHeight_VWrite; 

    return GO2_OK; 
}

GO2_EXPORT(Go2Status) Go2PartHeight_VRead(Go2PartHeight measurement, zXml xml, zXmlItem item)
{
    Go2PartHeightClass* obj = zHANDLE_POINTER(measurement);

    zCHECK(Go2PartMeasurement_VRead(measurement, xml, item)); 

    zCHECK(zXml_Child32s(xml, item, "RegionEnabled", &obj->regionEnabled)); 
    zCHECK(zXml_Child32s(xml, item, "Type", (z32s*) &obj->heightType)); 

    return GO2_OK; 
}

GO2_EXPORT(Go2Status) Go2PartHeight_VWrite(Go2PartHeight measurement, zXml xml, zXmlItem item)
{
    Go2PartHeightClass* obj = zHANDLE_POINTER(measurement);

    zCHECK(Go2PartMeasurement_VWrite(measurement, xml, item)); 

    zCHECK(zXml_SetChild32s(xml, item, "RegionEnabled", obj->regionEnabled)); 
    zCHECK(zXml_SetChild32s(xml, item, "Type", (z32s) obj->heightType)); 

    return GO2_OK; 
}

GO2_EXPORT(Go2Status) Go2PartHeight_SetId(Go2PartHeight measurement, Go2UInt32 id)
{
    return Go2Measurement_SetId(measurement, id); 
}

GO2_EXPORT(Go2UInt32) Go2PartHeight_Id(Go2PartHeight measurement)
{
    return Go2Measurement_Id(measurement); 
}

GO2_EXPORT(Go2Status) Go2PartHeight_SetName(Go2PartHeight measurement, const Go2Char* name)
{
    return Go2Measurement_SetName(measurement, name); 
}

GO2_EXPORT(Go2Status) Go2PartHeight_Name(Go2PartHeight measurement, Go2Char* name, Go2UInt32 capacity)
{
    return Go2Measurement_Name(measurement, name, capacity); 
}

GO2_EXPORT(Go2Status) Go2PartHeight_SetDecisionMin(Go2PartHeight measurement, Go2Double min)
{
    return Go2Measurement_SetDecisionMin(measurement, min); 
}

GO2_EXPORT(Go2Double) Go2PartHeight_DecisionMin(Go2PartHeight measurement)
{
    return Go2Measurement_DecisionMin(measurement); 
}

GO2_EXPORT(Go2Status) Go2PartHeight_SetDecisionMax(Go2PartHeight measurement, Go2Double max)
{
    return Go2Measurement_SetDecisionMax(measurement, max); 
}

GO2_EXPORT(Go2Double) Go2PartHeight_DecisionMax(Go2PartHeight measurement)
{
    return Go2Measurement_DecisionMax(measurement); 
}

GO2_EXPORT(Go2Status) Go2PartHeight_EnableHold(Go2PartHeight measurement, Go2Bool enable)
{
    return Go2Measurement_EnableHold(measurement, enable);  
} 

GO2_EXPORT(Go2Bool) Go2PartHeight_HoldEnabled(Go2PartHeight measurement)
{
    return Go2Measurement_HoldEnabled(measurement);  
}

GO2_EXPORT(Go2Status) Go2PartHeight_EnableSmoothing(Go2PartHeight measurement, Go2Bool enable)
{
    return Go2Measurement_EnableSmoothing(measurement, enable);  
} 

GO2_EXPORT(Go2Bool) Go2PartHeight_SmoothingEnabled(Go2PartHeight measurement)
{
    return Go2Measurement_SmoothingEnabled(measurement);  
} 

GO2_EXPORT(Go2UInt32) Go2PartHeight_SmoothingWindowMin(Go2PartHeight measurement)
{
    return Go2Measurement_SmoothingWindowMin(measurement);  
} 

GO2_EXPORT(Go2UInt32) Go2PartHeight_SmoothingWindowMax(Go2PartHeight measurement)
{
    return Go2Measurement_SmoothingWindowMax(measurement);  
} 

GO2_EXPORT(Go2Status) Go2PartHeight_SetSmoothingWindow(Go2PartHeight measurement, Go2UInt32 window)
{
    return Go2Measurement_SetSmoothingWindow(measurement, window);  
} 

GO2_EXPORT(Go2UInt32) Go2PartHeight_SmoothingWindow(Go2PartHeight measurement)
{
    return Go2Measurement_SmoothingWindow(measurement);  
} 

GO2_EXPORT(Go2Status) Go2PartHeight_SetType(Go2PartHeight measurement, Go2PartHeightType type)
{
    Go2PartHeightClass* obj = zHANDLE_POINTER(measurement);
    
    zCHECK(Go2System_CheckConfigurable(obj->system)); 
    obj->heightType = type; 
    zCHECK(Go2System_SetModified(obj->system)); 

    return GO2_OK; 
}

GO2_EXPORT(Go2PartHeightType) Go2PartHeight_Type(Go2PartHeight measurement)
{
    Go2PartHeightClass* obj = zHANDLE_POINTER(measurement);
    return obj->heightType; 
}



GO2_EXPORT(Go2Status) Go2PartHeight_SetScale(Go2PartHeight measurement, Go2Double scale){
    return Go2Measurement_SetScale(measurement, scale);
}

GO2_EXPORT(Go2Double) Go2PartHeight_Scale(Go2PartHeight measurement){
    return Go2Measurement_Scale(measurement);
}

GO2_EXPORT(Go2Status) Go2PartHeight_SetOffset(Go2PartHeight measurement, Go2Double offset){
    return Go2Measurement_SetOffset(measurement, offset);
}

GO2_EXPORT(Go2Double) Go2PartHeight_Offset(Go2PartHeight measurement){
    return Go2Measurement_Offset(measurement);
}

GO2_EXPORT(Go2Status) Go2PartHeight_EnableLink(Go2PartHeight measurement, Go2Bool enable)  
{
    return Go2Measurement_EnableLink(measurement, enable);  
}

GO2_EXPORT(Go2Bool) Go2PartHeight_LinkEnabled(Go2PartHeight measurement)  
{
    return Go2Measurement_LinkEnabled(measurement);  
}

GO2_EXPORT(Go2Status) Go2PartHeight_SetLink(Go2PartHeight measurement, Go2UInt32 link) 
{
    return Go2Measurement_SetLink(measurement, link); 
}

GO2_EXPORT(Go2UInt32) Go2PartHeight_Link(Go2PartHeight measurement) 
{
    return Go2Measurement_Link(measurement); 
}

GO2_EXPORT(Go2Status) Go2PartHeight_EnableRegion(Go2PartHeight measurement, Go2Bool enable)  
{
    return Go2PartMeasurement_EnableRegion(measurement, enable);  
}

GO2_EXPORT(Go2Bool) Go2PartHeight_RegionEnabled(Go2PartHeight measurement)  
{
    return Go2PartMeasurement_RegionEnabled(measurement);  
}

GO2_EXPORT(Go2PartRegion3d) Go2PartHeight_Region(Go2PartHeight measurement)
{
    return Go2PartMeasurement_Region(measurement);
}

GO2_EXPORT(Go2UInt32) Go2PartHeight_LinkOptionCount(Go2PartHeight measurement)
{
    return Go2Measurement_LinkOptionCount(measurement);
}

GO2_EXPORT(Go2UInt32) Go2PartHeight_LinkOptionAt(Go2PartHeight measurement, Go2UInt32 index)
{
    return Go2Measurement_LinkOptionAt(measurement, index);
}
