16 #include <sys/types.h> 33 memset(&m_Log, 0,
sizeof(m_Log));
46 CloseWriteFile(kid, m_Log[kid]);
56 int64_t dataSize = (int64_t)log.
data.size();
63 if (m_directory.empty())
68 _MKDIR(m_directory.c_str());
72 int serNum = m_devInfo.serialNumber;
78 log.
fileName = GetNewFileName(serNum, log.
fileCount, m_kml.GetDatasetName(kid).c_str());
84 string iconScale =
"0.5";
85 string labelScale =
"0.5";
88 if (m_showPointTimestamps)
94 if(m_altClampToGround)
95 altitudeMode =
"clampToGround";
97 altitudeMode =
"absolute";
100 string styleStr, colorStr;
102 iconUrl =
"http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png";
109 iconUrl =
"http://earth.google.com/images/kml-icons/track-directional/track-0.png";
110 colorStr =
"ff00ffff";
113 colorStr =
"ff0000ff";
116 colorStr =
"ffff0000";
119 colorStr =
"ffffff00";
122 iconUrl =
"http://earth.google.com/images/kml-icons/track-directional/track-0.png";
123 colorStr =
"ffff00ff";
129 *Style, *LineStyle, *IconStyle, *LabelStyle,
130 *Placemark, *
Point, *LineString,
144 kml->
SetAttribute(
"xmlns",
"http://www.opengis.net/kml/2.2");
145 kml->
SetAttribute(
"xmlns:gx",
"http://www.google.com/kml/ext/2.2");
151 styleStr = string(
"stylesel_");
196 double nextTime = log.
data[0].time;
197 for (
size_t i = 0; i < log.
data.size(); i++)
202 if (item.
time < nextTime)
206 nextTime = item.
time - fmod(item.
time, m_pointUpdatePeriodSec) + m_pointUpdatePeriodSec;
214 ostringstream timeStream;
221 timeStream << fixed << setprecision(1) << item.
time;
224 timeStream << fixed << setprecision(3) << item.
time;
232 if (item.
theta[2] != 0.0f)
234 string styleCntStr = styleStr + to_string(styleCnt++);
255 double alt =
_CLAMP(item.
lla[2], -1000, 100000);
259 ostringstream coordinateStream;
263 << item->
lla[1] <<
"," 264 << item->
lla[0] <<
"," 266 << item->
lla[2] <<
" ";
282 styleStr = string(
"stylesel_") + to_string(styleCnt++);
322 ostringstream coordinateStream;
324 for (
size_t i = 0; i < log.
data.size(); i++)
329 double alt =
_CLAMP(item.
lla[2], -1000, 100000);
331 if (i >= log.
data.size()-2)
343 coordinateStream << string(buf);
375 #if PLATFORM_IS_WINDOWS 386 std::wstring stemp = std::wstring(log.
fileName.begin(), log.
fileName.end());
388 ShellExecuteW(0, 0, filename, 0, 0, SW_SHOW);
402 if (!WriteDateToFile(dataHdr, dataBuf))
422 if (!WriteDateToFile(&dHdr, (uint8_t*)&ins1))
447 m_kml.WriteDataToFile(log.
data, dataHdr, dataBuf);
458 if (!CloseWriteFile(kid, log))
473 while (!(data = ReadDataFromChunk()))
476 if (!ReadChunkFromFile())
502 m_devInfo.serialNumber = serialNumber;
void OnReadData(p_data_t *data)
virtual bool CloseAllFiles()
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
p_data_t * ReadDataFromChunk()
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null if not of the requested type.
void SetSerialNumber(uint32_t serialNumber) OVERRIDE
void InitDeviceForWriting(int pHandle, std::string timestamp, std::string directory, uint64_t maxDiskSpace, uint32_t maxFileSize) OVERRIDE
void SetValue(const char *_value)
std::vector< sKmlLogData > data
TiXmlNode * LinkEndChild(TiXmlNode *addThis)
bool SaveFile() const
Save a file using the current document value. Returns true if successful.
virtual bool SaveData(p_data_hdr_t *dataHdr, const uint8_t *dataBuf)
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
bool WriteDateToFile(const p_data_hdr_t *dataHdr, const uint8_t *dataBuf)
bool CloseAllFiles() OVERRIDE
void SetAttribute(const char *name, const char *_value)
virtual void InitDeviceForWriting(int pHandle, string timestamp, string directory, uint64_t maxDiskSpace, uint32_t maxFileSize)
static int DID_TO_KID(int did)
bool SaveData(p_data_hdr_t *dataHdr, const uint8_t *dataBuf) OVERRIDE
#define _CLAMP(v, minV, maxV)
USBInterfaceDescriptor data
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
virtual TiXmlNode * Clone() const
Creates a new Element and returns it - the returned element is a copy.
bool CloseWriteFile(int kid, sKmlLog &log)
p_data_t * ReadData() OVERRIDE
bool OpenWithSystemApp(void) OVERRIDE
static int BYTES_PER_KID(int kid)