Newer
Older
Import / projects / Gameloft / core / Network / ClientConfig.h
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef __CLIENT_CONFIG_H__
#define __CLIENT_CONFIG_H__

#include "Utils/Serializer.h"

class ClientConfig : public SerializedBase
{
  JSON_SERIALIZED()

public:

  // internals
  inline const uint32_t     GetSvnRevision() const { return m_clientSvnRevision; }
  inline const std::string& GetClientId() const { return m_clientId; }
  inline const std::string& GetDeviceId() const { return m_deviceId; }
  void                      ExtractClientVersionsFromClientId(uint32_t & a_uiMaj, uint32_t & a_uiMin) const;
  inline const std::string& GetGameDbChecksum() const { return m_gameDbChecksum; }
  inline const bool         IsInactivityDetectionEnabled() const { return (m_allowClientInactivityDetection == 1); }

  // Set the gdid from gaia
  inline void SetDeviceId(const std::string& gdid) { m_deviceId = gdid; }

  // Set the local DB checksum
  inline void SetGameDbChecksum(const std::string& checksum) { m_gameDbChecksum = checksum; }

  inline const std::string & GetReportEmailAddress() const { return m_ReportEmailAddress; }

  inline bool GetSendServerTrace() const { return m_sendServerTrace; }

  // set the ISO 3166 Country code
  inline void SetCountryCode(const std::string& a_countryCode) { m_countryCode = a_countryCode; }
  inline const std::string& GetCountryCode() { return m_countryCode; }

protected:
  inline void SetSvnRevision(uint32_t a_uiRevision) { m_clientSvnRevision = a_uiRevision; }
  inline void SetClientId(const std::string & a_sClientId) { m_clientId = a_sClientId; }
  inline void SetClientEmailAddress(const std::string & a_sEmail) { m_ReportEmailAddress = a_sEmail; }
  inline void SetAllowClientInactivityDetection(uint32_t a_uiAllowClientInactivityDetection) { m_allowClientInactivityDetection = a_uiAllowClientInactivityDetection; }
  inline void SetSendServerTrace(bool a_bSend) { m_sendServerTrace = a_bSend; }

private:
  std::string m_clientId;
  std::string m_deviceId;

  // ISO 3166 Country code
  std::string m_countryCode; 

  std::string m_gameDbChecksum;
  std::string m_ReportEmailAddress;

  uint32_t m_clientSvnRevision = 0;
  uint32_t m_allowClientInactivityDetection = 1;
  bool m_sendServerTrace = false;
};

#endif //__CLIENT_CONFIG_H__

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////