1#pragma once
2
3#include <atomic>
4#include <mutex>
5#include <unordered_set>
6
7namespace mbgl {
8
9namespace util {
10class AsyncTask;
11} // namespace util
12
13class NetworkStatus {
14public:
15 enum class Status : uint8_t {
16 Online,
17 Offline,
18 };
19
20 static Status Get();
21 static void Set(Status);
22
23 static void Reachable();
24
25 static void Subscribe(util::AsyncTask* async);
26 static void Unsubscribe(util::AsyncTask* async);
27
28private:
29 static std::atomic<bool> online;
30 static std::mutex mtx;
31 static std::unordered_set<util::AsyncTask*> observers;
32};
33
34} // namespace mbgl
35

source code of qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/storage/network_status.hpp