react-native-nitro-pose-exercises 1.1.6 → 1.1.7
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/README.md +78 -126
- package/android/src/main/java/com/margelo/nitro/nitroposeexercises/NitroPoseExercises.kt +121 -4
- package/ios/NitroPoseExercises.swift +128 -11
- package/lib/module/NitroPoseExercises.nitro.js.map +1 -1
- package/lib/module/config/bicep-curl.js +3 -0
- package/lib/module/config/bicep-curl.js.map +1 -1
- package/lib/module/config/boat-pose.js +3 -0
- package/lib/module/config/boat-pose.js.map +1 -1
- package/lib/module/config/bow-pose.js +3 -0
- package/lib/module/config/bow-pose.js.map +1 -1
- package/lib/module/config/bridge-pose.js +3 -0
- package/lib/module/config/bridge-pose.js.map +1 -1
- package/lib/module/config/calf-raise.js +3 -0
- package/lib/module/config/calf-raise.js.map +1 -1
- package/lib/module/config/camel-pose.js +3 -0
- package/lib/module/config/camel-pose.js.map +1 -1
- package/lib/module/config/chair-pose.js +3 -0
- package/lib/module/config/chair-pose.js.map +1 -1
- package/lib/module/config/childs-pose.js +3 -0
- package/lib/module/config/childs-pose.js.map +1 -1
- package/lib/module/config/cobra-pose.js +3 -0
- package/lib/module/config/cobra-pose.js.map +1 -1
- package/lib/module/config/cobra-wings.js +3 -0
- package/lib/module/config/cobra-wings.js.map +1 -1
- package/lib/module/config/dead-lift.js +3 -0
- package/lib/module/config/dead-lift.js.map +1 -1
- package/lib/module/config/downward-dog.js +3 -0
- package/lib/module/config/downward-dog.js.map +1 -1
- package/lib/module/config/extended-side-angle.js +3 -0
- package/lib/module/config/extended-side-angle.js.map +1 -1
- package/lib/module/config/fish-pose.js +3 -0
- package/lib/module/config/fish-pose.js.map +1 -1
- package/lib/module/config/front-raise.js +3 -0
- package/lib/module/config/front-raise.js.map +1 -1
- package/lib/module/config/glute-bridge.js +3 -0
- package/lib/module/config/glute-bridge.js.map +1 -1
- package/lib/module/config/hip-abduction.js +3 -0
- package/lib/module/config/hip-abduction.js.map +1 -1
- package/lib/module/config/knee-raise.js +3 -0
- package/lib/module/config/knee-raise.js.map +1 -1
- package/lib/module/config/lateral-raise.js +3 -0
- package/lib/module/config/lateral-raise.js.map +1 -1
- package/lib/module/config/leg-raise.js +3 -0
- package/lib/module/config/leg-raise.js.map +1 -1
- package/lib/module/config/lunge.js +3 -0
- package/lib/module/config/lunge.js.map +1 -1
- package/lib/module/config/mountain-pose.js +3 -0
- package/lib/module/config/mountain-pose.js.map +1 -1
- package/lib/module/config/overarm-reach.js +3 -0
- package/lib/module/config/overarm-reach.js.map +1 -1
- package/lib/module/config/plank.js +3 -0
- package/lib/module/config/plank.js.map +1 -1
- package/lib/module/config/pull-up.js +3 -0
- package/lib/module/config/pull-up.js.map +1 -1
- package/lib/module/config/pushup.js +4 -0
- package/lib/module/config/pushup.js.map +1 -1
- package/lib/module/config/reverse-warrior.js +3 -0
- package/lib/module/config/reverse-warrior.js.map +1 -1
- package/lib/module/config/shoulder-press.js +3 -0
- package/lib/module/config/shoulder-press.js.map +1 -1
- package/lib/module/config/side-lung.js +3 -0
- package/lib/module/config/side-lung.js.map +1 -1
- package/lib/module/config/side-plank.js +3 -0
- package/lib/module/config/side-plank.js.map +1 -1
- package/lib/module/config/situp.js +3 -0
- package/lib/module/config/situp.js.map +1 -1
- package/lib/module/config/squat.js +3 -0
- package/lib/module/config/squat.js.map +1 -1
- package/lib/module/config/sumo-squat.js +3 -0
- package/lib/module/config/sumo-squat.js.map +1 -1
- package/lib/module/config/tree-pose.js +3 -0
- package/lib/module/config/tree-pose.js.map +1 -1
- package/lib/module/config/triangle-pose.js +3 -0
- package/lib/module/config/triangle-pose.js.map +1 -1
- package/lib/module/config/tricep-dip.js +4 -0
- package/lib/module/config/tricep-dip.js.map +1 -1
- package/lib/module/config/v-up.js +3 -0
- package/lib/module/config/v-up.js.map +1 -1
- package/lib/module/config/wall-sit.js +3 -0
- package/lib/module/config/wall-sit.js.map +1 -1
- package/lib/module/config/warrior-i.js +3 -0
- package/lib/module/config/warrior-i.js.map +1 -1
- package/lib/module/config/warrior-ii.js +3 -0
- package/lib/module/config/warrior-ii.js.map +1 -1
- package/lib/module/config/warrior-iii.js +3 -0
- package/lib/module/config/warrior-iii.js.map +1 -1
- package/lib/typescript/src/NitroPoseExercises.nitro.d.ts +9 -1
- package/lib/typescript/src/NitroPoseExercises.nitro.d.ts.map +1 -1
- package/lib/typescript/src/config/bicep-curl.d.ts.map +1 -1
- package/lib/typescript/src/config/boat-pose.d.ts.map +1 -1
- package/lib/typescript/src/config/bow-pose.d.ts.map +1 -1
- package/lib/typescript/src/config/bridge-pose.d.ts.map +1 -1
- package/lib/typescript/src/config/calf-raise.d.ts.map +1 -1
- package/lib/typescript/src/config/camel-pose.d.ts.map +1 -1
- package/lib/typescript/src/config/chair-pose.d.ts.map +1 -1
- package/lib/typescript/src/config/childs-pose.d.ts.map +1 -1
- package/lib/typescript/src/config/cobra-pose.d.ts.map +1 -1
- package/lib/typescript/src/config/cobra-wings.d.ts.map +1 -1
- package/lib/typescript/src/config/dead-lift.d.ts.map +1 -1
- package/lib/typescript/src/config/downward-dog.d.ts.map +1 -1
- package/lib/typescript/src/config/extended-side-angle.d.ts.map +1 -1
- package/lib/typescript/src/config/fish-pose.d.ts.map +1 -1
- package/lib/typescript/src/config/front-raise.d.ts.map +1 -1
- package/lib/typescript/src/config/glute-bridge.d.ts.map +1 -1
- package/lib/typescript/src/config/hip-abduction.d.ts.map +1 -1
- package/lib/typescript/src/config/knee-raise.d.ts.map +1 -1
- package/lib/typescript/src/config/lateral-raise.d.ts.map +1 -1
- package/lib/typescript/src/config/leg-raise.d.ts.map +1 -1
- package/lib/typescript/src/config/lunge.d.ts.map +1 -1
- package/lib/typescript/src/config/mountain-pose.d.ts.map +1 -1
- package/lib/typescript/src/config/overarm-reach.d.ts.map +1 -1
- package/lib/typescript/src/config/plank.d.ts.map +1 -1
- package/lib/typescript/src/config/pull-up.d.ts.map +1 -1
- package/lib/typescript/src/config/pushup.d.ts.map +1 -1
- package/lib/typescript/src/config/reverse-warrior.d.ts.map +1 -1
- package/lib/typescript/src/config/shoulder-press.d.ts.map +1 -1
- package/lib/typescript/src/config/side-lung.d.ts.map +1 -1
- package/lib/typescript/src/config/side-plank.d.ts.map +1 -1
- package/lib/typescript/src/config/situp.d.ts.map +1 -1
- package/lib/typescript/src/config/squat.d.ts.map +1 -1
- package/lib/typescript/src/config/sumo-squat.d.ts.map +1 -1
- package/lib/typescript/src/config/tree-pose.d.ts.map +1 -1
- package/lib/typescript/src/config/triangle-pose.d.ts.map +1 -1
- package/lib/typescript/src/config/tricep-dip.d.ts.map +1 -1
- package/lib/typescript/src/config/v-up.d.ts.map +1 -1
- package/lib/typescript/src/config/wall-sit.d.ts.map +1 -1
- package/lib/typescript/src/config/warrior-i.d.ts.map +1 -1
- package/lib/typescript/src/config/warrior-ii.d.ts.map +1 -1
- package/lib/typescript/src/config/warrior-iii.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JCameraAngleType.hpp +58 -0
- package/nitrogen/generated/android/c++/JExerciseConfig.hpp +19 -3
- package/nitrogen/generated/android/c++/JHybridNitroPoseExercisesSpec.cpp +47 -0
- package/nitrogen/generated/android/c++/JHybridNitroPoseExercisesSpec.hpp +5 -0
- package/nitrogen/generated/android/c++/JPostureFamily.hpp +73 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/CameraAngleType.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/ExerciseConfig.kt +19 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/HybridNitroPoseExercisesSpec.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/PostureFamily.kt +28 -0
- package/nitrogen/generated/ios/NitroPoseExercises-Swift-Cxx-Bridge.hpp +9 -0
- package/nitrogen/generated/ios/NitroPoseExercises-Swift-Cxx-Umbrella.hpp +6 -0
- package/nitrogen/generated/ios/c++/HybridNitroPoseExercisesSpecSwift.hpp +28 -0
- package/nitrogen/generated/ios/swift/CameraAngleType.swift +40 -0
- package/nitrogen/generated/ios/swift/ExerciseConfig.swift +17 -2
- package/nitrogen/generated/ios/swift/HybridNitroPoseExercisesSpec.swift +3 -0
- package/nitrogen/generated/ios/swift/HybridNitroPoseExercisesSpec_cxx.swift +76 -0
- package/nitrogen/generated/ios/swift/PostureFamily.swift +60 -0
- package/nitrogen/generated/shared/c++/CameraAngleType.hpp +76 -0
- package/nitrogen/generated/shared/c++/ExerciseConfig.hpp +20 -2
- package/nitrogen/generated/shared/c++/HybridNitroPoseExercisesSpec.cpp +5 -0
- package/nitrogen/generated/shared/c++/HybridNitroPoseExercisesSpec.hpp +5 -0
- package/nitrogen/generated/shared/c++/PostureFamily.hpp +96 -0
- package/package.json +1 -1
- package/src/NitroPoseExercises.nitro.ts +19 -0
- package/src/config/bicep-curl.ts +3 -0
- package/src/config/boat-pose.ts +3 -0
- package/src/config/bow-pose.ts +3 -0
- package/src/config/bridge-pose.ts +3 -0
- package/src/config/calf-raise.ts +3 -0
- package/src/config/camel-pose.ts +3 -0
- package/src/config/chair-pose.ts +3 -0
- package/src/config/childs-pose.ts +3 -0
- package/src/config/cobra-pose.ts +3 -0
- package/src/config/cobra-wings.ts +3 -0
- package/src/config/dead-lift.ts +3 -0
- package/src/config/downward-dog.ts +3 -0
- package/src/config/extended-side-angle.ts +3 -0
- package/src/config/fish-pose.ts +3 -0
- package/src/config/front-raise.ts +4 -0
- package/src/config/glute-bridge.ts +3 -0
- package/src/config/hip-abduction.ts +3 -0
- package/src/config/knee-raise.ts +3 -0
- package/src/config/lateral-raise.ts +3 -0
- package/src/config/leg-raise.ts +3 -0
- package/src/config/lunge.ts +3 -0
- package/src/config/mountain-pose.ts +3 -0
- package/src/config/overarm-reach.ts +3 -0
- package/src/config/plank.ts +3 -0
- package/src/config/pull-up.ts +3 -0
- package/src/config/pushup.ts +3 -0
- package/src/config/reverse-warrior.ts +3 -0
- package/src/config/shoulder-press.ts +3 -0
- package/src/config/side-lung.ts +3 -0
- package/src/config/side-plank.ts +3 -0
- package/src/config/situp.ts +3 -0
- package/src/config/squat.ts +3 -0
- package/src/config/sumo-squat.ts +4 -0
- package/src/config/tree-pose.ts +3 -0
- package/src/config/triangle-pose.ts +3 -0
- package/src/config/tricep-dip.ts +3 -0
- package/src/config/v-up.ts +4 -0
- package/src/config/wall-sit.ts +3 -0
- package/src/config/warrior-i.ts +3 -0
- package/src/config/warrior-ii.ts +3 -0
- package/src/config/warrior-iii.ts +3 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JCameraAngleType.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "CameraAngleType.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::nitroposeexercises {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "CameraAngleType" and the the Kotlin enum "CameraAngleType".
|
|
19
|
+
*/
|
|
20
|
+
struct JCameraAngleType final: public jni::JavaClass<JCameraAngleType> {
|
|
21
|
+
public:
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroposeexercises/CameraAngleType;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum CameraAngleType.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
CameraAngleType toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<CameraAngleType>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JCameraAngleType> fromCpp(CameraAngleType value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case CameraAngleType::SIDE:
|
|
46
|
+
static const auto fieldSIDE = clazz->getStaticField<JCameraAngleType>("SIDE");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldSIDE);
|
|
48
|
+
case CameraAngleType::FRONT:
|
|
49
|
+
static const auto fieldFRONT = clazz->getStaticField<JCameraAngleType>("FRONT");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldFRONT);
|
|
51
|
+
default:
|
|
52
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
53
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
} // namespace margelo::nitro::nitroposeexercises
|
|
@@ -11,17 +11,21 @@
|
|
|
11
11
|
#include "ExerciseConfig.hpp"
|
|
12
12
|
|
|
13
13
|
#include "AngleDefinition.hpp"
|
|
14
|
+
#include "CameraAngleType.hpp"
|
|
14
15
|
#include "ExercisePhase.hpp"
|
|
15
16
|
#include "ExerciseType.hpp"
|
|
16
17
|
#include "FormRule.hpp"
|
|
17
18
|
#include "FormSeverity.hpp"
|
|
18
19
|
#include "JAngleDefinition.hpp"
|
|
20
|
+
#include "JCameraAngleType.hpp"
|
|
19
21
|
#include "JExercisePhase.hpp"
|
|
20
22
|
#include "JExerciseType.hpp"
|
|
21
23
|
#include "JFormRule.hpp"
|
|
22
24
|
#include "JFormSeverity.hpp"
|
|
23
25
|
#include "JPhaseThreshold.hpp"
|
|
26
|
+
#include "JPostureFamily.hpp"
|
|
24
27
|
#include "PhaseThreshold.hpp"
|
|
28
|
+
#include "PostureFamily.hpp"
|
|
25
29
|
#include <string>
|
|
26
30
|
#include <vector>
|
|
27
31
|
|
|
@@ -58,6 +62,12 @@ namespace margelo::nitro::nitroposeexercises {
|
|
|
58
62
|
jni::local_ref<jni::JArrayClass<JFormRule>> formRules = this->getFieldValue(fieldFormRules);
|
|
59
63
|
static const auto fieldHoldDurationMs = clazz->getField<double>("holdDurationMs");
|
|
60
64
|
double holdDurationMs = this->getFieldValue(fieldHoldDurationMs);
|
|
65
|
+
static const auto fieldPostureFamily = clazz->getField<JPostureFamily>("postureFamily");
|
|
66
|
+
jni::local_ref<JPostureFamily> postureFamily = this->getFieldValue(fieldPostureFamily);
|
|
67
|
+
static const auto fieldVisibilityThreshold = clazz->getField<double>("visibilityThreshold");
|
|
68
|
+
double visibilityThreshold = this->getFieldValue(fieldVisibilityThreshold);
|
|
69
|
+
static const auto fieldCameraAngle = clazz->getField<JCameraAngleType>("cameraAngle");
|
|
70
|
+
jni::local_ref<JCameraAngleType> cameraAngle = this->getFieldValue(fieldCameraAngle);
|
|
61
71
|
return ExerciseConfig(
|
|
62
72
|
name->toStdString(),
|
|
63
73
|
type->toCpp(),
|
|
@@ -101,7 +111,10 @@ namespace margelo::nitro::nitroposeexercises {
|
|
|
101
111
|
}
|
|
102
112
|
return __vector;
|
|
103
113
|
}(formRules),
|
|
104
|
-
holdDurationMs
|
|
114
|
+
holdDurationMs,
|
|
115
|
+
postureFamily->toCpp(),
|
|
116
|
+
visibilityThreshold,
|
|
117
|
+
cameraAngle->toCpp()
|
|
105
118
|
);
|
|
106
119
|
}
|
|
107
120
|
|
|
@@ -111,7 +124,7 @@ namespace margelo::nitro::nitroposeexercises {
|
|
|
111
124
|
*/
|
|
112
125
|
[[maybe_unused]]
|
|
113
126
|
static jni::local_ref<JExerciseConfig::javaobject> fromCpp(const ExerciseConfig& value) {
|
|
114
|
-
using JSignature = JExerciseConfig(jni::alias_ref<jni::JString>, jni::alias_ref<JExerciseType>, jni::alias_ref<jni::JArrayClass<JAngleDefinition>>, jni::alias_ref<jni::JArrayClass<JPhaseThreshold>>, jni::alias_ref<jni::JArrayClass<JExercisePhase>>, jni::alias_ref<jni::JArrayClass<JFormRule>>, double);
|
|
127
|
+
using JSignature = JExerciseConfig(jni::alias_ref<jni::JString>, jni::alias_ref<JExerciseType>, jni::alias_ref<jni::JArrayClass<JAngleDefinition>>, jni::alias_ref<jni::JArrayClass<JPhaseThreshold>>, jni::alias_ref<jni::JArrayClass<JExercisePhase>>, jni::alias_ref<jni::JArrayClass<JFormRule>>, double, jni::alias_ref<JPostureFamily>, double, jni::alias_ref<JCameraAngleType>);
|
|
115
128
|
static const auto clazz = javaClassStatic();
|
|
116
129
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
117
130
|
return create(
|
|
@@ -158,7 +171,10 @@ namespace margelo::nitro::nitroposeexercises {
|
|
|
158
171
|
}
|
|
159
172
|
return __array;
|
|
160
173
|
}(value.formRules),
|
|
161
|
-
value.holdDurationMs
|
|
174
|
+
value.holdDurationMs,
|
|
175
|
+
JPostureFamily::fromCpp(value.postureFamily),
|
|
176
|
+
value.visibilityThreshold,
|
|
177
|
+
JCameraAngleType::fromCpp(value.cameraAngle)
|
|
162
178
|
);
|
|
163
179
|
}
|
|
164
180
|
};
|
|
@@ -35,6 +35,10 @@ namespace margelo::nitro::nitroposeexercises { struct AngleDefinition; }
|
|
|
35
35
|
namespace margelo::nitro::nitroposeexercises { struct PhaseThreshold; }
|
|
36
36
|
// Forward declaration of `FormRule` to properly resolve imports.
|
|
37
37
|
namespace margelo::nitro::nitroposeexercises { struct FormRule; }
|
|
38
|
+
// Forward declaration of `PostureFamily` to properly resolve imports.
|
|
39
|
+
namespace margelo::nitro::nitroposeexercises { enum class PostureFamily; }
|
|
40
|
+
// Forward declaration of `CameraAngleType` to properly resolve imports.
|
|
41
|
+
namespace margelo::nitro::nitroposeexercises { enum class CameraAngleType; }
|
|
38
42
|
// Forward declaration of `HybridFrameSpec` to properly resolve imports.
|
|
39
43
|
namespace margelo::nitro::camera { class HybridFrameSpec; }
|
|
40
44
|
|
|
@@ -80,6 +84,10 @@ namespace margelo::nitro::camera { class HybridFrameSpec; }
|
|
|
80
84
|
#include "JPhaseThreshold.hpp"
|
|
81
85
|
#include "FormRule.hpp"
|
|
82
86
|
#include "JFormRule.hpp"
|
|
87
|
+
#include "PostureFamily.hpp"
|
|
88
|
+
#include "JPostureFamily.hpp"
|
|
89
|
+
#include "CameraAngleType.hpp"
|
|
90
|
+
#include "JCameraAngleType.hpp"
|
|
83
91
|
#include <memory>
|
|
84
92
|
#include <VisionCamera/HybridFrameSpec.hpp>
|
|
85
93
|
#include <VisionCamera/JHybridFrameSpec.hpp>
|
|
@@ -238,6 +246,40 @@ namespace margelo::nitro::nitroposeexercises {
|
|
|
238
246
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_SessionResult::javaobject> /* onSessionComplete */)>("setOnSessionComplete_cxx");
|
|
239
247
|
method(_javaPart, onSessionComplete.has_value() ? JFunc_void_SessionResult_cxx::fromCpp(onSessionComplete.value()) : nullptr);
|
|
240
248
|
}
|
|
249
|
+
std::optional<std::function<void()>> JHybridNitroPoseExercisesSpec::getOnPostureLost() {
|
|
250
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JFunc_void::javaobject>()>("getOnPostureLost_cxx");
|
|
251
|
+
auto __result = method(_javaPart);
|
|
252
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void()> {
|
|
253
|
+
if (__result->isInstanceOf(JFunc_void_cxx::javaClassStatic())) [[likely]] {
|
|
254
|
+
auto downcast = jni::static_ref_cast<JFunc_void_cxx::javaobject>(__result);
|
|
255
|
+
return downcast->cthis()->getFunction();
|
|
256
|
+
} else {
|
|
257
|
+
auto __resultRef = jni::make_global(__result);
|
|
258
|
+
return JNICallable<JFunc_void, void()>(std::move(__resultRef));
|
|
259
|
+
}
|
|
260
|
+
}()) : std::nullopt;
|
|
261
|
+
}
|
|
262
|
+
void JHybridNitroPoseExercisesSpec::setOnPostureLost(const std::optional<std::function<void()>>& onPostureLost) {
|
|
263
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void::javaobject> /* onPostureLost */)>("setOnPostureLost_cxx");
|
|
264
|
+
method(_javaPart, onPostureLost.has_value() ? JFunc_void_cxx::fromCpp(onPostureLost.value()) : nullptr);
|
|
265
|
+
}
|
|
266
|
+
std::optional<std::function<void()>> JHybridNitroPoseExercisesSpec::getOnPostureRegained() {
|
|
267
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JFunc_void::javaobject>()>("getOnPostureRegained_cxx");
|
|
268
|
+
auto __result = method(_javaPart);
|
|
269
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void()> {
|
|
270
|
+
if (__result->isInstanceOf(JFunc_void_cxx::javaClassStatic())) [[likely]] {
|
|
271
|
+
auto downcast = jni::static_ref_cast<JFunc_void_cxx::javaobject>(__result);
|
|
272
|
+
return downcast->cthis()->getFunction();
|
|
273
|
+
} else {
|
|
274
|
+
auto __resultRef = jni::make_global(__result);
|
|
275
|
+
return JNICallable<JFunc_void, void()>(std::move(__resultRef));
|
|
276
|
+
}
|
|
277
|
+
}()) : std::nullopt;
|
|
278
|
+
}
|
|
279
|
+
void JHybridNitroPoseExercisesSpec::setOnPostureRegained(const std::optional<std::function<void()>>& onPostureRegained) {
|
|
280
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void::javaobject> /* onPostureRegained */)>("setOnPostureRegained_cxx");
|
|
281
|
+
method(_javaPart, onPostureRegained.has_value() ? JFunc_void_cxx::fromCpp(onPostureRegained.value()) : nullptr);
|
|
282
|
+
}
|
|
241
283
|
ExercisePhase JHybridNitroPoseExercisesSpec::getCurrentPhase() {
|
|
242
284
|
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JExercisePhase>()>("getCurrentPhase");
|
|
243
285
|
auto __result = method(_javaPart);
|
|
@@ -307,5 +349,10 @@ namespace margelo::nitro::nitroposeexercises {
|
|
|
307
349
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void()>("stopSession");
|
|
308
350
|
method(_javaPart);
|
|
309
351
|
}
|
|
352
|
+
bool JHybridNitroPoseExercisesSpec::isReady() {
|
|
353
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("isReady");
|
|
354
|
+
auto __result = method(_javaPart);
|
|
355
|
+
return static_cast<bool>(__result);
|
|
356
|
+
}
|
|
310
357
|
|
|
311
358
|
} // namespace margelo::nitro::nitroposeexercises
|
|
@@ -65,6 +65,10 @@ namespace margelo::nitro::nitroposeexercises {
|
|
|
65
65
|
void setOnPoseRegained(const std::optional<std::function<void()>>& onPoseRegained) override;
|
|
66
66
|
std::optional<std::function<void(const SessionResult& /* result */)>> getOnSessionComplete() override;
|
|
67
67
|
void setOnSessionComplete(const std::optional<std::function<void(const SessionResult& /* result */)>>& onSessionComplete) override;
|
|
68
|
+
std::optional<std::function<void()>> getOnPostureLost() override;
|
|
69
|
+
void setOnPostureLost(const std::optional<std::function<void()>>& onPostureLost) override;
|
|
70
|
+
std::optional<std::function<void()>> getOnPostureRegained() override;
|
|
71
|
+
void setOnPostureRegained(const std::optional<std::function<void()>>& onPostureRegained) override;
|
|
68
72
|
ExercisePhase getCurrentPhase() override;
|
|
69
73
|
double getRepCount() override;
|
|
70
74
|
std::vector<Landmark> getLandmarks() override;
|
|
@@ -79,6 +83,7 @@ namespace margelo::nitro::nitroposeexercises {
|
|
|
79
83
|
void pauseSession() override;
|
|
80
84
|
void resumeSession() override;
|
|
81
85
|
void stopSession() override;
|
|
86
|
+
bool isReady() override;
|
|
82
87
|
|
|
83
88
|
private:
|
|
84
89
|
jni::global_ref<JHybridNitroPoseExercisesSpec::JavaPart> _javaPart;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JPostureFamily.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "PostureFamily.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::nitroposeexercises {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "PostureFamily" and the the Kotlin enum "PostureFamily".
|
|
19
|
+
*/
|
|
20
|
+
struct JPostureFamily final: public jni::JavaClass<JPostureFamily> {
|
|
21
|
+
public:
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroposeexercises/PostureFamily;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum PostureFamily.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
PostureFamily toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<PostureFamily>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JPostureFamily> fromCpp(PostureFamily value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case PostureFamily::HORIZONTALPRONE:
|
|
46
|
+
static const auto fieldHORIZONTALPRONE = clazz->getStaticField<JPostureFamily>("HORIZONTALPRONE");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldHORIZONTALPRONE);
|
|
48
|
+
case PostureFamily::STANDINGUPRIGHT:
|
|
49
|
+
static const auto fieldSTANDINGUPRIGHT = clazz->getStaticField<JPostureFamily>("STANDINGUPRIGHT");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldSTANDINGUPRIGHT);
|
|
51
|
+
case PostureFamily::SEATED:
|
|
52
|
+
static const auto fieldSEATED = clazz->getStaticField<JPostureFamily>("SEATED");
|
|
53
|
+
return clazz->getStaticFieldValue(fieldSEATED);
|
|
54
|
+
case PostureFamily::INVERTED:
|
|
55
|
+
static const auto fieldINVERTED = clazz->getStaticField<JPostureFamily>("INVERTED");
|
|
56
|
+
return clazz->getStaticFieldValue(fieldINVERTED);
|
|
57
|
+
case PostureFamily::SIDEPLANK:
|
|
58
|
+
static const auto fieldSIDEPLANK = clazz->getStaticField<JPostureFamily>("SIDEPLANK");
|
|
59
|
+
return clazz->getStaticFieldValue(fieldSIDEPLANK);
|
|
60
|
+
case PostureFamily::SUPINE:
|
|
61
|
+
static const auto fieldSUPINE = clazz->getStaticField<JPostureFamily>("SUPINE");
|
|
62
|
+
return clazz->getStaticFieldValue(fieldSUPINE);
|
|
63
|
+
case PostureFamily::NONE:
|
|
64
|
+
static const auto fieldNONE = clazz->getStaticField<JPostureFamily>("NONE");
|
|
65
|
+
return clazz->getStaticFieldValue(fieldNONE);
|
|
66
|
+
default:
|
|
67
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
68
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
} // namespace margelo::nitro::nitroposeexercises
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/CameraAngleType.kt
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CameraAngleType.kt
|
|
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
|
+
package com.margelo.nitro.nitroposeexercises
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "CameraAngleType".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class CameraAngleType(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
SIDE(0),
|
|
20
|
+
FRONT(1);
|
|
21
|
+
|
|
22
|
+
companion object
|
|
23
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/ExerciseConfig.kt
CHANGED
|
@@ -38,7 +38,16 @@ data class ExerciseConfig(
|
|
|
38
38
|
val formRules: Array<FormRule>,
|
|
39
39
|
@DoNotStrip
|
|
40
40
|
@Keep
|
|
41
|
-
val holdDurationMs: Double
|
|
41
|
+
val holdDurationMs: Double,
|
|
42
|
+
@DoNotStrip
|
|
43
|
+
@Keep
|
|
44
|
+
val postureFamily: PostureFamily,
|
|
45
|
+
@DoNotStrip
|
|
46
|
+
@Keep
|
|
47
|
+
val visibilityThreshold: Double,
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
@Keep
|
|
50
|
+
val cameraAngle: CameraAngleType
|
|
42
51
|
) {
|
|
43
52
|
/* primary constructor */
|
|
44
53
|
|
|
@@ -52,6 +61,9 @@ data class ExerciseConfig(
|
|
|
52
61
|
&& Objects.deepEquals(this.repSequence, other.repSequence)
|
|
53
62
|
&& Objects.deepEquals(this.formRules, other.formRules)
|
|
54
63
|
&& Objects.deepEquals(this.holdDurationMs, other.holdDurationMs)
|
|
64
|
+
&& Objects.deepEquals(this.postureFamily, other.postureFamily)
|
|
65
|
+
&& Objects.deepEquals(this.visibilityThreshold, other.visibilityThreshold)
|
|
66
|
+
&& Objects.deepEquals(this.cameraAngle, other.cameraAngle)
|
|
55
67
|
}
|
|
56
68
|
|
|
57
69
|
override fun hashCode(): Int {
|
|
@@ -62,7 +74,10 @@ data class ExerciseConfig(
|
|
|
62
74
|
phases,
|
|
63
75
|
repSequence,
|
|
64
76
|
formRules,
|
|
65
|
-
holdDurationMs
|
|
77
|
+
holdDurationMs,
|
|
78
|
+
postureFamily,
|
|
79
|
+
visibilityThreshold,
|
|
80
|
+
cameraAngle
|
|
66
81
|
).contentDeepHashCode()
|
|
67
82
|
}
|
|
68
83
|
|
|
@@ -74,8 +89,8 @@ data class ExerciseConfig(
|
|
|
74
89
|
@Keep
|
|
75
90
|
@Suppress("unused")
|
|
76
91
|
@JvmStatic
|
|
77
|
-
private fun fromCpp(name: String, type: ExerciseType, angles: Array<AngleDefinition>, phases: Array<PhaseThreshold>, repSequence: Array<ExercisePhase>, formRules: Array<FormRule>, holdDurationMs: Double): ExerciseConfig {
|
|
78
|
-
return ExerciseConfig(name, type, angles, phases, repSequence, formRules, holdDurationMs)
|
|
92
|
+
private fun fromCpp(name: String, type: ExerciseType, angles: Array<AngleDefinition>, phases: Array<PhaseThreshold>, repSequence: Array<ExercisePhase>, formRules: Array<FormRule>, holdDurationMs: Double, postureFamily: PostureFamily, visibilityThreshold: Double, cameraAngle: CameraAngleType): ExerciseConfig {
|
|
93
|
+
return ExerciseConfig(name, type, angles, phases, repSequence, formRules, holdDurationMs, postureFamily, visibilityThreshold, cameraAngle)
|
|
79
94
|
}
|
|
80
95
|
}
|
|
81
96
|
}
|
|
@@ -129,6 +129,34 @@ abstract class HybridNitroPoseExercisesSpec: HybridObject() {
|
|
|
129
129
|
onSessionComplete = value?.let { it }
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
abstract var onPostureLost: (() -> Unit)?
|
|
133
|
+
|
|
134
|
+
private var onPostureLost_cxx: Func_void?
|
|
135
|
+
@Keep
|
|
136
|
+
@DoNotStrip
|
|
137
|
+
get() {
|
|
138
|
+
return onPostureLost?.let { Func_void_java(it) }
|
|
139
|
+
}
|
|
140
|
+
@Keep
|
|
141
|
+
@DoNotStrip
|
|
142
|
+
set(value) {
|
|
143
|
+
onPostureLost = value?.let { it }
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
abstract var onPostureRegained: (() -> Unit)?
|
|
147
|
+
|
|
148
|
+
private var onPostureRegained_cxx: Func_void?
|
|
149
|
+
@Keep
|
|
150
|
+
@DoNotStrip
|
|
151
|
+
get() {
|
|
152
|
+
return onPostureRegained?.let { Func_void_java(it) }
|
|
153
|
+
}
|
|
154
|
+
@Keep
|
|
155
|
+
@DoNotStrip
|
|
156
|
+
set(value) {
|
|
157
|
+
onPostureRegained = value?.let { it }
|
|
158
|
+
}
|
|
159
|
+
|
|
132
160
|
@get:DoNotStrip
|
|
133
161
|
@get:Keep
|
|
134
162
|
abstract val currentPhase: ExercisePhase
|
|
@@ -173,6 +201,10 @@ abstract class HybridNitroPoseExercisesSpec: HybridObject() {
|
|
|
173
201
|
@DoNotStrip
|
|
174
202
|
@Keep
|
|
175
203
|
abstract fun stopSession(): Unit
|
|
204
|
+
|
|
205
|
+
@DoNotStrip
|
|
206
|
+
@Keep
|
|
207
|
+
abstract fun isReady(): Boolean
|
|
176
208
|
|
|
177
209
|
// Default implementation of `HybridObject.toString()`
|
|
178
210
|
override fun toString(): String {
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroposeexercises/PostureFamily.kt
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PostureFamily.kt
|
|
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
|
+
package com.margelo.nitro.nitroposeexercises
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "PostureFamily".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class PostureFamily(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
HORIZONTALPRONE(0),
|
|
20
|
+
STANDINGUPRIGHT(1),
|
|
21
|
+
SEATED(2),
|
|
22
|
+
INVERTED(3),
|
|
23
|
+
SIDEPLANK(4),
|
|
24
|
+
SUPINE(5),
|
|
25
|
+
NONE(6);
|
|
26
|
+
|
|
27
|
+
companion object
|
|
28
|
+
}
|
|
@@ -445,5 +445,14 @@ namespace margelo::nitro::nitroposeexercises::bridge::swift {
|
|
|
445
445
|
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
446
446
|
return Result<void>::withError(error);
|
|
447
447
|
}
|
|
448
|
+
|
|
449
|
+
// pragma MARK: Result<bool>
|
|
450
|
+
using Result_bool_ = Result<bool>;
|
|
451
|
+
inline Result_bool_ create_Result_bool_(bool value) noexcept {
|
|
452
|
+
return Result<bool>::withValue(std::move(value));
|
|
453
|
+
}
|
|
454
|
+
inline Result_bool_ create_Result_bool_(const std::exception_ptr& error) noexcept {
|
|
455
|
+
return Result<bool>::withError(error);
|
|
456
|
+
}
|
|
448
457
|
|
|
449
458
|
} // namespace margelo::nitro::nitroposeexercises::bridge::swift
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
namespace margelo::nitro::nitroposeexercises { struct AngleDefinition; }
|
|
13
13
|
// Forward declaration of `AngleSnapshot` to properly resolve imports.
|
|
14
14
|
namespace margelo::nitro::nitroposeexercises { struct AngleSnapshot; }
|
|
15
|
+
// Forward declaration of `CameraAngleType` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nitroposeexercises { enum class CameraAngleType; }
|
|
15
17
|
// Forward declaration of `ExerciseConfig` to properly resolve imports.
|
|
16
18
|
namespace margelo::nitro::nitroposeexercises { struct ExerciseConfig; }
|
|
17
19
|
// Forward declaration of `ExercisePhase` to properly resolve imports.
|
|
@@ -34,6 +36,8 @@ namespace margelo::nitro::nitroposeexercises { class HybridNitroPoseExercisesSpe
|
|
|
34
36
|
namespace margelo::nitro::nitroposeexercises { struct Landmark; }
|
|
35
37
|
// Forward declaration of `PhaseThreshold` to properly resolve imports.
|
|
36
38
|
namespace margelo::nitro::nitroposeexercises { struct PhaseThreshold; }
|
|
39
|
+
// Forward declaration of `PostureFamily` to properly resolve imports.
|
|
40
|
+
namespace margelo::nitro::nitroposeexercises { enum class PostureFamily; }
|
|
37
41
|
// Forward declaration of `RepData` to properly resolve imports.
|
|
38
42
|
namespace margelo::nitro::nitroposeexercises { struct RepData; }
|
|
39
43
|
// Forward declaration of `SessionResult` to properly resolve imports.
|
|
@@ -44,6 +48,7 @@ namespace margelo::nitro::nitroposeexercises { enum class SessionStatus; }
|
|
|
44
48
|
// Include C++ defined types
|
|
45
49
|
#include "AngleDefinition.hpp"
|
|
46
50
|
#include "AngleSnapshot.hpp"
|
|
51
|
+
#include "CameraAngleType.hpp"
|
|
47
52
|
#include "ExerciseConfig.hpp"
|
|
48
53
|
#include "ExercisePhase.hpp"
|
|
49
54
|
#include "ExerciseType.hpp"
|
|
@@ -54,6 +59,7 @@ namespace margelo::nitro::nitroposeexercises { enum class SessionStatus; }
|
|
|
54
59
|
#include "HybridNitroPoseExercisesSpec.hpp"
|
|
55
60
|
#include "Landmark.hpp"
|
|
56
61
|
#include "PhaseThreshold.hpp"
|
|
62
|
+
#include "PostureFamily.hpp"
|
|
57
63
|
#include "RepData.hpp"
|
|
58
64
|
#include "SessionResult.hpp"
|
|
59
65
|
#include "SessionStatus.hpp"
|
|
@@ -40,6 +40,10 @@ namespace margelo::nitro::nitroposeexercises { struct AngleDefinition; }
|
|
|
40
40
|
namespace margelo::nitro::nitroposeexercises { struct PhaseThreshold; }
|
|
41
41
|
// Forward declaration of `FormRule` to properly resolve imports.
|
|
42
42
|
namespace margelo::nitro::nitroposeexercises { struct FormRule; }
|
|
43
|
+
// Forward declaration of `PostureFamily` to properly resolve imports.
|
|
44
|
+
namespace margelo::nitro::nitroposeexercises { enum class PostureFamily; }
|
|
45
|
+
// Forward declaration of `CameraAngleType` to properly resolve imports.
|
|
46
|
+
namespace margelo::nitro::nitroposeexercises { enum class CameraAngleType; }
|
|
43
47
|
// Forward declaration of `HybridFrameSpec` to properly resolve imports.
|
|
44
48
|
namespace margelo::nitro::camera { class HybridFrameSpec; }
|
|
45
49
|
|
|
@@ -62,6 +66,8 @@ namespace margelo::nitro::camera { class HybridFrameSpec; }
|
|
|
62
66
|
#include "AngleDefinition.hpp"
|
|
63
67
|
#include "PhaseThreshold.hpp"
|
|
64
68
|
#include "FormRule.hpp"
|
|
69
|
+
#include "PostureFamily.hpp"
|
|
70
|
+
#include "CameraAngleType.hpp"
|
|
65
71
|
#include <memory>
|
|
66
72
|
#include <VisionCamera/HybridFrameSpec.hpp>
|
|
67
73
|
|
|
@@ -164,6 +170,20 @@ namespace margelo::nitro::nitroposeexercises {
|
|
|
164
170
|
inline void setOnSessionComplete(const std::optional<std::function<void(const SessionResult& /* result */)>>& onSessionComplete) noexcept override {
|
|
165
171
|
_swiftPart.setOnSessionComplete(onSessionComplete);
|
|
166
172
|
}
|
|
173
|
+
inline std::optional<std::function<void()>> getOnPostureLost() noexcept override {
|
|
174
|
+
auto __result = _swiftPart.getOnPostureLost();
|
|
175
|
+
return __result;
|
|
176
|
+
}
|
|
177
|
+
inline void setOnPostureLost(const std::optional<std::function<void()>>& onPostureLost) noexcept override {
|
|
178
|
+
_swiftPart.setOnPostureLost(onPostureLost);
|
|
179
|
+
}
|
|
180
|
+
inline std::optional<std::function<void()>> getOnPostureRegained() noexcept override {
|
|
181
|
+
auto __result = _swiftPart.getOnPostureRegained();
|
|
182
|
+
return __result;
|
|
183
|
+
}
|
|
184
|
+
inline void setOnPostureRegained(const std::optional<std::function<void()>>& onPostureRegained) noexcept override {
|
|
185
|
+
_swiftPart.setOnPostureRegained(onPostureRegained);
|
|
186
|
+
}
|
|
167
187
|
inline ExercisePhase getCurrentPhase() noexcept override {
|
|
168
188
|
auto __result = _swiftPart.getCurrentPhase();
|
|
169
189
|
return static_cast<ExercisePhase>(__result);
|
|
@@ -228,6 +248,14 @@ namespace margelo::nitro::nitroposeexercises {
|
|
|
228
248
|
std::rethrow_exception(__result.error());
|
|
229
249
|
}
|
|
230
250
|
}
|
|
251
|
+
inline bool isReady() override {
|
|
252
|
+
auto __result = _swiftPart.isReady();
|
|
253
|
+
if (__result.hasError()) [[unlikely]] {
|
|
254
|
+
std::rethrow_exception(__result.error());
|
|
255
|
+
}
|
|
256
|
+
auto __value = std::move(__result.value());
|
|
257
|
+
return __value;
|
|
258
|
+
}
|
|
231
259
|
|
|
232
260
|
private:
|
|
233
261
|
NitroPoseExercises::HybridNitroPoseExercisesSpec_cxx _swiftPart;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CameraAngleType.swift
|
|
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
|
+
/**
|
|
9
|
+
* Represents the JS union `CameraAngleType`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias CameraAngleType = margelo.nitro.nitroposeexercises.CameraAngleType
|
|
12
|
+
|
|
13
|
+
public extension CameraAngleType {
|
|
14
|
+
/**
|
|
15
|
+
* Get a CameraAngleType for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "side":
|
|
21
|
+
self = .side
|
|
22
|
+
case "front":
|
|
23
|
+
self = .front
|
|
24
|
+
default:
|
|
25
|
+
return nil
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get the String value this CameraAngleType represents.
|
|
31
|
+
*/
|
|
32
|
+
var stringValue: String {
|
|
33
|
+
switch self {
|
|
34
|
+
case .side:
|
|
35
|
+
return "side"
|
|
36
|
+
case .front:
|
|
37
|
+
return "front"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -18,7 +18,7 @@ public extension ExerciseConfig {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `ExerciseConfig`.
|
|
20
20
|
*/
|
|
21
|
-
init(name: String, type: ExerciseType, angles: [AngleDefinition], phases: [PhaseThreshold], repSequence: [ExercisePhase], formRules: [FormRule], holdDurationMs: Double) {
|
|
21
|
+
init(name: String, type: ExerciseType, angles: [AngleDefinition], phases: [PhaseThreshold], repSequence: [ExercisePhase], formRules: [FormRule], holdDurationMs: Double, postureFamily: PostureFamily, visibilityThreshold: Double, cameraAngle: CameraAngleType) {
|
|
22
22
|
self.init(std.string(name), type, { () -> bridge.std__vector_AngleDefinition_ in
|
|
23
23
|
var __vector = bridge.create_std__vector_AngleDefinition_(angles.count)
|
|
24
24
|
for __item in angles {
|
|
@@ -43,7 +43,7 @@ public extension ExerciseConfig {
|
|
|
43
43
|
__vector.push_back(__item)
|
|
44
44
|
}
|
|
45
45
|
return __vector
|
|
46
|
-
}(), holdDurationMs)
|
|
46
|
+
}(), holdDurationMs, postureFamily, visibilityThreshold, cameraAngle)
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
@inline(__always)
|
|
@@ -80,4 +80,19 @@ public extension ExerciseConfig {
|
|
|
80
80
|
var holdDurationMs: Double {
|
|
81
81
|
return self.__holdDurationMs
|
|
82
82
|
}
|
|
83
|
+
|
|
84
|
+
@inline(__always)
|
|
85
|
+
var postureFamily: PostureFamily {
|
|
86
|
+
return self.__postureFamily
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@inline(__always)
|
|
90
|
+
var visibilityThreshold: Double {
|
|
91
|
+
return self.__visibilityThreshold
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@inline(__always)
|
|
95
|
+
var cameraAngle: CameraAngleType {
|
|
96
|
+
return self.__cameraAngle
|
|
97
|
+
}
|
|
83
98
|
}
|
|
@@ -19,6 +19,8 @@ public protocol HybridNitroPoseExercisesSpec_protocol: HybridObject {
|
|
|
19
19
|
var onPoseLost: (() -> Void)? { get set }
|
|
20
20
|
var onPoseRegained: (() -> Void)? { get set }
|
|
21
21
|
var onSessionComplete: ((_ result: SessionResult) -> Void)? { get set }
|
|
22
|
+
var onPostureLost: (() -> Void)? { get set }
|
|
23
|
+
var onPostureRegained: (() -> Void)? { get set }
|
|
22
24
|
var currentPhase: ExercisePhase { get }
|
|
23
25
|
var repCount: Double { get }
|
|
24
26
|
var landmarks: [Landmark] { get }
|
|
@@ -32,6 +34,7 @@ public protocol HybridNitroPoseExercisesSpec_protocol: HybridObject {
|
|
|
32
34
|
func pauseSession() throws -> Void
|
|
33
35
|
func resumeSession() throws -> Void
|
|
34
36
|
func stopSession() throws -> Void
|
|
37
|
+
func isReady() throws -> Bool
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
public extension HybridNitroPoseExercisesSpec_protocol {
|