Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
mobile_scanner
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Navaron Bracke
2024-09-04 12:51:17 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2f7de30a9806b743d49a214d0d4a9215282a8acf
2f7de30a
1 parent
e503f0a3
remove unused code in MacOS impl
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
13 deletions
macos/mobile_scanner/Sources/mobile_scanner/MobileScannerPlugin.swift
macos/mobile_scanner/Sources/mobile_scanner/MobileScannerPlugin.swift
View file @
2f7de30
...
...
@@ -32,8 +32,6 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
var
symbologies
:[
VNBarcodeSymbology
]
=
[]
// var analyzeMode: Int = 0
var
analyzing
:
Bool
=
false
var
position
=
AVCaptureDevice
.
Position
.
back
public
static
func
register
(
with
registrar
:
FlutterPluginRegistrar
)
{
...
...
@@ -65,8 +63,6 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
setScale
(
call
,
result
)
case
"resetScale"
:
resetScale
(
call
,
result
)
// case "analyze":
// switchAnalyzeMode(call, result)
case
"stop"
:
stop
(
result
)
case
"updateScanWindow"
:
...
...
@@ -101,12 +97,11 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
// Gets called when a new image is added to the buffer
public
func
captureOutput
(
_
output
:
AVCaptureOutput
,
didOutput
sampleBuffer
:
CMSampleBuffer
,
from
connection
:
AVCaptureConnection
)
{
// Ignore invalid texture
Id
// Ignore invalid texture
id.
if
textureId
==
nil
{
return
}
guard
let
imageBuffer
=
CMSampleBufferGetImageBuffer
(
sampleBuffer
)
else
{
print
(
"Failed to get image buffer from sample buffer."
)
return
}
latestBuffer
=
imageBuffer
...
...
@@ -118,7 +113,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
nextScanTime
=
currentTime
+
timeoutSeconds
imagesCurrentlyBeingProcessed
=
true
DispatchQueue
.
global
(
qos
:
.
userInitiated
)
.
async
{
[
weak
self
]
in
if
(
self
!.
latestBuffer
==
nil
)
{
if
self
!.
latestBuffer
==
nil
{
return
}
var
cgImage
:
CGImage
?
...
...
@@ -165,6 +160,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
// add the symbologies the user wishes to support
barcodeRequest
.
symbologies
=
self
!.
symbologies
}
try
imageRequestHandler
.
perform
([
barcodeRequest
])
}
catch
let
e
{
DispatchQueue
.
main
.
async
{
...
...
@@ -415,11 +411,6 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
result
(
nil
)
}
// func switchAnalyzeMode(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {
// analyzeMode = call.arguments as! Int
// result(nil)
// }
func
stop
(
_
result
:
FlutterResult
)
{
if
(
device
==
nil
||
captureSession
==
nil
)
{
result
(
nil
)
...
...
@@ -436,7 +427,6 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
device
.
removeObserver
(
self
,
forKeyPath
:
#
keyPath
(
AVCaptureDevice
.
torchMode
))
registry
.
unregisterTexture
(
textureId
)
// analyzeMode = 0
latestBuffer
=
nil
captureSession
=
nil
device
=
nil
...
...
Please
register
or
login
to post a comment