react-native-nitro-pose-exercises 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/NitroPoseExercises.podspec +32 -0
- package/README.md +538 -0
- package/android/CMakeLists.txt +31 -0
- package/android/build.gradle +121 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +11 -0
- package/android/src/main/java/com/margelo/nitro/nitroposeexercises/NitroPoseExercises.kt +535 -0
- package/android/src/main/java/com/margelo/nitro/nitroposeexercises/NitroPoseExercisesPackage.kt +22 -0
- package/ios/NitroPoseExercises.swift +527 -0
- package/lib/module/NitroPoseExercises.nitro.js +17 -0
- package/lib/module/NitroPoseExercises.nitro.js.map +1 -0
- package/lib/module/config/pushup.js +71 -0
- package/lib/module/config/pushup.js.map +1 -0
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NitroPoseExercises.nitro.d.ts +97 -0
- package/lib/typescript/src/NitroPoseExercises.nitro.d.ts.map +1 -0
- package/lib/typescript/src/config/pushup.d.ts +3 -0
- package/lib/typescript/src/config/pushup.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/android/c++/JAngleDefinition.hpp +69 -0
- package/nitrogen/generated/android/c++/JAngleSnapshot.hpp +61 -0
- package/nitrogen/generated/android/c++/JExerciseConfig.hpp +166 -0
- package/nitrogen/generated/android/c++/JExercisePhase.hpp +67 -0
- package/nitrogen/generated/android/c++/JExerciseType.hpp +61 -0
- package/nitrogen/generated/android/c++/JFormFeedback.hpp +67 -0
- package/nitrogen/generated/android/c++/JFormRule.hpp +79 -0
- package/nitrogen/generated/android/c++/JFormSeverity.hpp +61 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_ExercisePhase.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_FormFeedback.hpp +80 -0
- package/nitrogen/generated/android/c++/JFunc_void_HoldProgress.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_RepData.hpp +81 -0
- package/nitrogen/generated/android/c++/JFunc_void_SessionResult.hpp +85 -0
- package/nitrogen/generated/android/c++/JHoldProgress.hpp +65 -0
- package/nitrogen/generated/android/c++/JHybridNitroPoseExercisesSpec.cpp +311 -0
- package/nitrogen/generated/android/c++/JHybridNitroPoseExercisesSpec.hpp +87 -0
- package/nitrogen/generated/android/c++/JLandmark.hpp +69 -0
- package/nitrogen/generated/android/c++/JPhaseThreshold.hpp +71 -0
- package/nitrogen/generated/android/c++/JRepData.hpp +90 -0
- package/nitrogen/generated/android/c++/JSessionResult.hpp +120 -0
- package/nitrogen/generated/android/c++/JSessionStatus.hpp +67 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/AngleDefinition.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/AngleSnapshot.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/ExerciseConfig.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/ExercisePhase.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/ExerciseType.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/FormFeedback.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/FormRule.kt +76 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/FormSeverity.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/Func_void.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/Func_void_ExercisePhase.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/Func_void_FormFeedback.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/Func_void_HoldProgress.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/Func_void_RepData.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/Func_void_SessionResult.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/HoldProgress.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/HybridNitroPoseExercisesSpec.kt +196 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/Landmark.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/PhaseThreshold.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/RepData.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/SessionResult.kt +76 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/SessionStatus.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/nitroposeexercisesOnLoad.kt +35 -0
- package/nitrogen/generated/android/nitroposeexercises+autolinking.cmake +81 -0
- package/nitrogen/generated/android/nitroposeexercises+autolinking.gradle +27 -0
- package/nitrogen/generated/android/nitroposeexercisesOnLoad.cpp +66 -0
- package/nitrogen/generated/android/nitroposeexercisesOnLoad.hpp +34 -0
- package/nitrogen/generated/ios/NitroPoseExercises+autolinking.rb +62 -0
- package/nitrogen/generated/ios/NitroPoseExercises-Swift-Cxx-Bridge.cpp +100 -0
- package/nitrogen/generated/ios/NitroPoseExercises-Swift-Cxx-Bridge.hpp +449 -0
- package/nitrogen/generated/ios/NitroPoseExercises-Swift-Cxx-Umbrella.hpp +95 -0
- package/nitrogen/generated/ios/NitroPoseExercisesAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NitroPoseExercisesAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridNitroPoseExercisesSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroPoseExercisesSpecSwift.hpp +236 -0
- package/nitrogen/generated/ios/swift/AngleDefinition.swift +44 -0
- package/nitrogen/generated/ios/swift/AngleSnapshot.swift +34 -0
- package/nitrogen/generated/ios/swift/ExerciseConfig.swift +83 -0
- package/nitrogen/generated/ios/swift/ExercisePhase.swift +52 -0
- package/nitrogen/generated/ios/swift/ExerciseType.swift +44 -0
- package/nitrogen/generated/ios/swift/FormFeedback.swift +39 -0
- package/nitrogen/generated/ios/swift/FormRule.swift +54 -0
- package/nitrogen/generated/ios/swift/FormSeverity.swift +44 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_ExercisePhase.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_FormFeedback.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_HoldProgress.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_RepData.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_SessionResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/HoldProgress.swift +39 -0
- package/nitrogen/generated/ios/swift/HybridNitroPoseExercisesSpec.swift +73 -0
- package/nitrogen/generated/ios/swift/HybridNitroPoseExercisesSpec_cxx.swift +483 -0
- package/nitrogen/generated/ios/swift/Landmark.swift +44 -0
- package/nitrogen/generated/ios/swift/PhaseThreshold.swift +44 -0
- package/nitrogen/generated/ios/swift/RepData.swift +50 -0
- package/nitrogen/generated/ios/swift/SessionResult.swift +66 -0
- package/nitrogen/generated/ios/swift/SessionStatus.swift +52 -0
- package/nitrogen/generated/shared/c++/AngleDefinition.hpp +95 -0
- package/nitrogen/generated/shared/c++/AngleSnapshot.hpp +87 -0
- package/nitrogen/generated/shared/c++/ExerciseConfig.hpp +122 -0
- package/nitrogen/generated/shared/c++/ExercisePhase.hpp +88 -0
- package/nitrogen/generated/shared/c++/ExerciseType.hpp +80 -0
- package/nitrogen/generated/shared/c++/FormFeedback.hpp +93 -0
- package/nitrogen/generated/shared/c++/FormRule.hpp +105 -0
- package/nitrogen/generated/shared/c++/FormSeverity.hpp +80 -0
- package/nitrogen/generated/shared/c++/HoldProgress.hpp +91 -0
- package/nitrogen/generated/shared/c++/HybridNitroPoseExercisesSpec.cpp +46 -0
- package/nitrogen/generated/shared/c++/HybridNitroPoseExercisesSpec.hpp +117 -0
- package/nitrogen/generated/shared/c++/Landmark.hpp +95 -0
- package/nitrogen/generated/shared/c++/PhaseThreshold.hpp +97 -0
- package/nitrogen/generated/shared/c++/RepData.hpp +97 -0
- package/nitrogen/generated/shared/c++/SessionResult.hpp +108 -0
- package/nitrogen/generated/shared/c++/SessionStatus.hpp +88 -0
- package/package.json +187 -0
- package/src/NitroPoseExercises.nitro.ts +155 -0
- package/src/config/pushup.ts +62 -0
- package/src/index.tsx +28 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// FormRule.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `FormSeverity` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::nitroposeexercises { enum class FormSeverity; }
|
|
33
|
+
|
|
34
|
+
#include <string>
|
|
35
|
+
#include "FormSeverity.hpp"
|
|
36
|
+
|
|
37
|
+
namespace margelo::nitro::nitroposeexercises {
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A struct which can be represented as a JavaScript object (FormRule).
|
|
41
|
+
*/
|
|
42
|
+
struct FormRule final {
|
|
43
|
+
public:
|
|
44
|
+
std::string name SWIFT_PRIVATE;
|
|
45
|
+
std::string message SWIFT_PRIVATE;
|
|
46
|
+
FormSeverity severity SWIFT_PRIVATE;
|
|
47
|
+
std::string angleName SWIFT_PRIVATE;
|
|
48
|
+
double minAngle SWIFT_PRIVATE;
|
|
49
|
+
double maxAngle SWIFT_PRIVATE;
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
FormRule() = default;
|
|
53
|
+
explicit FormRule(std::string name, std::string message, FormSeverity severity, std::string angleName, double minAngle, double maxAngle): name(name), message(message), severity(severity), angleName(angleName), minAngle(minAngle), maxAngle(maxAngle) {}
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
friend bool operator==(const FormRule& lhs, const FormRule& rhs) = default;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
} // namespace margelo::nitro::nitroposeexercises
|
|
60
|
+
|
|
61
|
+
namespace margelo::nitro {
|
|
62
|
+
|
|
63
|
+
// C++ FormRule <> JS FormRule (object)
|
|
64
|
+
template <>
|
|
65
|
+
struct JSIConverter<margelo::nitro::nitroposeexercises::FormRule> final {
|
|
66
|
+
static inline margelo::nitro::nitroposeexercises::FormRule fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
67
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
68
|
+
return margelo::nitro::nitroposeexercises::FormRule(
|
|
69
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))),
|
|
70
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "message"))),
|
|
71
|
+
JSIConverter<margelo::nitro::nitroposeexercises::FormSeverity>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "severity"))),
|
|
72
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "angleName"))),
|
|
73
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minAngle"))),
|
|
74
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxAngle")))
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroposeexercises::FormRule& arg) {
|
|
78
|
+
jsi::Object obj(runtime);
|
|
79
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter<std::string>::toJSI(runtime, arg.name));
|
|
80
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "message"), JSIConverter<std::string>::toJSI(runtime, arg.message));
|
|
81
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "severity"), JSIConverter<margelo::nitro::nitroposeexercises::FormSeverity>::toJSI(runtime, arg.severity));
|
|
82
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "angleName"), JSIConverter<std::string>::toJSI(runtime, arg.angleName));
|
|
83
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "minAngle"), JSIConverter<double>::toJSI(runtime, arg.minAngle));
|
|
84
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "maxAngle"), JSIConverter<double>::toJSI(runtime, arg.maxAngle));
|
|
85
|
+
return obj;
|
|
86
|
+
}
|
|
87
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
88
|
+
if (!value.isObject()) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
jsi::Object obj = value.getObject(runtime);
|
|
92
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false;
|
|
96
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "message")))) return false;
|
|
97
|
+
if (!JSIConverter<margelo::nitro::nitroposeexercises::FormSeverity>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "severity")))) return false;
|
|
98
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "angleName")))) return false;
|
|
99
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minAngle")))) return false;
|
|
100
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxAngle")))) return false;
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// FormSeverity.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::nitroposeexercises {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (FormSeverity).
|
|
30
|
+
*/
|
|
31
|
+
enum class FormSeverity {
|
|
32
|
+
INFO SWIFT_NAME(info) = 0,
|
|
33
|
+
WARNING SWIFT_NAME(warning) = 1,
|
|
34
|
+
ERROR SWIFT_NAME(error) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::nitroposeexercises
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ FormSeverity <> JS FormSeverity (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::nitroposeexercises::FormSeverity> final {
|
|
44
|
+
static inline margelo::nitro::nitroposeexercises::FormSeverity fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
46
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
47
|
+
case hashString("info"): return margelo::nitro::nitroposeexercises::FormSeverity::INFO;
|
|
48
|
+
case hashString("warning"): return margelo::nitro::nitroposeexercises::FormSeverity::WARNING;
|
|
49
|
+
case hashString("error"): return margelo::nitro::nitroposeexercises::FormSeverity::ERROR;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum FormSeverity - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitroposeexercises::FormSeverity arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::nitroposeexercises::FormSeverity::INFO: return JSIConverter<std::string>::toJSI(runtime, "info");
|
|
57
|
+
case margelo::nitro::nitroposeexercises::FormSeverity::WARNING: return JSIConverter<std::string>::toJSI(runtime, "warning");
|
|
58
|
+
case margelo::nitro::nitroposeexercises::FormSeverity::ERROR: return JSIConverter<std::string>::toJSI(runtime, "error");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert FormSeverity to JS - invalid value: "
|
|
61
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isString()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
69
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
70
|
+
case hashString("info"):
|
|
71
|
+
case hashString("warning"):
|
|
72
|
+
case hashString("error"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HoldProgress.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::nitroposeexercises {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (HoldProgress).
|
|
39
|
+
*/
|
|
40
|
+
struct HoldProgress final {
|
|
41
|
+
public:
|
|
42
|
+
double elapsedMs SWIFT_PRIVATE;
|
|
43
|
+
double targetMs SWIFT_PRIVATE;
|
|
44
|
+
double stability SWIFT_PRIVATE;
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
HoldProgress() = default;
|
|
48
|
+
explicit HoldProgress(double elapsedMs, double targetMs, double stability): elapsedMs(elapsedMs), targetMs(targetMs), stability(stability) {}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
friend bool operator==(const HoldProgress& lhs, const HoldProgress& rhs) = default;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::nitroposeexercises
|
|
55
|
+
|
|
56
|
+
namespace margelo::nitro {
|
|
57
|
+
|
|
58
|
+
// C++ HoldProgress <> JS HoldProgress (object)
|
|
59
|
+
template <>
|
|
60
|
+
struct JSIConverter<margelo::nitro::nitroposeexercises::HoldProgress> final {
|
|
61
|
+
static inline margelo::nitro::nitroposeexercises::HoldProgress fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
62
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
63
|
+
return margelo::nitro::nitroposeexercises::HoldProgress(
|
|
64
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "elapsedMs"))),
|
|
65
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "targetMs"))),
|
|
66
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "stability")))
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroposeexercises::HoldProgress& arg) {
|
|
70
|
+
jsi::Object obj(runtime);
|
|
71
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "elapsedMs"), JSIConverter<double>::toJSI(runtime, arg.elapsedMs));
|
|
72
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "targetMs"), JSIConverter<double>::toJSI(runtime, arg.targetMs));
|
|
73
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "stability"), JSIConverter<double>::toJSI(runtime, arg.stability));
|
|
74
|
+
return obj;
|
|
75
|
+
}
|
|
76
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
77
|
+
if (!value.isObject()) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
jsi::Object obj = value.getObject(runtime);
|
|
81
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "elapsedMs")))) return false;
|
|
85
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "targetMs")))) return false;
|
|
86
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "stability")))) return false;
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroPoseExercisesSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridNitroPoseExercisesSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitroposeexercises {
|
|
11
|
+
|
|
12
|
+
void HybridNitroPoseExercisesSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridGetter("status", &HybridNitroPoseExercisesSpec::getStatus);
|
|
18
|
+
prototype.registerHybridGetter("onRepComplete", &HybridNitroPoseExercisesSpec::getOnRepComplete);
|
|
19
|
+
prototype.registerHybridSetter("onRepComplete", &HybridNitroPoseExercisesSpec::setOnRepComplete);
|
|
20
|
+
prototype.registerHybridGetter("onPhaseChange", &HybridNitroPoseExercisesSpec::getOnPhaseChange);
|
|
21
|
+
prototype.registerHybridSetter("onPhaseChange", &HybridNitroPoseExercisesSpec::setOnPhaseChange);
|
|
22
|
+
prototype.registerHybridGetter("onFormFeedback", &HybridNitroPoseExercisesSpec::getOnFormFeedback);
|
|
23
|
+
prototype.registerHybridSetter("onFormFeedback", &HybridNitroPoseExercisesSpec::setOnFormFeedback);
|
|
24
|
+
prototype.registerHybridGetter("onHoldProgress", &HybridNitroPoseExercisesSpec::getOnHoldProgress);
|
|
25
|
+
prototype.registerHybridSetter("onHoldProgress", &HybridNitroPoseExercisesSpec::setOnHoldProgress);
|
|
26
|
+
prototype.registerHybridGetter("onPoseLost", &HybridNitroPoseExercisesSpec::getOnPoseLost);
|
|
27
|
+
prototype.registerHybridSetter("onPoseLost", &HybridNitroPoseExercisesSpec::setOnPoseLost);
|
|
28
|
+
prototype.registerHybridGetter("onPoseRegained", &HybridNitroPoseExercisesSpec::getOnPoseRegained);
|
|
29
|
+
prototype.registerHybridSetter("onPoseRegained", &HybridNitroPoseExercisesSpec::setOnPoseRegained);
|
|
30
|
+
prototype.registerHybridGetter("onSessionComplete", &HybridNitroPoseExercisesSpec::getOnSessionComplete);
|
|
31
|
+
prototype.registerHybridSetter("onSessionComplete", &HybridNitroPoseExercisesSpec::setOnSessionComplete);
|
|
32
|
+
prototype.registerHybridGetter("currentPhase", &HybridNitroPoseExercisesSpec::getCurrentPhase);
|
|
33
|
+
prototype.registerHybridGetter("repCount", &HybridNitroPoseExercisesSpec::getRepCount);
|
|
34
|
+
prototype.registerHybridGetter("landmarks", &HybridNitroPoseExercisesSpec::getLandmarks);
|
|
35
|
+
prototype.registerHybridMethod("initialize", &HybridNitroPoseExercisesSpec::initialize);
|
|
36
|
+
prototype.registerHybridMethod("release", &HybridNitroPoseExercisesSpec::release);
|
|
37
|
+
prototype.registerHybridMethod("loadExercise", &HybridNitroPoseExercisesSpec::loadExercise);
|
|
38
|
+
prototype.registerHybridMethod("processFrame", &HybridNitroPoseExercisesSpec::processFrame);
|
|
39
|
+
prototype.registerHybridMethod("startSession", &HybridNitroPoseExercisesSpec::startSession);
|
|
40
|
+
prototype.registerHybridMethod("pauseSession", &HybridNitroPoseExercisesSpec::pauseSession);
|
|
41
|
+
prototype.registerHybridMethod("resumeSession", &HybridNitroPoseExercisesSpec::resumeSession);
|
|
42
|
+
prototype.registerHybridMethod("stopSession", &HybridNitroPoseExercisesSpec::stopSession);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
} // namespace margelo::nitro::nitroposeexercises
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroPoseExercisesSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `SessionStatus` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::nitroposeexercises { enum class SessionStatus; }
|
|
18
|
+
// Forward declaration of `RepData` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::nitroposeexercises { struct RepData; }
|
|
20
|
+
// Forward declaration of `ExercisePhase` to properly resolve imports.
|
|
21
|
+
namespace margelo::nitro::nitroposeexercises { enum class ExercisePhase; }
|
|
22
|
+
// Forward declaration of `FormFeedback` to properly resolve imports.
|
|
23
|
+
namespace margelo::nitro::nitroposeexercises { struct FormFeedback; }
|
|
24
|
+
// Forward declaration of `HoldProgress` to properly resolve imports.
|
|
25
|
+
namespace margelo::nitro::nitroposeexercises { struct HoldProgress; }
|
|
26
|
+
// Forward declaration of `SessionResult` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::nitroposeexercises { struct SessionResult; }
|
|
28
|
+
// Forward declaration of `Landmark` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::nitroposeexercises { struct Landmark; }
|
|
30
|
+
// Forward declaration of `ExerciseConfig` to properly resolve imports.
|
|
31
|
+
namespace margelo::nitro::nitroposeexercises { struct ExerciseConfig; }
|
|
32
|
+
// Forward declaration of `HybridFrameSpec` to properly resolve imports.
|
|
33
|
+
namespace margelo::nitro::camera { class HybridFrameSpec; }
|
|
34
|
+
|
|
35
|
+
#include "SessionStatus.hpp"
|
|
36
|
+
#include "RepData.hpp"
|
|
37
|
+
#include <functional>
|
|
38
|
+
#include <optional>
|
|
39
|
+
#include "ExercisePhase.hpp"
|
|
40
|
+
#include "FormFeedback.hpp"
|
|
41
|
+
#include "HoldProgress.hpp"
|
|
42
|
+
#include "SessionResult.hpp"
|
|
43
|
+
#include "Landmark.hpp"
|
|
44
|
+
#include <vector>
|
|
45
|
+
#include <NitroModules/Promise.hpp>
|
|
46
|
+
#include <string>
|
|
47
|
+
#include "ExerciseConfig.hpp"
|
|
48
|
+
#include <memory>
|
|
49
|
+
#include <VisionCamera/HybridFrameSpec.hpp>
|
|
50
|
+
|
|
51
|
+
namespace margelo::nitro::nitroposeexercises {
|
|
52
|
+
|
|
53
|
+
using namespace margelo::nitro;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* An abstract base class for `NitroPoseExercises`
|
|
57
|
+
* Inherit this class to create instances of `HybridNitroPoseExercisesSpec` in C++.
|
|
58
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
59
|
+
* @example
|
|
60
|
+
* ```cpp
|
|
61
|
+
* class HybridNitroPoseExercises: public HybridNitroPoseExercisesSpec {
|
|
62
|
+
* public:
|
|
63
|
+
* HybridNitroPoseExercises(...): HybridObject(TAG) { ... }
|
|
64
|
+
* // ...
|
|
65
|
+
* };
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
class HybridNitroPoseExercisesSpec: public virtual HybridObject {
|
|
69
|
+
public:
|
|
70
|
+
// Constructor
|
|
71
|
+
explicit HybridNitroPoseExercisesSpec(): HybridObject(TAG) { }
|
|
72
|
+
|
|
73
|
+
// Destructor
|
|
74
|
+
~HybridNitroPoseExercisesSpec() override = default;
|
|
75
|
+
|
|
76
|
+
public:
|
|
77
|
+
// Properties
|
|
78
|
+
virtual SessionStatus getStatus() = 0;
|
|
79
|
+
virtual std::optional<std::function<void(const RepData& /* data */)>> getOnRepComplete() = 0;
|
|
80
|
+
virtual void setOnRepComplete(const std::optional<std::function<void(const RepData& /* data */)>>& onRepComplete) = 0;
|
|
81
|
+
virtual std::optional<std::function<void(ExercisePhase /* phase */)>> getOnPhaseChange() = 0;
|
|
82
|
+
virtual void setOnPhaseChange(const std::optional<std::function<void(ExercisePhase /* phase */)>>& onPhaseChange) = 0;
|
|
83
|
+
virtual std::optional<std::function<void(const FormFeedback& /* feedback */)>> getOnFormFeedback() = 0;
|
|
84
|
+
virtual void setOnFormFeedback(const std::optional<std::function<void(const FormFeedback& /* feedback */)>>& onFormFeedback) = 0;
|
|
85
|
+
virtual std::optional<std::function<void(const HoldProgress& /* progress */)>> getOnHoldProgress() = 0;
|
|
86
|
+
virtual void setOnHoldProgress(const std::optional<std::function<void(const HoldProgress& /* progress */)>>& onHoldProgress) = 0;
|
|
87
|
+
virtual std::optional<std::function<void()>> getOnPoseLost() = 0;
|
|
88
|
+
virtual void setOnPoseLost(const std::optional<std::function<void()>>& onPoseLost) = 0;
|
|
89
|
+
virtual std::optional<std::function<void()>> getOnPoseRegained() = 0;
|
|
90
|
+
virtual void setOnPoseRegained(const std::optional<std::function<void()>>& onPoseRegained) = 0;
|
|
91
|
+
virtual std::optional<std::function<void(const SessionResult& /* result */)>> getOnSessionComplete() = 0;
|
|
92
|
+
virtual void setOnSessionComplete(const std::optional<std::function<void(const SessionResult& /* result */)>>& onSessionComplete) = 0;
|
|
93
|
+
virtual ExercisePhase getCurrentPhase() = 0;
|
|
94
|
+
virtual double getRepCount() = 0;
|
|
95
|
+
virtual std::vector<Landmark> getLandmarks() = 0;
|
|
96
|
+
|
|
97
|
+
public:
|
|
98
|
+
// Methods
|
|
99
|
+
virtual std::shared_ptr<Promise<void>> initialize(const std::string& modelPath) = 0;
|
|
100
|
+
virtual void release() = 0;
|
|
101
|
+
virtual void loadExercise(const ExerciseConfig& config) = 0;
|
|
102
|
+
virtual void processFrame(const std::shared_ptr<margelo::nitro::camera::HybridFrameSpec>& frame) = 0;
|
|
103
|
+
virtual void startSession(double targetReps, double countdownSeconds) = 0;
|
|
104
|
+
virtual void pauseSession() = 0;
|
|
105
|
+
virtual void resumeSession() = 0;
|
|
106
|
+
virtual void stopSession() = 0;
|
|
107
|
+
|
|
108
|
+
protected:
|
|
109
|
+
// Hybrid Setup
|
|
110
|
+
void loadHybridMethods() override;
|
|
111
|
+
|
|
112
|
+
protected:
|
|
113
|
+
// Tag for logging
|
|
114
|
+
static constexpr auto TAG = "NitroPoseExercises";
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
} // namespace margelo::nitro::nitroposeexercises
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Landmark.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::nitroposeexercises {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (Landmark).
|
|
39
|
+
*/
|
|
40
|
+
struct Landmark final {
|
|
41
|
+
public:
|
|
42
|
+
double x SWIFT_PRIVATE;
|
|
43
|
+
double y SWIFT_PRIVATE;
|
|
44
|
+
double z SWIFT_PRIVATE;
|
|
45
|
+
double visibility SWIFT_PRIVATE;
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
Landmark() = default;
|
|
49
|
+
explicit Landmark(double x, double y, double z, double visibility): x(x), y(y), z(z), visibility(visibility) {}
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
friend bool operator==(const Landmark& lhs, const Landmark& rhs) = default;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
} // namespace margelo::nitro::nitroposeexercises
|
|
56
|
+
|
|
57
|
+
namespace margelo::nitro {
|
|
58
|
+
|
|
59
|
+
// C++ Landmark <> JS Landmark (object)
|
|
60
|
+
template <>
|
|
61
|
+
struct JSIConverter<margelo::nitro::nitroposeexercises::Landmark> final {
|
|
62
|
+
static inline margelo::nitro::nitroposeexercises::Landmark fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
63
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
64
|
+
return margelo::nitro::nitroposeexercises::Landmark(
|
|
65
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x"))),
|
|
66
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y"))),
|
|
67
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "z"))),
|
|
68
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "visibility")))
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroposeexercises::Landmark& arg) {
|
|
72
|
+
jsi::Object obj(runtime);
|
|
73
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "x"), JSIConverter<double>::toJSI(runtime, arg.x));
|
|
74
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "y"), JSIConverter<double>::toJSI(runtime, arg.y));
|
|
75
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "z"), JSIConverter<double>::toJSI(runtime, arg.z));
|
|
76
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "visibility"), JSIConverter<double>::toJSI(runtime, arg.visibility));
|
|
77
|
+
return obj;
|
|
78
|
+
}
|
|
79
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
80
|
+
if (!value.isObject()) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
jsi::Object obj = value.getObject(runtime);
|
|
84
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x")))) return false;
|
|
88
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y")))) return false;
|
|
89
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "z")))) return false;
|
|
90
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "visibility")))) return false;
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PhaseThreshold.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `ExercisePhase` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::nitroposeexercises { enum class ExercisePhase; }
|
|
33
|
+
|
|
34
|
+
#include "ExercisePhase.hpp"
|
|
35
|
+
#include <string>
|
|
36
|
+
|
|
37
|
+
namespace margelo::nitro::nitroposeexercises {
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A struct which can be represented as a JavaScript object (PhaseThreshold).
|
|
41
|
+
*/
|
|
42
|
+
struct PhaseThreshold final {
|
|
43
|
+
public:
|
|
44
|
+
ExercisePhase phase SWIFT_PRIVATE;
|
|
45
|
+
std::string angleName SWIFT_PRIVATE;
|
|
46
|
+
double minAngle SWIFT_PRIVATE;
|
|
47
|
+
double maxAngle SWIFT_PRIVATE;
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
PhaseThreshold() = default;
|
|
51
|
+
explicit PhaseThreshold(ExercisePhase phase, std::string angleName, double minAngle, double maxAngle): phase(phase), angleName(angleName), minAngle(minAngle), maxAngle(maxAngle) {}
|
|
52
|
+
|
|
53
|
+
public:
|
|
54
|
+
friend bool operator==(const PhaseThreshold& lhs, const PhaseThreshold& rhs) = default;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
} // namespace margelo::nitro::nitroposeexercises
|
|
58
|
+
|
|
59
|
+
namespace margelo::nitro {
|
|
60
|
+
|
|
61
|
+
// C++ PhaseThreshold <> JS PhaseThreshold (object)
|
|
62
|
+
template <>
|
|
63
|
+
struct JSIConverter<margelo::nitro::nitroposeexercises::PhaseThreshold> final {
|
|
64
|
+
static inline margelo::nitro::nitroposeexercises::PhaseThreshold fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
65
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
66
|
+
return margelo::nitro::nitroposeexercises::PhaseThreshold(
|
|
67
|
+
JSIConverter<margelo::nitro::nitroposeexercises::ExercisePhase>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "phase"))),
|
|
68
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "angleName"))),
|
|
69
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minAngle"))),
|
|
70
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxAngle")))
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroposeexercises::PhaseThreshold& arg) {
|
|
74
|
+
jsi::Object obj(runtime);
|
|
75
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "phase"), JSIConverter<margelo::nitro::nitroposeexercises::ExercisePhase>::toJSI(runtime, arg.phase));
|
|
76
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "angleName"), JSIConverter<std::string>::toJSI(runtime, arg.angleName));
|
|
77
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "minAngle"), JSIConverter<double>::toJSI(runtime, arg.minAngle));
|
|
78
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "maxAngle"), JSIConverter<double>::toJSI(runtime, arg.maxAngle));
|
|
79
|
+
return obj;
|
|
80
|
+
}
|
|
81
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
82
|
+
if (!value.isObject()) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
jsi::Object obj = value.getObject(runtime);
|
|
86
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
if (!JSIConverter<margelo::nitro::nitroposeexercises::ExercisePhase>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "phase")))) return false;
|
|
90
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "angleName")))) return false;
|
|
91
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minAngle")))) return false;
|
|
92
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxAngle")))) return false;
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
} // namespace margelo::nitro
|