57 lines
1.6 KiB
C++
Executable File
57 lines
1.6 KiB
C++
Executable File
// **************************************************************************
|
|
//
|
|
// (C) Copyright 2009 Swiss SIMTEC AG
|
|
//
|
|
// **************************************************************************
|
|
//
|
|
// $HeadURL$
|
|
// $LastChangedBy$
|
|
// $LastChangedDate$
|
|
// $LastChangedRevision$
|
|
//
|
|
// **************************************************************************
|
|
|
|
// manual class headers
|
|
#include "GeoPairingDataBase.hpp"
|
|
#include "../logger.h"
|
|
|
|
namespace N_GeoPairingImpl
|
|
{
|
|
|
|
GeoPairingDataBase::GeoPairingDataBase(const char *loggerName)
|
|
: m_logger(CesGeoPairing::getLogger(loggerName ? loggerName : "GeoPairingDataBase"))
|
|
{
|
|
}
|
|
|
|
// ---------------------------------------------------------------
|
|
// This function parses a data stream
|
|
// ---------------------------------------------------------------
|
|
bool GeoPairingDataBase::parse(const QByteArray& a_transparentData)
|
|
{
|
|
const int startMessageId = 0;
|
|
//const int lenMessageId = 1;
|
|
const int startDevice = 1;
|
|
//const int lenDevice = 1;
|
|
|
|
if (a_transparentData.size() < m_Size)
|
|
{
|
|
ERROR_LOG(m_logger) << "Size of transparent Data not valid :" << a_transparentData.size()
|
|
<< " instead of " << m_Size;
|
|
return false;
|
|
}
|
|
|
|
m_MessageID = a_transparentData[startMessageId];
|
|
int messageId = m_MessageID;
|
|
INFO_LOG(m_logger) << "Header -> MessageID : " << messageId;
|
|
|
|
UInt8 deviceId;
|
|
deviceId = a_transparentData[startDevice];
|
|
|
|
m_DeviceID = static_cast<PanGeoPairingDeviceId>(deviceId);
|
|
INFO_LOG(m_logger) << "Header -> DeviceID : " << m_DeviceID;
|
|
|
|
return true;
|
|
}
|
|
|
|
} // namespace N_GeoPairingImpl
|