Repository navigation
Expand file tree
/
Copy pathDekiWiFiPackage.cpp
More file actions
99 lines (86 loc) · 2.42 KB
/
Copy pathDekiWiFiPackage.cpp
File metadata and controls
99 lines (86 loc) · 2.42 KB
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
// Package entry point of deki-wifi.
#include "DekiWiFiPackage.h"
#include "DekiWiFi.h"
#include <deki/interop/Plugin.h>
#include <deki/LogSystem.h>
extern void DekiWiFiRegisterComponents();
extern int DekiWiFiGetAutoComponentCount();
extern const Deki::ComponentMeta* DekiWiFiGetAutoComponentMeta(int index);
namespace DekiWifi
{
#ifdef DEKI_EDITOR
#endif
static bool s_WiFiRegistered = false;
} // namespace DekiWifi
// The exports below are C symbols at global scope; the package's own
// registration helpers and statics live in its namespace.
using namespace DekiWifi;
extern "C"
{
DEKI_WIFI_API int DekiWiFiEnsureRegistered(void)
{
#ifdef DEKI_EDITOR
if (s_WiFiRegistered)
{
return ::DekiWiFiGetAutoComponentCount();
}
s_WiFiRegistered = true;
::DekiWiFiRegisterComponents();
return ::DekiWiFiGetAutoComponentCount();
#else
return 0;
#endif
}
DEKI_PLUGIN_API const char* DekiPluginGetName(void)
{
return "Deki WiFi Package";
}
DEKI_PLUGIN_API const char* DekiPluginGetVersion(void)
{
#ifdef DEKI_PACKAGE_VERSION
return DEKI_PACKAGE_VERSION;
#else
return "0.0.0-dev";
#endif
}
DEKI_PLUGIN_API int DekiPluginInit(void)
{
return 0;
}
DEKI_PLUGIN_API void DekiPluginShutdown(void)
{
// Clear the active driver, so a hot reload of the integration package
// that owns it leaves no dangling pointer to its vtable.
DekiWiFi::SetCurrent(nullptr);
s_WiFiRegistered = false;
}
#ifdef DEKI_EDITOR
DEKI_PLUGIN_API int DekiPluginGetComponentCount(void)
{
return ::DekiWiFiGetAutoComponentCount();
}
DEKI_PLUGIN_API const Deki::ComponentMeta* DekiPluginGetComponentMeta(int index)
{
return ::DekiWiFiGetAutoComponentMeta(index);
}
#else
DEKI_PLUGIN_API int DekiPluginGetComponentCount(void)
{
return 0;
}
DEKI_PLUGIN_API const Deki::ComponentMeta* DekiPluginGetComponentMeta(int)
{
return nullptr;
}
#endif
DEKI_PLUGIN_API void DekiPluginRegisterComponents(void)
{
#ifdef DEKI_EDITOR
DekiWiFiEnsureRegistered();
#endif
}
// This package holds only the IDekiWiFi interface and the
// SetCurrent/GetCurrent facade; it registers no driver of its own. The
// drivers live in the platform integration packages and call
// DekiWiFi::SetCurrent themselves.
} // extern "C"