Welcome to mirror list, hosted at ThFree Co, Russian Federation.

platform_tizen.cpp « platform - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7c4001e7599f7d4788646f7326e12536f0fe5ede (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#include "platform.hpp"
#include "constants.hpp"
#include "platform_unix_impl.hpp"
#include "tizen_utils.hpp"
#include "http_thread_tizen.hpp"

#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>

#include "coding/file_reader.hpp"

#include "base/logging.hpp"

#include <FAppApp.h>
#include "tizen/inc/FIo.hpp"


Platform::Platform()
{
  Tizen::App::App * pApp = Tizen::App::App::GetInstance();
  // init directories
  string app_root = FromTizenString(pApp->GetAppRootPath());

  m_writableDir = FromTizenString(pApp->GetAppDataPath());
  m_resourcesDir = FromTizenString(pApp->GetAppResourcePath());
  m_settingsDir = m_writableDir + "settings/";
  Tizen::Io::Directory::Create(m_settingsDir.c_str(), true);

  m_tmpDir = m_writableDir + "tmp/";
  Tizen::Io::Directory::Create(m_tmpDir.c_str(), true);

  LOG(LDEBUG, ("App directory:", app_root));
  LOG(LDEBUG, ("Resources directory:", m_resourcesDir));
  LOG(LDEBUG, ("Writable directory:", m_writableDir));
  LOG(LDEBUG, ("Tmp directory:", m_tmpDir));
  LOG(LDEBUG, ("Settings directory:", m_settingsDir));
  LOG(LDEBUG, ("Client ID:", UniqueClientId()));

  m_flags[HAS_BOOKMARKS] = true;
  m_flags[HAS_ROTATION] = true;
  m_flags[HAS_ROUTING] = true;
}

void Platform::MkDir(string const & dirName) const
{
  Tizen::Io::Directory::Create(dirName.c_str(), true);
}

string Platform::UniqueClientId() const
{
  Tizen::App::App * pApp = Tizen::App::App::GetInstance();
  return FromTizenString(pApp->GetAppId());
}

void Platform::RunOnGuiThread(TFunctor const & fn)
{
  /// @todo
  fn();
}

void Platform::RunAsync(TFunctor const & fn, Priority p)
{
  /// @todo
  fn();
}

ModelReader * Platform::GetReader(string const & file, string const & searchScope) const
{
  return new FileReader(ReadPathForFile(file, searchScope),
                        READER_CHUNK_LOG_SIZE, READER_CHUNK_LOG_COUNT);
}

void Platform::GetFilesByRegExp(string const & directory, string const & regexp, FilesList & res)
{
  pl::EnumerateFilesByRegExp(directory, regexp, res);
}

bool Platform::GetFileSizeByName(string const & fileName, uint64_t & size) const
{
  try
  {
    return GetFileSizeByFullPath(ReadPathForFile(fileName), size);
  }
  catch (RootException const &)
  {
    return false;
  }
}

int Platform::VideoMemoryLimit() const
{
  return 10 * 1024 * 1024;
}

int Platform::PreCachingDepth() const
{
  return 3;
}

Platform::EConnectionType Platform::ConnectionStatus()
{
  // @TODO Add implementation
  return EConnectionType::CONNECTION_NONE;
}

void Platform::GetSystemFontNames(FilesList & res) const
{
}

extern Platform & GetPlatform()
{
  static Platform platform;
  return platform;
}

class HttpThread;

namespace downloader
{

class IHttpThreadCallback;

HttpThread * CreateNativeHttpThread(string const & url,
                                    downloader::IHttpThreadCallback & cb,
                                    int64_t beg,
                                    int64_t end,
                                    int64_t size,
                                    string const & pb)
{
  HttpThread * pRes = new HttpThread(url, cb, beg, end, size, pb);
  return pRes;
}

void DeleteNativeHttpThread(HttpThread * request)
{
  delete request;
}

}