99 lines
2.1 KiB
C++
99 lines
2.1 KiB
C++
#ifndef _ALADIN_STATUS_HPP_
|
|
#define _ALADIN_STATUS_HPP_
|
|
#ifndef _COMMON_WINDOWS_HPP_
|
|
#include <common/windows.hpp>
|
|
#endif
|
|
#ifndef _COMMON_ARRAY_HPP_
|
|
#include <common/array.hpp>
|
|
#endif
|
|
#ifndef _COMMON_MATH_HPP_
|
|
#include <common/math.hpp>
|
|
#endif
|
|
#ifndef _ALADIN_RAWDATA_HPP_
|
|
#include <aladin/rawdata.hpp>
|
|
#endif
|
|
|
|
class File;
|
|
|
|
class CurrentStatus
|
|
{
|
|
public:
|
|
CurrentStatus();
|
|
virtual ~CurrentStatus();
|
|
double getRemainingBattery(void)const;
|
|
bool getBattery(void)const;
|
|
WORD getTotalDives(void)const;
|
|
WORD getOffsetNewestLog(void)const;
|
|
WORD getOffsetLog(void)const;
|
|
BYTE getDiveProfiles(void)const;
|
|
WORD getEndOfProfileRingBuffer(void)const;
|
|
DWORD getAcquisitionTime(void)const;
|
|
bool readFrom(RawData &array);
|
|
bool readFrom(File &inFile);
|
|
bool writeTo(File &outFile);
|
|
String toString(void)const;
|
|
private:
|
|
BYTE mRemainingBattery;
|
|
BYTE mBattery;
|
|
BYTE mTotalDivesLow;
|
|
BYTE mTotalDivesHigh;
|
|
BYTE mOffsetNewestLog;
|
|
BYTE mDiveProfiles;
|
|
BYTE mEndOfProfileRingBufferLow;
|
|
BYTE mEndOfProfileRingBufferHigh;
|
|
BYTE mDataAquisitionTime1;
|
|
BYTE mDataAquisitionTime2;
|
|
BYTE mDataAquisitionTime3;
|
|
BYTE mDataAquisitionTime4;
|
|
BYTE mCheckSumLow;
|
|
BYTE mCheckSumHigh;
|
|
};
|
|
|
|
inline
|
|
double CurrentStatus::getRemainingBattery(void)const
|
|
{
|
|
return (mRemainingBattery*100.00)/256.00;
|
|
}
|
|
|
|
inline
|
|
bool CurrentStatus::getBattery(void)const
|
|
{
|
|
return mBattery&0xF0;
|
|
}
|
|
|
|
inline
|
|
WORD CurrentStatus::getTotalDives(void)const
|
|
{
|
|
return (mTotalDivesLow*256)+mTotalDivesHigh;
|
|
}
|
|
|
|
inline
|
|
WORD CurrentStatus::getOffsetNewestLog(void)const
|
|
{
|
|
return ((((WORD)mOffsetNewestLog+36)%37)*12)+0x600;
|
|
}
|
|
|
|
inline
|
|
WORD CurrentStatus::getOffsetLog(void)const
|
|
{
|
|
return 0x604;
|
|
}
|
|
|
|
inline
|
|
BYTE CurrentStatus::getDiveProfiles(void)const
|
|
{
|
|
return mDiveProfiles;
|
|
}
|
|
|
|
inline
|
|
WORD CurrentStatus::getEndOfProfileRingBuffer(void)const
|
|
{
|
|
return (mEndOfProfileRingBufferLow+(mEndOfProfileRingBufferHigh>>1)*256)&0x7FF;
|
|
}
|
|
|
|
inline
|
|
DWORD CurrentStatus::getAcquisitionTime(void)const
|
|
{
|
|
return (double)mDataAquisitionTime1*Math::power(2,24)+(double)mDataAquisitionTime2*Math::power(2,16)+(double)mDataAquisitionTime3*Math::power(2,8)+(double)mDataAquisitionTime4;
|
|
}
|
|
#endif |