react-native-neuroscan 0.1.0

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.
Files changed (51) hide show
  1. package/LICENSE +20 -0
  2. package/Neuroscan.podspec +29 -0
  3. package/README.md +233 -0
  4. package/android/app/build/generated/source/codegen/RCTAppDependencyProvider.h +25 -0
  5. package/android/app/build/generated/source/codegen/RCTAppDependencyProvider.mm +35 -0
  6. package/android/app/build/generated/source/codegen/RCTModuleProviders.h +16 -0
  7. package/android/app/build/generated/source/codegen/RCTModuleProviders.mm +51 -0
  8. package/android/app/build/generated/source/codegen/RCTModulesConformingToProtocolsProvider.h +18 -0
  9. package/android/app/build/generated/source/codegen/RCTModulesConformingToProtocolsProvider.mm +54 -0
  10. package/android/app/build/generated/source/codegen/RCTThirdPartyComponentsProvider.h +16 -0
  11. package/android/app/build/generated/source/codegen/RCTThirdPartyComponentsProvider.mm +30 -0
  12. package/android/app/build/generated/source/codegen/ReactAppDependencyProvider.podspec +34 -0
  13. package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeNeuroscanSpec.java +67 -0
  14. package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/NeuroScanCameraViewManagerDelegate.java +72 -0
  15. package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/NeuroScanCameraViewManagerInterface.java +29 -0
  16. package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
  17. package/android/app/build/generated/source/codegen/jni/RNNeuroScanSpec-generated.cpp +74 -0
  18. package/android/app/build/generated/source/codegen/jni/RNNeuroScanSpec.h +31 -0
  19. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNNeuroScanSpec/ComponentDescriptors.cpp +22 -0
  20. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNNeuroScanSpec/ComponentDescriptors.h +24 -0
  21. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNNeuroScanSpec/EventEmitters.cpp +62 -0
  22. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNNeuroScanSpec/EventEmitters.h +54 -0
  23. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNNeuroScanSpec/Props.cpp +32 -0
  24. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNNeuroScanSpec/Props.h +34 -0
  25. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNNeuroScanSpec/RNNeuroScanSpecJSI-generated.cpp +80 -0
  26. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNNeuroScanSpec/RNNeuroScanSpecJSI.h +134 -0
  27. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNNeuroScanSpec/ShadowNodes.cpp +17 -0
  28. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNNeuroScanSpec/ShadowNodes.h +32 -0
  29. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNNeuroScanSpec/States.cpp +16 -0
  30. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNNeuroScanSpec/States.h +29 -0
  31. package/android/build.gradle +73 -0
  32. package/android/src/main/AndroidManifest.xml +4 -0
  33. package/android/src/main/java/com/neuroscan/NeuroscanModule.kt +342 -0
  34. package/android/src/main/java/com/neuroscan/NeuroscanPackage.kt +36 -0
  35. package/ios/DocumentScannerController.swift +115 -0
  36. package/ios/NeuroScanImpl.swift +226 -0
  37. package/ios/Neuroscan.h +5 -0
  38. package/ios/Neuroscan.mm +118 -0
  39. package/lib/module/NativeNeuroscan.js +5 -0
  40. package/lib/module/NativeNeuroscan.js.map +1 -0
  41. package/lib/module/index.js +4 -0
  42. package/lib/module/index.js.map +1 -0
  43. package/lib/module/package.json +1 -0
  44. package/lib/typescript/package.json +1 -0
  45. package/lib/typescript/src/NativeNeuroscan.d.ts +47 -0
  46. package/lib/typescript/src/NativeNeuroscan.d.ts.map +1 -0
  47. package/lib/typescript/src/index.d.ts +3 -0
  48. package/lib/typescript/src/index.d.ts.map +1 -0
  49. package/package.json +126 -0
  50. package/src/NativeNeuroscan.ts +52 -0
  51. package/src/index.tsx +2 -0
@@ -0,0 +1,72 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GeneratePropsJavaDelegate.js
8
+ */
9
+
10
+ package com.facebook.react.viewmanagers;
11
+
12
+ import android.view.View;
13
+ import androidx.annotation.Nullable;
14
+ import com.facebook.react.bridge.ReadableArray;
15
+ import com.facebook.react.uimanager.BaseViewManager;
16
+ import com.facebook.react.uimanager.BaseViewManagerDelegate;
17
+ import com.facebook.react.uimanager.LayoutShadowNode;
18
+
19
+ public class NeuroScanCameraViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & NeuroScanCameraViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
20
+ public NeuroScanCameraViewManagerDelegate(U viewManager) {
21
+ super(viewManager);
22
+ }
23
+ @Override
24
+ public void setProperty(T view, String propName, @Nullable Object value) {
25
+ switch (propName) {
26
+ case "enableAutoCapture":
27
+ mViewManager.setEnableAutoCapture(view, value == null ? false : (boolean) value);
28
+ break;
29
+ case "showOverlay":
30
+ mViewManager.setShowOverlay(view, value == null ? false : (boolean) value);
31
+ break;
32
+ case "overlayColor":
33
+ mViewManager.setOverlayColor(view, value == null ? null : (String) value);
34
+ break;
35
+ case "overlayStrokeWidth":
36
+ mViewManager.setOverlayStrokeWidth(view, value == null ? 0f : ((Double) value).floatValue());
37
+ break;
38
+ case "autoCaptureDelay":
39
+ mViewManager.setAutoCaptureDelay(view, value == null ? 0 : ((Double) value).intValue());
40
+ break;
41
+ case "cameraPosition":
42
+ mViewManager.setCameraPosition(view, value == null ? null : (String) value);
43
+ break;
44
+ case "flashMode":
45
+ mViewManager.setFlashMode(view, value == null ? null : (String) value);
46
+ break;
47
+ case "resolution":
48
+ mViewManager.setResolution(view, value == null ? null : (String) value);
49
+ break;
50
+ default:
51
+ super.setProperty(view, propName, value);
52
+ }
53
+ }
54
+
55
+ @Override
56
+ public void receiveCommand(T view, String commandName, @Nullable ReadableArray args) {
57
+ switch (commandName) {
58
+ case "capturePhoto":
59
+ mViewManager.capturePhoto(view);
60
+ break;
61
+ case "startDetection":
62
+ mViewManager.startDetection(view);
63
+ break;
64
+ case "stopDetection":
65
+ mViewManager.stopDetection(view);
66
+ break;
67
+ case "setFlashMode":
68
+ mViewManager.setFlashMode(view, args.getString(0));
69
+ break;
70
+ }
71
+ }
72
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GeneratePropsJavaInterface.js
8
+ */
9
+
10
+ package com.facebook.react.viewmanagers;
11
+
12
+ import android.view.View;
13
+ import androidx.annotation.Nullable;
14
+ import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
15
+
16
+ public interface NeuroScanCameraViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
17
+ void setEnableAutoCapture(T view, boolean value);
18
+ void setShowOverlay(T view, boolean value);
19
+ void setOverlayColor(T view, @Nullable String value);
20
+ void setOverlayStrokeWidth(T view, float value);
21
+ void setAutoCaptureDelay(T view, int value);
22
+ void setCameraPosition(T view, @Nullable String value);
23
+ void setFlashMode(T view, @Nullable String value);
24
+ void setResolution(T view, @Nullable String value);
25
+ void capturePhoto(T view);
26
+ void startDetection(T view);
27
+ void stopDetection(T view);
28
+ void setFlashMode(T view, String mode);
29
+ }
@@ -0,0 +1,36 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ cmake_minimum_required(VERSION 3.13)
7
+ set(CMAKE_VERBOSE_MAKEFILE on)
8
+
9
+ file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNNeuroScanSpec/*.cpp)
10
+
11
+ add_library(
12
+ react_codegen_RNNeuroScanSpec
13
+ OBJECT
14
+ ${react_codegen_SRCS}
15
+ )
16
+
17
+ target_include_directories(react_codegen_RNNeuroScanSpec PUBLIC . react/renderer/components/RNNeuroScanSpec)
18
+
19
+ target_link_libraries(
20
+ react_codegen_RNNeuroScanSpec
21
+ fbjni
22
+ jsi
23
+ # We need to link different libraries based on whether we are building rncore or not, that's necessary
24
+ # because we want to break a circular dependency between react_codegen_rncore and reactnative
25
+ reactnative
26
+ )
27
+
28
+ target_compile_options(
29
+ react_codegen_RNNeuroScanSpec
30
+ PRIVATE
31
+ -DLOG_TAG=\"ReactNative\"
32
+ -fexceptions
33
+ -frtti
34
+ -std=c++20
35
+ -Wall
36
+ )
@@ -0,0 +1,74 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniCpp.js
9
+ */
10
+
11
+ #include "RNNeuroScanSpec.h"
12
+
13
+ namespace facebook::react {
14
+
15
+ static facebook::jsi::Value __hostFunction_NativeNeuroscanSpecJSI_scanDocument(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
16
+ static jmethodID cachedMethodId = nullptr;
17
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "scanDocument", "(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
18
+ }
19
+
20
+ static facebook::jsi::Value __hostFunction_NativeNeuroscanSpecJSI_detectEdges(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
21
+ static jmethodID cachedMethodId = nullptr;
22
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "detectEdges", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
23
+ }
24
+
25
+ static facebook::jsi::Value __hostFunction_NativeNeuroscanSpecJSI_cropDocument(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
26
+ static jmethodID cachedMethodId = nullptr;
27
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "cropDocument", "(Ljava/lang/String;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
28
+ }
29
+
30
+ static facebook::jsi::Value __hostFunction_NativeNeuroscanSpecJSI_processImage(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
31
+ static jmethodID cachedMethodId = nullptr;
32
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "processImage", "(Ljava/lang/String;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
33
+ }
34
+
35
+ static facebook::jsi::Value __hostFunction_NativeNeuroscanSpecJSI_scanAndProcess(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
36
+ static jmethodID cachedMethodId = nullptr;
37
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "scanAndProcess", "(Ljava/lang/String;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
38
+ }
39
+
40
+ static facebook::jsi::Value __hostFunction_NativeNeuroscanSpecJSI_cleanupTempFiles(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
41
+ static jmethodID cachedMethodId = nullptr;
42
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "cleanupTempFiles", "(Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
43
+ }
44
+
45
+ static facebook::jsi::Value __hostFunction_NativeNeuroscanSpecJSI_addListener(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
46
+ static jmethodID cachedMethodId = nullptr;
47
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "addListener", "(Ljava/lang/String;)V", args, count, cachedMethodId);
48
+ }
49
+
50
+ static facebook::jsi::Value __hostFunction_NativeNeuroscanSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
51
+ static jmethodID cachedMethodId = nullptr;
52
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "removeListeners", "(D)V", args, count, cachedMethodId);
53
+ }
54
+
55
+ NativeNeuroscanSpecJSI::NativeNeuroscanSpecJSI(const JavaTurboModule::InitParams &params)
56
+ : JavaTurboModule(params) {
57
+ methodMap_["scanDocument"] = MethodMetadata {1, __hostFunction_NativeNeuroscanSpecJSI_scanDocument};
58
+ methodMap_["detectEdges"] = MethodMetadata {1, __hostFunction_NativeNeuroscanSpecJSI_detectEdges};
59
+ methodMap_["cropDocument"] = MethodMetadata {2, __hostFunction_NativeNeuroscanSpecJSI_cropDocument};
60
+ methodMap_["processImage"] = MethodMetadata {2, __hostFunction_NativeNeuroscanSpecJSI_processImage};
61
+ methodMap_["scanAndProcess"] = MethodMetadata {2, __hostFunction_NativeNeuroscanSpecJSI_scanAndProcess};
62
+ methodMap_["cleanupTempFiles"] = MethodMetadata {0, __hostFunction_NativeNeuroscanSpecJSI_cleanupTempFiles};
63
+ methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeNeuroscanSpecJSI_addListener};
64
+ methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeNeuroscanSpecJSI_removeListeners};
65
+ }
66
+
67
+ std::shared_ptr<TurboModule> RNNeuroScanSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
68
+ if (moduleName == "Neuroscan") {
69
+ return std::make_shared<NativeNeuroscanSpecJSI>(params);
70
+ }
71
+ return nullptr;
72
+ }
73
+
74
+ } // namespace facebook::react
@@ -0,0 +1,31 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <ReactCommon/JavaTurboModule.h>
14
+ #include <ReactCommon/TurboModule.h>
15
+ #include <jsi/jsi.h>
16
+
17
+ namespace facebook::react {
18
+
19
+ /**
20
+ * JNI C++ class for module 'NativeNeuroscan'
21
+ */
22
+ class JSI_EXPORT NativeNeuroscanSpecJSI : public JavaTurboModule {
23
+ public:
24
+ NativeNeuroscanSpecJSI(const JavaTurboModule::InitParams &params);
25
+ };
26
+
27
+
28
+ JSI_EXPORT
29
+ std::shared_ptr<TurboModule> RNNeuroScanSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
30
+
31
+ } // namespace facebook::react
@@ -0,0 +1,22 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateComponentDescriptorCpp.js
9
+ */
10
+
11
+ #include <react/renderer/components/RNNeuroScanSpec/ComponentDescriptors.h>
12
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
13
+ #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
14
+
15
+ namespace facebook::react {
16
+
17
+ void RNNeuroScanSpec_registerComponentDescriptorsFromCodegen(
18
+ std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
19
+ registry->add(concreteComponentDescriptorProvider<NeuroScanCameraViewComponentDescriptor>());
20
+ }
21
+
22
+ } // namespace facebook::react
@@ -0,0 +1,24 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateComponentDescriptorH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <react/renderer/components/RNNeuroScanSpec/ShadowNodes.h>
14
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
15
+ #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
16
+
17
+ namespace facebook::react {
18
+
19
+ using NeuroScanCameraViewComponentDescriptor = ConcreteComponentDescriptor<NeuroScanCameraViewShadowNode>;
20
+
21
+ void RNNeuroScanSpec_registerComponentDescriptorsFromCodegen(
22
+ std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
23
+
24
+ } // namespace facebook::react
@@ -0,0 +1,62 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateEventEmitterCpp.js
9
+ */
10
+
11
+ #include <react/renderer/components/RNNeuroScanSpec/EventEmitters.h>
12
+
13
+
14
+ namespace facebook::react {
15
+
16
+ void NeuroScanCameraViewEventEmitter::onDocumentDetected(OnDocumentDetected $event) const {
17
+ dispatchEvent("documentDetected", [$event=std::move($event)](jsi::Runtime &runtime) {
18
+ auto $payload = jsi::Object(runtime);
19
+ $payload.setProperty(runtime, "topLeftX", $event.topLeftX);
20
+ $payload.setProperty(runtime, "topLeftY", $event.topLeftY);
21
+ $payload.setProperty(runtime, "topRightX", $event.topRightX);
22
+ $payload.setProperty(runtime, "topRightY", $event.topRightY);
23
+ $payload.setProperty(runtime, "bottomLeftX", $event.bottomLeftX);
24
+ $payload.setProperty(runtime, "bottomLeftY", $event.bottomLeftY);
25
+ $payload.setProperty(runtime, "bottomRightX", $event.bottomRightX);
26
+ $payload.setProperty(runtime, "bottomRightY", $event.bottomRightY);
27
+ $payload.setProperty(runtime, "confidence", $event.confidence);
28
+ return $payload;
29
+ });
30
+ }
31
+
32
+
33
+ void NeuroScanCameraViewEventEmitter::onPhotoCaptured(OnPhotoCaptured $event) const {
34
+ dispatchEvent("photoCaptured", [$event=std::move($event)](jsi::Runtime &runtime) {
35
+ auto $payload = jsi::Object(runtime);
36
+ $payload.setProperty(runtime, "imageUrl", $event.imageUrl);
37
+ $payload.setProperty(runtime, "width", $event.width);
38
+ $payload.setProperty(runtime, "height", $event.height);
39
+ return $payload;
40
+ });
41
+ }
42
+
43
+
44
+ void NeuroScanCameraViewEventEmitter::onError(OnError $event) const {
45
+ dispatchEvent("error", [$event=std::move($event)](jsi::Runtime &runtime) {
46
+ auto $payload = jsi::Object(runtime);
47
+ $payload.setProperty(runtime, "code", $event.code);
48
+ $payload.setProperty(runtime, "message", $event.message);
49
+ return $payload;
50
+ });
51
+ }
52
+
53
+
54
+ void NeuroScanCameraViewEventEmitter::onCameraReady(OnCameraReady $event) const {
55
+ dispatchEvent("cameraReady", [](jsi::Runtime &runtime) {
56
+ auto $payload = jsi::Object(runtime);
57
+
58
+ return $payload;
59
+ });
60
+ }
61
+
62
+ } // namespace facebook::react
@@ -0,0 +1,54 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateEventEmitterH.js
9
+ */
10
+ #pragma once
11
+
12
+ #include <react/renderer/components/view/ViewEventEmitter.h>
13
+
14
+
15
+ namespace facebook::react {
16
+ class NeuroScanCameraViewEventEmitter : public ViewEventEmitter {
17
+ public:
18
+ using ViewEventEmitter::ViewEventEmitter;
19
+
20
+ struct OnDocumentDetected {
21
+ Float topLeftX;
22
+ Float topLeftY;
23
+ Float topRightX;
24
+ Float topRightY;
25
+ Float bottomLeftX;
26
+ Float bottomLeftY;
27
+ Float bottomRightX;
28
+ Float bottomRightY;
29
+ Float confidence;
30
+ };
31
+
32
+ struct OnPhotoCaptured {
33
+ std::string imageUrl;
34
+ int width;
35
+ int height;
36
+ };
37
+
38
+ struct OnError {
39
+ std::string code;
40
+ std::string message;
41
+ };
42
+
43
+ struct OnCameraReady {
44
+
45
+ };
46
+ void onDocumentDetected(OnDocumentDetected value) const;
47
+
48
+ void onPhotoCaptured(OnPhotoCaptured value) const;
49
+
50
+ void onError(OnError value) const;
51
+
52
+ void onCameraReady(OnCameraReady value) const;
53
+ };
54
+ } // namespace facebook::react
@@ -0,0 +1,32 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GeneratePropsCpp.js
9
+ */
10
+
11
+ #include <react/renderer/components/RNNeuroScanSpec/Props.h>
12
+ #include <react/renderer/core/PropsParserContext.h>
13
+ #include <react/renderer/core/propsConversions.h>
14
+
15
+ namespace facebook::react {
16
+
17
+ NeuroScanCameraViewProps::NeuroScanCameraViewProps(
18
+ const PropsParserContext &context,
19
+ const NeuroScanCameraViewProps &sourceProps,
20
+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
21
+
22
+ enableAutoCapture(convertRawProp(context, rawProps, "enableAutoCapture", sourceProps.enableAutoCapture, {false})),
23
+ showOverlay(convertRawProp(context, rawProps, "showOverlay", sourceProps.showOverlay, {false})),
24
+ overlayColor(convertRawProp(context, rawProps, "overlayColor", sourceProps.overlayColor, {})),
25
+ overlayStrokeWidth(convertRawProp(context, rawProps, "overlayStrokeWidth", sourceProps.overlayStrokeWidth, {0.0})),
26
+ autoCaptureDelay(convertRawProp(context, rawProps, "autoCaptureDelay", sourceProps.autoCaptureDelay, {0})),
27
+ cameraPosition(convertRawProp(context, rawProps, "cameraPosition", sourceProps.cameraPosition, {})),
28
+ flashMode(convertRawProp(context, rawProps, "flashMode", sourceProps.flashMode, {})),
29
+ resolution(convertRawProp(context, rawProps, "resolution", sourceProps.resolution, {}))
30
+ {}
31
+
32
+ } // namespace facebook::react
@@ -0,0 +1,34 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GeneratePropsH.js
9
+ */
10
+ #pragma once
11
+
12
+ #include <react/renderer/components/view/ViewProps.h>
13
+ #include <react/renderer/core/PropsParserContext.h>
14
+
15
+ namespace facebook::react {
16
+
17
+ class NeuroScanCameraViewProps final : public ViewProps {
18
+ public:
19
+ NeuroScanCameraViewProps() = default;
20
+ NeuroScanCameraViewProps(const PropsParserContext& context, const NeuroScanCameraViewProps &sourceProps, const RawProps &rawProps);
21
+
22
+ #pragma mark - Props
23
+
24
+ bool enableAutoCapture{false};
25
+ bool showOverlay{false};
26
+ std::string overlayColor{};
27
+ Float overlayStrokeWidth{0.0};
28
+ int autoCaptureDelay{0};
29
+ std::string cameraPosition{};
30
+ std::string flashMode{};
31
+ std::string resolution{};
32
+ };
33
+
34
+ } // namespace facebook::react
@@ -0,0 +1,80 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleCpp.js
8
+ */
9
+
10
+ #include "RNNeuroScanSpecJSI.h"
11
+
12
+ namespace facebook::react {
13
+
14
+ static jsi::Value __hostFunction_NativeNeuroscanCxxSpecJSI_scanDocument(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
15
+ return static_cast<NativeNeuroscanCxxSpecJSI *>(&turboModule)->scanDocument(
16
+ rt,
17
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asObject(rt)
18
+ );
19
+ }
20
+ static jsi::Value __hostFunction_NativeNeuroscanCxxSpecJSI_detectEdges(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
21
+ return static_cast<NativeNeuroscanCxxSpecJSI *>(&turboModule)->detectEdges(
22
+ rt,
23
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
24
+ );
25
+ }
26
+ static jsi::Value __hostFunction_NativeNeuroscanCxxSpecJSI_cropDocument(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
27
+ return static_cast<NativeNeuroscanCxxSpecJSI *>(&turboModule)->cropDocument(
28
+ rt,
29
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
30
+ count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asObject(rt)
31
+ );
32
+ }
33
+ static jsi::Value __hostFunction_NativeNeuroscanCxxSpecJSI_processImage(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
34
+ return static_cast<NativeNeuroscanCxxSpecJSI *>(&turboModule)->processImage(
35
+ rt,
36
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
37
+ count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asObject(rt)
38
+ );
39
+ }
40
+ static jsi::Value __hostFunction_NativeNeuroscanCxxSpecJSI_scanAndProcess(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
41
+ return static_cast<NativeNeuroscanCxxSpecJSI *>(&turboModule)->scanAndProcess(
42
+ rt,
43
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
44
+ count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asObject(rt)
45
+ );
46
+ }
47
+ static jsi::Value __hostFunction_NativeNeuroscanCxxSpecJSI_cleanupTempFiles(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
48
+ return static_cast<NativeNeuroscanCxxSpecJSI *>(&turboModule)->cleanupTempFiles(
49
+ rt
50
+ );
51
+ }
52
+ static jsi::Value __hostFunction_NativeNeuroscanCxxSpecJSI_addListener(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
53
+ static_cast<NativeNeuroscanCxxSpecJSI *>(&turboModule)->addListener(
54
+ rt,
55
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
56
+ );
57
+ return jsi::Value::undefined();
58
+ }
59
+ static jsi::Value __hostFunction_NativeNeuroscanCxxSpecJSI_removeListeners(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
60
+ static_cast<NativeNeuroscanCxxSpecJSI *>(&turboModule)->removeListeners(
61
+ rt,
62
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
63
+ );
64
+ return jsi::Value::undefined();
65
+ }
66
+
67
+ NativeNeuroscanCxxSpecJSI::NativeNeuroscanCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
68
+ : TurboModule("Neuroscan", jsInvoker) {
69
+ methodMap_["scanDocument"] = MethodMetadata {1, __hostFunction_NativeNeuroscanCxxSpecJSI_scanDocument};
70
+ methodMap_["detectEdges"] = MethodMetadata {1, __hostFunction_NativeNeuroscanCxxSpecJSI_detectEdges};
71
+ methodMap_["cropDocument"] = MethodMetadata {2, __hostFunction_NativeNeuroscanCxxSpecJSI_cropDocument};
72
+ methodMap_["processImage"] = MethodMetadata {2, __hostFunction_NativeNeuroscanCxxSpecJSI_processImage};
73
+ methodMap_["scanAndProcess"] = MethodMetadata {2, __hostFunction_NativeNeuroscanCxxSpecJSI_scanAndProcess};
74
+ methodMap_["cleanupTempFiles"] = MethodMetadata {0, __hostFunction_NativeNeuroscanCxxSpecJSI_cleanupTempFiles};
75
+ methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeNeuroscanCxxSpecJSI_addListener};
76
+ methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeNeuroscanCxxSpecJSI_removeListeners};
77
+ }
78
+
79
+
80
+ } // namespace facebook::react