-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDekiWiFiModule.cpp
More file actions
80 lines (68 loc) · 2.37 KB
/
Copy pathDekiWiFiModule.cpp
File metadata and controls
80 lines (68 loc) · 2.37 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
#include "DekiWiFiModule.h"
#include "DekiWiFi.h"
#include "interop/DekiPlugin.h"
#include "DekiLogSystem.h"
#ifdef DEKI_EDITOR
extern void DekiWiFi_RegisterComponents();
extern int DekiWiFi_GetAutoComponentCount();
extern const DekiComponentMeta* DekiWiFi_GetAutoComponentMeta(int index);
#endif
static bool s_WiFiRegistered = false;
extern "C" {
DEKI_WIFI_API int DekiWiFi_EnsureRegistered(void)
{
#ifdef DEKI_EDITOR
if (s_WiFiRegistered) return DekiWiFi_GetAutoComponentCount();
s_WiFiRegistered = true;
DekiWiFi_RegisterComponents();
return DekiWiFi_GetAutoComponentCount();
#else
return 0;
#endif
}
DEKI_PLUGIN_API const char* DekiPlugin_GetName(void) { return "Deki WiFi Module"; }
DEKI_PLUGIN_API const char* DekiPlugin_GetVersion(void)
{
#ifdef DEKI_MODULE_VERSION
return DEKI_MODULE_VERSION;
#else
return "0.0.0-dev";
#endif
}
DEKI_PLUGIN_API const char* DekiPlugin_GetReflectionJson(void) { return "{}"; }
DEKI_PLUGIN_API int DekiPlugin_Init(void)
{
DEKI_LOG_INFO("[deki-wifi] DekiPlugin_Init");
return 0;
}
DEKI_PLUGIN_API void DekiPlugin_Shutdown(void)
{
// Null the active driver so a hot-reload of the integration module that
// owns it doesn't leave a dangling pointer to its vtable.
DekiWiFi::SetCurrent(nullptr);
s_WiFiRegistered = false;
}
#ifdef DEKI_EDITOR
DEKI_PLUGIN_API int DekiPlugin_GetComponentCount(void) { return DekiWiFi_GetAutoComponentCount(); }
DEKI_PLUGIN_API const DekiComponentMeta* DekiPlugin_GetComponentMeta(int index)
{
return DekiWiFi_GetAutoComponentMeta(index);
}
#else
DEKI_PLUGIN_API int DekiPlugin_GetComponentCount(void) { return 0; }
DEKI_PLUGIN_API const DekiComponentMeta* DekiPlugin_GetComponentMeta(int) { return nullptr; }
#endif
DEKI_PLUGIN_API void DekiPlugin_RegisterComponents(void)
{
#ifdef DEKI_EDITOR
int n = DekiWiFi_EnsureRegistered();
DEKI_LOG_INFO("[deki-wifi] DekiPlugin_RegisterComponents -> %d component(s)", n);
#endif
}
DEKI_PLUGIN_API int DekiPlugin_GetFeatureCount(void) { return 0; }
DEKI_PLUGIN_API const struct DekiModuleFeatureInfo* DekiPlugin_GetFeature(int) { return nullptr; }
// No providers registered here — this module owns only the interface and
// the SetCurrent/GetCurrent facade. Concrete drivers live in platform
// integration modules and call DekiWiFi::SetCurrent themselves.
DEKI_PLUGIN_API void DekiPlugin_RegisterModules(void) {}
} // extern "C"