Matlab Simulink/LQ_Target_1500S_V4_0_grt_Output/LQ_ODK/src_odk_helpers/ODK_CpuReadData.cpp
bool CODK_CpuReadData::ReadS7BOOL(const long  byteOffset,  // Buffer index to the data
                                  int         bitNo,       // Bit number within the byte to read
                                  bool       &value) const // Variable to store the read value
{
    ODK_UINT8 temp;

    // Verify valid bit index
    if ((bitNo < 0) || (bitNo > 7))
    {
        return false;
    }

    // Verify offset is within data area
    if ((byteOffset < 0) || ((byteOffset + ODK_SIZEBIT8) > m_nBytes))
    {
        return false;
    }

    // read the byte containing the bit
    if (!ReadUINT8(byteOffset, temp))
    {
        return false;
    }

    // Shift the bit to the first location
    temp = static_cast<ODK_UINT8>(temp >> bitNo);

    // Isolate the value
    if ((temp & 1) == 1)
    {
        value = true;
    }
    else
    {
        value = false;
    }
    return true;
}
//
// ReadS7BOOL : Reads a boolean value from the data area
//
ReadS7BOOL : Reads a boolean value from the data area
ReadS7BOOL : Reads a boolean value from the data area
bool CODK_CpuReadData::ReadS7BOOL(const long  byteOffset,  
                                  int         bitNo,       
                                  bool       &value) const 
{
    ODK_UINT8 temp;
    if ((bitNo < 0) || (bitNo > 7))
    {
        return false;
    }
    if ((byteOffset < 0) || ((byteOffset + ODK_SIZEBIT8) > m_nBytes))
    {
        return false;
    }
    if (!ReadUINT8(byteOffset, temp))
    {
        return false;
    }
    temp = static_cast<ODK_UINT8>(temp >> bitNo);
    if ((temp & 1) == 1)
    {
        value = true;
    }
    else
    {
        value = false;
    }
    return true;
}
bool CODK_CpuReadData :: ReadS7BOOL ( const long byteOffset , int bitNo , bool & value ) const { ODK_UINT8 temp ; if ( ( bitNo < 0 ) || ( bitNo > 7 ) ) { return false ; } if ( ( byteOffset < 0 ) || ( ( byteOffset + ODK_SIZEBIT8 ) > m_nBytes ) ) { return false ; } if ( ! ReadUINT8 ( byteOffset , temp ) ) { return false ; } temp = static_cast < ODK_UINT8 > ( temp >> bitNo ) ; if ( ( temp & 1 ) == 1 ) { value = true ; } else { value = false ; } return true ; }
ReadS7BOOL : Reads a boolean value from the data area
ReadS7BOOL : Reads a boolean value from the data area
// Buffer index to the data // Bit number within the byte to read // Variable to store the read value // Verify valid bit index // Verify offset is within data area // read the byte containing the bit // Shift the bit to the first location // Isolate the value